Add I2S/ADV7511 audio support for ARC AXS10x boards
Subsystems (7)
v2 cover Add I2S/ADV7511 audio support for ARC AXS10x boards
ARC AXS10x platforms consist of a mainboard with several peripherals. One of those peripherals is an HDMI output port controlled by the ADV7511 transmitter.
This patch set adds audio for the ADV7511 transmitter and I2S audio for the AXS10x platform.
Changes v1 -> v2:
* DT bindings moved to separate patch (as suggested by Alexey Brodkin)
* Removed defconfigs entries (as suggested by Alexey Brodkin)
Jose Abreu (3):
drm/i2c/adv7511: Add audio support
ASoC: dwc: Add I2S HDMI audio support
arc: axs10x: Add support for Designware I2S on DT
arch/arc/boot/dts/axs10x_mb.dtsi | 49 +- drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ----------------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++++++++ include/sound/soc-dai.h | 1 + sound/soc/dwc/Kconfig | 1 + sound/soc/dwc/designware_i2s.c | 385 ++++++++++++- 10 files changed, 1788 insertions(+), 1041 deletions(-) delete mode 100644 drivers/gpu/drm/i2c/adv7511.c create mode 100644 drivers/gpu/drm/i2c/adv7511_audio.c create mode 100644 drivers/gpu/drm/i2c/adv7511_core.c
Signature · 7 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 1/3 drm/i2c/adv7511: Add audio support
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit 1770c4a1e32b ("Merge remote-tracking branch 'xilinx/master' into xcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/
The main core file was renamed from adv7511.c to adv7511_core.c so that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.
The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
---
No changes v1 -> v2.
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ----------------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++++++++ include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-) delete mode 100644 drivers/gpu/drm/i2c/adv7511.c create mode 100644 drivers/gpu/drm/i2c/adv7511_audio.c create mode 100644 drivers/gpu/drm/i2c/adv7511_core.c
drivers/gpu/drm/i2c/Kconfig +11 -0
@@ -7,6 +7,17 @@ config DRM_I2C_ADV7511 help Support for the Analog Device ADV7511(W) and ADV7513 HDMI encoders. +config DRM_I2C_ADV7511_AUDIO + bool "ADV7511 audio" + depends on DRM_I2C_ADV7511 && SND_SOC + default y + help + This adds support for audio on the ADV7511(W) and ADV7513 HDMI + encoders. + + By selecting this option the ADV7511 will register a codec interface + into ALSA. + config DRM_I2C_CH7006 tristate "Chrontel ch7006 TV encoder" default m if DRM_NOUVEAU
drivers/gpu/drm/i2c/Makefile +2 -0
@@ -1,5 +1,7 @@ ccflags-y := -Iinclude/drm +adv7511-y := adv7511_core.o +adv7511-$(CONFIG_DRM_I2C_ADV7511_AUDIO) += adv7511_audio.o obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511.o ch7006-y := ch7006_drv.o ch7006_mode.o
drivers/gpu/drm/i2c/adv7511.c deleted +0 -1024
1,024 lines not on this page · raw message
drivers/gpu/drm/i2c/adv7511.h +41 -0
51 lines not on this page · raw message
drivers/gpu/drm/i2c/adv7511_audio.c new file +310 -0
310 lines not on this page · raw message
drivers/gpu/drm/i2c/adv7511_core.c new file +1005 -0
1,005 lines not on this page · raw message
include/sound/soc-dai.h +1 -0
@@ -33,6 +33,7 @@ struct snd_compr_stream;#define SND_SOC_DAIFMT_DSP_B 5/* L data MSB during FRM LRC */ #define SND_SOC_DAIFMT_AC97 6/* AC97 */ #define SND_SOC_DAIFMT_PDM 7/* Pulse density modulation */ +#define SND_SOC_DAIFMT_SPDIF 8/* SPDIF */ /* left and right justified also known as MSB and LSB respectively */ #define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
Signature · 1 line
1.9.1
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
Hi,
Quoted 12 lines · Jose Abreu
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch 'xilinx/master' intoxcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.
Quoted 5 lines
The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
Is there a reason why we set the mode to HDMI at probe itself? Shouldn't it be okay to set the mode later once we read the EDID off the panel?
Some more comments below.
Quoted 20 lines
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
Signed-off-by Jose Abreu <[email protected]>---
No changes v1 -> v2.
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ----------------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++++++++ include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-)delete mode 100644
drivers/gpu/drm/i2c/adv7511.ccreate mode 100644drivers/gpu/drm/i2c/adv7511_audio.ccreate mode 100644drivers/gpu/drm/i2c/adv7511_core.c
<snip>
Quoted 73 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +73
-0+ +static int adv7511_probe (struct i2c_client *i2c,const struct i2c_device_id *id) +{ +struct adv7511_link_config link_config; +struct adv7511 *adv7511; +struct device *dev = &i2c->dev; +unsigned int val; +int ret; + +if (!dev->of_node) +return -EINVAL ; + + adv7511 =devm_kzalloc (dev,sizeof (*adv7511),GFP_KERNEL ); +if (!adv7511) +return -ENOMEM ; + + adv7511->powered = false; + adv7511->status = connector_status_disconnected; + + ret =adv7511_parse_dt (dev->of_node, &link_config); +if (ret) +return ret; + +/* +* The power down GPIO is optional. If present, toggle it from active to +* inactive to wake up the encoder. +*/ + adv7511->gpio_pd =devm_gpiod_get_optional (dev,"pd" ,GPIOD_OUT_HIGH ); +if (IS_ERR (adv7511->gpio_pd)) +return PTR_ERR (adv7511->gpio_pd); + +if (adv7511->gpio_pd) { +mdelay (5 ); +gpiod_set_value_cansleep (adv7511->gpio_pd,0 ); + } + + adv7511->regmap =devm_regmap_init_i2c (i2c, &adv7511_regmap_config); +if (IS_ERR (adv7511->regmap)) +return PTR_ERR (adv7511->regmap); + + ret =regmap_read (adv7511->regmap,ADV7511_REG_CHIP_REVISION , &val); +if (ret) +return ret; +dev_dbg (dev,"Rev. %d\n" , val); + + ret =regmap_register_patch (adv7511->regmap, adv7511_fixed_registers, +ARRAY_SIZE (adv7511_fixed_registers)); +if (ret) +return ret; + +regmap_write (adv7511->regmap,ADV7511_REG_EDID_I2C_ADDR , edid_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_PACKET_I2C_ADDR , + packet_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_CEC_I2C_ADDR , cec_i2c_addr); +adv7511_packet_disable (adv7511,0xffff ); + + adv7511->i2c_main = i2c; + adv7511->i2c_edid =i2c_new_dummy (i2c->adapter, edid_i2c_addr >>1 ); +if (!adv7511->i2c_edid) +return -ENOMEM ; + +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_i2c_unregister_device; + } + +/* CEC is unused for now */
drivers/gpu/drm/i2c/adv7511_core.c line 919
Quoted 10 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +10
-0+regmap_write (adv7511->regmap,ADV7511_REG_CEC_CTRL , +ADV7511_CEC_CTRL_POWER_DOWN ); + +adv7511_power_off (adv7511); + +i2c_set_clientdata (i2c, adv7511); + +#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO +adv7511_audio_init (&i2c->dev); +#endif
If we intend to have more audio funcs being used by the core in the future, it would be nice to have NOP audio funcs rather than having multiple #ifdef checks in the driver when CONFIG_DRM_I2C_ADV7511_AUDIO isn't set.
Quoted 10 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +10
-0+ +adv7511_set_link_config (adv7511, &link_config); + +/* Enable HDMI mode */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_HDCP_HDMI_CFG , +ADV7511_HDMI_CFG_MODE_MASK , +ADV7511_HDMI_CFG_MODE_HDMI ); + +return 0 ; +
drivers/gpu/drm/i2c/adv7511_core.c line 939
Quoted 10 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +10
-0+err_i2c_unregister_device: +i2c_unregister_device (adv7511->i2c_edid); + +return ret; +} + +static int adv7511_remove (struct i2c_client *i2c) +{ +struct adv7511 *adv7511 =i2c_get_clientdata (i2c); +
Are we missing a call to adv7511_audio_exit() here?
Thanks,
Archit
Signature · 5 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
Hi Archit,
Quoted 18 lines · Archit Taneja
Hi,
Quoted 15 lines · Jose Abreu
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch 'xilinx/master' intoxcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.The audio can be disabled using menu-config so it is possible to use only video mode.
Quoted 9 lines
Quoted 2 lines
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
Is there a reason why we set the mode to HDMI at probe itself? Shouldn't it be okay to set the mode later once we read the EDID off the panel?
Some more comments below.
Well, when I was using this in kernel 3.18 (with an older version of the driver) I noticed that DVI mode was being used even when HDMI was connected so I forced the driver to start in HDMI mode. There were some changes in the driver so it is possible that this is no longer needed. Should I drop it?
Quoted 104 lines
Quoted 20 lines
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
Signed-off-by Jose Abreu <[email protected]>---
No changes v1 -> v2.
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ----------------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++++++++ include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-)delete mode 100644
drivers/gpu/drm/i2c/adv7511.ccreate mode 100644drivers/gpu/drm/i2c/adv7511_audio.ccreate mode 100644drivers/gpu/drm/i2c/adv7511_core.c<snip>
Quoted 81 lines
(quoted diff) +2
-0+ +static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id*id)
drivers/gpu/drm/i2c/adv7511_core.c new file +78
-0+{ +struct adv7511_link_config link_config; +struct adv7511 *adv7511; +struct device *dev = &i2c->dev; +unsigned int val; +int ret; + +if (!dev->of_node) +return -EINVAL ; + + adv7511 =devm_kzalloc (dev,sizeof (*adv7511),GFP_KERNEL ); +if (!adv7511) +return -ENOMEM ; + + adv7511->powered = false; + adv7511->status = connector_status_disconnected; + + ret =adv7511_parse_dt (dev->of_node, &link_config); +if (ret) +return ret; + +/* +* The power down GPIO is optional. If present, toggle it from active to +* inactive to wake up the encoder. +*/ + adv7511->gpio_pd =devm_gpiod_get_optional (dev,"pd" ,GPIOD_OUT_HIGH ); +if (IS_ERR (adv7511->gpio_pd)) +return PTR_ERR (adv7511->gpio_pd); + +if (adv7511->gpio_pd) { +mdelay (5 ); +gpiod_set_value_cansleep (adv7511->gpio_pd,0 ); + } + + adv7511->regmap =devm_regmap_init_i2c (i2c, &adv7511_regmap_config); +if (IS_ERR (adv7511->regmap)) +return PTR_ERR (adv7511->regmap); + + ret =regmap_read (adv7511->regmap,ADV7511_REG_CHIP_REVISION , &val); +if (ret) +return ret; +dev_dbg (dev,"Rev. %d\n" , val); + + ret =regmap_register_patch (adv7511->regmap, adv7511_fixed_registers, +ARRAY_SIZE (adv7511_fixed_registers)); +if (ret) +return ret; + +regmap_write (adv7511->regmap,ADV7511_REG_EDID_I2C_ADDR , edid_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_PACKET_I2C_ADDR , + packet_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_CEC_I2C_ADDR , cec_i2c_addr); +adv7511_packet_disable (adv7511,0xffff ); + + adv7511->i2c_main = i2c; + adv7511->i2c_edid =i2c_new_dummy (i2c->adapter, edid_i2c_addr >>1 ); +if (!adv7511->i2c_edid) +return -ENOMEM ; + +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_i2c_unregister_device; + } + +/* CEC is unused for now */ +regmap_write (adv7511->regmap,ADV7511_REG_CEC_CTRL , +ADV7511_CEC_CTRL_POWER_DOWN ); + +adv7511_power_off (adv7511); + +i2c_set_clientdata (i2c, adv7511); +
Quoted 9 lines
drivers/gpu/drm/i2c/adv7511_core.c line 919
Quoted 3 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +3
-0+#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO +adv7511_audio_init (&i2c->dev); +#endif If we intend to have more audio funcs being used by the core in the future, it would be nice to have NOP audio funcs rather than having multiple #ifdef checks in the driver when
CONFIG_DRM_I2C_ADV7511_AUDIOisn't set.
I will move this ifdef to adv751_audio and use NOP functions.
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +14
-0+ +adv7511_set_link_config (adv7511, &link_config); + +/* Enable HDMI mode */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_HDCP_HDMI_CFG , +ADV7511_HDMI_CFG_MODE_MASK , +ADV7511_HDMI_CFG_MODE_HDMI ); + +return 0 ; + +err_i2c_unregister_device: +i2c_unregister_device (adv7511->i2c_edid); + +return ret;
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c line 939
Quoted 6 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +6
-0+} + +static int adv7511_remove (struct i2c_client *i2c) +{ +struct adv7511 *adv7511 =i2c_get_clientdata (i2c); +Are we missing a call to
adv7511_audio_exit()here?
I followed the code in Analog Devices tree where there is no call to audio_exit() but indeed you are correct. I will add this call.
Quoted 4 lines
Thanks,
Archit
Thanks for your comments!
Best regards,
Jose Miguel Abreu
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
Quoted 28 lines · Jose Abreu
Hi Archit,
Quoted 25 lines · Archit Taneja
Hi,
Quoted 12 lines · Jose Abreu
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch 'xilinx/master' intoxcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.Quoted 5 lines
The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
Is there a reason why we set the mode to HDMI at probe itself? Shouldn't it be okay to set the mode later once we read the EDID off the panel?
Quoted 7 lines
Quoted 2 lines
Some more comments below.
Well, when I was using this in kernel 3.18 (with an older version of the driver) I noticed that DVI mode was being used even when HDMI was connected so I forced the driver to start in HDMI mode. There were some changes in the driver so it is possible that this is no longer needed. Should I drop it?
Mode selection works fine with ADV7533 on a 4.5 kernel. I'm assuming it should work out of the box for ADV7511 too. We should drop this.
Quoted 115 lines
Quoted 105 lines
Quoted 21 lines
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
Signed-off-by Jose Abreu <[email protected]>---
No changes v1 -> v2.
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ----------------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++++++++ include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-)delete mode 100644
drivers/gpu/drm/i2c/adv7511.ccreate mode 100644drivers/gpu/drm/i2c/adv7511_audio.ccreate mode 100644drivers/gpu/drm/i2c/adv7511_core.c<snip>
Quoted 81 lines
(quoted diff) +2
-0+ +static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id*id)
drivers/gpu/drm/i2c/adv7511_core.c new file +78
-0+{ +struct adv7511_link_config link_config; +struct adv7511 *adv7511; +struct device *dev = &i2c->dev; +unsigned int val; +int ret; + +if (!dev->of_node) +return -EINVAL ; + + adv7511 =devm_kzalloc (dev,sizeof (*adv7511),GFP_KERNEL ); +if (!adv7511) +return -ENOMEM ; + + adv7511->powered = false; + adv7511->status = connector_status_disconnected; + + ret =adv7511_parse_dt (dev->of_node, &link_config); +if (ret) +return ret; + +/* +* The power down GPIO is optional. If present, toggle it from active to +* inactive to wake up the encoder. +*/ + adv7511->gpio_pd =devm_gpiod_get_optional (dev,"pd" ,GPIOD_OUT_HIGH ); +if (IS_ERR (adv7511->gpio_pd)) +return PTR_ERR (adv7511->gpio_pd); + +if (adv7511->gpio_pd) { +mdelay (5 ); +gpiod_set_value_cansleep (adv7511->gpio_pd,0 ); + } + + adv7511->regmap =devm_regmap_init_i2c (i2c, &adv7511_regmap_config); +if (IS_ERR (adv7511->regmap)) +return PTR_ERR (adv7511->regmap); + + ret =regmap_read (adv7511->regmap,ADV7511_REG_CHIP_REVISION , &val); +if (ret) +return ret; +dev_dbg (dev,"Rev. %d\n" , val); + + ret =regmap_register_patch (adv7511->regmap, adv7511_fixed_registers, +ARRAY_SIZE (adv7511_fixed_registers)); +if (ret) +return ret; + +regmap_write (adv7511->regmap,ADV7511_REG_EDID_I2C_ADDR , edid_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_PACKET_I2C_ADDR , + packet_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_CEC_I2C_ADDR , cec_i2c_addr); +adv7511_packet_disable (adv7511,0xffff ); + + adv7511->i2c_main = i2c; + adv7511->i2c_edid =i2c_new_dummy (i2c->adapter, edid_i2c_addr >>1 ); +if (!adv7511->i2c_edid) +return -ENOMEM ; + +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_i2c_unregister_device; + } + +/* CEC is unused for now */ +regmap_write (adv7511->regmap,ADV7511_REG_CEC_CTRL , +ADV7511_CEC_CTRL_POWER_DOWN ); + +adv7511_power_off (adv7511); + +i2c_set_clientdata (i2c, adv7511); +Quoted 9 lines
drivers/gpu/drm/i2c/adv7511_core.c line 919
Quoted 3 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +3
-0+#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO +adv7511_audio_init (&i2c->dev); +#endif If we intend to have more audio funcs being used by the core in the future, it would be nice to have NOP audio funcs rather than having multiple #ifdef checks in the driver when
CONFIG_DRM_I2C_ADV7511_AUDIOisn't set.
Quoted 1 line
I will move this ifdef to
adv751_audioand use NOP functions.
Thanks, I think it should help in the longer run.
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +14
-0+ +adv7511_set_link_config (adv7511, &link_config); + +/* Enable HDMI mode */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_HDCP_HDMI_CFG , +ADV7511_HDMI_CFG_MODE_MASK , +ADV7511_HDMI_CFG_MODE_HDMI ); + +return 0 ; + +err_i2c_unregister_device: +i2c_unregister_device (adv7511->i2c_edid); + +return ret;Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c line 939
Quoted 6 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +6
-0+} + +static int adv7511_remove (struct i2c_client *i2c) +{ +struct adv7511 *adv7511 =i2c_get_clientdata (i2c); +Are we missing a call to
adv7511_audio_exit()here?
Quoted 3 lines
I followed the code in Analog Devices tree where there is no call to
audio_exit()but indeed you are correct. I will add this call.
Since we have 3 files for adv7511 now, could we also move the driver to a separate folder? The long term plan is to convert all the i2c slave encoder drivers to bridges. Keeping them together would be nicer when we migrate this driver to the bridge folder.
Thanks,
Archit
Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
Hi Archit,
Quoted 34 lines · Archit Taneja
Quoted 31 lines · Jose Abreu
Hi Archit,
Quoted 27 lines · Archit Taneja
Hi,
Quoted 12 lines · Jose Abreu
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch 'xilinx/master' intoxcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.Quoted 5 lines
The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
Is there a reason why we set the mode to HDMI at probe itself? Shouldn't it be okay to set the mode later once we read the EDID off the panel?
Some more comments below.
Quoted 9 lines
Quoted 4 lines
Well, when I was using this in kernel 3.18 (with an older version of the driver) I noticed that DVI mode was being used even when HDMI was connected so I forced the driver to start in HDMI mode. There were some changes in the driver so it is possible that this is no longer needed. Should I drop it?
Mode selection works fine with ADV7533 on a 4.5 kernel. I'm assuming it should work out of the box for ADV7511 too. We should drop this.
Ok, will drop.
Quoted 145 lines
Quoted 117 lines
Quoted 107 lines
Quoted 23 lines
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
---
No changes v1 -> v2.
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ----------------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++++++++ include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-)delete mode 100644
drivers/gpu/drm/i2c/adv7511.ccreate mode 100644drivers/gpu/drm/i2c/adv7511_audio.ccreate mode 100644drivers/gpu/drm/i2c/adv7511_core.c<snip>
Quoted 81 lines
(quoted diff) +2
-0+ +static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id*id)
drivers/gpu/drm/i2c/adv7511_core.c new file +78
-0+{ +struct adv7511_link_config link_config; +struct adv7511 *adv7511; +struct device *dev = &i2c->dev; +unsigned int val; +int ret; + +if (!dev->of_node) +return -EINVAL ; + + adv7511 =devm_kzalloc (dev,sizeof (*adv7511),GFP_KERNEL ); +if (!adv7511) +return -ENOMEM ; + + adv7511->powered = false; + adv7511->status = connector_status_disconnected; + + ret =adv7511_parse_dt (dev->of_node, &link_config); +if (ret) +return ret; + +/* +* The power down GPIO is optional. If present, toggle it from active to +* inactive to wake up the encoder. +*/ + adv7511->gpio_pd =devm_gpiod_get_optional (dev,"pd" ,GPIOD_OUT_HIGH ); +if (IS_ERR (adv7511->gpio_pd)) +return PTR_ERR (adv7511->gpio_pd); + +if (adv7511->gpio_pd) { +mdelay (5 ); +gpiod_set_value_cansleep (adv7511->gpio_pd,0 ); + } + + adv7511->regmap =devm_regmap_init_i2c (i2c, &adv7511_regmap_config); +if (IS_ERR (adv7511->regmap)) +return PTR_ERR (adv7511->regmap); + + ret =regmap_read (adv7511->regmap,ADV7511_REG_CHIP_REVISION , &val); +if (ret) +return ret; +dev_dbg (dev,"Rev. %d\n" , val); + + ret =regmap_register_patch (adv7511->regmap, adv7511_fixed_registers, +ARRAY_SIZE (adv7511_fixed_registers)); +if (ret) +return ret; + +regmap_write (adv7511->regmap,ADV7511_REG_EDID_I2C_ADDR , edid_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_PACKET_I2C_ADDR , + packet_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_CEC_I2C_ADDR , cec_i2c_addr); +adv7511_packet_disable (adv7511,0xffff ); + + adv7511->i2c_main = i2c; + adv7511->i2c_edid =i2c_new_dummy (i2c->adapter, edid_i2c_addr >>1 ); +if (!adv7511->i2c_edid) +return -ENOMEM ; + +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_i2c_unregister_device; + } + +/* CEC is unused for now */ +regmap_write (adv7511->regmap,ADV7511_REG_CEC_CTRL , +ADV7511_CEC_CTRL_POWER_DOWN ); + +adv7511_power_off (adv7511); + +i2c_set_clientdata (i2c, adv7511); +Quoted 9 lines
drivers/gpu/drm/i2c/adv7511_core.c line 919
Quoted 3 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +3
-0+#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO +adv7511_audio_init (&i2c->dev); +#endif If we intend to have more audio funcs being used by the core in the future, it would be nice to have NOP audio funcs rather than having multiple #ifdef checks in the driver when
CONFIG_DRM_I2C_ADV7511_AUDIOisn't set.Quoted 1 line
I will move this ifdef to
adv751_audioand use NOP functions.Thanks, I think it should help in the longer run.
Quoted 24 lines
Quoted 23 lines
Quoted 11 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +10
-0+ +adv7511_set_link_config (adv7511, &link_config); + +/* Enable HDMI mode */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_HDCP_HDMI_CFG , +ADV7511_HDMI_CFG_MODE_MASK , +ADV7511_HDMI_CFG_MODE_HDMI ); + +return 0 ; +drivers/gpu/drm/i2c/adv7511_core.c line 939
Quoted 10 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +10
-0+err_i2c_unregister_device: +i2c_unregister_device (adv7511->i2c_edid); + +return ret; +} + +static int adv7511_remove (struct i2c_client *i2c) +{ +struct adv7511 *adv7511 =i2c_get_clientdata (i2c); +Are we missing a call to
adv7511_audio_exit()here?
Quoted 8 lines
Quoted 3 lines
I followed the code in Analog Devices tree where there is no call to
audio_exit()but indeed you are correct. I will add this call.Since we have 3 files for adv7511 now, could we also move the driver to a separate folder? The long term plan is to convert all the i2c slave encoder drivers to bridges. Keeping them together would be nicer when we migrate this driver to the bridge folder.
Ok, will move to separate folder.
Quoted 4 lines
Thanks,
Archit
Best regards,
Jose Miguel Abreu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
In reply to Jose AbreuHi Jose,
Quoted 24 lines · Jose Abreu
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch 'xilinx/master' intoxcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
Signed-off-by Jose Abreu <[email protected]>---
Quoted 8 lines
No changes v1 -> v2.
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ----------------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++++++++
Please keep the file rename separate (and use -M flag when generating the patch) from the introduction of audio support. Having to check 1k LOC movement alongside the introduction of new one is a bit... suboptimal.
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
In reply to Jose AbreuHi Jose,
Thank you for the patch.
Quoted 24 lines · On Monday 28 Mar 2016 15:36:09 Jose Abreu wrote:
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch 'xilinx/master' intoxcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
Signed-off-by Jose Abreu <[email protected]>---
Quoted 8 lines
No changes v1 -> v2.
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ------------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++++
Please use git-format-patch -M to detect renames if you send a new version of this series, it will help with review.
Quoted 5 lines
include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-) delete mode 100644 drivers/gpu/drm/i2c/adv7511.c create mode 100644 drivers/gpu/drm/i2c/adv7511_audio.c create mode 100644 drivers/gpu/drm/i2c/adv7511_core.c
[snip]
Quoted 5 lines
(quoted diff) +0
-0
b/drivers/gpu/drm/i2c/adv7511_core.cnew file mode 100644 index 0000000..d54256adrivers/gpu/drm/i2c/adv7511_core.c new file +0
-0
[snip]
Quoted 72 lines
+static int
adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)+{drivers/gpu/drm/i2c/adv7511_core.c new file +70
-0+struct adv7511_link_config link_config; +struct adv7511 *adv7511; +struct device *dev = &i2c->dev; +unsigned int val; +int ret; + +if (!dev->of_node) +return -EINVAL ; + + adv7511 =devm_kzalloc (dev,sizeof (*adv7511),GFP_KERNEL ); +if (!adv7511) +return -ENOMEM ; + + adv7511->powered = false; + adv7511->status = connector_status_disconnected; + + ret =adv7511_parse_dt (dev->of_node, &link_config); +if (ret) +return ret; + +/* +* The power down GPIO is optional. If present, toggle it from active to +* inactive to wake up the encoder. +*/ + adv7511->gpio_pd =devm_gpiod_get_optional (dev,"pd" ,GPIOD_OUT_HIGH ); +if (IS_ERR (adv7511->gpio_pd)) +return PTR_ERR (adv7511->gpio_pd); + +if (adv7511->gpio_pd) { +mdelay (5 ); +gpiod_set_value_cansleep (adv7511->gpio_pd,0 ); + } + + adv7511->regmap =devm_regmap_init_i2c (i2c, &adv7511_regmap_config); +if (IS_ERR (adv7511->regmap)) +return PTR_ERR (adv7511->regmap); + + ret =regmap_read (adv7511->regmap,ADV7511_REG_CHIP_REVISION , &val); +if (ret) +return ret; +dev_dbg (dev,"Rev. %d\n" , val); + + ret =regmap_register_patch (adv7511->regmap, adv7511_fixed_registers, +ARRAY_SIZE (adv7511_fixed_registers)); +if (ret) +return ret; + +regmap_write (adv7511->regmap,ADV7511_REG_EDID_I2C_ADDR , edid_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_PACKET_I2C_ADDR , + packet_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_CEC_I2C_ADDR , cec_i2c_addr); +adv7511_packet_disable (adv7511,0xffff ); + + adv7511->i2c_main = i2c; + adv7511->i2c_edid =i2c_new_dummy (i2c->adapter, edid_i2c_addr >>1 ); +if (!adv7511->i2c_edid) +return -ENOMEM ; + +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_i2c_unregister_device; + } + +/* CEC is unused for now */
drivers/gpu/drm/i2c/adv7511_core.c line 919
Quoted 10 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +10
-0+regmap_write (adv7511->regmap,ADV7511_REG_CEC_CTRL , +ADV7511_CEC_CTRL_POWER_DOWN ); + +adv7511_power_off (adv7511); + +i2c_set_clientdata (i2c, adv7511); + +#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO +adv7511_audio_init (&i2c->dev); +#endif
Shouldn't we condition this to the audio channel being somehow described in DT ? If a board doesn't route audio signals to the ADV7511 audio input, there's no need to register an audio codec.
Quoted 15 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +15
-0+ +adv7511_set_link_config (adv7511, &link_config); + +/* Enable HDMI mode */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_HDCP_HDMI_CFG , +ADV7511_HDMI_CFG_MODE_MASK , +ADV7511_HDMI_CFG_MODE_HDMI ); + +return 0 ; + +err_i2c_unregister_device: +i2c_unregister_device (adv7511->i2c_edid); + +return ret; +}
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
Hi Laurent,
Quoted 31 lines · Laurent Pinchart
Hi Jose,
Thank you for the patch.
Quoted 26 lines · On Monday 28 Mar 2016 15:36:09 Jose Abreu wrote:
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch 'xilinx/master' intoxcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
---
No changes v1 -> v2.
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ------------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++++Please use git-format-patch -M to detect renames if you send a new version of this series, it will help with review.
Ok, will do that in next version.
Quoted 91 lines
Quoted 5 lines
include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-) delete mode 100644 drivers/gpu/drm/i2c/adv7511.c create mode 100644 drivers/gpu/drm/i2c/adv7511_audio.c create mode 100644 drivers/gpu/drm/i2c/adv7511_core.c[snip]
Quoted 5 lines
(quoted diff) +0
-0
b/drivers/gpu/drm/i2c/adv7511_core.cnew file mode 100644 index 0000000..d54256adrivers/gpu/drm/i2c/adv7511_core.c new file +0
-0[snip]
Quoted 77 lines
+static int
adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)+{drivers/gpu/drm/i2c/adv7511_core.c new file +75
-0+struct adv7511_link_config link_config; +struct adv7511 *adv7511; +struct device *dev = &i2c->dev; +unsigned int val; +int ret; + +if (!dev->of_node) +return -EINVAL ; + + adv7511 =devm_kzalloc (dev,sizeof (*adv7511),GFP_KERNEL ); +if (!adv7511) +return -ENOMEM ; + + adv7511->powered = false; + adv7511->status = connector_status_disconnected; + + ret =adv7511_parse_dt (dev->of_node, &link_config); +if (ret) +return ret; + +/* +* The power down GPIO is optional. If present, toggle it from active to +* inactive to wake up the encoder. +*/ + adv7511->gpio_pd =devm_gpiod_get_optional (dev,"pd" ,GPIOD_OUT_HIGH ); +if (IS_ERR (adv7511->gpio_pd)) +return PTR_ERR (adv7511->gpio_pd); + +if (adv7511->gpio_pd) { +mdelay (5 ); +gpiod_set_value_cansleep (adv7511->gpio_pd,0 ); + } + + adv7511->regmap =devm_regmap_init_i2c (i2c, &adv7511_regmap_config); +if (IS_ERR (adv7511->regmap)) +return PTR_ERR (adv7511->regmap); + + ret =regmap_read (adv7511->regmap,ADV7511_REG_CHIP_REVISION , &val); +if (ret) +return ret; +dev_dbg (dev,"Rev. %d\n" , val); + + ret =regmap_register_patch (adv7511->regmap, adv7511_fixed_registers, +ARRAY_SIZE (adv7511_fixed_registers)); +if (ret) +return ret; + +regmap_write (adv7511->regmap,ADV7511_REG_EDID_I2C_ADDR , edid_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_PACKET_I2C_ADDR , + packet_i2c_addr); +regmap_write (adv7511->regmap,ADV7511_REG_CEC_I2C_ADDR , cec_i2c_addr); +adv7511_packet_disable (adv7511,0xffff ); + + adv7511->i2c_main = i2c; + adv7511->i2c_edid =i2c_new_dummy (i2c->adapter, edid_i2c_addr >>1 ); +if (!adv7511->i2c_edid) +return -ENOMEM ; + +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_i2c_unregister_device; + } + +/* CEC is unused for now */ +regmap_write (adv7511->regmap,ADV7511_REG_CEC_CTRL , +ADV7511_CEC_CTRL_POWER_DOWN ); + +adv7511_power_off (adv7511); +
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c line 919
Quoted 5 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +5
-0+i2c_set_clientdata (i2c, adv7511); + +#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO +adv7511_audio_init (&i2c->dev); +#endif Shouldn't we condition this to the audio channel being somehow described in DT ? If a board doesn't route audio signals to the ADV7511 audio input, there's no need to register an audio codec.
I can do this but the audio is already conditionally compiled using menuconfig. Is it really necessary to add this extra layer of condition?
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +7
-0+ +adv7511_set_link_config (adv7511, &link_config); + +/* Enable HDMI mode */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_HDCP_HDMI_CFG , +ADV7511_HDMI_CFG_MODE_MASK , +ADV7511_HDMI_CFG_MODE_HDMI );
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c line 934
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +8
-0+ +return 0 ; + +err_i2c_unregister_device: +i2c_unregister_device (adv7511->i2c_edid); + +return ret; +}
Best regards,
Jose Miguel Abreu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
Hi Jose,
Quoted 77 lines · On Monday 04 Apr 2016 10:05:39 Jose Abreu wrote:
Quoted 35 lines · Laurent Pinchart
Quoted 25 lines · On Monday 28 Mar 2016 15:36:09 Jose Abreu wrote:
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch'xilinx/master' into
xcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
Signed-off-by Jose Abreu <[email protected]>---
Quoted 8 lines
No changes v1 -> v2.
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ---------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++Quoted 2 lines
Please use git-format-patch -M to detect renames if you send a new version of this series, it will help with review.
Ok, will do that in next version.
Quoted 36 lines
Quoted 5 lines
include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-) delete mode 100644 drivers/gpu/drm/i2c/adv7511.c create mode 100644 drivers/gpu/drm/i2c/adv7511_audio.c create mode 100644 drivers/gpu/drm/i2c/adv7511_core.c[snip]
Quoted 5 lines
(quoted diff) +0
-0
b/drivers/gpu/drm/i2c/adv7511_core.cnew file mode 100644 index 0000000..d54256adrivers/gpu/drm/i2c/adv7511_core.c new file +0
-0[snip]
Quoted 20 lines
+static int
adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)+{drivers/gpu/drm/i2c/adv7511_core.c new file +18
-0+struct adv7511_link_config link_config; +struct adv7511 *adv7511; +struct device *dev = &i2c->dev; +unsigned int val; +int ret; + +if (!dev->of_node) +return -EINVAL ; + + adv7511 =devm_kzalloc (dev,sizeof (*adv7511),GFP_KERNEL ); +if (!adv7511) +return -ENOMEM ; + + adv7511->powered = false; + adv7511->status = connector_status_disconnected; + + ret =adv7511_parse_dt (dev->of_node, &link_config); +if (ret)
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +4
-0+return ret; + +/* +* The power down GPIO is optional. If present, toggle it from active to
drivers/gpu/drm/i2c/adv7511_core.c new file +3
-0+* inactive to wake up the encoder. +*/ + adv7511->gpio_pd = devm_gpiod_get_optional(dev, "pd",
GPIOD_OUT_HIGH);
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +19
-0+if (IS_ERR (adv7511->gpio_pd)) +return PTR_ERR (adv7511->gpio_pd); + +if (adv7511->gpio_pd) { +mdelay (5 ); +gpiod_set_value_cansleep (adv7511->gpio_pd,0 ); + } + + adv7511->regmap =devm_regmap_init_i2c (i2c, &adv7511_regmap_config); +if (IS_ERR (adv7511->regmap)) +return PTR_ERR (adv7511->regmap); + + ret =regmap_read (adv7511->regmap,ADV7511_REG_CHIP_REVISION , &val); +if (ret) +return ret; +dev_dbg (dev,"Rev. %d\n" , val); + + ret =regmap_register_patch (adv7511->regmap, adv7511_fixed_registers, +ARRAY_SIZE (adv7511_fixed_registers));
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +4
-0+if (ret) +return ret; + + regmap_write(adv7511->regmap, ADV7511_REG_EDID_I2C_ADDR,
edid_i2c_addr);drivers/gpu/drm/i2c/adv7511_core.c new file +3
-0+regmap_write (adv7511->regmap,ADV7511_REG_PACKET_I2C_ADDR , + packet_i2c_addr); + regmap_write(adv7511->regmap, ADV7511_REG_CEC_I2C_ADDR,
cec_i2c_addr);
Quoted 34 lines
Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +25
-0+adv7511_packet_disable (adv7511,0xffff ); + + adv7511->i2c_main = i2c; + adv7511->i2c_edid =i2c_new_dummy (i2c->adapter, edid_i2c_addr >>1 ); +if (!adv7511->i2c_edid) +return -ENOMEM ; + +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_i2c_unregister_device; + } + +/* CEC is unused for now */ +regmap_write (adv7511->regmap,ADV7511_REG_CEC_CTRL , +ADV7511_CEC_CTRL_POWER_DOWN ); + +adv7511_power_off (adv7511); + +i2c_set_clientdata (i2c, adv7511);Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c line 919
Quoted 4 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +4
-0+ +#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO +adv7511_audio_init (&i2c->dev); +#endif Shouldn't we condition this to the audio channel being somehow described in DT ? If a board doesn't route audio signals to the ADV7511 audio input, there's no need to register an audio codec.
Quoted 2 lines
I can do this but the audio is already conditionally compiled using menuconfig. Is it really necessary to add this extra layer of condition?
The idea is that enabling support for ADV7511 audio in the kernel isn't coupled with whether the system includes audio support. It would be confusing, and would also waste resources, to create a Linux sound device when no sound channel is routed on the board.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +15
-0+ +adv7511_set_link_config (adv7511, &link_config); + +/* Enable HDMI mode */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_HDCP_HDMI_CFG , +ADV7511_HDMI_CFG_MODE_MASK , +ADV7511_HDMI_CFG_MODE_HDMI ); + +return 0 ; + +err_i2c_unregister_device: +i2c_unregister_device (adv7511->i2c_edid); + +return ret; +}
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
Hi Laurent,
Quoted 145 lines · Laurent Pinchart
Hi Jose,
Quoted 73 lines · On Monday 04 Apr 2016 10:05:39 Jose Abreu wrote:
Quoted 28 lines · Laurent Pinchart
Quoted 27 lines · On Monday 28 Mar 2016 15:36:09 Jose Abreu wrote:
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch'xilinx/master' into
xcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
---
No changes v1 -> v2.
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ---------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005 ++++++++++++++++++++++++++++Please use git-format-patch -M to detect renames if you send a new version of this series, it will help with review.
Ok, will do that in next version.
Quoted 34 lines
Quoted 5 lines
include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-) delete mode 100644 drivers/gpu/drm/i2c/adv7511.c create mode 100644 drivers/gpu/drm/i2c/adv7511_audio.c create mode 100644 drivers/gpu/drm/i2c/adv7511_core.c[snip]
Quoted 5 lines
(quoted diff) +0
-0
b/drivers/gpu/drm/i2c/adv7511_core.cnew file mode 100644 index 0000000..d54256adrivers/gpu/drm/i2c/adv7511_core.c new file +0
-0[snip]
Quoted 20 lines
+static int
adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)+{drivers/gpu/drm/i2c/adv7511_core.c new file +18
-0+struct adv7511_link_config link_config; +struct adv7511 *adv7511; +struct device *dev = &i2c->dev; +unsigned int val; +int ret; + +if (!dev->of_node) +return -EINVAL ; + + adv7511 =devm_kzalloc (dev,sizeof (*adv7511),GFP_KERNEL ); +if (!adv7511) +return -ENOMEM ; + + adv7511->powered = false; + adv7511->status = connector_status_disconnected; + + ret =adv7511_parse_dt (dev->of_node, &link_config); +if (ret)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +4
-0+return ret; + +/* +* The power down GPIO is optional. If present, toggle it from active to
drivers/gpu/drm/i2c/adv7511_core.c new file +3
-0+* inactive to wake up the encoder. +*/ + adv7511->gpio_pd = devm_gpiod_get_optional(dev, "pd",
GPIOD_OUT_HIGH);Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +19
-0+if (IS_ERR (adv7511->gpio_pd)) +return PTR_ERR (adv7511->gpio_pd); + +if (adv7511->gpio_pd) { +mdelay (5 ); +gpiod_set_value_cansleep (adv7511->gpio_pd,0 ); + } + + adv7511->regmap =devm_regmap_init_i2c (i2c, &adv7511_regmap_config); +if (IS_ERR (adv7511->regmap)) +return PTR_ERR (adv7511->regmap); + + ret =regmap_read (adv7511->regmap,ADV7511_REG_CHIP_REVISION , &val); +if (ret) +return ret; +dev_dbg (dev,"Rev. %d\n" , val); + + ret =regmap_register_patch (adv7511->regmap, adv7511_fixed_registers, +ARRAY_SIZE (adv7511_fixed_registers));Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +4
-0+if (ret) +return ret; + + regmap_write(adv7511->regmap, ADV7511_REG_EDID_I2C_ADDR,
edid_i2c_addr);drivers/gpu/drm/i2c/adv7511_core.c new file +3
-0+regmap_write (adv7511->regmap,ADV7511_REG_PACKET_I2C_ADDR , + packet_i2c_addr); + regmap_write(adv7511->regmap, ADV7511_REG_CEC_I2C_ADDR,
cec_i2c_addr);Quoted 32 lines
Quoted 32 lines
Quoted 19 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +19
-0+adv7511_packet_disable (adv7511,0xffff ); + + adv7511->i2c_main = i2c; + adv7511->i2c_edid =i2c_new_dummy (i2c->adapter, edid_i2c_addr >>1 ); +if (!adv7511->i2c_edid) +return -ENOMEM ; + +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_i2c_unregister_device; + } + +/* CEC is unused for now */ drivers/gpu/drm/i2c/adv7511_core.c line 919
Quoted 10 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +10
-0+regmap_write (adv7511->regmap,ADV7511_REG_CEC_CTRL , +ADV7511_CEC_CTRL_POWER_DOWN ); + +adv7511_power_off (adv7511); + +i2c_set_clientdata (i2c, adv7511); + +#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO +adv7511_audio_init (&i2c->dev); +#endif Shouldn't we condition this to the audio channel being somehow described in DT ? If a board doesn't route audio signals to the ADV7511 audio input, there's no need to register an audio codec.
Quoted 6 lines
Quoted 2 lines
I can do this but the audio is already conditionally compiled using menuconfig. Is it really necessary to add this extra layer of condition?
The idea is that enabling support for ADV7511 audio in the kernel isn't coupled with whether the system includes audio support. It would be confusing, and would also waste resources, to create a Linux sound device when no sound channel is routed on the board.
Ok, will do that in next version. Another question: I am facing a problem when compiling ALSA as a module, as the ADV7511 audio is not embedded into ALSA the compilation fails with undefined references to ALSA functions. The solution that I am planning to use is to add a default value to the ADV7511 kconfig entry so that the driver is compiled as module when ALSA is a module and as embedded if ALSA is embedded. Is this okay or is there another solution without moving the ADV7511 audio to the ALSA directory?
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 6 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +5
-0+ +adv7511_set_link_config (adv7511, &link_config); + +/* Enable HDMI mode */ + regmap_update_bits(adv7511->regmap, ADV7511_REG_HDCP_HDMI_CFG,drivers/gpu/drm/i2c/adv7511_core.c line 934
Quoted 10 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +10
-0+ADV7511_HDMI_CFG_MODE_MASK , + ADV7511_HDMI_CFG_MODE_HDMI); + +return 0 ; + +err_i2c_unregister_device: +i2c_unregister_device (adv7511->i2c_edid); + +return ret; +}
Best regards,
Jose Miguel Abreu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
Hi Jose,
Quoted 165 lines · On Tuesday 05 Apr 2016 12:00:54 Jose Abreu wrote:
Quoted 156 lines · Laurent Pinchart
Quoted 80 lines · On Monday 04 Apr 2016 10:05:39 Jose Abreu wrote:
Quoted 37 lines · Laurent Pinchart
Quoted 27 lines · On Monday 28 Mar 2016 15:36:09 Jose Abreu wrote:
This patch adds audio support for the ADV7511 HDMI transmitter using ALSA SoC.
The code was ported from Analog Devices linux tree from commit
1770c4a1e32b("Merge remote-tracking branch'xilinx/master' into
xcomm_zynq"), which is available at:
- https://github.com/analogdevicesinc/linux/The main core file was renamed from
adv7511.ctoadv7511_core.cso that audio and video compile into a single adv7511.ko module and to keep up with Analog Devices kernel tree.The audio can be disabled using menu-config so it is possible to use only video mode.
The HDMI mode is automatically started at boot and the audio (when enabled) registers as a codec into ALSA.
SPDIF DAI format was also added to ASoC as it is required by adv7511 audio.
Signed-off-by Jose Abreu <[email protected]>---
No changes v1 -> v2.
Quoted 8 lines
drivers/gpu/drm/i2c/Kconfig | 11 + drivers/gpu/drm/i2c/Makefile | 2 + drivers/gpu/drm/i2c/adv7511.c | 1024 ---------------------------- drivers/gpu/drm/i2c/adv7511.h | 41 ++ drivers/gpu/drm/i2c/adv7511_audio.c | 310 +++++++++++ drivers/gpu/drm/i2c/adv7511_core.c | 1005++++++++++++++++++++++++++++
Quoted 3 lines
Please use git-format-patch -M to detect renames if you send a new version
of this series, it will help with review.Ok, will do that in next version.
Quoted 36 lines
Quoted 5 lines
include/sound/soc-dai.h | 1 + 7 files changed, 1370 insertions(+), 1024 deletions(-) delete mode 100644 drivers/gpu/drm/i2c/adv7511.c create mode 100644 drivers/gpu/drm/i2c/adv7511_audio.c create mode 100644 drivers/gpu/drm/i2c/adv7511_core.c[snip]
Quoted 5 lines
(quoted diff) +0
-0
b/drivers/gpu/drm/i2c/adv7511_core.cnew file mode 100644 index 0000000..d54256adrivers/gpu/drm/i2c/adv7511_core.c new file +0
-0[snip]
Quoted 20 lines
+static int
adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)+{drivers/gpu/drm/i2c/adv7511_core.c new file +18
-0+struct adv7511_link_config link_config; +struct adv7511 *adv7511; +struct device *dev = &i2c->dev; +unsigned int val; +int ret; + +if (!dev->of_node) +return -EINVAL ; + + adv7511 =devm_kzalloc (dev,sizeof (*adv7511),GFP_KERNEL ); +if (!adv7511) +return -ENOMEM ; + + adv7511->powered = false; + adv7511->status = connector_status_disconnected; + + ret =adv7511_parse_dt (dev->of_node, &link_config); +if (ret)Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +4
-0+return ret; + +/* +* The power down GPIO is optional. If present, toggle it from active to
drivers/gpu/drm/i2c/adv7511_core.c new file +3
-0+* inactive to wake up the encoder. +*/ + adv7511->gpio_pd = devm_gpiod_get_optional(dev, "pd",
GPIOD_OUT_HIGH);Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +19
-0+if (IS_ERR (adv7511->gpio_pd)) +return PTR_ERR (adv7511->gpio_pd); + +if (adv7511->gpio_pd) { +mdelay (5 ); +gpiod_set_value_cansleep (adv7511->gpio_pd,0 ); + } + + adv7511->regmap =devm_regmap_init_i2c (i2c, &adv7511_regmap_config); +if (IS_ERR (adv7511->regmap)) +return PTR_ERR (adv7511->regmap); + + ret =regmap_read (adv7511->regmap,ADV7511_REG_CHIP_REVISION , &val); +if (ret) +return ret; +dev_dbg (dev,"Rev. %d\n" , val); + + ret =regmap_register_patch (adv7511->regmap, adv7511_fixed_registers, +ARRAY_SIZE (adv7511_fixed_registers));Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c
Quoted 8 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +4
-0+if (ret) +return ret; + + regmap_write(adv7511->regmap, ADV7511_REG_EDID_I2C_ADDR,
edid_i2c_addr);drivers/gpu/drm/i2c/adv7511_core.c new file +3
-0+regmap_write (adv7511->regmap,ADV7511_REG_PACKET_I2C_ADDR , + packet_i2c_addr); + regmap_write(adv7511->regmap, ADV7511_REG_CEC_I2C_ADDR,
cec_i2c_addr);Quoted 34 lines
Quoted 33 lines
Quoted 19 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +19
-0+adv7511_packet_disable (adv7511,0xffff ); + + adv7511->i2c_main = i2c; + adv7511->i2c_edid =i2c_new_dummy (i2c->adapter, edid_i2c_addr >>1 ); +if (!adv7511->i2c_edid) +return -ENOMEM ; + +if (i2c->irq) { +init_waitqueue_head (&adv7511->wq); + + ret =devm_request_threaded_irq (dev, i2c->irq,NULL , + adv7511_irq_handler, +IRQF_ONESHOT ,dev_name (dev), + adv7511); +if (ret) + goto err_i2c_unregister_device; + } + +/* CEC is unused for now */ drivers/gpu/drm/i2c/adv7511_core.c line 919
Quoted 10 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +10
-0+regmap_write (adv7511->regmap,ADV7511_REG_CEC_CTRL , +ADV7511_CEC_CTRL_POWER_DOWN ); + +adv7511_power_off (adv7511); + +i2c_set_clientdata (i2c, adv7511); + +#ifdef CONFIG_DRM_I2C_ADV7511_AUDIO +adv7511_audio_init (&i2c->dev); +#endif Shouldn't we condition this to the audio channel being somehow described in DT ? If a board doesn't route audio signals to the ADV7511 audio input, there's no need to register an audio codec.
Quoted 7 lines
Quoted 2 lines
I can do this but the audio is already conditionally compiled using menuconfig. Is it really necessary to add this extra layer of condition?
The idea is that enabling support for ADV7511 audio in the kernel isn't coupled with whether the system includes audio support. It would be confusing, and would also waste resources, to create a Linux sound device when no sound channel is routed on the board.
Quoted 7 lines
Ok, will do that in next version. Another question: I am facing a problem when compiling ALSA as a module, as the ADV7511 audio is not embedded into ALSA the compilation fails with undefined references to ALSA functions. The solution that I am planning to use is to add a default value to the ADV7511 kconfig entry so that the driver is compiled as module when ALSA is a module and as embedded if ALSA is embedded. Is this okay or is there another solution without moving the ADV7511 audio to the ALSA directory?
You can write the Kconfig dependency as
depends on DRM_I2C_ADV7511
depends on SND_SOC=y || (SND_SOC && DRM_I2C_ADV7511=m)
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i2c/adv7511_core.c new file +15
-0+ +adv7511_set_link_config (adv7511, &link_config); + +/* Enable HDMI mode */ +regmap_update_bits (adv7511->regmap,ADV7511_REG_HDCP_HDMI_CFG , +ADV7511_HDMI_CFG_MODE_MASK , +ADV7511_HDMI_CFG_MODE_HDMI ); + +return 0 ; + +err_i2c_unregister_device: +i2c_unregister_device (adv7511->i2c_edid); + +return ret; +}
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
kbuild test robot
build botRe: [PATCH 1/3 v2] drm/i2c/adv7511: Add audio support
In reply to Jose Abreureproduce:
Hi Jose,
[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.6-rc1 next-20160401]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Jose-Abreu/Add-I2S-ADV7511-audio-support-for-ARC-AXS10x-boards/20160328-224040 base: git://people.freedesktop.org/~airlied/linux.git drm-next config: x86_64-randconfig-s5-04031201 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/built-in.o: In function `adv7511_audio_init':
>> (.text+0x1c608b): undefined reference to `snd_soc_register_codec' drivers/built-in.o: In function `adv7511_audio_exit': >> (.text+0x1c6096): undefined reference to `snd_soc_unregister_codec'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v2 2/3 ASoC: dwc: Add I2S HDMI audio support
In reply to Jose AbreuHDMI audio support was added to the AXS board using an I2S cpu driver and a custom platform driver.
The platform driver supports two channels @ 16 bits with rates 32k, 44.1k and 48k. ALSA Simple audio card is used to glue the cpu, platform and codec driver (adv7511).
---
No changes v1 -> v2.
sound/soc/dwc/Kconfig | 1 + sound/soc/dwc/designware_i2s.c | 385 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 373 insertions(+), 13 deletions(-)
sound/soc/dwc/Kconfig +1 -0
@@ -2,6 +2,7 @@ config SND_DESIGNWARE_I2S tristate "Synopsys I2S Device Driver" depends on CLKDEV_LOOKUP select SND_SOC_GENERIC_DMAENGINE_PCM + select SND_SIMPLE_CARD help Say Y or M if you want to add support for I2S driver for Synopsys desigwnware I2S device. The device supports upto
sound/soc/dwc/designware_i2s.c +372 -13
517 lines not on this page · raw message
Signature · 7 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3 v2] ASoC: dwc: Add I2S HDMI audio support
Hi Jose,
Quoted 36 lines · Jose Abreu
HDMI audio support was added to the AXS board using an I2S cpu driver and a custom platform driver.
The platform driver supports two channels @ 16 bits with rates 32k, 44.1k and 48k. ALSA Simple audio card is used to glue the cpu, platform and codec driver (adv7511).
Signed-off-by Jose Abreu <[email protected]>---
No changes v1 -> v2.
sound/soc/dwc/Kconfig | 1 +-
sound/soc/dwc/designware_i2s.c | 385 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+---2 files changed, 373 insertions(+-), 13 deletions(-)sound/soc/dwc/Kconfig +1
-1--- a/sound/soc/dwc/Kconfig +-+-+- b/sound/soc/dwc/Kconfig@@ -2,6 +-2,7 @@ config
SND_DESIGNWARE_I2S
tristate "Synopsys I2S Device Driver"
depends onCLKDEV_LOOKUP
selectSND_SOC_GENERIC_DMAENGINE_PCM
+- selectSND_SIMPLE_CARD
help
Say Y or M if you want to add support for I2S driver for Synopsys desigwnware I2S device. The device supports uptosound/soc/dwc/designware_i2s.c +1
-1--- a/sound/soc/dwc/designware_i2s.c +-+-+- b/sound/soc/dwc/designware_i2s.c@@ -84,11 +-84,37 @@
#defineMAX_CHANNEL_NUM8
#defineMIN_CHANNEL_NUM2
Quoted 9 lines
+-/* FPGA Version Info */ +-#define FPGA_VER_INFO 0xE0011230 +-#define FPGA_VER_27M 0x000FBED9 +- +-/* PLL registers addresses */ +-#define PLL_IDIV_ADDR 0xE00100A0 +-#define PLL_FBDIV_ADDR 0xE00100A4 +-#define PLL_ODIV0_ADDR 0xE00100A8 +-#define PLL_ODIV1_ADDR 0xE00100AC
Well I think all is not acceptable.
See all these FPGA_VER_xxx as well as PLL_xxx
are strictly ARC SDP specific things and have nothing to do with generic driver.
That's so pity we don't have a driver for all clocks/PLLs on ARC SDP yet. So as of now I may only propose to use hard-coded fixed clocks as I did with ARC PGU, see "pguclk" here:
http://lists.infradead.org/pipermail/linux-snps-arc/2016-March/000790.html
Again I'll try to implement missing clock driver sometime soon because more and more stuff requires it but for now let's use a work-around.
Quoted 16 lines
+-struct dw_i2s_pll { +- unsigned int rate; +- unsigned int data_width; +- unsigned int idiv; +- unsigned int fbdiv; +- unsigned int odiv0; +- unsigned int odiv1; +-}; +- +-static const struct dw_i2s_pll dw_i2s_pll_cfg_27m[] = { +- /* 27Mhz */ +- { 32000, 16, 0x104, 0x451, 0x10E38, 0x2000 }, +- { 44100, 16, 0x104, 0x596, 0x10D35, 0x2000 }, +- { 48000, 16, 0x208, 0xA28, 0x10B2C, 0x2000 }, +- { 0, 0, 0, 0, 0, 0 },};
Quoted 8 lines
+-static const struct dw_i2s_pll dw_i2s_pll_cfg_28m[] = {
+- /* 28.224Mhz */
+- { 32000, 16, 0x82, 0x105, 0x107DF, 0x2000 },
+- { 44100, 16, 0x28A, 0x1, 0x10001, 0x2000 },
+- { 48000, 16, 0xA28, 0x187, 0x10042, 0x2000 },
+- { 0, 0, 0, 0, 0, 0 },
+-};These 2 hunks as well should go in ARC SDP clocks.
Quoted 17 lines
+-static int i2s_pll_cfg(struct i2s_clk_config_data *config)
+-{
+- const struct dw_i2s_pll *pll_cfg;
+- u32 rate = config->sample_rate;
+- u32 data_width = config->data_width;
+- int i;
+-
+- if (readl((void *)FPGA_VER_INFO) <= FPGA_VER_27M)
+- pll_cfg = dw_i2s_pll_cfg_27m;
+- else
+- pll_cfg = dw_i2s_pll_cfg_28m;
+-
+- for (i = 0; pll_cfg[i].rate != 0; i+-+-) {
+- if ((pll_cfg[i].rate == rate) &&
+- (pll_cfg[i].data_width == data_width)) {
+- writel(pll_cfg[i].idiv, (void *)PLL_IDIV_ADDR);
+- writel(pll_cfg[i].fbdiv, (void *)PLL_FBDIV_ADDR);Quoted 8 lines
+- writel(pll_cfg[i].odiv0, (void *)PLL_ODIV0_ADDR); +- writel(pll_cfg[i].odiv1, (void *)PLL_ODIV1_ADDR); +- return 0; +- } +- } +- +- return -EINVAL; +-}
Ditto.
-Alexey--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3 v2] ASoC: dwc: Add I2S HDMI audio support
Hi Alexey,
Quoted 52 lines · Alexey Brodkin
Hi Jose,
Quoted 35 lines · Jose Abreu
HDMI audio support was added to the AXS board using an I2S cpu driver and a custom platform driver.
The platform driver supports two channels @ 16 bits with rates 32k, 44.1k and 48k. ALSA Simple audio card is used to glue the cpu, platform and codec driver (adv7511).
---
No changes v1 -> v2.
sound/soc/dwc/Kconfig | 1 + sound/soc/dwc/designware_i2s.c | 385 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 373 insertions(+), 13 deletions(-)sound/soc/dwc/Kconfig +1
-0@@ -2,6 +2,7 @@ config SND_DESIGNWARE_I2S tristate "Synopsys I2S Device Driver" depends on CLKDEV_LOOKUP select SND_SOC_GENERIC_DMAENGINE_PCM + select SND_SIMPLE_CARD help Say Y or M if you want to add support for I2S driver for Synopsys desigwnware I2S device. The device supports uptosound/soc/dwc/designware_i2s.c +0
-0@@ -84,11 +84,37 @@#define MAX_CHANNEL_NUM 8#define MIN_CHANNEL_NUM 2sound/soc/dwc/designware_i2s.c line 95
Quoted 10 lines
sound/soc/dwc/designware_i2s.c +9
-0+/* FPGA Version Info */ +#define FPGA_VER_INFO 0xE0011230 +#define FPGA_VER_27M 0x000FBED9 + +/* PLL registers addresses */ +#define PLL_IDIV_ADDR 0xE00100A0 +#define PLL_FBDIV_ADDR 0xE00100A4 +#define PLL_ODIV0_ADDR 0xE00100A8 +#define PLL_ODIV1_ADDR 0xE00100ACWell I think all is not acceptable.
See all theseFPGA_VER_xxxas well asPLL_xxx
are strictly ARC SDP specific things and have nothing to do with generic driver.
Quoted 7 lines
That's so pity we don't have a driver for all clocks/PLLs on ARC SDP yet. So as of now I may only propose to use hard-coded fixed clocks as I did with ARC PGU, see "pguclk" here:
http://lists.infradead.org/pipermail/linux-snps-arc/2016-March/000790.htmlAgain I'll try to implement missing clock driver sometime soon because more and more stuff requires it but for now let's use a work-around.
Yes, this is a workaround that we are using so that the driver works in ARC SDP platforms. The driver still has the functionality to operate using a clock driver (it must be declared in device tree) but if the clock handle is not declared the driver will assume that must use the internal PLL config options. This is currently the only option to make it work in ARC SDP.
I will send a v3 soon without this workaround and when the missing clock drivers are implemented I will re-test this.
Quoted 53 lines
Quoted 14 lines
sound/soc/dwc/designware_i2s.c +14
-0+struct dw_i2s_pll { +unsigned int rate; +unsigned int data_width; +unsigned int idiv; +unsigned int fbdiv; +unsigned int odiv0; +unsigned int odiv1; +}; + +static const struct dw_i2s_pll dw_i2s_pll_cfg_27m[] = { +/* 27Mhz */ + {32000 ,16 ,0x104 ,0x451 ,0x10E38 ,0x2000 }, + {44100 ,16 ,0x104 ,0x596 ,0x10D35 ,0x2000 }, + {48000 ,16 ,0x208 ,0xA28 ,0x10B2C ,0x2000 },sound/soc/dwc/designware_i2s.c struct dw_i2s_dev { · line 163
Quoted 10 lines
sound/soc/dwc/designware_i2s.c +8
-0+ { 0, 0, 0, 0, 0, 0 }, }; +static const struct dw_i2s_pll dw_i2s_pll_cfg_28m[] = { +/* 28.224Mhz */ + {32000 ,16 ,0x82 ,0x105 ,0x107DF ,0x2000 }, + {44100 ,16 ,0x28A ,0x1 ,0x10001 ,0x2000 }, + {48000 ,16 ,0xA28 ,0x187 ,0x10042 ,0x2000 }, + {0 ,0 ,0 ,0 ,0 ,0 }, +};These 2 hunks as well should go in ARC SDP clocks.
Quoted 15 lines
sound/soc/dwc/designware_i2s.c +15
-0+static int i2s_pll_cfg (struct i2s_clk_config_data *config) +{ +const struct dw_i2s_pll *pll_cfg; +u32 rate = config->sample_rate; +u32 data_width = config->data_width; +int i; + +if (readl ((void *)FPGA_VER_INFO ) <=FPGA_VER_27M ) + pll_cfg = dw_i2s_pll_cfg_27m; +else + pll_cfg = dw_i2s_pll_cfg_28m; + +for (i =0 ; pll_cfg[i].rate !=0 ; i++) { +if ((pll_cfg[i].rate == rate) && + (pll_cfg[i].data_width == data_width)) {sound/soc/dwc/designware_i2s.c static inline void i2s_clear_irqs(struct dw_i2s_dev *dev, u32 stream) · line 333
Quoted 10 lines
sound/soc/dwc/designware_i2s.c +10
-0+writel (pll_cfg[i].idiv, (void *)PLL_IDIV_ADDR ); +writel (pll_cfg[i].fbdiv, (void *)PLL_FBDIV_ADDR ); +writel (pll_cfg[i].odiv0, (void *)PLL_ODIV0_ADDR ); +writel (pll_cfg[i].odiv1, (void *)PLL_ODIV1_ADDR ); +return 0 ; + } + } + +return -EINVAL ; +}Ditto.
Quoted 1 line
-Alexey
Best regards,
Jose Miguel Abreu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
maintainerRe: [PATCH 2/3 v2] ASoC: dwc: Add I2S HDMI audio support
In reply to Jose AbreuQuoted 9 lines · Jose Abreu
HDMI audio support was added to the AXS board using an I2S cpu driver and a custom platform driver.
The platform driver supports two channels @ 16 bits with rates 32k, 44.1k and 48k. ALSA Simple audio card is used to glue the cpu, platform and codec driver (adv7511).
sound/soc/dwc/Kconfig | 1 + sound/soc/dwc/designware_i2s.c | 385 +++++++++++++++++++++++++++++++++++++++--
Your changelog appears to describe the writing of a machine driver but this is a large patch adding code to an I2S controller driver. This means I can't review your patch since I can't tell what it is supposed to do. If you've added functionality to this driver you need to send one or more patches each of which adds a single feature to the driver together with a changelog which describes what that feature is.
Glancing at the patch I'm not 100% sure that the features you're adding are part of the Synopsis device but I'm not entirely sure.
sound/soc/dwc/Kconfig config SND_DESIGNWARE_I2S · line 5
Quoted 11 lines
2 files changed, 373 insertions(+), 13 deletions(-)sound/soc/dwc/Kconfig +1
-0@@ -2,6 +2,7 @@ config SND_DESIGNWARE_I2S tristate "Synopsys I2S Device Driver" depends on CLKDEV_LOOKUP select SND_SOC_GENERIC_DMAENGINE_PCM + select SND_SIMPLE_CARD
No, this doesn't make sense - the fact that someone has used a Synopsis I2S controller doesn't mean that they have a system which uses simple-card. If the user wants to use simple-card they need to enable it separately, this is the same pattern we follow for all CPU controller drivers.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3 v2] ASoC: dwc: Add I2S HDMI audio support
Hi Mark,
Quoted 16 lines · Mark Brown
Quoted 8 lines · Jose Abreu
HDMI audio support was added to the AXS board using an I2S cpu driver and a custom platform driver.
The platform driver supports two channels @ 16 bits with rates 32k, 44.1k and 48k. ALSA Simple audio card is used to glue the cpu, platform and codec driver (adv7511).
sound/soc/dwc/Kconfig | 1 + sound/soc/dwc/designware_i2s.c | 385 +++++++++++++++++++++++++++++++++++++++--Your changelog appears to describe the writing of a machine driver but this is a large patch adding code to an I2S controller driver. This means I can't review your patch since I can't tell what it is supposed to do. If you've added functionality to this driver you need to send one or more patches each of which adds a single feature to the driver together with a changelog which describes what that feature is.
Quoted 3 lines
Glancing at the patch I'm not 100% sure that the features you're adding are part of the Synopsis device but I'm not entirely sure.
The major part of this patch is the adding of an ALSA platform driver so that audio comes out of the box in AXS boards but we also added functionalities to the i2s driver and performed one bug fix related with the mask/unmask of interrupts. I will split the patches but they will depend on each other.
Quoted 17 lines
sound/soc/dwc/Kconfig config SND_DESIGNWARE_I2S · line 5
Quoted 11 lines
2 files changed, 373 insertions(+), 13 deletions(-)sound/soc/dwc/Kconfig +1
-0@@ -2,6 +2,7 @@ config SND_DESIGNWARE_I2S tristate "Synopsys I2S Device Driver" depends on CLKDEV_LOOKUP select SND_SOC_GENERIC_DMAENGINE_PCM + select SND_SIMPLE_CARDNo, this doesn't make sense - the fact that someone has used a Synopsis I2S controller doesn't mean that they have a system which uses simple-card. If the user wants to use simple-card they need to enable it separately, this is the same pattern we follow for all CPU controller drivers.
I will remove this.
Quoted 5 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Best regards,
Jose Miguel Abreu
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Mark Brown
maintainerRe: [PATCH 2/3 v2] ASoC: dwc: Add I2S HDMI audio support
Quoted 4 lines · Jose Abreu
The major part of this patch is the adding of an ALSA platform driver so that audio comes out of the box in AXS boards but we also added functionalities to the i2s driver and performed one bug fix related with the mask/unmask of interrupts. I will split the patches but they will depend on each other.
If you want to add a new platform driver you need to add a new platform driver, not shove the code into an existing driver for a seperate IP.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3 v2] ASoC: dwc: Add I2S HDMI audio support
Hi Mark,
Quoted 9 lines · Mark Brown
Quoted 4 lines · Jose Abreu
The major part of this patch is the adding of an ALSA platform driver so that audio comes out of the box in AXS boards but we also added functionalities to the i2s driver and performed one bug fix related with the mask/unmask of interrupts. I will split the patches but they will depend on each other.
If you want to add a new platform driver you need to add a new platform driver, not shove the code into an existing driver for a seperate IP.
I can separate the platform driver into a new file but they will have to be compiled into the same module as the new additions to the i2s driver depend on functions of the platform driver (see i2s_irq_handler()). Or should I divide this into two modules and add a Kconfig option to the platform driver? Besides this I first wanted the driver to be compiled into the same module so that it is compatible with kernel 3.18 where simple audio card requires that platform driver == cpu driver.
Best regards,
Jose Miguel Abreu
Mark Brown
maintainerRe: [PATCH 2/3 v2] ASoC: dwc: Add I2S HDMI audio support
Quoted 8 lines · Jose Abreu
Quoted 2 lines · Mark Brown
If you want to add a new platform driver you need to add a new platform driver, not shove the code into an existing driver for a seperate IP.
I can separate the platform driver into a new file but they will have to be compiled into the same module as the new additions to the i2s driver depend on functions of the platform driver (see
i2s_irq_handler()). Or should I divide
No, that's not at all acceptable. The Designware IP is not specific to your system, you can't make it depend on your platform driver. The kernel needs to work on other people's systems too. You need to work through and/or extend the abstractions the framework provides to separate the drivers for different IPs.
Quoted 4 lines
this into two modules and add a
Kconfigoption to the platform driver? Besides this I first wanted the driver to be compiled into the same module so that it is compatible with kernel 3.18 where simple audio card requires that platform driver == cpu driver.
That's not OK upstream, we're working on the current kernel not on random old kernels. We don't carry compatibility code to enable current kernel code to be run on years old kernels.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 3/3 arc: axs10x: Add support for Designware I2S on DT
In reply to Jose AbreuSynopsys Designware ARC SDP boards support HDMI audio output using the ADV7511 HDMI transmitter.
This patchs enables audio output using Designware I2S driver, ALSA SoC simple audio card and ADV7511 codec.
---
Changes v1 -> v2:
* This change was introduced in v2.
arch/arc/boot/dts/axs10x_mb.dtsi | 49 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-)
arch/arc/boot/dts/axs10x_mb.dtsi +45 -4
@@ -138,12 +138,23 @@ interrupts = <14>; }; - i2c@0x1e000 { - compatible = "snps,designware-i2c"; + i2s: i2s@1e000 { + compatible = "snps,designware-i2s"; reg = <0x1e000 0x100>; - clock-frequency = <400000>; - clocks = <&i2cclk>; interrupts = <15>; + #sound-dai-cells = <0>; + }; + + sound { + compatible = "simple-audio-card"; + simple-audio-card,name = "AXS10X HDMI Audio"; + simple-audio-card,format = "i2s"; + simple-audio-card,cpu { + sound-dai = <&i2s>; + }; + simple-audio-card,codec { + sound-dai = <&adv7511>; + }; }; i2c@0x1f000 {
@@ -155,6 +166,36 @@ clocks = <&i2cclk>; interrupts = <16>; + adv7511: adv7511@39 { + compatible = "adi,adv7511"; + reg = <0x39>; + interrupts = <23>; + adi,input-depth = <8>; + adi,input-colorspace = "rgb"; + adi,input-clock = "1x"; + adi,clock-delay = <0x03>; + #sound-dai-cells = <0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + /* RGB/YUV input */ + port@0 { + reg = <0>; + adv7511_input: endpoint { + }; + }; + + /* HDMI output */ + port@1 { + reg = <1>; + adv7511_output: endpoint { + }; + }; + }; + }; + eeprom@0x54{ compatible = "24c01"; reg = <0x54>;
Signature · 7 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
maintainerQuoted 3 lines · Jose Abreu
ARC AXS10x platforms consist of a mainboard with several peripherals. One of those peripherals is an HDMI output port controlled by the ADV7511 transmitter.
I'm going to tell you the same thing I tell everyone else working on HDMI audio integration: you all need to talk to each other and review each other's code and unless there is a very good reason for it there should be at least some code sharing. For example take a look at the patches Jyri Sarha has been posting recently. I don't have detailed knowledge of HDMI and the range of hardware that's out there for it but I am seeing a number of different people posting patch serieses that look a lot like each other and like they should be sharing things.
Please also try to keep your CC lists reasonable, the set of people you've copied on this stuff is enormous and I'm having trouble seeing why a lot of tehm are included.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel