ASoC: Add support for DAC PCM1789
v3 cover ASoC: Add support for DAC PCM1789
Hello everyone,
The current series is the 3rd version to add the support of Texas Instrument's DAC PCM1789. This DAC is very minimalist and does not have many registers.
It is important to notice that this DAC needs to always have clocks enabled (even without any data) otherwise it will be in a "desynchronized" state and can not send data correctly.
This issue has been solved by performing a reset each time a sound is played. This reset can produce a "pop" noise.
Depending on your DAI, you will need to provide and enable the MCLK to be able to communicate with this codec throught i2c.
Changes since v2:
- Update SPDX headers according to Mark Brown's review.
- Update the dt bindings according to Rob Herring's review.
Changes since v1:
- Create a new file to support pcm1789 instead of converting the existing pcm179x driver. All the patches are merged into one patch.
- Update the code to use gpiod for the reset.
- Add some fixes according to Thomas Petazzoni's reviews
- Create a new patch to add device-tree bindings for this new DAC.
Thank you in advance for any review.
Best regards,
Mylène
Mylène Josserand (2):
ASoC: codecs: Add support for PCM1789
ASoC: Add bindings for PCM1789
.../devicetree/bindings/sound/pcm1789.txt | 22 ++ sound/soc/codecs/Kconfig | 12 + sound/soc/codecs/Makefile | 4 + sound/soc/codecs/pcm1789-i2c.c | 62 +++++ sound/soc/codecs/pcm1789.c | 274 +++++++++++++++++++++ sound/soc/codecs/pcm1789.h | 17 ++ 6 files changed, 391 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/pcm1789.txt create mode 100644 sound/soc/codecs/pcm1789-i2c.c create mode 100644 sound/soc/codecs/pcm1789.c create mode 100644 sound/soc/codecs/pcm1789.h
Signature · 6 lines
2.11.0 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH v3 1/2 ASoC: codecs: Add support for PCM1789
Add Texas Instruments's PCM1789 DAC support. It is a simple DAC and does not have many registers.
One particularity about this DAC is that the clocks must be always enabled. Also, an entire software reset is necessary while starting to play a sound otherwise, the clocks are not synchronized (so the DAC is not able to send data).
--- sound/soc/codecs/Kconfig | 12 ++ sound/soc/codecs/Makefile | 4 + sound/soc/codecs/pcm1789-i2c.c | 62 ++++++++++ sound/soc/codecs/pcm1789.c | 274 +++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/pcm1789.h | 17 +++ 5 files changed, 369 insertions(+) create mode 100644 sound/soc/codecs/pcm1789-i2c.c create mode 100644 sound/soc/codecs/pcm1789.c create mode 100644 sound/soc/codecs/pcm1789.h
sound/soc/codecs/Kconfig +12 -0
@@ -112,6 +112,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_NAU8825 if I2C select SND_SOC_HDMI_CODEC select SND_SOC_PCM1681 if I2C + select SND_SOC_PCM1789_I2C if I2C select SND_SOC_PCM179X_I2C if I2C select SND_SOC_PCM179X_SPI if SPI_MASTER select SND_SOC_PCM186X_I2C if I2C
@@ -676,6 +677,17 @@ config SND_SOC_PCM1681 tristate "Texas Instruments PCM1681 CODEC" depends on I2C +config SND_SOC_PCM1789 + tristate + +config SND_SOC_PCM1789_I2C + tristate "Texas Instruments PCM1789 CODEC (I2C)" + depends on I2C + select SND_SOC_PCM1789 + help + Enable support for Texas Instruments PCM1789 CODEC. + Select this if your PCM1789 is connected via an I2C bus. + config SND_SOC_PCM179X tristate
sound/soc/codecs/Makefile +4 -0
@@ -108,6 +108,8 @@ snd-soc-nau8824-objs := nau8824.o snd-soc-nau8825-objs := nau8825.o snd-soc-hdmi-codec-objs := hdmi-codec.o snd-soc-pcm1681-objs := pcm1681.o +snd-soc-pcm1789-codec-objs := pcm1789.o +snd-soc-pcm1789-i2c-objs := pcm1789-i2c.o snd-soc-pcm179x-codec-objs := pcm179x.o snd-soc-pcm179x-i2c-objs := pcm179x-i2c.o snd-soc-pcm179x-spi-objs := pcm179x-spi.o
@@ -359,6 +361,8 @@ obj-$(CONFIG_SND_SOC_NAU8825) += snd-soc-nau8825.o obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o obj-$(CONFIG_SND_SOC_PCM179X) += snd-soc-pcm179x-codec.o +obj-$(CONFIG_SND_SOC_PCM1789_I2C) += snd-soc-pcm1789-i2c.o +obj-$(CONFIG_SND_SOC_PCM1789) += snd-soc-pcm1789-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
sound/soc/codecs/pcm1789-i2c.c new file +62 -0
62 lines not on this page · raw message
sound/soc/codecs/pcm1789.c new file +274 -0
274 lines not on this page · raw message
sound/soc/codecs/pcm1789.h new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 +// Definitions for PCM1789 audio driver +// Copyright (C) 2018 Bootlin +// Mylène Josserand <[email protected]> + +#ifndef __PCM1789_H__ +#define __PCM1789_H__ + +#define PCM1789_FORMATS (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE | \ + SNDRV_PCM_FMTBIT_S16_LE) + +extern const struct regmap_config pcm1789_regmap_config; + +int pcm1789_common_init (struct device *dev,struct regmap *regmap); +int pcm1789_common_exit (struct device *dev); + +#endif
Signature · 6 lines
2.11.0 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
kbuild test robot
build botRe: [PATCH v3 1/2] ASoC: codecs: Add support for PCM1789
Thank you for the patch! Perhaps something to improve:
Hi Mylène,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on v4.16-rc4]
[also build test WARNING on next-20180316]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
coccinelle warnings: (new ones prefixed by >>)
>> sound/soc/codecs/pcm1789.c:265:1-3: ERROR: test of a variable/field address
vim +265 sound/soc/codecs/pcm1789.c
260
261 int pcm1789_common_exit(struct device *dev)
262 {
263 struct pcm1789_private *priv = dev_get_drvdata(dev);
264
> 265 if (&priv->work)
266 flush_work(&priv->work);
267
268 return 0;
269 }
270 EXPORT_SYMBOL_GPL(pcm1789_common_exit);
271
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Mark Brown
maintainerRe: [PATCH v3 1/2] ASoC: codecs: Add support for PCM1789
Quoted 4 lines · kbuild test robot
Quoted 3 lines
Quoted 1 line
sound/soc/codecs/pcm1789.c:265:1-3: ERROR: test of a variable/field address
265 if (
&priv->work)266
flush_work(&priv->work);
This is a legit warning but otherwise this looks good so I'll apply, please send a followup patch fixing this.
PATCH v3 2/2 ASoC: Add bindings for PCM1789
In reply to Mylène JosserandAdd a device-tree binding for Texas Instrument's PCM1789 codec. For the moment, only I2C bus is supported but SPI could be added in future.
--- .../devicetree/bindings/sound/pcm1789.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/pcm1789.txt
Documentation/devicetree/bindings/sound/pcm1789.txt new file +22 -0
@@ -0,0 +1,22 @@ +Texas Instruments pcm1789 DT bindings + +PCM1789 is a simple audio codec that can be connected via +I2C or SPI. Currently, only I2C bus is supported. + +Required properties: + + - compatible: "ti,pcm1789" + +Required properties on I2C: + + - reg: the I2C address + - reset-gpios: GPIO to control the RESET pin + +Examples: + + audio-codec@4c { + compatible = "ti,pcm1789"; + reg = <0x4c>; + reset-gpios = <&gpio2 14 GPIO_ACTIVE_LOW>; + #sound-dai-cells = <0>; + };
Signature · 1 line
2.11.0
Re: [PATCH v3 2/2] ASoC: Add bindings for PCM1789
Quoted 9 lines · Mylène Josserand
Add a device-tree binding for Texas Instrument's PCM1789 codec. For the moment, only I2C bus is supported but SPI could be added in future.
Signed-off-by Mylène Josserand <[email protected]>--- .../devicetree/bindings/sound/pcm1789.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/pcm1789.txt