public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: "Harry Wentland" <harry.wentland@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Rodrigo Siqueira" <siqueira@igalia.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Andrzej Hajda" <andrzej.hajda@intel.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Robert Foss" <rfoss@kernel.org>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Tvrtko Ursulin" <tursulin@ursulin.net>,
	"Dmitry Baryshkov" <lumag@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Rob Herring" <robh@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Cristian Ciocaltea" <cristian.ciocaltea@collabora.com>
Cc: kernel@collabora.com, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH v8 13/20] drm/bridge: dw-hdmi-qp: Implement atomic_get_output_bus_fmts
Date: Mon, 23 Feb 2026 12:21:56 +0100	[thread overview]
Message-ID: <5968719.DvuYhMxLoT@workhorse> (raw)
In-Reply-To: <ff7b531a-77c1-4c7d-b09d-47779b640193@collabora.com>

On Sunday, 22 February 2026 11:42:39 Central European Standard Time Cristian Ciocaltea wrote:
> Hi Nicolas,
> 
> On 2/16/26 3:01 PM, Nicolas Frattaroli wrote:
> > The atomic_get_output_bus_fmts callback is used by the DRM bridge layer
> > to recursively select a suitable output format in a bridge chain.
> > 
> > As a bridge that outputs to HDMI, dw-hdmi-qp will have its output
> > formats determined by which formats the platform-specific integration of
> > the hardware supports, and the chosen HDMI output bit depth.
> > 
> > Implement this callback. The returned u32* buffer is supposed to be
> > freed by the caller of this callback, as specified by the callback's
> > documentation.
> > 
> > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> > ---
> >  drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 178 +++++++++++++++++++++++++++
> >  1 file changed, 178 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
> > index d649a1cf07f5..4c00218e5fd7 100644
> > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
> > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
> > @@ -11,6 +11,7 @@
> >  #include <linux/export.h>
> >  #include <linux/i2c.h>
> >  #include <linux/irq.h>
> > +#include <linux/media-bus-format.h>
> >  #include <linux/minmax.h>
> >  #include <linux/module.h>
> >  #include <linux/mutex.h>
> > @@ -749,6 +750,182 @@ static struct i2c_adapter *dw_hdmi_qp_i2c_adapter(struct dw_hdmi_qp *hdmi)
> >  	return adap;
> >  }
> >  
> > +static int dw_hdmi_qp_config_avi_infoframe(struct dw_hdmi_qp *hdmi,
> > +					   const u8 *buffer, size_t len)
> > +{
> > +	u32 val, i, j;
> > +
> > +	if (len != HDMI_INFOFRAME_SIZE(AVI)) {
> > +		dev_err(hdmi->dev, "failed to configure avi infoframe\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	/*
> > +	 * DW HDMI QP IP uses a different byte format from standard AVI info
> > +	 * frames, though generally the bits are in the correct bytes.
> > +	 */
> > +	val = buffer[1] << 8 | buffer[2] << 16;
> > +	dw_hdmi_qp_write(hdmi, val, PKT_AVI_CONTENTS0);
> > +
> > +	for (i = 0; i < 4; i++) {
> > +		for (j = 0; j < 4; j++) {
> > +			if (i * 4 + j >= 14)
> > +				break;
> > +			if (!j)
> > +				val = buffer[i * 4 + j + 3];
> > +			val |= buffer[i * 4 + j + 3] << (8 * j);
> > +		}
> > +
> > +		dw_hdmi_qp_write(hdmi, val, PKT_AVI_CONTENTS1 + i * 4);
> > +	}
> > +
> > +	dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_AVI_FIELDRATE, PKTSCHED_PKT_CONFIG1);
> > +
> > +	dw_hdmi_qp_mod(hdmi, PKTSCHED_AVI_TX_EN | PKTSCHED_GCP_TX_EN,
> > +		       PKTSCHED_AVI_TX_EN | PKTSCHED_GCP_TX_EN, PKTSCHED_PKT_EN);
> > +
> > +	return 0;
> > +}
> > +
> > +static int dw_hdmi_qp_config_drm_infoframe(struct dw_hdmi_qp *hdmi,
> > +					   const u8 *buffer, size_t len)
> > +{
> > +	u32 val, i;
> > +
> > +	if (len != HDMI_INFOFRAME_SIZE(DRM)) {
> > +		dev_err(hdmi->dev, "failed to configure drm infoframe\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_TX_EN, PKTSCHED_PKT_EN);
> > +
> > +	val = buffer[1] << 8 | buffer[2] << 16;
> > +	dw_hdmi_qp_write(hdmi, val, PKT_DRMI_CONTENTS0);
> > +
> > +	for (i = 0; i <= buffer[2]; i++) {
> > +		if (i % 4 == 0)
> > +			val = buffer[3 + i];
> > +		val |= buffer[3 + i] << ((i % 4) * 8);
> > +
> > +		if ((i % 4 == 3) || i == buffer[2])
> > +			dw_hdmi_qp_write(hdmi, val,
> > +					 PKT_DRMI_CONTENTS1 + ((i / 4) * 4));
> > +	}
> > +
> > +	dw_hdmi_qp_mod(hdmi, 0, PKTSCHED_DRMI_FIELDRATE, PKTSCHED_PKT_CONFIG1);
> > +	dw_hdmi_qp_mod(hdmi, PKTSCHED_DRMI_TX_EN, PKTSCHED_DRMI_TX_EN,
> > +		       PKTSCHED_PKT_EN);
> > +
> > +	return 0;
> > +}
> > +
> > +/*
> > + * Static values documented in the TRM
> > + * Different values are only used for debug purposes
> > + */
> > +#define DW_HDMI_QP_AUDIO_INFOFRAME_HB1	0x1
> > +#define DW_HDMI_QP_AUDIO_INFOFRAME_HB2	0xa
> > +
> > +static int dw_hdmi_qp_config_audio_infoframe(struct dw_hdmi_qp *hdmi,
> > +					     const u8 *buffer, size_t len)
> > +{
> > +	/*
> > +	 * AUDI_CONTENTS0: { RSV, HB2, HB1, RSV }
> > +	 * AUDI_CONTENTS1: { PB3, PB2, PB1, PB0 }
> > +	 * AUDI_CONTENTS2: { PB7, PB6, PB5, PB4 }
> > +	 *
> > +	 * PB0: CheckSum
> > +	 * PB1: | CT3    | CT2  | CT1  | CT0  | F13  | CC2 | CC1 | CC0 |
> > +	 * PB2: | F27    | F26  | F25  | SF2  | SF1  | SF0 | SS1 | SS0 |
> > +	 * PB3: | F37    | F36  | F35  | F34  | F33  | F32 | F31 | F30 |
> > +	 * PB4: | CA7    | CA6  | CA5  | CA4  | CA3  | CA2 | CA1 | CA0 |
> > +	 * PB5: | DM_INH | LSV3 | LSV2 | LSV1 | LSV0 | F52 | F51 | F50 |
> > +	 * PB6~PB10: Reserved
> > +	 *
> > +	 * AUDI_CONTENTS0 default value defined by HDMI specification,
> > +	 * and shall only be changed for debug purposes.
> > +	 */
> > +	u32 header_bytes = (DW_HDMI_QP_AUDIO_INFOFRAME_HB1 << 8) |
> > +			  (DW_HDMI_QP_AUDIO_INFOFRAME_HB2 << 16);
> > +
> > +	regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS0, &header_bytes, 1);
> > +	regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 1);
> > +	regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[4], 1);
> > +
> > +	/* Enable ACR, AUDI, AMD */
> > +	dw_hdmi_qp_mod(hdmi,
> > +		       PKTSCHED_ACR_TX_EN | PKTSCHED_AUDI_TX_EN | PKTSCHED_AMD_TX_EN,
> > +		       PKTSCHED_ACR_TX_EN | PKTSCHED_AUDI_TX_EN | PKTSCHED_AMD_TX_EN,
> > +		       PKTSCHED_PKT_EN);
> > +
> > +	/* Enable AUDS */
> > +	dw_hdmi_qp_mod(hdmi, PKTSCHED_AUDS_TX_EN, PKTSCHED_AUDS_TX_EN, PKTSCHED_PKT_EN);
> > +
> > +	return 0;
> > +}
> 
> Something's wrong with this patch as all the functions above have been dropped
> since the HDMI VSI & SPD InfoFrames series [1] got merged.  The previous
> revision was fine though, hence that's likely an unexpected artifact of the
> latest rebase.

