Skip to contentSkip to conversation

ASoC: tas2781: Add tas2781 driver

PATCH Superseded Shenghao Ding 1 participant 1 message Mar 12, 2023

Subsystems (3)

v4 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 ASoC: tas2781: Add tas2781 driver

Create tas2781 driver.

---
Changes in v4:
- make the entire comment block a C++ one
- remove uncessary dbg log in the firmware downlaoding
- remove simliar macro already defined in ALSA header
- use crc8_populate_msb() to generate the crc lookup table
- remove all the hungarian notation in the code
- remove log failures to allocate
- add comment for tas2781_digital_getvol on the reason to custom control, tas2781 contain book and page two-level regmap, especially book switching will set two registers, one is BXXPXXR00, the other is B0P0R7F, after switching to the correct book, then the code can leverage the mechanism for paging, and access the register.
- return 1 in all of the put control callback
- fix "Control names for volumes should end with Volume"
- remove the Lock in the control callback functions
- remove likely() or unlikely().
- remove uncessary GPIO check for irq
- remove unused functions
- remove i2c check in the i2c probe
Changes to be committed:

	modified:   sound/soc/codecs/Kconfig
	modified:   sound/soc/codecs/Makefile
	new file:   sound/soc/codecs/tas2781-dsp.c
	new file:   sound/soc/codecs/tas2781-dsp.h
	new file:   sound/soc/codecs/tas2781-i2c.c
	new file:   sound/soc/codecs/tas2781.h
---
 sound/soc/codecs/Kconfig       |   12 +
 sound/soc/codecs/Makefile      |    2 +
 sound/soc/codecs/tas2781-dsp.c | 2192 ++++++++++++++++++++++++++++++++
 sound/soc/codecs/tas2781-dsp.h |  178 +++
 sound/soc/codecs/tas2781-i2c.c | 1660 ++++++++++++++++++++++++
 sound/soc/codecs/tas2781.h     |  170 +++
 6 files changed, 4214 insertions(+)
 create mode 100644 sound/soc/codecs/tas2781-dsp.c
 create mode 100644 sound/soc/codecs/tas2781-dsp.h
 create mode 100644 sound/soc/codecs/tas2781-i2c.c
 create mode 100644 sound/soc/codecs/tas2781.h
sound/soc/codecs/Kconfig +12 -0
index 07747565c3b5..e1afe1ced5d7 100644
@@ -229,6 +229,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_TAS2764
 	imply SND_SOC_TAS2770
 	imply SND_SOC_TAS2780
+	imply SND_SOC_TAS2781
 	imply SND_SOC_TAS5086
 	imply SND_SOC_TAS571X
 	imply SND_SOC_TAS5720
@@ -1637,6 +1638,17 @@ config SND_SOC_TAS2780
 	  Enable support for Texas Instruments TAS2780 high-efficiency
 	  digital input mono Class-D audio power amplifiers.
 
+config SND_SOC_TAS2781
+	tristate "Texas Instruments TAS2781 speaker amplifier"
+	depends on I2C
+	select REGMAP_I2C
+	select CRC8
+	help
+	  Enable support for Texas Instruments TAS2781 Smart Amplifier
+	  Digital input mono Class-D and DSP-inside audio power amplifiers.
+	  Note the TAS2781 driver implements a flexible and configurable
+	  algo coff setting, for one, two, even multiple TAS2781 chips.
+
 config SND_SOC_TAS5086
 	tristate "Texas Instruments TAS5086 speaker amplifier"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index f1ca18f7946c..5559b9e9cc17 100644
@@ -262,6 +262,7 @@ snd-soc-tas5805m-objs := tas5805m.o
 snd-soc-tas6424-objs := tas6424.o
 snd-soc-tda7419-objs := tda7419.o
 snd-soc-tas2770-objs := tas2770.o
+snd-soc-tas2781-objs :=	tas2781-i2c.o tas2781-dsp.o
 snd-soc-tfa9879-objs := tfa9879.o
 snd-soc-tfa989x-objs := tfa989x.o
 snd-soc-tlv320adc3xxx-objs := tlv320adc3xxx.o
@@ -619,6 +620,7 @@ 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_TAS2780)	+= snd-soc-tas2780.o
+obj-$(CONFIG_SND_SOC_TAS2781)	+= snd-soc-tas2781.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/tas2781-dsp.c new file +2192 -0

2,192 lines not on this page · raw message

sound/soc/codecs/tas2781-dsp.h new file +178 -0

178 lines not on this page · raw message

sound/soc/codecs/tas2781-i2c.c new file +1660 -0

592 lines not on this page · raw message

sound/soc/codecs/tas2781.h new file +170 -0

170 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.34.1

Part of the diff is not shown here. View the raw message.