From: Jani Nikula <jani.nikula@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Emma Anholt <emma@anholt.net>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Maxime Ripard <mripard@kernel.org>
Subject: Re: [PATCH RFC 01/13] drm/connector: Introduce an HDMI connector
Date: Tue, 15 Aug 2023 12:19:14 +0300 [thread overview]
Message-ID: <878racd5nx.fsf@intel.com> (raw)
In-Reply-To: <20230814-kms-hdmi-connector-state-v1-1-048054df3654@kernel.org>
On Mon, 14 Aug 2023, Maxime Ripard <mripard@kernel.org> wrote:
> A lot of the various HDMI drivers duplicate some logic that depends on
> the HDMI spec itself and not really a particular hardware
> implementation.
>
> Output BPC or format selection, infoframe generation are good examples
> of such areas.
>
> This creates a lot of boilerplate, with a lot of variations, which makes
> it hard for userspace to rely on, and makes it difficult to get it right
> for drivers.
>
> Let's create a new connector variant specifically dedicated to HDMI
> controllers that will allow to abstract away the duplicated logic.
>
> Hopefully, this will make drivers simpler to handle, and their behaviour
> more consistent.
>
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
> ---
> drivers/gpu/drm/Makefile | 1 +
> drivers/gpu/drm/drm_hdmi_connector.c | 45 ++++++++++++++++++++++++++++++++++++
> include/drm/drm_connector.h | 16 +++++++++++++
> 3 files changed, 62 insertions(+)
>
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 7a09a89b493b..1520d4ccd3d7 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -27,6 +27,7 @@ drm-y := \
> drm_fourcc.o \
> drm_framebuffer.o \
> drm_gem.o \
> + drm_hdmi_connector.o \
> drm_ioctl.o \
> drm_lease.o \
> drm_managed.o \
> diff --git a/drivers/gpu/drm/drm_hdmi_connector.c b/drivers/gpu/drm/drm_hdmi_connector.c
> new file mode 100644
> index 000000000000..62f01dd2e6df
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_hdmi_connector.c
> @@ -0,0 +1,45 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +#include <drm/drm_connector.h>
> +#include <drm/drm_mode.h>
> +
> +#include <linux/export.h>
> +
> +/**
> + * drmm_hdmi_connector_init - Init a preallocated HDMI connector
> + * @dev: DRM device
> + * @hdmi_connector: A pointer to the HDMI connector to init
> + * @connector_type: user visible type of the connector
> + * @ddc: optional pointer to the associated ddc adapter
> + *
> + * Initialises a preallocated HDMI connector. Connectors can be
> + * subclassed as part of driver connector objects.
> + *
> + * Cleanup is automatically handled with a call to
> + * drm_connector_cleanup() in a DRM-managed action.
> + *
> + * The connector structure should be allocated with drmm_kzalloc().
> + *
> + * Returns:
> + * Zero on success, error code on failure.
> + */
> +int drmm_hdmi_connector_init(struct drm_device *dev,
> + struct drm_hdmi_connector *hdmi_connector,
> + const struct drm_connector_funcs *funcs,
> + int connector_type,
> + struct i2c_adapter *ddc)
> +{
> + struct drm_connector *connector = &hdmi_connector->base;
> + int ret;
> +
> + if (connector_type != DRM_MODE_CONNECTOR_HDMIA ||
> + connector_type != DRM_MODE_CONNECTOR_HDMIB)
> + return -EINVAL;
> +
> + ret = drmm_connector_init(dev, connector, funcs, connector_type, ddc);
> + if (ret)
> + return ret;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drmm_hdmi_connector_init);
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index d300fde6c1a4..1859b74083f5 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -2042,6 +2042,22 @@ void drm_connector_attach_privacy_screen_provider(
> struct drm_connector *connector, struct drm_privacy_screen *priv);
> void drm_connector_update_privacy_screen(const struct drm_connector_state *connector_state);
>
> +struct drm_hdmi_connector {
> + /**
> + * @base: Base Connector
> + */
> + struct drm_connector base;
> +};
> +
> +#define connector_to_hdmi_connector(connector) \
> + container_of_const(connector, struct drm_hdmi_connector, base)
> +
> +int drmm_hdmi_connector_init(struct drm_device *dev,
> + struct drm_hdmi_connector *hdmi_connector,
> + const struct drm_connector_funcs *funcs,
> + int connector_type,
> + struct i2c_adapter *ddc);
> +
Pure bikeshedding, maybe add drm_hdmi_connector.h from the start so we
don't have to split this up later.
BR,
Jani.
> /**
> * struct drm_tile_group - Tile group metadata
> * @refcount: reference count
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2023-08-15 9:19 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 13:56 [PATCH RFC 00/13] drm/connector: Create HDMI Connector infrastructure Maxime Ripard
2023-08-14 13:56 ` [PATCH RFC 01/13] drm/connector: Introduce an HDMI connector Maxime Ripard
2023-08-15 9:19 ` Jani Nikula [this message]
2023-08-14 13:56 ` [PATCH RFC 02/13] drm/connector: hdmi: Create a custom state Maxime Ripard
2023-08-14 13:56 ` [PATCH RFC 03/13] drm/connector: hdmi: Add Broadcast RGB property Maxime Ripard
2023-08-14 14:46 ` Simon Ser
2023-08-14 14:46 ` Simon Ser
2023-08-14 13:56 ` [PATCH RFC 04/13] drm/connector: hdmi: Add helper to get the RGB range Maxime Ripard
2023-08-14 13:56 ` [PATCH RFC 05/13] drm/connector: hdmi: Add output BPC to the connector state Maxime Ripard
2023-08-14 13:56 ` [PATCH RFC 06/13] drm/connector: hdmi: Add support for output format Maxime Ripard
2023-08-14 17:17 ` kernel test robot
2023-08-14 13:56 ` [PATCH RFC 07/13] drm/connector: hdmi: Calculate TMDS character rate Maxime Ripard
2023-08-14 13:56 ` [PATCH RFC 08/13] drm/connector: hdmi: Add custom hook to filter " Maxime Ripard
2023-08-14 13:56 ` [PATCH RFC 09/13] drm/connector: hdmi: Compute bpc and format automatically Maxime Ripard
2023-08-14 13:56 ` [PATCH RFC 10/13] drm/connector: hdmi: Add Infoframes generation Maxime Ripard
2023-08-15 11:20 ` Dave Stevenson
2023-08-15 11:20 ` Dave Stevenson
2023-08-14 13:56 ` [PATCH RFC 11/13] drm/connector: hdmi: Create Infoframe DebugFS entries Maxime Ripard
2023-08-14 13:56 ` [PATCH RFC 12/13] drm/vc4: hdmi: Create destroy state implementation Maxime Ripard
2023-08-14 13:56 ` [PATCH RFC 13/13] drm/vc4: hdmi: Switch to HDMI connector Maxime Ripard
2023-08-14 17:58 ` kernel test robot
2023-08-22 10:22 ` kernel test robot
2023-08-16 8:43 ` [PATCH RFC 00/13] drm/connector: Create HDMI Connector infrastructure Hans Verkuil
2023-08-22 14:16 ` Daniel Vetter
2023-08-22 14:16 ` Daniel Vetter
2023-08-22 14:35 ` Maxime Ripard
2023-08-22 14:41 ` Daniel Vetter
2023-08-22 14:41 ` Daniel Vetter
2023-08-22 14:51 ` Jani Nikula
2023-08-22 15:05 ` Daniel Vetter
2023-08-22 15:05 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878racd5nx.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=emma@anholt.net \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.