Add support for es8388 and hdmi audio on the rock2
Subsystems (4)
v7 cover Add support for es8388 and hdmi audio on the rock2
This set of patches adds a machine driver for rk3288-based boards that have the built-in HDMI audio and a generic analog output. It also adds slave mode to the es8328 driver that currently only supported the master mode. Then, it adds the required DT definitions to link rockchip-i2s to the es8388 analog output and to hdmi audio.
This work is based on the initial work that was done by Sjoerd Simons <[email protected]> with some improvements, changes and more commits.
Changes in v7:
- Added patch 2/4
- No longer select ES8328_I2C for RK3288_HDMI_ANALOG
- Fixed DT regulator names in the DT for the Rock2
- Splitted pins for the headphone in the DT for the Rock2
Changes in v6:
- Fixed bad error handling for gpio in rk3288_analog_hdmi.c
- Removed message duplication in rk_hw_params(), in rk3288_analog_hdmi.c
- Removed patch 1/4 (from the previous series), as it has been merged
Changes in v5:
- Fixed coding style issue in patch 2/4 (the switch case).
- Moved the code for the master mode and the slave mode into the switch case for patch 2/4
- Fixed error handling for patch 3/4
Changes in v4:
- Add support for multi codecs in the asoc machine driver, so the driver matches the hw architecture (analog and hdmi audio are connected on
the same i2s line)
- Renamed the driver to rk3288-hdmi-analog.c and changed its
documentation
- Add built-in support for hdmi audio in this driver
- Add support for the property 'rockchip,routing'
Changes in v3:
- Cosmetic changes in rockchip_es8388.c
- Added missing email to MODULE_AUTHOR in rockchip_es8388.c
Changes in v2:
- Fixed wrong use of the data structure i2c_device_id
- Fixed wrong dependencies for SND_SOC_ROCKCHIP_ES8388
Romain Perier (4):
ASoC: es8328: Add support for slave mode
ASoC: Allow to select ES8328_I2C and ES8328_SPI directly
ASoC: rockchip: Add machine driver for RK3288 boards that use
analog/HDMI
arm: dts: Add support for ES8388 to the Radxa Rock 2
.../bindings/sound/rockchip,rk3288-hdmi-analog.txt | 36 +++ arch/arm/boot/dts/rk3288-rock2-som.dtsi | 2 +- arch/arm/boot/dts/rk3288-rock2-square.dts | 42 +++ sound/soc/codecs/Kconfig | 8 +- sound/soc/codecs/es8328.c | 20 +- sound/soc/rockchip/Kconfig | 9 + sound/soc/rockchip/Makefile | 2 + sound/soc/rockchip/rk3288_hdmi_analog.c | 299 +++++++++++++++++++++ 8 files changed, 407 insertions(+), 11 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk3288-hdmi-analog.txt create mode 100644 sound/soc/rockchip/rk3288_hdmi_analog.c
Signature · 1 line
2.9.3
PATCH v7 1/4 ASoC: es8328: Add support for slave mode
Currently, the function that changes the DAI format only supports master mode. Trying to use a slave mode exits the function with -EINVAL and leave the codec misconfigured. This commits adds support for enabling the slave mode.
---
Changes in v7: None
Changes in v6: None
Changes in v5:
- Fixed coding style issue for the switch case
- Moved the code for master mode and slave mode to the switch case
Changes in v4: None
Changes in v3: None
Changes in v2: None
sound/soc/codecs/es8328.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
sound/soc/codecs/es8328.c +14 -6
@@ -589,9 +589,21 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai,u8 dac_mode =0 ;u8 adc_mode =0 ; -/* set master/slave audio interface */ -if ((fmt &SND_SOC_DAIFMT_MASTER_MASK ) !=SND_SOC_DAIFMT_CBM_CFM ) +switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBM_CFM : +/* Master serial port mode, with BCLK generated automatically */ +snd_soc_update_bits (codec,ES8328_MASTERMODE , +ES8328_MASTERMODE_MSC , +ES8328_MASTERMODE_MSC ); +break ; +case SND_SOC_DAIFMT_CBS_CFS : +/* Slave serial port mode */ +snd_soc_update_bits (codec,ES8328_MASTERMODE , +ES8328_MASTERMODE_MSC ,0 ); +break ; +default :return -EINVAL ; + }/* interface format */ switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {
@@ -620,10 +632,6 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai,snd_soc_update_bits (codec,ES8328_ADCCONTROL4 ,ES8328_ADCCONTROL4_ADCFORMAT_MASK , adc_mode); -/* Master serial port mode, with BCLK generated automatically */ -snd_soc_update_bits (codec,ES8328_MASTERMODE , -ES8328_MASTERMODE_MSC ,ES8328_MASTERMODE_MSC ); -return 0 ; }
Signature · 1 line
2.9.3
PATCH v7 2/4 ASoC: Allow to select ES8328_I2C and ES8328_SPI directly
In reply to Romain PerierCurrently, we have to select these symbols explictly via Kconfig, from another entry. If we plan to use generic audio drivers like simple-audio-card, the user need to be able to enable these symbols directly via the menuconfig.
---
Changes in v7:
- Added this commit
sound/soc/codecs/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/Kconfig +4 -4
@@ -528,12 +528,12 @@ config SND_SOC_ES8328 tristate "Everest Semi ES8328 CODEC" config SND_SOC_ES8328_I2C - tristate - select SND_SOC_ES8328 + depends on SND_SOC_ES8328 + tristate "I2C support for Everest Semi ES8328 CODEC" config SND_SOC_ES8328_SPI - tristate - select SND_SOC_ES8328 + depends on SND_SOC_ES8328 + tristate "SPI support for Everest Semi ES8328 CODEC" config SND_SOC_GTM601 tristate 'GTM601 UMTS modem audio codec'
Signature · 1 line
2.9.3
kbuild test robot
build botRe: [PATCH v7 2/4] ASoC: Allow to select ES8328_I2C and ES8328_SPI directly
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…
Hi Romain,
[auto build test ERROR on rockchip/for-next]
[also build test ERROR on v4.10-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Romain-Perier/Add-support-for-es8388-and-hdmi-audio-on-the-rock2/20170131-230045 base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next config: arm-imx_v6_v7_defconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm
All error/warnings (new ones prefixed by >>):
warning: (SND_SOC_IMX_ES8328 && SND_SOC_ALL_CODECS) selects SND_SOC_ES8328_I2C which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_ES8328)
warning: (SND_SOC_IMX_ES8328 && SND_SOC_ALL_CODECS) selects SND_SOC_ES8328_SPI which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && SND_SOC_ES8328)
sound/built-in.o: In function `es8328_i2c_probe':
>> last.c:(.text+0x2be74): undefined reference to `es8328_probe' >> last.c:(.text+0x2be84): undefined reference to `es8328_regmap_config'
sound/built-in.o: In function `es8328_spi_probe':
last.c:(.text+0x2bec8): undefined reference to es8328_probe' last.c:(.text+0x2bed8): undefined reference to es8328_regmap_config'
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v7 3/4 ASoC: rockchip: Add machine driver for RK3288 boards that use analog/HDMI
In reply to Romain PerierThe driver is used for Rockchip rk3288-based boards using a configurable analog output (can be an headphone) and the built-in HDMI audio output that is part of the RK3288 SoCs and use the Alsa HDMI codec driver. For some rk3288-based boards the analog output and the hdmi audio are plugged on the same i2s line, so we have to do the same in the driver by using a DAI link CPU to multicodecs. This configuration can be found for example on the Radxa Rock2 or the Firefly-RK3288.
This commit is based on the initial work that was done by Sjoerd Simons <[email protected]> with some improvements.
---
Changes in v7:
- No longer select SND_SOC_ES8328_I2C from kconfig (as this driver is dynamic and genric for analog outputs)
Changes in v6:
- Fixed bad error handling for gpios in the probe function
- Replaced 'codec clock' by 'cpu clock' for set_sysclk for cpu_dai Changes in v5:
- Fixed error handling for gpios in the probe function
Changes in v4:
- Added support for multi codecs in the asoc machine driver, so the driver matches the hw architecture (analog and hdmi audio are connected on the same i2s line)
- Renamed the driver to rk3288-hdmi-analog.c
- Changed some variables names due to this renaming
- Changed the documentation
- Added built-in support for hdmi audio in this driver
- Added support for the property 'rockchip,routing'
Changes in v3:
- Cosmetic changes
- Added missing email to MODULE_AUTHOR
Changes in v2:
- Fixed wrong dependencies for SND_SOC_ROCKCHIP_ES8388, SND_SOC_ROCKCHIP_I2S was selected with unmet direct dependencies
.../bindings/sound/rockchip,rk3288-hdmi-analog.txt | 36 +++ sound/soc/rockchip/Kconfig | 9 + sound/soc/rockchip/Makefile | 2 + sound/soc/rockchip/rk3288_hdmi_analog.c | 299 +++++++++++++++++++++ 4 files changed, 346 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk3288-hdmi-analog.txt create mode 100644 sound/soc/rockchip/rk3288_hdmi_analog.c
Documentation/devicetree/bindings/sound/rockchip,rk3288-hdmi-analog.txt new file +36 -0
@@ -0,0 +1,36 @@ +ROCKCHIP RK3288 with HDMI and analog audio + +Required properties: +- compatible: "rockchip,rk3288-hdmi-analog" +- rockchip,model: The user-visible name of this sound complex +- rockchip,i2s-controller: The phandle of the Rockchip I2S controller that's + connected to the CODEC +- rockchip,audio-codec: The phandle of the analog audio codec. +- rockchip,routing: A list of the connections between audio components. + Each entry is a pair of strings, the first being the + connection's sink, the second being the connection's + source. For this driver the first string should always be + "Analog". + +Optionnal properties: +- rockchip,hp-en-gpios = The phandle of the GPIO that power up/down the + headphone (when the analog output is an headphone). +- rockchip,hp-det-gpios = The phandle of the GPIO that detects the headphone + (when the analog output is an headphone). +- pinctrl-names, pinctrl-0: Please refer to pinctrl-bindings.txt + +Example: + +sound { + compatible = "rockchip,rockchip-audio-es8388"; + rockchip,model = "Analog audio output"; + rockchip,i2s-controller = <&i2s>; + rockchip,audio-codec = <&es8388>; + rockchip,routing = "Analog", "LOUT2", + "Analog", "ROUT2"; + rockchip,hp-en-gpios = <&gpio8 0 GPIO_ACTIVE_HIGH>; + rockchip,hp-det-gpios = <&gpio7 7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&headphone>; +}; +
sound/soc/rockchip/Kconfig +9 -0
@@ -42,6 +42,15 @@ config SND_SOC_ROCKCHIP_RT5645 Say Y or M here if you want to add support for SoC audio on Rockchip boards using the RT5645/RT5650 codec, such as Veyron. +config SND_SOC_RK3288_HDMI_ANALOG + tristate "ASoC support multiple codecs for Rockchip RK3288 boards" + depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && CLKDEV_LOOKUP + select SND_SOC_ROCKCHIP_I2S + select SND_SOC_HDMI_CODEC + help + Say Y or M here if you want to add support for SoC audio on Rockchip + RK3288 boards using an analog output and the built-in HDMI audio. + config SND_SOC_RK3399_GRU_SOUND tristate "ASoC support multiple codecs for Rockchip RK3399 GRU boards" depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && CLKDEV_LOOKUP && SPI
sound/soc/rockchip/Makefile +2 -0
@@ -7,8 +7,10 @@ obj-$(CONFIG_SND_SOC_ROCKCHIP_SPDIF) += snd-soc-rockchip-spdif.o snd-soc-rockchip-max98090-objs := rockchip_max98090.o snd-soc-rockchip-rt5645-objs := rockchip_rt5645.o +snd-soc-rk3288-hdmi-analog-objs := rk3288_hdmi_analog.o snd-soc-rk3399-gru-sound-objs := rk3399_gru_sound.o obj-$(CONFIG_SND_SOC_ROCKCHIP_MAX98090) += snd-soc-rockchip-max98090.o obj-$(CONFIG_SND_SOC_ROCKCHIP_RT5645) += snd-soc-rockchip-rt5645.o +obj-$(CONFIG_SND_SOC_RK3288_HDMI_ANALOG) += snd-soc-rk3288-hdmi-analog.o obj-$(CONFIG_SND_SOC_RK3399_GRU_SOUND) += snd-soc-rk3399-gru-sound.o
sound/soc/rockchip/rk3288_hdmi_analog.c new file +299 -0
299 lines not on this page · raw message
Signature · 1 line
2.9.3
A message that is not in the archive (sent off-list or not yet received): 20170131145526.26808-4-romain.perier-ZGY8ohtN/[email protected]
Applied "ASoC: rockchip: Add machine driver for RK3288 boards that use analog/HDMI" to the asoc tree
The patch
ASoC: rockchip: Add machine driver for RK3288 boards that use analog/HDMI
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
eaae2ea735933bcf57227956ab9bcd8464d1519aMon Sep 17 00:00:00 2001
From: Romain Perier <romain.perier-ZGY8ohtN/[email protected]>
Date: Fri, 3 Feb 2017 15:37:59 +0100
Subject: [PATCH] ASoC: rockchip: Add machine driver for RK3288 boards that use
analog/HDMI
The driver is used for Rockchip rk3288-based boards using a configurable analog output (can be an headphone) and the built-in HDMI audio output that is part of the RK3288 SoCs and use the Alsa HDMI codec driver. For some rk3288-based boards the analog output and the hdmi audio are plugged on the same i2s line, so we have to do the same in the driver by using a DAI link CPU to multicodecs. This configuration can be found for example on the Radxa Rock2 or the Firefly-RK3288.
This commit is based on the initial work that was done by Sjoerd Simons <sjoerd.simons-ZGY8ohtN/[email protected]> with some improvements.
--- .../bindings/sound/rockchip,rk3288-hdmi-analog.txt | 36 +++ sound/soc/rockchip/Kconfig | 9 + sound/soc/rockchip/Makefile | 2 + sound/soc/rockchip/rk3288_hdmi_analog.c | 299 +++++++++++++++++++++ 4 files changed, 346 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk3288-hdmi-analog.txt create mode 100644 sound/soc/rockchip/rk3288_hdmi_analog.c
Documentation/devicetree/bindings/sound/rockchip,rk3288-hdmi-analog.txt new file +36 -0
@@ -0,0 +1,36 @@ +ROCKCHIP RK3288 with HDMI and analog audio + +Required properties: +- compatible: "rockchip,rk3288-hdmi-analog" +- rockchip,model: The user-visible name of this sound complex +- rockchip,i2s-controller: The phandle of the Rockchip I2S controller that's + connected to the CODEC +- rockchip,audio-codec: The phandle of the analog audio codec. +- rockchip,routing: A list of the connections between audio components. + Each entry is a pair of strings, the first being the + connection's sink, the second being the connection's + source. For this driver the first string should always be + "Analog". + +Optionnal properties: +- rockchip,hp-en-gpios = The phandle of the GPIO that power up/down the + headphone (when the analog output is an headphone). +- rockchip,hp-det-gpios = The phandle of the GPIO that detects the headphone + (when the analog output is an headphone). +- pinctrl-names, pinctrl-0: Please refer to pinctrl-bindings.txt + +Example: + +sound { + compatible = "rockchip,rockchip-audio-es8388"; + rockchip,model = "Analog audio output"; + rockchip,i2s-controller = <&i2s>; + rockchip,audio-codec = <&es8388>; + rockchip,routing = "Analog", "LOUT2", + "Analog", "ROUT2"; + rockchip,hp-en-gpios = <&gpio8 0 GPIO_ACTIVE_HIGH>; + rockchip,hp-det-gpios = <&gpio7 7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&headphone>; +}; +
sound/soc/rockchip/Kconfig +9 -0
@@ -42,6 +42,15 @@ config SND_SOC_ROCKCHIP_RT5645 Say Y or M here if you want to add support for SoC audio on Rockchip boards using the RT5645/RT5650 codec, such as Veyron. +config SND_SOC_RK3288_HDMI_ANALOG + tristate "ASoC support multiple codecs for Rockchip RK3288 boards" + depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && CLKDEV_LOOKUP + select SND_SOC_ROCKCHIP_I2S + select SND_SOC_HDMI_CODEC + help + Say Y or M here if you want to add support for SoC audio on Rockchip + RK3288 boards using an analog output and the built-in HDMI audio. + config SND_SOC_RK3399_GRU_SOUND tristate "ASoC support multiple codecs for Rockchip RK3399 GRU boards" depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && CLKDEV_LOOKUP && SPI
sound/soc/rockchip/Makefile +2 -0
@@ -7,8 +7,10 @@ obj-$(CONFIG_SND_SOC_ROCKCHIP_SPDIF) += snd-soc-rockchip-spdif.o snd-soc-rockchip-max98090-objs := rockchip_max98090.o snd-soc-rockchip-rt5645-objs := rockchip_rt5645.o +snd-soc-rk3288-hdmi-analog-objs := rk3288_hdmi_analog.o snd-soc-rk3399-gru-sound-objs := rk3399_gru_sound.o obj-$(CONFIG_SND_SOC_ROCKCHIP_MAX98090) += snd-soc-rockchip-max98090.o obj-$(CONFIG_SND_SOC_ROCKCHIP_RT5645) += snd-soc-rockchip-rt5645.o +obj-$(CONFIG_SND_SOC_RK3288_HDMI_ANALOG) += snd-soc-rk3288-hdmi-analog.o obj-$(CONFIG_SND_SOC_RK3399_GRU_SOUND) += snd-soc-rk3399-gru-sound.o
sound/soc/rockchip/rk3288_hdmi_analog.c new file +299 -0
299 lines not on this page · raw message
Signature · 6 lines
2.11.0 -- 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 v7 4/4 arm: dts: Add support for ES8388 to the Radxa Rock 2
In reply to Romain PerierThis commit adds the DT definition of the es8388 i2c device found at address 0x10. It also adds the definition for connecting the Rockchip I2S to the es8388 analog output.
This commit is based on the initial work that was done by Sjoerd Simons <[email protected]> with some improvements.
---
Changes in v7:
- Added a new label for vccio_codec
- Use vccio_codec instead of vcca_codec
- Splitted headphone pins into hp_det and phone_ctl
Changes in v6: None
Changes in v5: None
Changes in v4:
- Updated to the new DT binding
- Added the property 'rockchip,routing'
- Renamed the node sound_es8388 to sound_i2s
Changes in v3: None
Changes in v2: None
arch/arm/boot/dts/rk3288-rock2-som.dtsi | 2 +- arch/arm/boot/dts/rk3288-rock2-square.dts | 42 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-)
arch/arm/boot/dts/rk3288-rock2-som.dtsi +1 -1
@@ -136,7 +136,7 @@ regulator-always-on; }; - vcc_io: REG2 { + vcc_io: vccio_codec: REG2 { regulator-name = "VCC_IO"; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>;
arch/arm/boot/dts/rk3288-rock2-square.dts +42 -0
64 lines not on this page · raw message
Signature · 1 line
2.9.3