Oops, yeah, I think I messed this up during rebase. Thanks for letting me know!

> 
> [1] https://lore.kernel.org/all/20260129-dw-hdmi-qp-iframe-v2-0-0157ad05232c@collabora.com/
> 





  reply	other threads:[~2026-02-23 11:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16 13:01 [PATCH v8 00/20] Add new general DRM property "color format" Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 01/20] drm/amd/display: Remove unnecessary SIGNAL_TYPE_HDMI_TYPE_A check Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 02/20] drm: Add new general DRM property "color format" Nicolas Frattaroli
2026-02-23 16:17   ` Jani Nikula
2026-02-24  9:03     ` Maxime Ripard
2026-02-24 14:38   ` Maxime Ripard
2026-02-16 13:01 ` [PATCH v8 03/20] drm: Add enum conversions for drm_color_format_enum Nicolas Frattaroli
2026-02-24 14:39   ` Maxime Ripard
2026-02-16 13:01 ` [PATCH v8 04/20] drm/bridge: Act on the DRM color format property Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 05/20] drm/display: hdmi-state-helper: Act on color format DRM property Nicolas Frattaroli
2026-02-24 14:41   ` Maxime Ripard
2026-02-16 13:01 ` [PATCH v8 06/20] drm/display: hdmi-state-helper: Try subsampling in mode_valid Nicolas Frattaroli
2026-02-23 10:58   ` Maxime Ripard
2026-02-16 13:01 ` [PATCH v8 07/20] drm/i915: Implement the "color format" DRM property Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 08/20] drm/amdgpu: Implement " Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 09/20] drm/rockchip: Add YUV422 output mode constants for VOP2 Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 10/20] drm/rockchip: vop2: Add RK3576 to the RG swap special case Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 11/20] drm/rockchip: vop2: Recognise 10-bit YUV422 as YUV format Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 12/20] drm/rockchip: vop2: Set correct output format for RK3576 YUV422 Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 13/20] drm/bridge: dw-hdmi-qp: Implement atomic_get_output_bus_fmts Nicolas Frattaroli
2026-02-22 10:42   ` Cristian Ciocaltea
2026-02-23 11:21     ` Nicolas Frattaroli [this message]
2026-02-16 13:01 ` [PATCH v8 14/20] drm/rockchip: dw_hdmi_qp: Implement "color format" DRM property Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 15/20] drm/rockchip: dw_hdmi_qp: Set supported_formats platdata Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 16/20] drm/connector: Register color format property on HDMI connectors Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 17/20] drm/tests: hdmi: Add tests for the color_format property Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 18/20] drm/tests: hdmi: Add tests for HDMI helper's mode_valid Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 19/20] drm/tests: bridge: Add KUnit tests for bridge chain format selection Nicolas Frattaroli
2026-02-16 13:01 ` [PATCH v8 20/20] drm/bridge: Document " Nicolas Frattaroli
2026-02-16 20:36   ` Randy Dunlap

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=5968719.DvuYhMxLoT@workhorse \
    --to=nicolas.frattaroli@collabora.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrzej.hajda@intel.com \
    --cc=andy.yan@rock-chips.com \
    --cc=christian.koenig@amd.com \
    --cc=corbet@lwn.net \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=robh@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.com \
    --cc=sunpeng.li@amd.com \
    --cc=tursulin@ursulin.net \
    --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