Skip to contentSkip to conversation

Audio support for adv7511 hdmi bridge

PATCH Superseded John Stultz 3 participants 7 messages Sep 6, 2016 – Sep 16, 2016

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Audio support for adv7511 hdmi bridge

This is another swing at getting the adv7511 hdmi bridge audio support reviewed.

I've taken the core audio work done by Lars-Peter Clausen, and adapted by Srinivas Kandagatla and Archit Taneja, and tried to rework it to use the hdmi-codec sound driver.

This patchset, along with the i2s driver and dts changes allows HDMI audio to work on the HiKey board.

I'd really appreciate any thoughts or feedback.

New in v3:
* Dropped unnecessary first patch
* Made a few clenaups suggested by Laurent
* Made audio a config time option, as suggested by Laurent
* Folded in Andy Green's audio packet initialization patch

thanks
-john

Cc David Airlie <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Andy Green <[email protected]>
Cc Dave Long <[email protected]>
Cc Guodong Xu <[email protected]>
Cc Zhangfei Gao <[email protected]>
Cc Mark Brown <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Jose Abreu <[email protected]>

John Stultz (1):
drm/bridge: adv7511: Add Audio support.

Srinivas Kandagatla (1):
drm/bridge: adv7511: Enable the audio data and clock pads on adv7533

 drivers/gpu/drm/bridge/adv7511/Kconfig         |   9 ++
 drivers/gpu/drm/bridge/adv7511/Makefile        |   1 +
 drivers/gpu/drm/bridge/adv7511/adv7511.h       |  16 ++
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 213 +++++++++++++++++++++++++
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |   4 +
 drivers/gpu/drm/bridge/adv7511/adv7533.c       |   1 +
 6 files changed, 244 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/2 drm/bridge: adv7511: Add Audio support.

This patch adds support to Audio for both adv7511 and adv7533 bridge chips.

This patch was originally from [1] by Lars-Peter Clausen <[email protected]> and was adapted by Archit Taneja <[email protected]> and Srinivas Kandagatla <[email protected]>.

Then I heavily reworked it to use the hdmi-codec driver. And also folded in some audio packet initialization done by Andy Green <[email protected]>. So credit to them, but blame to me.

[1] https://github.com/analogdevicesinc/linux/blob/xcomm_zynq/drivers/gpu/drm/i2c/adv7511_audio.c

Cc David Airlie <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Andy Green <[email protected]>
Cc Dave Long <[email protected]>
Cc Guodong Xu <[email protected]>
Cc Zhangfei Gao <[email protected]>
Cc Mark Brown <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Jose Abreu <[email protected]>

---
v3:
* Allowed audio support to be configured in or out, as suggested by Laurent
* Minor cleanups suggested by Laurent
* Folded in Andy's audio packet initialization patch, as suggested by Archit

 drivers/gpu/drm/bridge/adv7511/Kconfig         |   9 ++
 drivers/gpu/drm/bridge/adv7511/Makefile        |   1 +
 drivers/gpu/drm/bridge/adv7511/adv7511.h       |  16 ++
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 213 +++++++++++++++++++++++++
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |   4 +
 5 files changed, 243 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
drivers/gpu/drm/bridge/adv7511/Kconfig +9 -0
index d2b0499..b303ad1 100644
@@ -3,9 +3,18 @@ config DRM_I2C_ADV7511
 	depends on OF
 	select DRM_KMS_HELPER
 	select REGMAP_I2C
+	select SND_SOC_HDMI_CODEC if SND_SOC
 	help
 	  Support for the Analog Device ADV7511(W) and ADV7513 HDMI encoders.
 
+config DRM_I2C_ADV7511_AUDIO
+	tristate "ADV7511 HDMI Audio driver"
+	depends on DRM_I2C_ADV7511 && SND_SOC
+	select SND_SOC_HDMI_CODEC
+	help
+	  Support the ADV7511 HDMI Audio interface. This is used in
+	  conjunction with the AV7511  HDMI driver.
+
 config DRM_I2C_ADV7533
 	bool "ADV7533 encoder"
 	depends on DRM_I2C_ADV7511
