dt-bindings: tas2764: Add the TAS2764 binding doc
PATCH 1/2 dt-bindings: tas2764: Add the TAS2764 binding doc
Add the binding for the TAS2764 Smart Amplifier.
--- .../devicetree/bindings/sound/tas2764.yaml | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/tas2764.yaml
Documentation/devicetree/bindings/sound/tas2764.yaml new file +74 -0
@@ -0,0 +1,74 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2020 Texas Instruments Incorporated +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/sound/tas2764.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Texas Instruments TAS2764 Smart PA + +maintainers: + - Dan Murphy <[email protected]> + +description: | + The TAS2764 is a mono, digital input Class-D audio amplifier optimized for + efficiently driving high peak power into small loudspeakers. + Integrated speaker voltage and current sense provides for + real time monitoring of loudspeaker behavior. + +properties: + compatible: + enum: + - ti,tas2764 + + reg: + maxItems: 1 + description: | + I2C address of the device can be between 0x38 to 0x45. + + reset-gpio: + description: GPIO used to reset the device. + + shutdown-gpios: + description: GPIO used to control the state of the device. + + interrupts: + maxItems: 1 + + ti,imon-slot-no: + $ref: /schemas/types.yaml#/definitions/uint32 + description: TDM TX current sense time slot. + + ti,vmon-slot-no: + $ref: /schemas/types.yaml#/definitions/uint32 + description: TDM TX voltage sense time slot. + + '#sound-dai-cells': + const: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + codec: codec@38 { + compatible = "ti,tas2764"; + reg = <0x38>; + #sound-dai-cells = <1>; + interrupt-parent = <&gpio1>; + interrupts = <14>; + reset-gpio = <&gpio1 15 0>; + shutdown-gpios = <&gpio1 15 0>; + ti,imon-slot-no = <0>; + ti,vmon-slot-no = <2>; + }; + }; + +...
Signature · 1 line
2.28.0.585.ge1cfff676549
PATCH 2/2 ASoC: tas2764: Add the driver for the TAS2764
Introduce the Texas Instruments TAS2764 amplifier driver with I/V sense for loud speaker applications.
--- sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tas2764.c | 683 +++++++++++++++++++++++++++++++++++++ sound/soc/codecs/tas2764.h | 88 +++++ 4 files changed, 778 insertions(+) create mode 100644 sound/soc/codecs/tas2764.c create mode 100644 sound/soc/codecs/tas2764.h
sound/soc/codecs/Kconfig +5 -0
@@ -195,6 +195,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_STI_SAS imply SND_SOC_TAS2552 imply SND_SOC_TAS2562 + imply SND_SOC_TAS2764 imply SND_SOC_TAS2770 imply SND_SOC_TAS5086 imply SND_SOC_TAS571X
@@ -1303,6 +1304,10 @@ config SND_SOC_TAS2562 tristate "Texas Instruments TAS2562 Mono Audio amplifier" depends on I2C +config SND_SOC_TAS2764 + tristate "Texas Instruments TAS2764 Mono Audio amplifier" + depends on I2C + config SND_SOC_TAS2770 tristate "Texas Instruments TAS2770 speaker amplifier" depends on I2C
sound/soc/codecs/Makefile +2 -0
@@ -304,6 +304,7 @@ snd-soc-simple-amplifier-objs := simple-amplifier.o snd-soc-tpa6130a2-objs := tpa6130a2.o snd-soc-tas2552-objs := tas2552.o snd-soc-tas2562-objs := tas2562.o +snd-soc-tas2764-objs := tas2764.o obj-$(CONFIG_SND_SOC_88PM860X) += snd-soc-88pm860x.o obj-$(CONFIG_SND_SOC_AB8500_CODEC) += snd-soc-ab8500-codec.o
@@ -517,6 +518,7 @@ obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o obj-$(CONFIG_SND_SOC_STI_SAS) += snd-soc-sti-sas.o obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o obj-$(CONFIG_SND_SOC_TAS2562) += snd-soc-tas2562.o +obj-$(CONFIG_SND_SOC_TAS2764) += snd-soc-tas2764.o obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o
sound/soc/codecs/tas2764.c new file +683 -0
683 lines not on this page · raw message
sound/soc/codecs/tas2764.h new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
2.28.0.585.ge1cfff676549
Mark Brown
maintainerDocumentation/devicetree/bindings/sound/tas2764.yaml line 30
Quoted 2 lines · Dan Murphy
Documentation/devicetree/bindings/sound/tas2764.yaml new file +2
-0+ reset-gpio: + description: GPIO used to reset the device.
Even if only a single GPIO is allowed DT properties for GPIOs should be plural.
Mark Brown
maintainerRe: [PATCH 2/2] ASoC: tas2764: Add the driver for the TAS2764
In reply to Dan MurphyOn Wed, Sep 30, 2020 at 11:38:09AM -0500, Dan Murphy wrote:
This all looks good - a few very minor things below but nothing substantial:
sound/soc/codecs/tas2764.c line 159
Quoted 3 lines
sound/soc/codecs/tas2764.c new file +3
-0+default : +dev_err (tas2764->dev,"Not supported evevt\n" ); +return -EINVAL ;
evevt -> event
sound/soc/codecs/tas2764.c line 206
Quoted 9 lines
sound/soc/codecs/tas2764.c new file +9
-0+static int tas2764_mute (struct snd_soc_dai *dai,int mute,int direction) +{ +struct snd_soc_component *component = dai->component; +int ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , +TAS2764_PWR_CTRL_MASK , + mute ?TAS2764_PWR_CTRL_MUTE :0 ); + +if (ret <0 ) +return ret;
This looks weird with the ternery operator and extreme indentation - could you please at least split the declaration of ret from the call to make the line length a bit extreme?
sound/soc/codecs/tas2764.c line 359
Quoted 9 lines
sound/soc/codecs/tas2764.c new file +9
-0+switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) { +case SND_SOC_DAIFMT_I2S : +case SND_SOC_DAIFMT_DSP_A : + tdm_rx_start_slot =1 ; +break ; +case SND_SOC_DAIFMT_DSP_B : +case SND_SOC_DAIFMT_LEFT_J : + tdm_rx_start_slot =0 ; +break ;
I'm not seeing any other handling that distinguishes between the I2S and DSP modes anywhere - I'm guessing this is because the device is really only implementing the DSP modes but because it's mono this is compatible with the I2S modes? It'd be worth having a comment saying this since while that would be OK not distinguishing between modes properly is a common error in drivers so it'd help avoid cut'n'paste issues if someone uses this code as a reference.
sound/soc/codecs/tas2764.c line 550
Quoted 7 lines
sound/soc/codecs/tas2764.c new file +7
-0+static int tas2764_register_codec (struct tas2764_priv *tas2764) +{ +return devm_snd_soc_register_component (tas2764->dev, + &soc_component_driver_tas2764, + tas2764_dai_driver, +ARRAY_SIZE (tas2764_dai_driver)); +}
This is a bit odd - can we not just inline the component registration rather than having this function?
Re: [PATCH 2/2] ASoC: tas2764: Add the driver for the TAS2764
Mark
Thanks for the review
Quoted 9 lines · Mark Brown
On Wed, Sep 30, 2020 at 11:38:09AM -0500, Dan Murphy wrote:
This all looks good - a few very minor things below but nothing substantial:
sound/soc/codecs/tas2764.c line 159
Quoted 3 lines
sound/soc/codecs/tas2764.c new file +3
-0+default : +dev_err (tas2764->dev,"Not supported evevt\n" ); +return -EINVAL ;evevt -> event
OK
Quoted 13 lines
sound/soc/codecs/tas2764.c line 206
Quoted 10 lines
sound/soc/codecs/tas2764.c new file +9
-0+static int tas2764_mute (struct snd_soc_dai *dai,int mute,int direction) +{ +struct snd_soc_component *component = dai->component; +int ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , +TAS2764_PWR_CTRL_MASK , + mute ?TAS2764_PWR_CTRL_MUTE :0 ); + +if (ret <0 ) +return ret;This looks weird with the ternery operator and extreme indentation - could you please at least split the declaration of ret from the call to make the line length a bit extreme?
I will fix it up
Quoted 8 lines
Quoted 8 lines
sound/soc/codecs/tas2764.c new file +8
-0+switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) { +case SND_SOC_DAIFMT_I2S : +case SND_SOC_DAIFMT_DSP_A : + tdm_rx_start_slot =1 ; +break ; +case SND_SOC_DAIFMT_DSP_B : +case SND_SOC_DAIFMT_LEFT_J : + tdm_rx_start_slot =0 ;
Quoted 8 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ break;I'm not seeing any other handling that distinguishes between the I2S and DSP modes anywhere - I'm guessing this is because the device is really only implementing the DSP modes but because it's mono this is compatible with the I2S modes? It'd be worth having a comment saying this since while that would be OK not distinguishing between modes properly is a common error in drivers so it'd help avoid cut'n'paste issues if someone uses this code as a reference.
Ah it does do LEFT J and Right J so I will fix this
Quoted 9 lines
sound/soc/codecs/tas2764.c line 550
Quoted 7 lines
sound/soc/codecs/tas2764.c new file +7
-0+static int tas2764_register_codec (struct tas2764_priv *tas2764) +{ +return devm_snd_soc_register_component (tas2764->dev, + &soc_component_driver_tas2764, + tas2764_dai_driver, +ARRAY_SIZE (tas2764_dai_driver)); +}This is a bit odd - can we not just inline the component registration rather than having this function?
I will eliminate this completely and move to i2c_probe
Dan