ASoC: codecs: Add PCM186x binding documentation
PATCH 1/2 ASoC: codecs: Add PCM186x binding documentation
Add the dt-binding documentation for the TI PCM186x 2ch and 4ch Audio ADCs With Universal Front End.
--- .../devicetree/bindings/sound/pcm186x.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/pcm186x.txt
Documentation/devicetree/bindings/sound/pcm186x.txt new file +42 -0
@@ -0,0 +1,42 @@ +Texas Instruments PCM186x Universal Audio ADC + +These devices support both I2C and SPI (configured with pin strapping +on the board). + +Required properties: + + - compatible : "ti,pcm1862", + "ti,pcm1863", + "ti,pcm1864", + "ti,pcm1865" + + - reg : The I2C address of the device for I2C, the chip select + number for SPI. + + - avdd-supply: Analog core power supply (3.3v) + - dvdd-supply: Digital core power supply + - iovdd-supply: Digital IO power supply + See regulator/regulator.txt for more information + +CODEC input pins: + * VINL1 + * VINR1 + * VINL2 + * VINR2 + * VINL3 + * VINR3 + * VINL4 + * VINR4 + +The pins can be used in referring sound node's audio-routing property. + +Example: + + pcm186x: pcm186x@4a { + compatible = "ti,pcm1865"; + reg = <0x4a>; + + avdd-supply = <®_3v3_analog>; + dvdd-supply = <®_3v3>; + iovdd-supply = <®_1v8>; + };
Signature · 1 line
2.15.0
PATCH 2/2 ASoC: codecs: Add initial PCM1862/63/64/65 universal ADC driver
From: Andreas Dannenberg <[email protected]>
This is an initial version of the PCM186x codec driver supporting both 2-channel and 4-channel device variants. Not all device features are supported yet such as master/slave mode PLL configuration for which the codec driver currently relies on the PCM186x built-in clock auto-detection feature or the connection of digital microphones. However here is what's here and what should work:
- Support for SPI and I2C low-level interfaces
- Regmap support and basic register definitions
- Input Mixer and Mux selection
- I2C, LJ, and TDM DAI format support
--- sound/soc/codecs/Kconfig | 17 + sound/soc/codecs/Makefile | 6 + sound/soc/codecs/pcm186x-i2c.c | 79 +++++ sound/soc/codecs/pcm186x-spi.c | 79 +++++ sound/soc/codecs/pcm186x.c | 778 +++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/pcm186x.h | 271 ++++++++++++++ 6 files changed, 1230 insertions(+) create mode 100644 sound/soc/codecs/pcm186x-i2c.c create mode 100644 sound/soc/codecs/pcm186x-spi.c create mode 100644 sound/soc/codecs/pcm186x.c create mode 100644 sound/soc/codecs/pcm186x.h
sound/soc/codecs/Kconfig +17 -0
@@ -109,6 +109,8 @@ config SND_SOC_ALL_CODECS select SND_SOC_PCM1681 if I2C select SND_SOC_PCM179X_I2C if I2C select SND_SOC_PCM179X_SPI if SPI_MASTER + select SND_SOC_PCM186X_I2C if I2C + select SND_SOC_PCM186X_SPI if SPI_MASTER select SND_SOC_PCM3008 select SND_SOC_PCM3168A_I2C if I2C select SND_SOC_PCM3168A_SPI if SPI_MASTER
@@ -661,6 +663,21 @@ config SND_SOC_PCM179X_SPI Enable support for Texas Instruments PCM179x CODEC. Select this if your PCM179x is connected via an SPI bus. +config SND_SOC_PCM186X + tristate + +config SND_SOC_PCM186X_I2C + tristate "Texas Instruments PCM186x CODECs - I2C" + depends on I2C + select SND_SOC_PCM186X + select REGMAP_I2C + +config SND_SOC_PCM186X_SPI + tristate "Texas Instruments PCM186x CODECs - SPI" + depends on SPI_MASTER + select SND_SOC_PCM186X + select REGMAP_SPI + config SND_SOC_PCM3008 tristate
sound/soc/codecs/Makefile +6 -0
@@ -105,6 +105,9 @@ snd-soc-pcm1681-objs := pcm1681.o snd-soc-pcm179x-codec-objs := pcm179x.o snd-soc-pcm179x-i2c-objs := pcm179x-i2c.o snd-soc-pcm179x-spi-objs := pcm179x-spi.o +snd-soc-pcm186x-objs := pcm186x.o +snd-soc-pcm186x-i2c-objs := pcm186x-i2c.o +snd-soc-pcm186x-spi-objs := pcm186x-spi.o snd-soc-pcm3008-objs := pcm3008.o snd-soc-pcm3168a-objs := pcm3168a.o snd-soc-pcm3168a-i2c-objs := pcm3168a-i2c.o
@@ -345,6 +348,9 @@ obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o obj-$(CONFIG_SND_SOC_PCM179X) += snd-soc-pcm179x-codec.o obj-$(CONFIG_SND_SOC_PCM179X_I2C) += snd-soc-pcm179x-i2c.o obj-$(CONFIG_SND_SOC_PCM179X_SPI) += snd-soc-pcm179x-spi.o +obj-$(CONFIG_SND_SOC_PCM186X) += snd-soc-pcm186x.o +obj-$(CONFIG_SND_SOC_PCM186X_I2C) += snd-soc-pcm186x-i2c.o +obj-$(CONFIG_SND_SOC_PCM186X_SPI) += snd-soc-pcm186x-spi.o obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o obj-$(CONFIG_SND_SOC_PCM3168A) += snd-soc-pcm3168a.o obj-$(CONFIG_SND_SOC_PCM3168A_I2C) += snd-soc-pcm3168a-i2c.o
sound/soc/codecs/pcm186x-i2c.c new file +79 -0
79 lines not on this page · raw message
sound/soc/codecs/pcm186x-spi.c new file +79 -0
79 lines not on this page · raw message
sound/soc/codecs/pcm186x.c new file +778 -0
778 lines not on this page · raw message
sound/soc/codecs/pcm186x.h new file +271 -0
271 lines not on this page · raw message
Signature · 1 line
2.15.0
Mark Brown
maintainerRe: [PATCH 2/2] ASoC: codecs: Add initial PCM1862/63/64/65 universal ADC driver
On Fri, Nov 10, 2017 at 01:57:11PM -0600, Andrew F. Davis wrote:
This looks mostly good, a few small issues though:
sound/soc/codecs/pcm186x-i2c.c line 40
Quoted 1 line
sound/soc/codecs/pcm186x-i2c.c new file +1
-0+dev_info (&i2c->dev,"%s() i2c->addr=%d\n" , __func__, i2c->addr);
No need for this as standard, we already have I2C level logging facilities if they're really needed. It's OK to do things like log chip revisions read back from hardware but this is pure software.
sound/soc/codecs/pcm186x.c line 56
Quoted 2 lines
sound/soc/codecs/pcm186x.c new file +2
-0+static const struct snd_kcontrol_new pcm1863_snd_controls[] = { + SOC_DOUBLE_R_S_TLV("Analog Gain", PCM186X_PGA_VAL_CH1_L,
Volume controls should end in Volume to tell userspace how to handle them, see ControlNames.txt.
sound/soc/codecs/pcm186x.c line 682
Quoted 13 lines
sound/soc/codecs/pcm186x.c new file +13
-0+ ret =devm_regulator_bulk_get (dev,ARRAY_SIZE (priv->supplies), + priv->supplies); +if (ret !=0 ) { +dev_err (dev,"failed to request supplies: %d\n" , ret); +return ret; + } + +/* Reset device registers for a consistent power-on like state */ + ret =regmap_write (regmap,PCM186X_PAGE ,PCM186X_RESET ); +if (ret !=0 ) { +dev_err (dev,"failed to write device: %d\n" , ret); +return ret; + }
We didn't enable the supplies for the device before we reset it, if the device was powered off then the write will hopefully not work and we'll get a spurious error here. The driver should bounce the supplies on at least long enough to do the reset, it's not ideal but it's robust.
Quoted 40 lines · Andrew F. Davis
Add the dt-binding documentation for the TI PCM186x 2ch and 4ch Audio ADCs With Universal Front End.
Signed-off-by Andrew F. Davis <[email protected]>--- .../devicetree/bindings/sound/pcm186x.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/pcm186x.txtDocumentation/devicetree/bindings/sound/pcm186x.txt new file +25
-0@@ -0,0 +1,42 @@ +Texas Instruments PCM186x Universal Audio ADC + +These devices support both I2C and SPI (configured with pin strapping +on the board). + +Required properties: + + - compatible : "ti,pcm1862", + "ti,pcm1863", + "ti,pcm1864", + "ti,pcm1865" + + - reg : The I2C address of the device for I2C, the chip select + number for SPI. + + - avdd-supply: Analog core power supply (3.3v) + - dvdd-supply: Digital core power supply + - iovdd-supply: Digital IO power supply + See regulator/regulator.txt for more information + +CODEC input pins: + * VINL1 + * VINR1 + * VINL2 + * VINR2
Documentation/devicetree/bindings/sound/pcm186x.txt line 35
Quoted 10 lines
Documentation/devicetree/bindings/sound/pcm186x.txt new file +10
-0+ * VINL3 + * VINR3 + * VINL4 + * VINR4 + +The pins can be used in referring sound node's audio-routing property. + +Example: + + pcm186x: pcm186x@4a {
audio-codec@4a
With that,
Quoted 10 lines
Documentation/devicetree/bindings/sound/pcm186x.txt new file +7
-0+ compatible = "ti,pcm1865"; + reg = <0x4a>; + + avdd-supply = <®_3v3_analog>; + dvdd-supply = <®_3v3>; + iovdd-supply = <®_1v8>; + };Signature · 1 line
2.15.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