ASoC: tas2552: Support TI TAS2552 Amplifier
PATCH v2 1/1 ASoC: tas2552: Support TI TAS2552 Amplifier
Support the TI TAS2552 Class D amplifier.
The TAS2552 is a high efficiency Class-D audio power amplifier with advanced battery current management and an integrated Class-G boost The device constantly measures the
current and voltage across the load and provides a digital stream of this information.
---
v2 - Address RFC comments- Added regmap, and snd_soc calls
removed debug code, address checkpatch errors -https://patchwork.kernel.org/patch/4378281/
.../devicetree/bindings/sound/tas2552.txt | 22 + include/sound/tas2552-plat.h | 25 ++ sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tas2552.c | 462 ++++++++++++++++++++ sound/soc/codecs/tas2552.h | 75 ++++ 6 files changed, 591 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/tas2552.txt create mode 100644 include/sound/tas2552-plat.h create mode 100644 sound/soc/codecs/tas2552.c create mode 100644 sound/soc/codecs/tas2552.h
Documentation/devicetree/bindings/sound/tas2552.txt new file +22 -0
@@ -0,0 +1,22 @@ +Texas Instruments - tas2552 Codec module + +The tas2552 serial control bus communicates through I2C protocols + +Required properties: + +- compatible - "string" - One of: + "ti,tas2552" - TAS2552 + +- reg - <int> - I2C slave address + +Optional properties: + +- power-gpio - gpio pin to enable/disable the device + +Example: + +tas2552: tas2552@41 { + compatible = "ti,tas2552"; + reg = <0x41>; + power-gpio = <&gpio4 2 GPIO_ACTIVE_HIGH>; +};
include/sound/tas2552-plat.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* TAS2552 driver platform header +* +* Copyright (C) 2014 Texas Instruments Inc. +* +* Author: Dan Murphy <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +*/ + +#ifndef TAS2552_PLAT_H +#define TAS2552_PLAT_H + +struct tas2552_platform_data { +int power_gpio; +}; + +#endif
sound/soc/codecs/Kconfig +5 -0
@@ -99,6 +99,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_TLV320AIC32X4 if I2C select SND_SOC_TLV320AIC3X if I2C select SND_SOC_TPA6130A2 if I2C + select SND_SOC_TAS2552 if I2C select SND_SOC_TLV320DAC33 if I2C select SND_SOC_TWL4030 if TWL4030_CORE select SND_SOC_TWL6040 if TWL6040_CORE
@@ -754,4 +755,8 @@ config SND_SOC_TPA6130A2 tristate "Texas Instruments TPA6130A2 headphone amplifier" depends on I2C +config SND_SOC_TAS2552 + tristate "Texas Instruments TAS2552 Mono Audio amplifier" + depends on I2C + endmenu
sound/soc/codecs/Makefile +2 -0
@@ -162,6 +162,7 @@ snd-soc-wm-hubs-objs := wm_hubs.o # Amp snd-soc-max9877-objs := max9877.o snd-soc-tpa6130a2-objs := tpa6130a2.o +snd-soc-tas2552-objs := tas2552.o obj-$(CONFIG_SND_SOC_88PM860X) += snd-soc-88pm860x.o obj-$(CONFIG_SND_SOC_AB8500_CODEC) += snd-soc-ab8500-codec.o
@@ -325,3 +326,4 @@ obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o # Amp obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o obj-$(CONFIG_SND_SOC_TPA6130A2) += snd-soc-tpa6130a2.o +obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o
sound/soc/codecs/tas2552.c new file +462 -0
462 lines not on this page · raw message
sound/soc/codecs/tas2552.h new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Hi,
Quoted 33 lines · Dan Murphy
Support the TI TAS2552 Class D amplifier.
The TAS2552 is a high efficiency Class-D audio power amplifier with advanced battery current management and an integrated Class-G boost The device constantly measures the
current and voltage across the load and provides a digital stream of this information.Signed-off-by Dan Murphy <[email protected]>---
v2 - Address RFC comments- Added regmap, and
snd_soccalls
removed debug code, address checkpatch errors -https://patchwork.kernel.org/patch/4378281/.../devicetree/bindings/sound/tas2552.txt | 22 + include/sound/tas2552-plat.h | 25 ++ sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tas2552.c | 462 ++++++++++++++++++++ sound/soc/codecs/tas2552.h | 75 ++++ 6 files changed, 591 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/tas2552.txt create mode 100644 include/sound/tas2552-plat.h create mode 100644 sound/soc/codecs/tas2552.c create mode 100644 sound/soc/codecs/tas2552.hDocumentation/devicetree/bindings/sound/tas2552.txt new file +0
-0
Documentation/devicetree/bindings/sound/tas2552.txt line 8
Quoted 8 lines
Documentation/devicetree/bindings/sound/tas2552.txt new file +8
-0@@ -0,0 +1,22 @@ +Texas Instruments - tas2552 Codec module + +The tas2552 serial control bus communicates through I2C protocols + +Required properties: + +- compatible - "string" - One of: + "ti,tas2552" - TAS2552
Drop the "string". The compatible list is a standard property and its type (string list) is well-known.
You could change "One of:" to "should contain:", which will look less weird with a single entry.
Documentation/devicetree/bindings/sound/tas2552.txt line 10
Quoted 1 line
Documentation/devicetree/bindings/sound/tas2552.txt new file +1
-0+- reg - <int> - I2C slave address
Similarly to "string" we can get rid of <int> here. i2c addresses are well-known to be described in a single u32 cell.
Documentation/devicetree/bindings/sound/tas2552.txt line 14
Quoted 4 lines
Documentation/devicetree/bindings/sound/tas2552.txt new file +4
-0+ +Optional properties: + +- power-gpio - gpio pin to enable/disable the device
The code below seems to look for "enable-gpio". Searching for "power-gpio" only hits in the line above and the example below. I assume the code is in error?
Quoted 8 lines
Documentation/devicetree/bindings/sound/tas2552.txt new file +8
-0+ +Example: + +tas2552: tas2552@41 { + compatible = "ti,tas2552"; + reg = <0x41>; + power-gpio = <&gpio4 2 GPIO_ACTIVE_HIGH>; +};
[...]
Documentation/devicetree/bindings/sound/tas2552.txt
Quoted 4 lines
Documentation/devicetree/bindings/sound/tas2552.txt new file +4
-0+ if (pdata) { + data->power_gpio = pdata->power_gpio; + } else if (np) { + data->power_gpio = of_get_named_gpio(np, "enable-gpio", 0);
Usually I see this logic the other way around, looking for DT data first then falling back to platform data if no DT information was present.
Cheers,
Mark.
Hi
Quoted 54 lines · Mark Rutland
Hi,
Quoted 33 lines · Dan Murphy
Support the TI TAS2552 Class D amplifier.
The TAS2552 is a high efficiency Class-D audio power amplifier with advanced battery current management and an integrated Class-G boost The device constantly measures the
current and voltage across the load and provides a digital stream of this information.Signed-off-by Dan Murphy <[email protected]>---
v2 - Address RFC comments- Added regmap, and
snd_soccalls
removed debug code, address checkpatch errors -https://patchwork.kernel.org/patch/4378281/.../devicetree/bindings/sound/tas2552.txt | 22 + include/sound/tas2552-plat.h | 25 ++ sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tas2552.c | 462 ++++++++++++++++++++ sound/soc/codecs/tas2552.h | 75 ++++ 6 files changed, 591 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/tas2552.txt create mode 100644 include/sound/tas2552-plat.h create mode 100644 sound/soc/codecs/tas2552.c create mode 100644 sound/soc/codecs/tas2552.hDocumentation/devicetree/bindings/sound/tas2552.txt new file +0
-0Documentation/devicetree/bindings/sound/tas2552.txt line 8
Quoted 8 lines
Documentation/devicetree/bindings/sound/tas2552.txt new file +8
-0@@ -0,0 +1,22 @@ +Texas Instruments - tas2552 Codec module + +The tas2552 serial control bus communicates through I2C protocols + +Required properties: + +- compatible - "string" - One of: + "ti,tas2552" - TAS2552Drop the "string". The compatible list is a standard property and its type (string list) is well-known.
You could change "One of:" to "should contain:", which will look less weird with a single entry.
Documentation/devicetree/bindings/sound/tas2552.txt line 10
Quoted 1 line
Documentation/devicetree/bindings/sound/tas2552.txt new file +1
-0+- reg - <int> - I2C slave addressSimilarly to "string" we can get rid of <int> here. i2c addresses are well-known to be described in a single u32 cell.
Quoted 7 lines
Documentation/devicetree/bindings/sound/tas2552.txt line 14
Quoted 4 lines
Documentation/devicetree/bindings/sound/tas2552.txt new file +4
-0+ +Optional properties: + +- power-gpio - gpio pin to enable/disable the deviceThe code below seems to look for "enable-gpio". Searching for "power-gpio" only hits in the line above and the example below. I assume the code is in error?
No this was PEBKAC I did not update the documentation when I wrote the code.
Quoted 15 lines
Quoted 9 lines
Documentation/devicetree/bindings/sound/tas2552.txt new file +8
-0+ +Example: + +tas2552: tas2552@41 { + compatible = "ti,tas2552"; + reg = <0x41>; + power-gpio = <&gpio4 2 GPIO_ACTIVE_HIGH>; +};[...]
Documentation/devicetree/bindings/sound/tas2552.txt
Quoted 4 lines
Documentation/devicetree/bindings/sound/tas2552.txt new file +4
-0+ if (pdata) { + data->power_gpio = pdata->power_gpio; + } else if (np) { + data->power_gpio = of_get_named_gpio(np, "enable-gpio", 0);
Quoted 5 lines
Usually I see this logic the other way around, looking for DT data first then falling back to platform data if no DT information was present.
Cheers,
Mark.
Thanks for the review. I will take these changes into v3 after a good code review soak time.
Dan
Signature · 2 lines
------------------ Dan Murphy
Mark Brown
maintainerQuoted 9 lines · Mark Rutland
Quoted 3 lines · Dan Murphy
+Optional properties:
+- power-gpio - gpio pin to enable/disable the device
The code below seems to look for "enable-gpio". Searching for "power-gpio" only hits in the line above and the example below. I assume the code is in error?
It depends what this is for - if it's for an external regulator it should be a regulator binding. Also all GPIO properties are supposed to be called -gpios because DT conventions.
Quoted 7 lines · Mark Brown
Quoted 5 lines · Mark Rutland
Quoted 3 lines · Dan Murphy
+Optional properties:
+- power-gpio - gpio pin to enable/disable the device
Quoted 7 lines
Quoted 3 lines
The code below seems to look for "enable-gpio". Searching for "power-gpio" only hits in the line above and the example below. I assume the code is in error?
It depends what this is for - if it's for an external regulator it should be a regulator binding. Also all GPIO properties are supposed to be called -gpios because DT conventions.
Sure. I was commenting on the mismatch between "enable" in the code and "power" in the documentation rather than the appropriateness of either "power-gpios" or "enable-gpios".
Mark.