All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property
@ 2026-08-18  2:05 Xin Ji
  2026-08-18  2:05 ` [PATCH 2/2] drm: anx7625: add I2S input stream right justified control Xin Ji
  2026-08-18  2:12 ` [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property sashiko-bot
  0 siblings, 2 replies; 4+ messages in thread
From: Xin Ji @ 2026-08-18  2:05 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Luca Ceresoli, David Airlie,
	Simona Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Xin Ji
  Cc: r.mereu, bliang, jhuang, dri-devel, devicetree, linux-kernel

Add property "analogix,audio-right-justify-enable" to control
anx7625 to enable right justify.

Signed-off-by: Xin Ji <xji@analogixsemi.com>
---
 .../devicetree/bindings/display/bridge/analogix,anx7625.yaml  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
index 6ad466952c02..f1b08c6b4877 100644
--- a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml
@@ -82,6 +82,10 @@ properties:
     type: boolean
     description: let the driver enable audio HDMI codec function or not.
 
+  analogix,audio-right-justify-enable:
+    type: boolean
+    description: enable audio data stream right justify.
+
   aux-bus:
     $ref: /schemas/display/dp-aux-bus.yaml#
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drm: anx7625: add I2S input stream right justified control
  2026-08-18  2:05 [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property Xin Ji
@ 2026-08-18  2:05 ` Xin Ji
  2026-08-18  2:13   ` sashiko-bot
  2026-08-18  2:12 ` [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property sashiko-bot
  1 sibling, 1 reply; 4+ messages in thread
From: Xin Ji @ 2026-08-18  2:05 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: r.mereu, bliang, jhuang, Xin Ji, dri-devel, linux-kernel

The default audio data stream is left justify. When the
property "analogix,audio-right-justify-enable" is detected,
the code enables right justify.

Signed-off-by: Xin Ji <xji@analogixsemi.com>
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 9 +++++++++
 drivers/gpu/drm/bridge/analogix/anx7625.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index c3af88e14f8b..f4bce0000676 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1883,6 +1883,9 @@ static int anx7625_parse_dt(struct device *dev,
 	if (of_property_read_bool(np, "analogix,audio-enable"))
 		pdata->audio_en = 1;
 
+	if (of_property_read_bool(np, "analogix,audio-right-justify-enable"))
+		pdata->audio_right_justify = 1;
+
 	return 0;
 }
 
@@ -2083,6 +2086,12 @@ static int anx7625_audio_hw_params(struct device *dev, void *data,
 		ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client,
 				AUDIO_CHANNEL_STATUS_6, ~AUDIO_LAYOUT);
 
+	/* Right justified */
+	if (ctx->pdata.audio_right_justify)
+		ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client,
+					AUDIO_CONTROL_REGISTER,
+					RIGHT_JUSTIFY_CTRL);
+
 	/* FS */
 	switch (params->sample_rate) {
 	case 32000:
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h
index 957d234ec07c..9dd9970d2172 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.h
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.h
@@ -154,6 +154,8 @@
 #define HPD_TIME               54000
 
 #define AUDIO_CONTROL_REGISTER 0xe6
+#define RIGHT_JUSTIFY_CTRL     BIT(0)
+
 #define TDM_TIMING_MODE 0x08
 
 #define I2C_ADDR_72_DPTX              0x72
@@ -444,6 +446,7 @@ struct anx7625_platform_data {
 	int is_dpi;
 	int mipi_lanes;
 	int audio_en;
+	int audio_right_justify;
 	int dp_lane0_swing_reg_cnt;
 	u8 lane0_reg_data[DP_TX_SWING_REG_CNT];
 	int dp_lane1_swing_reg_cnt;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property
  2026-08-18  2:05 [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property Xin Ji
  2026-08-18  2:05 ` [PATCH 2/2] drm: anx7625: add I2S input stream right justified control Xin Ji
@ 2026-08-18  2:12 ` sashiko-bot
  1 sibling, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-08-18  2:12 UTC (permalink / raw)
  To: Xin Ji; +Cc: devicetree, conor+dt, dri-devel, robh

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Adding a vendor-specific DT property for audio interface format bypasses standard ASoC DAI format negotiation.
--

--- Patch [1]: [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property ---
Please note that due to recitation restrictions, I cannot quote the original
patch code directly. The review below is provided as a free-form summary of
the findings.

commit c7f75f4b785470ba45b421324266273f5142da0b
Author: Xin Ji <xji@analogixsemi.com>

dt-bindings: drm/bridge: anx7625: Add right justify property

This commit adds a new boolean property to the analogix,anx7625 device tree
bindings. The property controls whether the driver enables the audio right
justify function for the data stream.

[Severity: Medium]
Does adding a vendor-specific devicetree property for the audio interface
format bypass the standard ASoC DAI format negotiation?

The standard hdmi-codec framework already supports right justified formats
using the existing DAI format structures, which are normally passed dynamically
to the driver's hw_params callback based on standard sound card properties.

Creating a custom property like analogix,audio-right-justify-enable hardcodes
this configuration statically in the devicetree, which creates a permanent ABI.
Should this driver instead rely on the standard hdmi-codec API to handle the
DAI format negotiation rather than introducing a custom vendor property?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818020559.961335-1-xji@analogixsemi.com?part=1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] drm: anx7625: add I2S input stream right justified control
  2026-08-18  2:05 ` [PATCH 2/2] drm: anx7625: add I2S input stream right justified control Xin Ji
@ 2026-08-18  2:13   ` sashiko-bot
  0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-08-18  2:13 UTC (permalink / raw)
  To: Xin Ji; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

New issues:
- [Medium] Bypassing standard ALSA HDMI codec DAI format negotiation.
- [Medium] RIGHT_JUSTIFY_CTRL bit is conditionally set but never cleared.

Pre-existing issues:
- [High] Use-After-Free due to interrupt firing after workqueue destruction.
--

--- Patch [2]: [PATCH 2/2] drm: anx7625: add I2S input stream right justified control ---
commit e78186b015f668998903e293729ea71c5bebfbd8
Author: Xin Ji <xji@analogixsemi.com>

drm: anx7625: add I2S input stream right justified control

The default audio data stream is left justify. When the
property "analogix,audio-right-justify-enable" is detected,
the code enables right justify.

> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index fffcd6154c710..d00aa6ea7273d 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c

[ ... ]

> @@ -2083,6 +2086,12 @@ static int anx7625_audio_hw_params(struct device *dev, void *data,
>  		ret |= anx7625_write_and(ctx, ctx->i2c.tx_p2_client,
>  				AUDIO_CHANNEL_STATUS_6, ~AUDIO_LAYOUT);
>  
> +	/* Right justified */
> +	if (ctx->pdata.audio_right_justify)

[Severity: Medium]
Instead of bypassing standard ALSA HDMI codec DAI format negotiation,
should this code check the standard fmt->fmt parameter for HDMI_RIGHT_J?

When the driver receives HDMI_RIGHT_J via hdmi_codec_daifmt->fmt at the
start of anx7625_audio_hw_params(), it rejects it with -EINVAL. Relying
on a custom static DT property breaks compatibility with generic ALSA
sound cards that dynamically negotiate the DAI format.

[Severity: Medium]
Is there a missing clear operation for this bit?

If a bootloader or previous kernel execution left the RIGHT_JUSTIFY_CTRL
bit set, and ctx->pdata.audio_right_justify is false, the hardware will
remain in right-justified mode even when standard I2S is expected. Should
there be an anx7625_write_and() to clear the bit on the false path?

> +		ret |= anx7625_write_or(ctx, ctx->i2c.tx_p2_client,
> +					AUDIO_CONTROL_REGISTER,
> +					RIGHT_JUSTIFY_CTRL);
> +
>  	/* FS */
>  	switch (params->sample_rate) {
>  	case 32000:

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but does the driver have a
use-after-free vulnerability during unbind?

In anx7625_i2c_remove(), the workqueue is destroyed before the interrupt is
disabled:

	if (platform->pdata.intp_irq)
		destroy_workqueue(platform->workqueue);

Because the driver uses devm_request_threaded_irq(), the interrupt is
only freed after remove() returns. If an interrupt (like Hot Plug Detect)
fires after destroy_workqueue(), the ISR anx7625_intr_hpd_isr() will
attempt to use it:

	queue_work(ctx->workqueue, &ctx->work);

Should disable_irq() be called before destroying the workqueue to prevent
the ISR from dereferencing the freed workqueue pointer?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818020559.961335-1-xji@analogixsemi.com?part=2

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-18  2:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18  2:05 [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property Xin Ji
2026-08-18  2:05 ` [PATCH 2/2] drm: anx7625: add I2S input stream right justified control Xin Ji
2026-08-18  2:13   ` sashiko-bot
2026-08-18  2:12 ` [PATCH 1/2] dt-bindings: drm/bridge: anx7625: Add right justify property sashiko-bot

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.