Skip to contentSkip to conversation

dt-bindings: ASoC: Add tas2770 smart PA dt bindings

PATCH Superseded [email protected] 2 participants 3 messages Sep 11, 2019

Subsystems (4)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dt-bindings: ASoC: Add tas2770 smart PA dt bindings

From: Frank Shi <[email protected]>

Add tas2770 smart PA dt bindings

---
 .../devicetree/bindings/sound/tas2770.txt          | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/tas2770.txt
Documentation/devicetree/bindings/sound/tas2770.txt new file +37 -0
new file mode 100644
index 0000000..ede6bb3
@@ -0,0 +1,37 @@
+Texas Instruments TAS2770 Smart PA
+
+The TAS2770 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.
+
+Required properties:
+
+ - compatible:	   - Should contain "ti,tas2770".
+ - reg:		       - The i2c address. Should contain <0x4c>, <0x4d>,<0x4e>, or <0x4f>.
+ - #address-cells  - Should be <1>.
+ - #size-cells     - Should be <0>.
+ - ti,asi-format:  - Sets TDM RX capture edge. 0->Rising; 1->Falling.
+ - ti,imon-slot-no:- TDM TX current sense time slot.
+ - ti,vmon-slot-no:- TDM TX voltage sense time slot.
+
+Optional properties:
+
+- interrupt-parent: the phandle to the interrupt controller which provides
+                     the interrupt.
+- interrupts: interrupt specification for data-ready.
+
+Examples:
+
+    tas2770@4c {
+                compatible = "ti,tas2770";
+                reg = <0x4c>;
+                #address-cells = <1>;
+                #size-cells = <0>;
+                interrupt-parent = <&msm_gpio>;
+                interrupts = <97 0>;
+                ti,asi-format = <0>;
+                ti,imon-slot-no = <0>;
+                ti,vmon-slot-no = <2>;
+        };
+
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 tas2770: add tas2770 smart PA kernel driver

From: Frank Shi <[email protected]>

add tas2770 smart PA kernel driver

---
 sound/soc/codecs/Kconfig   |   5 +
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/tas2770.c | 954 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/tas2770.h | 166 ++++++++
 4 files changed, 1127 insertions(+)
 create mode 100644 sound/soc/codecs/tas2770.c
 create mode 100644 sound/soc/codecs/tas2770.h
sound/soc/codecs/Kconfig +5 -0
index 8f3e787..cc92da3 100644
@@ -111,6 +111,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_STAC9766 if SND_SOC_AC97_BUS
 	select SND_SOC_STI_SAS
 	select SND_SOC_TAS2552 if I2C
+	select SND_SOC_TAS2770 if I2C
 	select SND_SOC_TAS5086 if I2C
 	select SND_SOC_TAS571X if I2C
 	select SND_SOC_TFA9879 if I2C
@@ -652,6 +653,10 @@ config SND_SOC_TAS2552
 	tristate "Texas Instruments TAS2552 Mono Audio amplifier"
 	depends on I2C
 
+config SND_SOC_TAS2770
+	tristate "Texas Instruments TAS2770 speaker amplifier"
+	depends on I2C
+
 config SND_SOC_TAS5086
 	tristate "Texas Instruments TAS5086 speaker amplifier"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index 5305cc6..63b8488 100644
@@ -116,6 +116,7 @@ snd-soc-stac9766-objs := stac9766.o
 snd-soc-sti-sas-objs := sti-sas.o
 snd-soc-tas5086-objs := tas5086.o
 snd-soc-tas571x-objs := tas571x.o
+snd-soc-tas2770-objs := tas2770.o
 snd-soc-tfa9879-objs := tfa9879.o
 snd-soc-tlv320aic23-objs := tlv320aic23.o
 snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o
@@ -332,6 +333,7 @@ obj-$(CONFIG_SND_SOC_STI_SAS)	+= snd-soc-sti-sas.o
 obj-$(CONFIG_SND_SOC_TAS2552)	+= snd-soc-tas2552.o
 obj-$(CONFIG_SND_SOC_TAS5086)	+= snd-soc-tas5086.o
 obj-$(CONFIG_SND_SOC_TAS571X)	+= snd-soc-tas571x.o
+obj-$(CONFIG_SND_SOC_TAS2770) += snd-soc-tas2770.o
 obj-$(CONFIG_SND_SOC_TFA9879)	+= snd-soc-tfa9879.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23)	+= snd-soc-tlv320aic23.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C)	+= snd-soc-tlv320aic23-i2c.o
sound/soc/codecs/tas2770.c new file +954 -0

954 lines not on this page · raw message

sound/soc/codecs/tas2770.h new file +166 -0

166 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#2 lore raw

Re: [PATCH v2] tas2770: add tas2770 smart PA kernel driver

sound/soc/codecs/tas2770.c line 10

Quoted 12 lines · On Wed, Sep 11, 2019 at 06:25:29PM +0800, [email protected] wrote:

+++ b/sound/soc/codecs/tas2770.c

sound/soc/codecs/tas2770.c new file +10 -0
@@ -0,0 +1,954 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ * ALSA SoC Texas Instruments TAS2770 20-W Digital Input Mono Class-D
+ * Audio Amplifier with Speaker I/V Sense
+ *
+ * Copyright (C) 2016-2017 Texas Instruments Incorporated - http://www.ti.com/
+ *	Author: Tracy Yi <[email protected]>
+ *	Shi Fu <[email protected]>
+ */

This is a C style comment not a C++ style comment.

Quoted 6 lines
sound/soc/codecs/tas2770.c new file +6 -0
+static int tas2770_regmap_read(struct tas2770_priv *tas2770,
+			unsigned int reg, unsigned int *value)
+{
+	int result = 0;
+	int retry_count = TAS2770_I2C_RETRY_COUNT;
+

sound/soc/codecs/tas2770.c line 64

Quoted 10 lines
sound/soc/codecs/tas2770.c new file +10 -0
+	while (retry_count--) {
+		result = snd_soc_component_read(tas2770->component, reg,
+			value);
+		if (!result)
+			break;
+
+		msleep(20);
+	}
+	if (!retry_count)
+		return -ETIMEDOUT;

This appears to be the same as the previous version? It looks like we still have code to hande the device randomly resetting underneath the driver - like I said we really need to understand why that's being done, I'd strongly suggest splitting that code out into a separate patch so we can review the base driver and hopefully merge it while we discuss this reboot support.