ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier
Subsystems (4)
PATCH 1/1 ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier
Analog Devices SSM4567 is a boost class-D audio amplifier.
--- .../devicetree/bindings/sound/ssm4567.txt | 15 + sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/ssm4567.c | 350 +++++++++++++++++++++ 4 files changed, 371 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/ssm4567.txt create mode 100644 sound/soc/codecs/ssm4567.c
Documentation/devicetree/bindings/sound/ssm4567.txt new file +15 -0
@@ -0,0 +1,15 @@ +Analog Devices SSM4567 audio amplifier + +This device supports I2C only. + +Required properties: + - compatible : Must be "adi,ssm4567" + - reg : the I2C address of the device. This will either be 0x34 (LR_SEL/ADDR connected to AGND), + 0x35 (LR_SEL/ADDR connected to IOVDD) or 0x36 (LR_SEL/ADDR open). + +Example: + + ssm4567: ssm4567@34 { + compatible = "adi,ssm4567"; + reg = <0x34>; + };
sound/soc/codecs/Kconfig +4 -0
@@ -94,6 +94,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_SSM2518 if I2C select SND_SOC_SSM2602_SPI if SPI_MASTER select SND_SOC_SSM2602_I2C if I2C + select SND_SOC_SSM4567 if I2C select SND_SOC_STA32X if I2C select SND_SOC_STA350 if I2C select SND_SOC_STA529 if I2C
@@ -546,6 +547,9 @@ config SND_SOC_SSM2602_I2C select SND_SOC_SSM2602 tristate +config SND_SOC_SSM4567 + tristate "Analog Devices ssm4567 amplifier driver support" + config SND_SOC_STA32X tristate
sound/soc/codecs/Makefile +2 -0
@@ -95,6 +95,7 @@ snd-soc-ssm2518-objs := ssm2518.o snd-soc-ssm2602-objs := ssm2602.o snd-soc-ssm2602-spi-objs := ssm2602-spi.o snd-soc-ssm2602-i2c-objs := ssm2602-i2c.o +snd-soc-ssm4567-objs := ssm4567.o snd-soc-sta32x-objs := sta32x.o snd-soc-sta350-objs := sta350.o snd-soc-sta529-objs := sta529.o
@@ -266,6 +267,7 @@ obj-$(CONFIG_SND_SOC_SSM2518) += snd-soc-ssm2518.o obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o obj-$(CONFIG_SND_SOC_SSM2602_SPI) += snd-soc-ssm2602-spi.o obj-$(CONFIG_SND_SOC_SSM2602_I2C) += snd-soc-ssm2602-i2c.o +obj-$(CONFIG_SND_SOC_SSM4567) += snd-soc-ssm4567.o obj-$(CONFIG_SND_SOC_STA32X) += snd-soc-sta32x.o obj-$(CONFIG_SND_SOC_STA350) += snd-soc-sta350.o obj-$(CONFIG_SND_SOC_STA529) += snd-soc-sta529.o
sound/soc/codecs/ssm4567.c new file +350 -0
350 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
Lars-Peter Clausen
maintainerQuoted 3 lines · Anatol Pomozov
Analog Devices SSM4567 is a boost class-D audio amplifier.
Signed-off-by Anatol Pomozov <[email protected]>
Looks mostly okay. I also have a driver for this chip which is getting ready for upstream. It is a bit more complete feature wise, but I can rebase it ontop of your driver.
https://github.com/analogdevicesinc/linux/blob/asoc-ssm4329/sound/soc/codecs/ssm4567.c
[...]
Quoted 5 lines
sound/soc/codecs/Kconfig +0
-0@@ -94,6 +94,7 @@ config SND_SOC_ALL_CODECS
[...]
sound/soc/codecs/Kconfig config SND_SOC_SSM2602_I2C · line 551
Quoted 2 lines
sound/soc/codecs/Kconfig +2
-0+config SND_SOC_SSM4567 + tristate "Analog Devices ssm4567 amplifier driver support"
depends on I2C
Quoted 9 lines
sound/soc/codecs/Kconfig +1
-0+ config SND_SOC_STA32X tristatesound/soc/codecs/ssm4567.c new file +0
-0
[...]
sound/soc/codecs/ssm4567.c line 19
Quoted 2 lines
sound/soc/codecs/ssm4567.c new file +2
-0+#include <linux/gpio.h> +#include <linux/of_gpio.h>
No gpios in this driver
[...]
Quoted 2 lines
sound/soc/codecs/ssm4567.c new file +2
-0+ +static const struct snd_kcontrol_new ssm4567_snd_controls[] = {
[...]
sound/soc/codecs/ssm4567.c line 149
Quoted 1 line
sound/soc/codecs/ssm4567.c new file +1
-0+ SOC_SINGLE("Master Playback Switch", SSM4567_REG_DAC_CTRL, 6, 1, 1),
This one and ...
[...]
Quoted 2 lines
sound/soc/codecs/ssm4567.c new file +2
-0+}; +
[...]
sound/soc/codecs/ssm4567.c line 197
Quoted 8 lines
sound/soc/codecs/ssm4567.c new file +8
-0+static int ssm4567_mute (struct snd_soc_dai *dai,int mute) +{ +struct ssm4567 *ssm4567 =snd_soc_codec_get_drvdata (dai->codec); +unsigned int val; + + val = mute ?SSM4567_DAC_MUTE :0 ; +return regmap_update_bits (ssm4567->regmap,SSM4567_REG_DAC_CTRL , +SSM4567_DAC_MUTE , val);
... this one control the same bit, so there will be conflicts.
Quoted 2 lines
sound/soc/codecs/ssm4567.c new file +2
-0+} +
Hi
Quoted 9 lines · Lars-Peter Clausen
Quoted 4 lines · Anatol Pomozov
Analog Devices SSM4567 is a boost class-D audio amplifier.
Signed-off-by Anatol Pomozov <[email protected]>Looks mostly okay. I also have a driver for this chip which is getting ready for upstream. It is a bit more complete feature wise,
D'oh I wish I knew it before start working on the driver.
Quoted 1 line
but I can rebase it ontop of your driver.
Thanks!
Quoted 70 lines
https://github.com/analogdevicesinc/linux/blob/asoc-ssm4329/sound/soc/codecs/ssm4567.c
[...]
Quoted 6 lines
sound/soc/codecs/Kconfig +0
-0@@ -94,6 +94,7 @@ config SND_SOC_ALL_CODECS[...]
sound/soc/codecs/Kconfig config SND_SOC_SSM2602_I2C · line 551
Quoted 3 lines
sound/soc/codecs/Kconfig +2
-0+config SND_SOC_SSM4567 + tristate "Analog Devices ssm4567 amplifier driver support"depends on I2C
Quoted 9 lines
sound/soc/codecs/Kconfig +1
-0+ config SND_SOC_STA32X tristatesound/soc/codecs/ssm4567.c new file +0
-0[...]
sound/soc/codecs/ssm4567.c line 19
Quoted 3 lines
sound/soc/codecs/ssm4567.c new file +2
-0+#include <linux/gpio.h> +#include <linux/of_gpio.h> No gpios in this driver
[...]
Quoted 3 lines
sound/soc/codecs/ssm4567.c new file +2
-0+ +static const struct snd_kcontrol_new ssm4567_snd_controls[] = {[...]
Quoted 3 lines
+ SOC_SINGLE("Master Playback Switch",
SSM4567_REG_DAC_CTRL, 6, 1,
1),This one and ...
[...]
Quoted 3 lines
sound/soc/codecs/ssm4567.c new file +2
-0+}; +[...]
sound/soc/codecs/ssm4567.c line 197
Quoted 9 lines
sound/soc/codecs/ssm4567.c new file +8
-0+static int ssm4567_mute (struct snd_soc_dai *dai,int mute) +{ +struct ssm4567 *ssm4567 =snd_soc_codec_get_drvdata (dai->codec); +unsigned int val; + + val = mute ?SSM4567_DAC_MUTE :0 ; +return regmap_update_bits (ssm4567->regmap,SSM4567_REG_DAC_CTRL , +SSM4567_DAC_MUTE , val);... this one control the same bit, so there will be conflicts.
Quoted 2 lines
sound/soc/codecs/ssm4567.c
Quoted 2 lines
sound/soc/codecs/ssm4567.c new file +2
-0+} +
I've fixed the items you mentioned.
One difference I spotted between your and mine patches is that you don't call regcache_cache_only(regmap) before powering down the device. Is it because I2C alive in power down mode? I guess I need to remove regcache_cache_only() then.
Lars-Peter Clausen
maintainerQuoted 7 lines · Anatol Pomozov
I've fixed the items you mentioned.
One difference I spotted between your and mine patches is that you don't call
regcache_cache_only(regmap)before powering down the device. Is it because I2C alive in power down mode? I guess I need to removeregcache_cache_only()then.
Yes, the interface should be alive, unless of course you disable the regulator. But having the regcache_cache_only() should not hurt, except that we need to resync the registers on power on, which can cause small additional delays.
- Lars
PATCH 1/1 ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier
In reply to Anatol PomozovAnalog Devices SSM4567 is a boost class-D audio amplifier.
--- .../devicetree/bindings/sound/ssm4567.txt | 15 + sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/ssm4567.c | 345 +++++++++++++++++++++ 4 files changed, 367 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/ssm4567.txt create mode 100644 sound/soc/codecs/ssm4567.c
Documentation/devicetree/bindings/sound/ssm4567.txt new file +15 -0
@@ -0,0 +1,15 @@ +Analog Devices SSM4567 audio amplifier + +This device supports I2C only. + +Required properties: + - compatible : Must be "adi,ssm4567" + - reg : the I2C address of the device. This will either be 0x34 (LR_SEL/ADDR connected to AGND), + 0x35 (LR_SEL/ADDR connected to IOVDD) or 0x36 (LR_SEL/ADDR open). + +Example: + + ssm4567: ssm4567@34 { + compatible = "adi,ssm4567"; + reg = <0x34>; + };
sound/soc/codecs/Kconfig +5 -0
@@ -94,6 +94,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_SSM2518 if I2C select SND_SOC_SSM2602_SPI if SPI_MASTER select SND_SOC_SSM2602_I2C if I2C + select SND_SOC_SSM4567 if I2C select SND_SOC_STA32X if I2C select SND_SOC_STA350 if I2C select SND_SOC_STA529 if I2C
@@ -546,6 +547,10 @@ config SND_SOC_SSM2602_I2C select SND_SOC_SSM2602 tristate +config SND_SOC_SSM4567 + tristate "Analog Devices ssm4567 amplifier driver support" + depends on I2C + config SND_SOC_STA32X tristate
sound/soc/codecs/Makefile +2 -0
@@ -95,6 +95,7 @@ snd-soc-ssm2518-objs := ssm2518.o snd-soc-ssm2602-objs := ssm2602.o snd-soc-ssm2602-spi-objs := ssm2602-spi.o snd-soc-ssm2602-i2c-objs := ssm2602-i2c.o +snd-soc-ssm4567-objs := ssm4567.o snd-soc-sta32x-objs := sta32x.o snd-soc-sta350-objs := sta350.o snd-soc-sta529-objs := sta529.o
@@ -266,6 +267,7 @@ obj-$(CONFIG_SND_SOC_SSM2518) += snd-soc-ssm2518.o obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o obj-$(CONFIG_SND_SOC_SSM2602_SPI) += snd-soc-ssm2602-spi.o obj-$(CONFIG_SND_SOC_SSM2602_I2C) += snd-soc-ssm2602-i2c.o +obj-$(CONFIG_SND_SOC_SSM4567) += snd-soc-ssm4567.o obj-$(CONFIG_SND_SOC_STA32X) += snd-soc-sta32x.o obj-$(CONFIG_SND_SOC_STA350) += snd-soc-sta350.o obj-$(CONFIG_SND_SOC_STA529) += snd-soc-sta529.o
sound/soc/codecs/ssm4567.c new file +345 -0
345 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
Quoted 3 lines · Anatol Pomozov
Analog Devices SSM4567 is a boost class-D audio amplifier.
Signed-off-by Anatol Pomozov <[email protected]>
Thanks.
Hi
Quoted 8 lines · Lars-Peter Clausen
Quoted 4 lines · Anatol Pomozov
Analog Devices SSM4567 is a boost class-D audio amplifier.
Signed-off-by Anatol Pomozov <[email protected]>
Thanks!
Once your changes will be ready I'll be glad to test them. We do not use output sensing yet but we might do it in the future.
Quoted 1 line · Anatol Pomozov
Analog Devices SSM4567 is a boost class-D audio amplifier.
Applied, but don't send patches in reply to existing threads especially if you don't include a version tag in the header. This was very nearly deleted unread. One thing to look at incrementally:
sound/soc/codecs/ssm4567.c line 214
Quoted 4 lines
sound/soc/codecs/ssm4567.c new file +4
-0+ ret =regmap_update_bits (ssm4567->regmap, +SSM4567_REG_POWER_CTRL , +SSM4567_POWER_SPWDN ,0x00 ); +regcache_sync (ssm4567->regmap);
This checks the return value of _update_bits() but not _sync() - make your mind up please! I'd also split the _set_power() function into two, there is much more conditional code for the two cases than common code in there.