drivers/gpu/drm/bridge/adv7511/Makefile +1 -0
index 9019327..5ba6755 100644
@@ -1,3 +1,4 @@
 adv7511-y := adv7511_drv.o
+adv7511-$(CONFIG_DRM_I2C_ADV7511_AUDIO) += adv7511_audio.o
 adv7511-$(CONFIG_DRM_I2C_ADV7533) += adv7533.o
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511.o
drivers/gpu/drm/bridge/adv7511/adv7511.h +16 -0
index 161c923..992d76c 100644
@@ -309,6 +309,8 @@ struct adv7511 {
 	struct drm_display_mode curr_mode;
 
 	unsigned int f_tmds;
+	unsigned int f_audio;
+	unsigned int audio_source;
 
 	unsigned int current_edid_segment;
 	uint8_t edid_buf[256];
@@ -334,6 +336,7 @@ struct adv7511 {
 	bool use_timing_gen;
 
 	enum adv7511_type type;
+	struct platform_device *audio_pdev;
 };
 
 #ifdef CONFIG_DRM_I2C_ADV7533
@@ -389,4 +392,17 @@ static inline int adv7533_parse_dt(struct device_node *np, struct adv7511 *adv)
 }
 #endif
 
+#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO
+int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511);
+void adv7511_audio_exit(struct adv7511 *adv7511);
+#else /*CONFIG_DRM_I2C_ADV7511_AUDIO */
+static inline int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511)
+{
+	return 0;
+}
+static inline void adv7511_audio_exit(struct adv7511 *adv7511)
+{
+}
+#endif /* CONFIG_DRM_I2C_ADV7511_AUDIO */
+
 #endif /* __DRM_I2C_ADV7511_H__ */
drivers/gpu/drm/bridge/adv7511/adv7511_audio.c new file +213 -0

213 lines not on this page · raw message

drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +4 -0
index ec8fb2e..d0b0c6a 100644
@@ -1037,6 +1037,8 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 		goto err_unregister_cec;
 	}
 
+	adv7511_audio_init(dev, adv7511);
+
 	return 0;
 
 err_unregister_cec:
@@ -1058,6 +1060,8 @@ static int adv7511_remove(struct i2c_client *i2c)
 
 	drm_bridge_remove(&adv7511->bridge);
 
+	adv7511_audio_exit(adv7511);
+
 	i2c_unregister_device(adv7511->i2c_edid);
 
 	kfree(adv7511->edid);
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v3 1/2
#2 lore raw

Re: [PATCH 1/2 v3] drm/bridge: adv7511: Add Audio support.

Quoted 13 lines · John Stultz

This patch adds support to Audio for both adv7511 and adv7533 bridge chips.

This patch was originally from [1] by Lars-Peter Clausen <[email protected]> and was adapted by Archit Taneja <[email protected]> and Srinivas Kandagatla <[email protected]>.

Then I heavily reworked it to use the hdmi-codec driver. And also folded in some audio packet initialization done by Andy Green <[email protected]>. So credit to them, but blame to me.

[1] https://github.com/analogdevicesinc/linux/blob/xcomm_zynq/drivers/gpu/drm/i2c/adv7511_audio.c

Quoted 16 lines
Cc David Airlie <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Andy Green <[email protected]>
Cc Dave Long <[email protected]>
Cc Guodong Xu <[email protected]>
Cc Zhangfei Gao <[email protected]>
Cc Mark Brown <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Jose Abreu <[email protected]>

I'm not to fond of the hdmi-codec stuff, but within its context this looks ok. Thanks for getting this upstream ready. Just one tiny bit regarding the Kconfig entry.

If that is fixed feel free to add on the next revision:

Quoted 19 lines

