On Tue, Jan 07, 2025 at 03:34:35PM +0100, Maxime Ripard wrote:
> On Wed, Dec 25, 2024 at 01:10:12AM +0200, Dmitry Baryshkov wrote:
> > Switch VC4 driver to using CEC helpers code, simplifying hotplug and
> > registration / cleanup. The existing vc4_hdmi_cec_release() is kept for
> > now.
> > 
> > Signed-off-by: Dmitry Baryshkov <dmitry.barysh...@linaro.org>
> > ---
> >  drivers/gpu/drm/vc4/Kconfig    |  1 +
> >  drivers/gpu/drm/vc4/vc4_hdmi.c | 92 
> > ++++++++++++++++++++----------------------
> >  drivers/gpu/drm/vc4/vc4_hdmi.h |  1 -
> >  3 files changed, 44 insertions(+), 50 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
> > index 
> > 6cc7b7e6294a1bfa54137ca65296cd47e46b1e1e..360fbe755951cc40fecb4f9d643a096a6cf92b8e
> >  100644
> > --- a/drivers/gpu/drm/vc4/Kconfig
> > +++ b/drivers/gpu/drm/vc4/Kconfig
> > @@ -34,6 +34,7 @@ config DRM_VC4_HDMI_CEC
> >     bool "Broadcom VC4 HDMI CEC Support"
> >     depends on DRM_VC4
> >     select CEC_CORE
> > +   select DRM_DISPLAY_HDMI_CEC_HELPER
> >     help
> >       Choose this option if you have a Broadcom VC4 GPU
> >       and want to use CEC.
> > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> > index 
> > 47d9ada98430634cfd8c1e21c2a4d00d501bab7e..3086c2ad3bb2e8fafdc1f37ba985aa5785d49f9a
> >  100644
> > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> > @@ -32,6 +32,7 @@
> >   */
> >  
> >  #include <drm/display/drm_hdmi_audio_helper.h>
> > +#include <drm/display/drm_hdmi_cec_helper.h>
> >  #include <drm/display/drm_hdmi_helper.h>
> >  #include <drm/display/drm_hdmi_state_helper.h>
> >  #include <drm/display/drm_scdc_helper.h>
> > @@ -400,16 +401,8 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi 
> > *vc4_hdmi,
> >      * the lock for now.
> >      */
> >  
> > -   if (status == connector_status_disconnected) {
> > -           cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
> > -           return;
> > -   }
> > -
> >     drm_atomic_helper_connector_hdmi_hotplug(connector, status);
> >  
> > -   cec_s_phys_addr(vc4_hdmi->cec_adap,
> > -                   connector->display_info.source_physical_address, false);
> > -
> >     if (status != connector_status_connected)
> >             return;
> >  
> > @@ -2388,7 +2381,7 @@ static irqreturn_t vc4_cec_irq_handler_rx_thread(int 
> > irq, void *priv)
> >     struct vc4_hdmi *vc4_hdmi = priv;
> >  
> >     if (vc4_hdmi->cec_rx_msg.len)
> > -           cec_received_msg(vc4_hdmi->cec_adap,
> > +           cec_received_msg(vc4_hdmi->connector.cec.adapter,
> >                              &vc4_hdmi->cec_rx_msg);
> >  
> >     return IRQ_HANDLED;
> > @@ -2399,14 +2392,14 @@ static irqreturn_t 
> > vc4_cec_irq_handler_tx_thread(int irq, void *priv)
> >     struct vc4_hdmi *vc4_hdmi = priv;
> >  
> >     if (vc4_hdmi->cec_tx_ok) {
> > -           cec_transmit_done(vc4_hdmi->cec_adap, CEC_TX_STATUS_OK,
> > +           cec_transmit_done(vc4_hdmi->connector.cec.adapter, 
> > CEC_TX_STATUS_OK,
> >                               0, 0, 0, 0);
> 
> Shouldn't we create helpers for those just like we did to deal with phys_addr?

For phys_addr it was required as we were wrapping locking, adapter and
notifier calls. I can add wrappers for these calls too, of course.

-- 
With best wishes
Dmitry

Reply via email to