Skip to contentSkip to conversation

ASoC: add es7241 support

PATCH Superseded Jerome Brunet 2 participants 4 messages Jun 29, 2018 – Jun 30, 2018

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover ASoC: add es7241 support

Add support for the es7241 which is a simple 2 channels analog to digital converter.

Jerome Brunet (2):
ASoC: es7241: add dt-bindings documentation for the es7241 adc
ASoC: es7241: add es7241 codec support

 .../devicetree/bindings/sound/everest,es7241.txt   |  23 ++
 sound/soc/codecs/Kconfig                           |   4 +
 sound/soc/codecs/Makefile                          |   2 +
 sound/soc/codecs/es7241.c                          | 307 +++++++++++++++++++++
 4 files changed, 336 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/everest,es7241.txt
 create mode 100644 sound/soc/codecs/es7241.c
Signature · 1 line
2.14.4
#1 lore raw

PATCH 1/2 ASoC: es7241: add dt-bindings documentation for the es7241 adc

---
 .../devicetree/bindings/sound/everest,es7241.txt   | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/everest,es7241.txt
Documentation/devicetree/bindings/sound/everest,es7241.txt new file +23 -0
new file mode 100644
index 000000000000..adee52281b3c
@@ -0,0 +1,23 @@
+ES7134 i2s DA converter
+
+Required properties:
+- compatible : "everest,es7241"
+
+Optional properties:
+- VDDP-supply: regulator phandle for the VDDA supply
+- VDDA-supply: regulator phandle for the VDDP supply
+- VDDD-supply: regulator phandle for the VDDD supply
+- reset-gpios: gpio connected to the reset pin
+- m0-gpios   : gpio connected to the m0 pin
+- m1-gpios   : gpio connected to the m1 pin
+
+Example:
+
+linein: audio-codec@2 {
+	#sound-dai-cells = <0>;
+	compatible = "everest,es7241";
+	VDDA-supply = <&vcc_3v3>;
+	VDDP-supply = <&vcc_3v3>;
+	VDDD-supply = <&vcc_3v3>;
+	reset-gpios = <&gpio GPIOH_42>;
+};
Signature · 1 line
2.14.4
#2 lore raw

PATCH 2/2 ASoC: es7241: add es7241 codec support

In reply to Jerome Brunet

Add support for the everest es7241 which is a simple 2 channels analog to digital converter.

---
 sound/soc/codecs/Kconfig  |   4 +
 sound/soc/codecs/Makefile |   2 +
 sound/soc/codecs/es7241.c | 307 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 313 insertions(+)
 create mode 100644 sound/soc/codecs/es7241.c
sound/soc/codecs/Kconfig +4 -0
index f5839eeeed5e..047ac28ba40f 100644
@@ -79,6 +79,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_ES8328_SPI if SPI_MASTER
 	select SND_SOC_ES8328_I2C if I2C
 	select SND_SOC_ES7134
+	select SND_SOC_ES7241
 	select SND_SOC_GTM601
 	select SND_SOC_HDAC_HDMI
 	select SND_SOC_ICS43432
@@ -584,6 +585,9 @@ config SND_SOC_HDMI_CODEC
 config SND_SOC_ES7134
        tristate "Everest Semi ES7134 CODEC"
 
+config SND_SOC_ES7241
+       tristate "Everest Semi ES7241 CODEC"
+
 config SND_SOC_ES8316
 	tristate "Everest Semi ES8316 CODEC"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index 6cc15d1c5767..719653a4c882 100644
@@ -71,6 +71,7 @@ snd-soc-da732x-objs := da732x.o
 snd-soc-da9055-objs := da9055.o
 snd-soc-dmic-objs := dmic.o
 snd-soc-es7134-objs := es7134.o
+snd-soc-es7241-objs := es7241.o
 snd-soc-es8316-objs := es8316.o
 snd-soc-es8328-objs := es8328.o
 snd-soc-es8328-i2c-objs := es8328-i2c.o
@@ -329,6 +330,7 @@ obj-$(CONFIG_SND_SOC_DA732X)	+= snd-soc-da732x.o
 obj-$(CONFIG_SND_SOC_DA9055)	+= snd-soc-da9055.o
 obj-$(CONFIG_SND_SOC_DMIC)	+= snd-soc-dmic.o
 obj-$(CONFIG_SND_SOC_ES7134)	+= snd-soc-es7134.o
