Skip to contentSkip to conversation

tas2770: add tas2770 smart PA kernel driver

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

Subsystems (3)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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 | 952 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/tas2770.h | 166 ++++++++
 4 files changed, 1125 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 +952 -0

952 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
#1 lore raw
Quoted 10 lines · On Thu, Sep 12, 2019 at 10:00:38AM +0800, [email protected] wrote:

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 | 952 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/tas2770.h | 166 ++++++++

We've lost the device tree binding patch from this version?

Quoted 9 lines
sound/soc/codecs/tas2770.c new file +9 -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;
+
+	while (retry_count--) {
+		result = snd_soc_component_read(tas2770->component, reg,
+			value);

sound/soc/codecs/tas2770.c line 65

Quoted 10 lines
sound/soc/codecs/tas2770.c new file +10 -0
+		if (!result)
+			break;
+
+		msleep(20);
+	}
+	if (!retry_count)
+		return -ETIMEDOUT;
+
+	return 0;
+}

It looks like we still have this code for what appears to be handling the device randomly resetting underneath the driver. Please, as I've said on both prior versions, split this out into a separate patch to ease review and explain why this is required. Start off with a simple driver which looks like normal drivers, add this stuff later.