[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAA8EJppxnVuVL9LH1Ars0=SKBM1L05Z5KwA_z1_+=dBugfrL-g@mail.gmail.com>
Date: Tue, 7 Jan 2025 18:18:07 +0200
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Maxime Ripard <mripard@...nel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Dave Stevenson <dave.stevenson@...pberrypi.com>, MaĆra Canal <mcanal@...lia.com>,
Raspberry Pi Kernel Maintenance <kernel-list@...pberrypi.com>, Andrzej Hajda <andrzej.hajda@...el.com>,
Neil Armstrong <neil.armstrong@...aro.org>, Robert Foss <rfoss@...nel.org>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>, Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC/RFT 2/9] drm/display: add CEC helpers code
On Tue, 7 Jan 2025 at 16:32, Maxime Ripard <mripard@...nel.org> wrote:
>
> On Wed, Dec 25, 2024 at 01:10:10AM +0200, Dmitry Baryshkov wrote:
> > Add generic CEC helpers to be used by HDMI drivers. Both notifier and
> > and adapter are supported for registration. Once registered, the driver
> > can call common set of functions to update physical address, to
> > invalidate it or to unregister CEC data.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> > ---
> > drivers/gpu/drm/display/Kconfig | 5 +
> > drivers/gpu/drm/display/Makefile | 2 +
> > drivers/gpu/drm/display/drm_hdmi_cec_helper.c | 145 ++++++++++++++++++++++++++
> > include/drm/display/drm_hdmi_cec_helper.h | 38 +++++++
> > 4 files changed, 190 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/display/Kconfig b/drivers/gpu/drm/display/Kconfig
> > index 8d22b7627d41f7bc015decf24ae02a05bc00f055..49da9b768acf3e5f84f2cefae4bb042cfd57a50c 100644
> > --- a/drivers/gpu/drm/display/Kconfig
> > +++ b/drivers/gpu/drm/display/Kconfig
> > @@ -82,6 +82,11 @@ config DRM_DISPLAY_HDMI_AUDIO_HELPER
> > DRM display helpers for HDMI Audio functionality (generic HDMI Codec
> > implementation).
> >
> > +config DRM_DISPLAY_HDMI_CEC_HELPER
> > + bool
> > + help
> > + DRM display helpers for HDMI CEC implementation.
> > +
> > config DRM_DISPLAY_HDMI_HELPER
> > bool
> > help
> > diff --git a/drivers/gpu/drm/display/Makefile b/drivers/gpu/drm/display/Makefile
> > index b17879b957d5401721396e247fa346387cf6c48a..2cd078e2b81c1a9e6b336c4187b444bcb8a50e51 100644
> > --- a/drivers/gpu/drm/display/Makefile
> > +++ b/drivers/gpu/drm/display/Makefile
> > @@ -16,6 +16,8 @@ drm_display_helper-$(CONFIG_DRM_DISPLAY_DSC_HELPER) += \
> > drm_display_helper-$(CONFIG_DRM_DISPLAY_HDCP_HELPER) += drm_hdcp_helper.o
> > drm_display_helper-$(CONFIG_DRM_DISPLAY_HDMI_AUDIO_HELPER) += \
> > drm_hdmi_audio_helper.o
> > +drm_display_helper-$(CONFIG_DRM_DISPLAY_HDMI_CEC_HELPER) += \
> > + drm_hdmi_cec_helper.o
> > drm_display_helper-$(CONFIG_DRM_DISPLAY_HDMI_HELPER) += \
> > drm_hdmi_helper.o \
> > drm_scdc_helper.o
> > diff --git a/drivers/gpu/drm/display/drm_hdmi_cec_helper.c b/drivers/gpu/drm/display/drm_hdmi_cec_helper.c
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..2a3832e68232fa3b839a3c7457b2013779cada86
> > --- /dev/null
> > +++ b/drivers/gpu/drm/display/drm_hdmi_cec_helper.c
> > @@ -0,0 +1,145 @@
> > +// SPDX-License-Identifier: MIT
> > +/*
> > + * Copyright (c) 2024 Linaro Ltd
> > + */
> > +
> > +#include <drm/drm_bridge.h>
> > +#include <drm/drm_connector.h>
> > +#include <drm/display/drm_hdmi_cec_helper.h>
> > +
> > +#include <linux/mutex.h>
> > +
> > +#include <media/cec.h>
> > +#include <media/cec-notifier.h>
> > +
> > +static void drm_connector_hdmi_cec_adapter_unregister(struct drm_connector *connector)
> > +{
> > + cec_unregister_adapter(connector->cec.adapter);
> > + connector->cec.adapter = NULL;
> > + connector->cec.unregister = NULL;
> > +}
> > +
> > +int drm_connector_hdmi_cec_adapter_register(struct drm_connector *connector,
> > + const struct cec_adap_ops *ops,
> > + const char *name,
> > + u8 available_las,
> > + int (*init_cec)(struct drm_connector *connector),
> > + void (*uninit_cec)(struct drm_connector *connector),
> > + struct device *dev)
>
> We're missing a documentation here. Why do we need drivers to pass both
> a set of cec_adap_ops and a bunch of extra functions? Shouldn't we make
> this a single structure like we did for audio?
Also might be an option, I didn't want to add extra wrappers in the
first place, but I can add them.
>
> Also, to remain consistent, we should call that function drm_connector_hdmi_cec_register
I wanted to point out the _adapter_ part, because we also have
whatever_cec_notifier_register() and at some point we might also get
whatever_cec_pin_register() if we wrap sun4i implementation too.
--
With best wishes
Dmitry
Powered by blists - more mailing lists