+obj-$(CONFIG_SND_SOC_ES7241)	+= snd-soc-es7241.o
 obj-$(CONFIG_SND_SOC_ES8316)    += snd-soc-es8316.o
 obj-$(CONFIG_SND_SOC_ES8328)	+= snd-soc-es8328.o
 obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
sound/soc/codecs/es7241.c new file +307 -0

307 lines not on this page · raw message

Signature · 1 line
2.14.4
#3 lore raw

Re: [PATCH 2/2] ASoC: es7241: add es7241 codec support

Hi Jerome,

I love your patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on v4.18-rc2 next-20180629]
[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/Jerome-Brunet/ASoC-add-es7241-support/20180630-021159
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

smatch warnings:
sound/soc/codecs/es7241.c:147 es7241_set_fmt() warn: missing break? reassigning 'priv->is_slave'

# https://github.com/0day-ci/linux/commit/d494a70ae50e5f95d2ab09bcaf3065b4359bde0e
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d494a70ae50e5f95d2ab09bcaf3065b4359bde0e
vim +147 sound/soc/codecs/es7241.c

d494a70a Jerome Brunet 2018-06-29  123  
d494a70a Jerome Brunet 2018-06-29  124  static int es7241_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
d494a70a Jerome Brunet 2018-06-29  125  {
d494a70a Jerome Brunet 2018-06-29  126  	struct es7241_data *priv = snd_soc_dai_get_drvdata(dai);
d494a70a Jerome Brunet 2018-06-29  127  
d494a70a Jerome Brunet 2018-06-29  128  	if ((fmt & SND_SOC_DAIFMT_INV_MASK) != SND_SOC_DAIFMT_NB_NF) {
d494a70a Jerome Brunet 2018-06-29  129  		dev_err(dai->dev, "Unsupported dai clock inversion\n");
d494a70a Jerome Brunet 2018-06-29  130  		return -EINVAL;
d494a70a Jerome Brunet 2018-06-29  131  	}
d494a70a Jerome Brunet 2018-06-29  132  
d494a70a Jerome Brunet 2018-06-29  133  	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
d494a70a Jerome Brunet 2018-06-29  134  	case SND_SOC_DAIFMT_I2S:
d494a70a Jerome Brunet 2018-06-29  135  	case SND_SOC_DAIFMT_LEFT_J:
d494a70a Jerome Brunet 2018-06-29  136  		break;
d494a70a Jerome Brunet 2018-06-29  137  
d494a70a Jerome Brunet 2018-06-29  138  	default:
d494a70a Jerome Brunet 2018-06-29  139  		dev_err(dai->dev, "Unsupported dai format\n");
d494a70a Jerome Brunet 2018-06-29  140  		return -EINVAL;
d494a70a Jerome Brunet 2018-06-29  141  	}
d494a70a Jerome Brunet 2018-06-29  142  
d494a70a Jerome Brunet 2018-06-29  143  	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
d494a70a Jerome Brunet 2018-06-29  144  	case SND_SOC_DAIFMT_CBS_CFS:
d494a70a Jerome Brunet 2018-06-29  145  		priv->is_slave = true;
d494a70a Jerome Brunet 2018-06-29  146  	case SND_SOC_DAIFMT_CBM_CFM:
d494a70a Jerome Brunet 2018-06-29 @147  		priv->is_slave = false;
d494a70a Jerome Brunet 2018-06-29  148  		break;
d494a70a Jerome Brunet 2018-06-29  149  
d494a70a Jerome Brunet 2018-06-29  150  	default:
d494a70a Jerome Brunet 2018-06-29  151  		dev_err(dai->dev, "Unsupported clock configuration\n");
d494a70a Jerome Brunet 2018-06-29  152  		return -EINVAL;
d494a70a Jerome Brunet 2018-06-29  153  	}
d494a70a Jerome Brunet 2018-06-29  154  
d494a70a Jerome Brunet 2018-06-29  155  	return 0;
d494a70a Jerome Brunet 2018-06-29  156  }
d494a70a Jerome Brunet 2018-06-29  157