Add support for es8388 on the rock2
Subsystems (4)
v2 cover Add support for es8388 on the rock2
This set of patches adds a machine driver for rockchip boards that use ES8388 codecs. 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.
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 v2:
- Fixed wrong use of the data structure i2c_device_id
- Fixed wrong dependencies for SND_SOC_ROCKCHIP_ES8388
Romain Perier (4):
ASoC: es8328-i2c: Add compatible for ES8388
ASoC: es8328: Add support for slave mode
ASoC: rockchip: Add machine driver for ES8388 codecs
arm: dts: Add support for ES8388 to the Radxa Rock 2
Documentation/devicetree/bindings/sound/es8328.txt | 2 +- .../devicetree/bindings/sound/rockchip-es8388.txt | 28 +++ arch/arm/boot/dts/rk3288-rock2-square.dts | 37 +++ sound/soc/codecs/es8328-i2c.c | 2 + sound/soc/codecs/es8328.c | 28 ++- sound/soc/rockchip/Kconfig | 9 + sound/soc/rockchip/Makefile | 2 + sound/soc/rockchip/rockchip_es8388.c | 270 +++++++++++++++++++++ 8 files changed, 371 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/rockchip-es8388.txt create mode 100644 sound/soc/rockchip/rockchip_es8388.c
Signature · 1 line
2.9.3
PATCH v2 1/4 ASoC: es8328-i2c: Add compatible for ES8388
This commit adds a compatible string for everest,es8388. This is an audio codec that is compatible with es8328.
---
Changes in v2:
- Fixed wrong use of the i2c_device_id data structure
Documentation/devicetree/bindings/sound/es8328.txt | 2 +- sound/soc/codecs/es8328-i2c.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/es8328.txt +1 -1
@@ -4,7 +4,7 @@ This device supports both I2C and SPI. Required properties: - - compatible : "everest,es8328" + - compatible : Should be "everest,es8328" or "everest,es8388" - DVDD-supply : Regulator providing digital core supply voltage 1.8 - 3.6V - AVDD-supply : Regulator providing analog supply voltage 3.3V - PVDD-supply : Regulator providing digital IO supply voltage 1.8 - 3.6V
sound/soc/codecs/es8328-i2c.c +2 -0
@@ -20,12 +20,14 @@static const struct i2c_device_id es8328_id[] = { {"es8328" ,0 }, + {"es8388" ,0 }, { } };MODULE_DEVICE_TABLE (i2c, es8328_id);static const struct of_device_id es8328_of_match[] = { { .compatible ="everest,es8328" , }, + { .compatible ="everest,es8388" , }, { } };MODULE_DEVICE_TABLE (of, es8328_of_match);
Signature · 1 line
2.9.3
PATCH v2 2/4 ASoC: es8328: Add support for slave mode
In reply to Romain PerierCurrently, 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 v2: None
sound/soc/codecs/es8328.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
sound/soc/codecs/es8328.c +22 -6
@@ -588,10 +588,18 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai,struct snd_soc_codec *codec = codec_dai->codec;u8 dac_mode =0 ;u8 adc_mode =0 ; +bool master; -/* set master/slave audio interface */ -if ((fmt &SND_SOC_DAIFMT_MASTER_MASK ) !=SND_SOC_DAIFMT_CBM_CFM ) -return -EINVAL ; +switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBM_CFM : + master = true; +break ; +case SND_SOC_DAIFMT_CBS_CFS : + master = false; +break ; +default : +return -EINVAL ; + }/* interface format */ switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {
@@ -620,9 +628,17 @@ 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 ); +if (master) { +/* Master serial port mode, with BCLK generated automatically */ +snd_soc_update_bits (codec,ES8328_MASTERMODE , +ES8328_MASTERMODE_MSC , +ES8328_MASTERMODE_MSC ); + }else { +/* Slave serial port mode */ +snd_soc_update_bits (codec,ES8328_MASTERMODE , +ES8328_MASTERMODE_MSC , +0 ); + }return 0 ; }
Signature · 1 line
2.9.3
PATCH v2 3/4 ASoC: rockchip: Add machine driver for ES8388 codecs
In reply to Romain PerierThe driver is used for Rockchip boards using an audio codec compatible with ES8388.
This commit is based on the initial work that was done by Sjoerd Simons <[email protected]> with some improvements.
---
Changes in v2:
- Fixed wrong dependencies for SND_SOC_ROCKCHIP_ES8388, SND_SOC_ROCKCHIP_I2S was selected with unmet direct dependencies
.../devicetree/bindings/sound/rockchip-es8388.txt | 28 +++ sound/soc/rockchip/Kconfig | 9 + sound/soc/rockchip/Makefile | 2 + sound/soc/rockchip/rockchip_es8388.c | 270 +++++++++++++++++++++ 4 files changed, 309 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/rockchip-es8388.txt create mode 100644 sound/soc/rockchip/rockchip_es8388.c
Documentation/devicetree/bindings/sound/rockchip-es8388.txt new file +28 -0
@@ -0,0 +1,28 @@ +ROCKCHIP with ES8388 CODECS + +Required properties: +- compatible: "rockchip,rockchip-audio-es8388" +- 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 es8388 audio codec + +Optionnal properties: +- rockchip,hp-en-gpios = The phandle of the GPIO that power up/down the + headphone. +- rockchip,hp-det-gpios = The phandle of the GPIO that detects the 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,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_ROCKCHIP_ES8388 + tristate "ASoC support for Rockchip boards using a ES8388 codec" + depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && CLKDEV_LOOKUP + select SND_SOC_ROCKCHIP_I2S + select SND_SOC_ES8328_I2C + help + Say Y or M here if you want to add support for SoC audio on Rockchip + boards using the ES8388 Codec such as Radxa Rock 2 + 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-rockchip-es8388-objs := rockchip_es8388.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_ROCKCHIP_ES8388) += snd-soc-rockchip-es8388.o obj-$(CONFIG_SND_SOC_RK3399_GRU_SOUND) += snd-soc-rk3399-gru-sound.o
sound/soc/rockchip/rockchip_es8388.c new file +270 -0
270 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v2 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 v2: None
arch/arm/boot/dts/rk3288-rock2-square.dts | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/arm/boot/dts/rk3288-rock2-square.dts +37 -0
@@ -86,6 +86,17 @@ #sound-dai-cells = <0>; }; + sound_es8388 { + compatible = "rockchip,rockchip-audio-es8388"; + rockchip,model = "Analog audio output"; + rockchip,i2s-controller = <&i2s>; + rockchip,audio-codec = <&es8388>; + rockchip,hp-en-gpios = <&gpio8 0 GPIO_ACTIVE_HIGH>; + rockchip,hp-det-gpios = <&gpio7 7 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&headphone>; + }; + sdio_pwrseq: sdio-pwrseq { compatible = "mmc-pwrseq-simple"; clocks = <&hym8563>;
@@ -173,10 +184,29 @@ }; }; +&i2c2 { + status = "okay"; + + es8388: es8388@10 { + compatible = "everest,es8388", "everest,es8328"; + reg = <0x10>; + AVDD-supply = <&vcca_codec>; + DVDD-supply = <&vcca_codec>; + HPVDD-supply = <&vcca_codec>; + PVDD-supply = <&vcca_codec>; + clocks = <&cru SCLK_I2S0_OUT>; + clock-names = "i2s_clk_out"; + }; +}; + &i2c5 { status = "okay"; }; +&i2s { + status = "okay"; +}; + &pinctrl { ir { ir_int: ir-int {
@@ -190,6 +220,13 @@ }; }; + sound { + headphone: headphone { + rockchip,pins = <8 0 RK_FUNC_GPIO &pcfg_pull_up>, + <7 7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + usb { host_vbus_drv: host-vbus-drv { rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
Signature · 1 line
2.9.3
Re: [alsa-devel] [PATCH v2 3/4] ASoC: rockchip: Add machine driver for ES8388 codecs
In reply to a message not in the archiveTwo nits, see below.
<snip>
sound/soc/rockchip/rockchip_es8388.c line 186
Quoted 10 lines
sound/soc/rockchip/rockchip_es8388.c new file +10
-0+static int snd_rk_mc_probe (struct platform_device *pdev) +{ +int ret =0 ; +struct snd_soc_card *card = &snd_soc_card_rk; +struct device_node *np = pdev->dev.of_node; +struct rk_es8388_drvdata *machine; + + machine =devm_kzalloc (&pdev->dev,sizeof (struct rk_es8388_drvdata ), +GFP_KERNEL ); +
You don't need this new line here.
Quoted 3 lines
sound/soc/rockchip/rockchip_es8388.c new file +3
-0+if (!machine) +return -ENOMEM ; +
<snip>
sound/soc/rockchip/rockchip_es8388.c line 267
Quoted 3 lines
sound/soc/rockchip/rockchip_es8388.c new file +3
-0+module_platform_driver (snd_rk_es8388_driver); + +MODULE_AUTHOR ("Sjoerd Simons" );
You should also add your email address near name.
sound/soc/rockchip/rockchip_es8388.c line 270
Quoted 3 lines
sound/soc/rockchip/rockchip_es8388.c new file +3
-0+MODULE_DESCRIPTION ("Rockchip es8388 machine ASoC driver" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_ALIAS ("platform:" DRV_NAME );
thanks,
Daniel.
--
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: [alsa-devel] [PATCH v2 3/4] ASoC: rockchip: Add machine driver for ES8388 codecs
In reply to a message not in the archiveHi Daniel,
Quoted 1 line · Daniel Baluta
Two nits, see below.
All fixed,
Thanks,
Romain
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Applied "ASoC: es8328-i2c: Add compatible for ES8388" to the asoc tree
In reply to a message not in the archiveThe patch
ASoC: es8328-i2c: Add compatible for ES8388
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
5f166156dbd4c0cf85632799ee7330d24deeec4eMon Sep 17 00:00:00 2001
From: Romain Perier <romain.perier-ZGY8ohtN/[email protected]>
Date: Mon, 23 Jan 2017 11:41:46 +0100
Subject: [PATCH] ASoC: es8328-i2c: Add compatible for ES8388
This commit adds a compatible string for everest,es8388. This is an audio codec that is compatible with es8328.
--- Documentation/devicetree/bindings/sound/es8328.txt | 2 +- sound/soc/codecs/es8328-i2c.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/es8328.txt +1 -1
@@ -4,7 +4,7 @@ This device supports both I2C and SPI. Required properties: - - compatible : "everest,es8328" + - compatible : Should be "everest,es8328" or "everest,es8388" - DVDD-supply : Regulator providing digital core supply voltage 1.8 - 3.6V - AVDD-supply : Regulator providing analog supply voltage 3.3V - PVDD-supply : Regulator providing digital IO supply voltage 1.8 - 3.6V
sound/soc/codecs/es8328-i2c.c +2 -0
@@ -20,12 +20,14 @@static const struct i2c_device_id es8328_id[] = { {"es8328" ,0 }, + {"es8388" ,0 }, { } };MODULE_DEVICE_TABLE (i2c, es8328_id);static const struct of_device_id es8328_of_match[] = { { .compatible ="everest,es8328" , }, + { .compatible ="everest,es8388" , }, { } };MODULE_DEVICE_TABLE (of, es8328_of_match);
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