---
v3:
* Allowed audio support to be configured in or out, as suggested by Laurent
* Minor cleanups suggested by Laurent
* Folded in Andy's audio packet initialization patch, as suggested by Archit

 drivers/gpu/drm/bridge/adv7511/Kconfig         |   9 ++
 drivers/gpu/drm/bridge/adv7511/Makefile        |   1 +
 drivers/gpu/drm/bridge/adv7511/adv7511.h       |  16 ++
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 213 +++++++++++++++++++++++++
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |   4 +
 5 files changed, 243 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
drivers/gpu/drm/bridge/adv7511/Kconfig +0 -0
index d2b0499..b303ad1 100644

drivers/gpu/drm/bridge/adv7511/Kconfig config DRM_I2C_ADV7511 · line 6

Quoted 4 lines
drivers/gpu/drm/bridge/adv7511/Kconfig +1 -0
@@ -3,9 +3,18 @@ config DRM_I2C_ADV7511
 	depends on OF
 	select DRM_KMS_HELPER
 	select REGMAP_I2C
+	select SND_SOC_HDMI_CODEC if SND_SOC

This seems to be redundant considering the select done by DRM_I2C_ADV7511_AUDIO.

drivers/gpu/drm/bridge/adv7511/Kconfig config DRM_I2C_ADV7511 · line 11

Quoted 5 lines
drivers/gpu/drm/bridge/adv7511/Kconfig +2 -0
 	help
 	  Support for the Analog Device ADV7511(W) and ADV7513 HDMI encoders.
 
+config DRM_I2C_ADV7511_AUDIO
+	tristate "ADV7511 HDMI Audio driver"

This should be bool. It either gets built into the ADV7511 driver (which itself could either be a module or built-in) or not. But setting this option itself to module wont work.

Quoted 6 lines
drivers/gpu/drm/bridge/adv7511/Kconfig +6 -0
+	depends on DRM_I2C_ADV7511 && SND_SOC
+	select SND_SOC_HDMI_CODEC
+	help
+	  Support the ADV7511 HDMI Audio interface. This is used in
+	  conjunction with the AV7511  HDMI driver.
+

[...]

drivers/gpu/drm/bridge/adv7511/Kconfig

Quoted 3 lines
drivers/gpu/drm/bridge/adv7511/Kconfig +3 -0
+static void audio_shutdown(struct device *dev, void *data)
+{
+}

Unrelated to this patch, but it looks like the shutdown callback should maybe be made optional.

Quoted 5 lines
drivers/gpu/drm/bridge/adv7511/Kconfig +5 -0
+static const struct hdmi_codec_ops adv7511_codec_ops = {
+	.hw_params	= adv7511_hdmi_hw_params,
+	.audio_shutdown = audio_shutdown,
+	.audio_startup	= audio_startup,
+};
#3 lore raw

Re: [PATCH 1/2 v3] drm/bridge: adv7511: Add Audio support.

Quoted 68 lines · Lars-Peter Clausen
Quoted 13 lines · John Stultz

This patch adds support to Audio for both adv7511 and adv7533 bridge chips.

This patch was originally from [1] by Lars-Peter Clausen <[email protected]> and was adapted by Archit Taneja <[email protected]> and Srinivas Kandagatla <[email protected]>.

Then I heavily reworked it to use the hdmi-codec driver. And also folded in some audio packet initialization done by Andy Green <[email protected]>. So credit to them, but blame to me.

[1] https://github.com/analogdevicesinc/linux/blob/xcomm_zynq/drivers/gpu/drm/i2c/adv7511_audio.c

Quoted 16 lines
Cc David Airlie <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Andy Green <[email protected]>
Cc Dave Long <[email protected]>
Cc Guodong Xu <[email protected]>
Cc Zhangfei Gao <[email protected]>
Cc Mark Brown <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Jose Abreu <[email protected]>

I'm not to fond of the hdmi-codec stuff, but within its context this looks ok. Thanks for getting this upstream ready. Just one tiny bit regarding the Kconfig entry.

If that is fixed feel free to add on the next revision:

Quoted 19 lines

