From: Neil Armstrong <neil.armstrong@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Kevin Hilman <khilman@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Rob Clark <robin.clark@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jessica.zhang@oss.qualcomm.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org
Subject: Re: [PATCH RESEND 2/2] drm/bridge: lontium-lt9611uxc: switch to HDMI audio helpers
Date: Mon, 18 Aug 2025 10:08:35 +0200 [thread overview]
Message-ID: <e173b1b3-ad91-46ad-b293-c52948bb32a1@linaro.org> (raw)
In-Reply-To: <20250803-lt9611uxc-hdmi-v1-2-cb9ce1793acf@oss.qualcomm.com>
On 03/08/2025 13:53, Dmitry Baryshkov wrote:
> While LT9611UXC is a DSI-to-HDMI bridge, it implements all HDMI-related
> functions internally, in the firmware, thus it doesn't make sense to
> implement DRM_BRIDGE_OP_HDMI. However it is possible to implement
> DRM_BRIDGE_OP_HDMI_AUDIO, streamlining HDMI audio plumbing (which
> includes plugged notifications and ELD handling).
>
> Implement corresponding callbacks and trigger EDID read /
> drm_connector_hdmi_audio_plugged_notify() from the hpd_notify callback.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 125 +++++++++++------------------
> 1 file changed, 49 insertions(+), 76 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
> index 38fb8776c0f441ae433c60a7680aaa6501a8956e..11aab07d88df646a54fea287030a183eb823b26d 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
> @@ -17,8 +17,6 @@
> #include <linux/wait.h>
> #include <linux/workqueue.h>
>
> -#include <sound/hdmi-codec.h>
> -
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_bridge.h>
> #include <drm/drm_edid.h>
> @@ -27,6 +25,8 @@
> #include <drm/drm_print.h>
> #include <drm/drm_probe_helper.h>
>
> +#include <drm/display/drm_hdmi_audio_helper.h>
> +
> #define EDID_BLOCK_SIZE 128
> #define EDID_NUM_BLOCKS 2
>
> @@ -48,7 +48,6 @@ struct lt9611uxc {
> struct device_node *dsi1_node;
> struct mipi_dsi_device *dsi0;
> struct mipi_dsi_device *dsi1;
> - struct platform_device *audio_pdev;
>
> struct gpio_desc *reset_gpio;
> struct gpio_desc *enable_gpio;
> @@ -429,12 +428,52 @@ static const struct drm_edid *lt9611uxc_bridge_edid_read(struct drm_bridge *brid
> return drm_edid_read_custom(connector, lt9611uxc_get_edid_block, lt9611uxc);
> }
>
> +static void lt9611uxc_bridge_hpd_notify(struct drm_bridge *bridge,
> + struct drm_connector *connector,
> + enum drm_connector_status status)
> +{
> + const struct drm_edid *drm_edid;
> +
> + if (status == connector_status_disconnected) {
> + drm_connector_hdmi_audio_plugged_notify(connector, false);
> + drm_edid_connector_update(connector, NULL);
> + return;
> + }
> +
> + drm_edid = lt9611uxc_bridge_edid_read(bridge, connector);
> + drm_edid_connector_update(connector, drm_edid);
> + drm_edid_free(drm_edid);
> +
> + if (status == connector_status_connected)
> + drm_connector_hdmi_audio_plugged_notify(connector, true);
> +}
> +
> +static int lt9611uxc_hdmi_audio_prepare(struct drm_bridge *bridge,
> + struct drm_connector *connector,
> + struct hdmi_codec_daifmt *fmt,
> + struct hdmi_codec_params *hparms)
> +{
> + /*
> + * LT9611UXC will automatically detect rate and sample size, so no need
> + * to setup anything here.
> + */
> + return 0;
> +}
> +
> +static void lt9611uxc_hdmi_audio_shutdown(struct drm_bridge *bridge,
> + struct drm_connector *connector)
> +{
> +}
> +
> static const struct drm_bridge_funcs lt9611uxc_bridge_funcs = {
> .attach = lt9611uxc_bridge_attach,
> .mode_valid = lt9611uxc_bridge_mode_valid,
> .mode_set = lt9611uxc_bridge_mode_set,
> .detect = lt9611uxc_bridge_detect,
> .edid_read = lt9611uxc_bridge_edid_read,
> + .hpd_notify = lt9611uxc_bridge_hpd_notify,
> + .hdmi_audio_prepare = lt9611uxc_hdmi_audio_prepare,
> + .hdmi_audio_shutdown = lt9611uxc_hdmi_audio_shutdown,
> };
>
> static int lt9611uxc_parse_dt(struct device *dev,
> @@ -508,73 +547,6 @@ static int lt9611uxc_read_version(struct lt9611uxc *lt9611uxc)
> return ret < 0 ? ret : rev;
> }
>
> -static int lt9611uxc_hdmi_hw_params(struct device *dev, void *data,
> - struct hdmi_codec_daifmt *fmt,
> - struct hdmi_codec_params *hparms)
> -{
> - /*
> - * LT9611UXC will automatically detect rate and sample size, so no need
> - * to setup anything here.
> - */
> - return 0;
> -}
> -
> -static void lt9611uxc_audio_shutdown(struct device *dev, void *data)
> -{
> -}
> -
> -static int lt9611uxc_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
> - struct device_node *endpoint,
> - void *data)
> -{
> - struct of_endpoint of_ep;
> - int ret;
> -
> - ret = of_graph_parse_endpoint(endpoint, &of_ep);
> - if (ret < 0)
> - return ret;
> -
> - /*
> - * HDMI sound should be located as reg = <2>
> - * Then, it is sound port 0
> - */
> - if (of_ep.port == 2)
> - return 0;
> -
> - return -EINVAL;
> -}
> -
> -static const struct hdmi_codec_ops lt9611uxc_codec_ops = {
> - .hw_params = lt9611uxc_hdmi_hw_params,
> - .audio_shutdown = lt9611uxc_audio_shutdown,
> - .get_dai_id = lt9611uxc_hdmi_i2s_get_dai_id,
> -};
> -
> -static int lt9611uxc_audio_init(struct device *dev, struct lt9611uxc *lt9611uxc)
> -{
> - struct hdmi_codec_pdata codec_data = {
> - .ops = <9611uxc_codec_ops,
> - .max_i2s_channels = 2,
> - .i2s = 1,
> - .data = lt9611uxc,
> - };
> -
> - lt9611uxc->audio_pdev =
> - platform_device_register_data(dev, HDMI_CODEC_DRV_NAME,
> - PLATFORM_DEVID_AUTO,
> - &codec_data, sizeof(codec_data));
> -
> - return PTR_ERR_OR_ZERO(lt9611uxc->audio_pdev);
> -}
> -
> -static void lt9611uxc_audio_exit(struct lt9611uxc *lt9611uxc)
> -{
> - if (lt9611uxc->audio_pdev) {
> - platform_device_unregister(lt9611uxc->audio_pdev);
> - lt9611uxc->audio_pdev = NULL;
> - }
> -}
> -
> #define LT9611UXC_FW_PAGE_SIZE 32
> static void lt9611uxc_firmware_write_page(struct lt9611uxc *lt9611uxc, u16 addr, const u8 *buf)
> {
> @@ -858,11 +830,17 @@ static int lt9611uxc_probe(struct i2c_client *client)
> i2c_set_clientdata(client, lt9611uxc);
>
> lt9611uxc->bridge.of_node = client->dev.of_node;
> - lt9611uxc->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID;
> + lt9611uxc->bridge.ops = DRM_BRIDGE_OP_DETECT |
> + DRM_BRIDGE_OP_EDID |
> + DRM_BRIDGE_OP_HDMI_AUDIO;
> if (lt9611uxc->hpd_supported)
> lt9611uxc->bridge.ops |= DRM_BRIDGE_OP_HPD;
> lt9611uxc->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
>
> + lt9611uxc->bridge.hdmi_audio_dev = dev;
> + lt9611uxc->bridge.hdmi_audio_max_i2s_playback_channels = 2;
> + lt9611uxc->bridge.hdmi_audio_dai_port = 2;
> +
> drm_bridge_add(<9611uxc->bridge);
>
> /* Attach primary DSI */
> @@ -881,10 +859,6 @@ static int lt9611uxc_probe(struct i2c_client *client)
> }
> }
>
> - ret = lt9611uxc_audio_init(dev, lt9611uxc);
> - if (ret)
> - goto err_remove_bridge;
> -
> return 0;
>
> err_remove_bridge:
> @@ -908,7 +882,6 @@ static void lt9611uxc_remove(struct i2c_client *client)
>
> free_irq(client->irq, lt9611uxc);
> cancel_work_sync(<9611uxc->work);
> - lt9611uxc_audio_exit(lt9611uxc);
> drm_bridge_remove(<9611uxc->bridge);
>
> mutex_destroy(<9611uxc->ocm_lock);
>
LGTM
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2025-08-18 13:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-03 11:53 [PATCH RESEND 0/2] drm/bridge: lontium-lt9611uxc: switch to DRM_BRIDGE_OP_HDMI_AUDIO Dmitry Baryshkov
2025-08-03 11:53 ` [PATCH RESEND 1/2] drm/bridge: add connector argument to .hpd_notify callback Dmitry Baryshkov
2025-08-18 8:08 ` Neil Armstrong
2025-08-03 11:53 ` [PATCH RESEND 2/2] drm/bridge: lontium-lt9611uxc: switch to HDMI audio helpers Dmitry Baryshkov
2025-08-18 8:08 ` Neil Armstrong [this message]
2025-09-16 17:37 ` [PATCH RESEND 0/2] drm/bridge: lontium-lt9611uxc: switch to DRM_BRIDGE_OP_HDMI_AUDIO Dmitry Baryshkov
2025-12-24 22:32 ` Dmitry Baryshkov
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=e173b1b3-ad91-46ad-b293-c52948bb32a1@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jbrunet@baylibre.com \
--cc=jernej.skrabec@gmail.com \
--cc=jessica.zhang@oss.qualcomm.com \
--cc=jonas@kwiboo.se \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marijn.suijten@somainline.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=mripard@kernel.org \
--cc=rfoss@kernel.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®