drm/bridge: dw-hdmi-qp: fix multi-channel audio output
PATCH 1/1 drm/bridge: dw-hdmi-qp: fix multi-channel audio output
From: Jonas Karlman <[email protected]>
Channel Allocation (PB4) and Level Shift Information (PB5) are configured with values from PB1 and PB2 due to the wrong offset being used. This results in missing audio channels or incorrect speaker placement when playing multi-channel audio.
Use the correct offset to fix multi-channel audio output.
---
buffer is a pointer to u8 while data written to PKT_AUDI_CONTENTS is u32, so buffer contains audio infoframe header (buffer[0:2]) + checksum (buffer[3]) + payload byte 1-10 (buffer[4:13]), e.g.
regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 1) .. will write PB0-PB3 to AUDI_CONTENTS1
regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[4], 1) .. will write PB1-PB4 to AUDI_CONTENTS2, but should be PB4-PB7
&buffer[4] will point to payload byte 4 not payload byte 1, due to u8/u32 and not considering the size of header+checksum (3+1).
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +1 -1
@@ -845,7 +845,7 @@ static int dw_hdmi_qp_config_audio_infoframe(struct dw_hdmi_qp *hdmi,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 ); +regmap_bulk_write (hdmi->regm,PKT_AUDI_CONTENTS2 , &buffer[7 ],1 );/* Enable ACR, AUDI, AMD */ dw_hdmi_qp_mod(hdmi,
Signature · 1 line
2.34.1
Hi Christian,
Quoted 35 lines · Christian Hewitt
From: Jonas Karlman <[email protected]>
Channel Allocation (PB4) and Level Shift Information (PB5) are configured with values from PB1 and PB2 due to the wrong offset being used. This results in missing audio channels or incorrect speaker placement when playing multi-channel audio.
Use the correct offset to fix multi-channel audio output.
Fixes fd0141d1a8a2 ("drm/bridge: synopsys: Add audio support for dw-hdmi-qp")Reported-by Christian Hewitt <[email protected]>Signed-off-by Jonas Karlman <[email protected]>---
buffer is a pointer to u8 while data written toPKT_AUDI_CONTENTSis u32, so buffer contains audio infoframe header (buffer[0:2]) + checksum (buffer[3]) + payload byte 1-10 (buffer[4:13]), e.g.
regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 1).. will write PB0-PB3 toAUDI_CONTENTS1
regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[4], 1).. will write PB1-PB4 toAUDI_CONTENTS2, but should be PB4-PB7&buffer[4] will point to payload byte 4 not payload byte 1, due to u8/u32 and not considering the size of header+checksum (3+1).
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +0
-0
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c static int dw_hdmi_qp_config_audio_infoframe(struct dw_hdmi_qp *hdmi, · line 848
Quoted 5 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +1
-1@@ -845,7 +845,7 @@ static int dw_hdmi_qp_config_audio_infoframe(struct dw_hdmi_qp *hdmi,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 ); +regmap_bulk_write (hdmi->regm,PKT_AUDI_CONTENTS2 , &buffer[7 ],1 );
Since making use of regmap_bulk_write(), this could be further optimized as:
- regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 1); - regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[4], 1); + regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 2);
Regardless,
Please note you also need to provide your SoB, check "Sign your work ..." section in [1].
Regards,
Cristian
[1] https://www.kernel.org/doc/Documentation/process/submitting-patches.rst
Quoted 17 lines · Cristian Ciocaltea
Hi Christian,
Quoted 12 lines · Christian Hewitt
From: Jonas Karlman <[email protected]>
Channel Allocation (PB4) and Level Shift Information (PB5) are configured with values from PB1 and PB2 due to the wrong offset being used. This results in missing audio channels or incorrect speaker placement when playing multi-channel audio.
Use the correct offset to fix multi-channel audio output.
Fixes fd0141d1a8a2 ("drm/bridge: synopsys: Add audio support for dw-hdmi-qp")Reported-by Christian Hewitt <[email protected]>Signed-off-by Jonas Karlman <[email protected]>
Quoted 34 lines
Quoted 22 lines
---
buffer is a pointer to u8 while data written toPKT_AUDI_CONTENTSis u32, so buffer contains audio infoframe header (buffer[0:2]) + checksum (buffer[3]) + payload byte 1-10 (buffer[4:13]), e.g.
regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 1).. will write PB0-PB3 toAUDI_CONTENTS1
regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[4], 1).. will write PB1-PB4 toAUDI_CONTENTS2, but should be PB4-PB7&buffer[4] will point to payload byte 4 not payload byte 1, due to u8/u32 and not considering the size of header+checksum (3+1).
---drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +0
-0drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c static int dw_hdmi_qp_config_audio_infoframe(struct dw_hdmi_qp *hdmi, · line 848
Quoted 5 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +1
-1@@ -845,7 +845,7 @@ static int dw_hdmi_qp_config_audio_infoframe(struct dw_hdmi_qp *hdmi,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 ); +regmap_bulk_write (hdmi->regm,PKT_AUDI_CONTENTS2 , &buffer[7 ],1 );Since making use of
regmap_bulk_write(), this could be further optimized as:(quoted diff) +1
-2- regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 1); - regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS2, &buffer[4], 1); + regmap_bulk_write(hdmi->regm, PKT_AUDI_CONTENTS1, &buffer[3], 2);
Quoted 6 lines
Regardless,
Reviewed-by Cristian Ciocaltea <[email protected]>Please note you also need to provide your SoB, check "Sign your work ..." section in [1].
Ahh, I was hoping to just forward Jonas’ patch. If it’s possible to apply the SoB above when merging, please do. If not I can send a v2 series (someone let me know).
Christian
Quoted 4 lines
Regards,
Cristian[1] https://www.kernel.org/doc/Documentation/process/submitting-patches.rst