---
v3:
* Allowed audio support to be configured in or out, as suggested by Laurent
* Minor cleanups suggested by Laurent
* Folded in Andy's audio packet initialization patch, as suggested by Archit

 drivers/gpu/drm/bridge/adv7511/Kconfig         |   9 ++
 drivers/gpu/drm/bridge/adv7511/Makefile        |   1 +
 drivers/gpu/drm/bridge/adv7511/adv7511.h       |  16 ++
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 213 +++++++++++++++++++++++++
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   |   4 +
 5 files changed, 243 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
drivers/gpu/drm/bridge/adv7511/Kconfig +0 -0
index d2b0499..b303ad1 100644

drivers/gpu/drm/bridge/adv7511/Kconfig config DRM_I2C_ADV7511 · line 6

Quoted 4 lines
drivers/gpu/drm/bridge/adv7511/Kconfig +1 -0
@@ -3,9 +3,18 @@ config DRM_I2C_ADV7511
      depends on OF
      select DRM_KMS_HELPER
      select REGMAP_I2C
+     select SND_SOC_HDMI_CODEC if SND_SOC

This seems to be redundant considering the select done by DRM_I2C_ADV7511_AUDIO.

Quoted 3 lines
drivers/gpu/drm/bridge/adv7511/Kconfig +0 -0
      help
        Support for the Analog Device ADV7511(W) and ADV7513 HDMI encoders.
 
Quoted 6 lines

drivers/gpu/drm/bridge/adv7511/Kconfig config DRM_I2C_ADV7511 · line 11

Quoted 2 lines
drivers/gpu/drm/bridge/adv7511/Kconfig +2 -0
+config DRM_I2C_ADV7511_AUDIO
+     tristate "ADV7511 HDMI Audio driver"

This should be bool. It either gets built into the ADV7511 driver (which itself could either be a module or built-in) or not. But setting this option itself to module wont work.

Ah! Thanks for the catch here!

I really appreciate the feedback! I'll integrate those changes and respin the patch here shortly!

thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

PATCH v3 2/2 drm/bridge: adv7511: Enable the audio data and clock pads on adv7533

In reply to John Stultz

From: Srinivas Kandagatla <[email protected]>

This patch enables the Audio Data and Clock pads to the adv7533 bridge. Without this patch audio can not be played.

Cc David Airlie <[email protected]>
Cc Archit Taneja <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Wolfram Sang <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Andy Green <[email protected]>
Cc Dave Long <[email protected]>
Cc Guodong Xu <[email protected]>
Cc Zhangfei Gao <[email protected]>
Cc Mark Brown <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Jose Abreu <[email protected]>
---
 drivers/gpu/drm/bridge/adv7511/adv7533.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/adv7511/adv7533.c +1 -0
index 5eebd15..6798ecf 100644
@@ -29,6 +29,7 @@ static const struct reg_sequence adv7533_cec_fixed_registers[] = {
 	{ 0x17, 0xd0 },
 	{ 0x24, 0x20 },
 	{ 0x57, 0x11 },
+	{ 0x05, 0xc8 },
 };
 
 static const struct regmap_config adv7533_cec_regmap_config = {
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw
In reply to John Stultz
Quoted 10 lines · John Stultz

This is another swing at getting the adv7511 hdmi bridge audio support reviewed.

I've taken the core audio work done by Lars-Peter Clausen, and adapted by Srinivas Kandagatla and Archit Taneja, and tried to rework it to use the hdmi-codec sound driver.

This patchset, along with the i2s driver and dts changes allows HDMI audio to work on the HiKey board.

Quoted 7 lines

I'd really appreciate any thoughts or feedback.

New in v3:
* Dropped unnecessary first patch
* Made a few clenaups suggested by Laurent
* Made audio a config time option, as suggested by Laurent
* Folded in Andy Green's audio packet initialization patch

Ping? Just wanted to see if there was any other feedback on this?

thanks
-john

#6 lore raw
Quoted 1 line · John Stultz

Ping? Just wanted to see if there was any other feedback on this?

Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. If there have been review comments then people may be waiting for those to be addressed. Sending content free pings just adds to the mail volume (if they are seen at all) and if something has gone wrong you'll have to resend the patches anyway.