The tas2783 is a smart audio amplifier with integrated MIPI SoundWire interface (Version 1.2.1 compliant), I2C, and I2S/TDM interfaces designed for portable applications. An on-chip DSP supports Texas Instruments SmartAmp speaker protection algorithm. The integrated speaker voltage and current sense provides for real-time monitoring of loudspeakers.
Subsystems (3)
Shenghao Ding
maintainerPATCH v10 1/1 The tas2783 is a smart audio amplifier with integrated MIPI SoundWire interface (Version 1.2.1 compliant), I2C, and I2S/TDM interfaces designed for portable applications. An on-chip DSP supports Texas Instruments SmartAmp speaker protection algorithm. The integrated speaker voltage and current sense provides for real-time monitoring of loudspeakers.
The ASoC component provides the majority of the functionality of the device, all the audio functions.
---
Change in v10:
- simplify tasdevice_set_sdw_stream
- fixed some Linux coding style
- fixed the spelling mistakes
- Select left/right channel based on unique id
- a longer description has been added
- remove unused crc8 in KCONFIG
- Invert of RE here means reciprocal of RE
- correct indentation
- correct the wrong pow calibrated register
- correct comment on RESET register
- fixed usually lines don't end with an open parenthesis
- fixed tasdevice_sdw_shutdown
- use defines for function, entity, etc. for readable
- remove unnecessary codec_lock in component_probe()
- remove struct sdw_stream_data
- remove unused macro definitions
- use BIT(2) and BIT(1) instead of 0x2 and 0x1
- implement pm_runtime
- reg_start is u8, reg_start + i only adds i byte, it should be reg_start + i * 4, because the calibration values
- fixed total_sz in tas2783_calibration
- add a define for TASDEVICE_REG(0, 0, 0x0a)
- rework macro style in header file
- Add select CRC32
- rewrite the mute and the return value handling
- Add comments on bin file
- Add link_id into the fw name to distinguish the same sdw id on different sdw id.
- remove unnecessary mutex_lock
- use set_active() in tasdevice_io_init and move all other parts in the probe.
- move pm_runtime_get_noresume to the probe
- fix the return value of putvol function
- add put_noidle in tasdevice_sdw_remove
- remove unused header file(of.h)
- correct the style of the multi-line comment
- Set the readable registers in tas2783_readable_register for debugfs
- Use new PM macros
- Use default put and get inline SOC_SINGLE_RANGE_TLV and SOC_SINGLE_SX_TLV
- Use respective %pt to log the calibrated time
- Remove unnecessary struct tm
- Add trailing comma tasdevice_dapm_widgets and tasdevice_audio_map
- Rewrite the return value handling in tasdevice_sdw_probe
- use dev_num instead of id.unique_id
- rework the log
- Add code to check the size of calibrated data in UEFI
- Add description of Layout of calibrated Data in UEFI
- switch back link_id and unique_id to identify the devcie
- unique_id offset as the device index of the calibrated data
- update calibrated data layout stored in UEFI, add link_id and unique_id into the calibrated data in case of tas2783 sitting in different SDQW buses.
--- sound/soc/codecs/Kconfig | 16 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tas2783-sdw.c | 932 +++++++++++++++++++++++++++++++++ sound/soc/codecs/tas2783.h | 106 ++++ 4 files changed, 1056 insertions(+) create mode 100644 sound/soc/codecs/tas2783-sdw.c create mode 100644 sound/soc/codecs/tas2783.h
sound/soc/codecs/Kconfig +16 -0
@@ -247,6 +247,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_TAS2781_COMLIB imply SND_SOC_TAS2781_FMWLIB imply SND_SOC_TAS2781_I2C + imply SND_SOC_TAS2783 imply SND_SOC_TAS5086 imply SND_SOC_TAS571X imply SND_SOC_TAS5720
@@ -1847,6 +1848,21 @@ config SND_SOC_TAS2781_I2C algo coefficient setting, for one, two or even multiple TAS2781 chips. +config SND_SOC_TAS2783 + tristate "Texas Instruments TAS2783 speaker amplifier (sdw)" + depends on SOUNDWIRE + depends on EFI + select REGMAP + select REGMAP_SOUNDWIRE + select CRC32 + select CRC32_SARWATE + help + Enable support for Texas Instruments TAS2783 Smart Amplifier + Digital input mono Class-D and DSP-inside audio power amplifiers. + TAS2783 supports the MIPI SoundWire v1.2 compatible interface + for audio and control data. At the end of calibrated data appends + the crc data with crc32_sarwate for error detection. + config SND_SOC_TAS5086 tristate "Texas Instruments TAS5086 speaker amplifier" depends on I2C
sound/soc/codecs/Makefile +2 -0
@@ -284,6 +284,7 @@ snd-soc-tas2770-objs := tas2770.o snd-soc-tas2781-comlib-objs := tas2781-comlib.o snd-soc-tas2781-fmwlib-objs := tas2781-fmwlib.o snd-soc-tas2781-i2c-objs := tas2781-i2c.o +snd-soc-tas2783-objs := tas2783-sdw.o snd-soc-tfa9879-objs := tfa9879.o snd-soc-tfa989x-objs := tfa989x.o snd-soc-tlv320adc3xxx-objs := tlv320adc3xxx.o
@@ -664,6 +665,7 @@ obj-$(CONFIG_SND_SOC_TAS2780) += snd-soc-tas2780.o obj-$(CONFIG_SND_SOC_TAS2781_COMLIB) += snd-soc-tas2781-comlib.o obj-$(CONFIG_SND_SOC_TAS2781_FMWLIB) += snd-soc-tas2781-fmwlib.o obj-$(CONFIG_SND_SOC_TAS2781_I2C) += snd-soc-tas2781-i2c.o +obj-$(CONFIG_SND_SOC_TAS2783) += snd-soc-tas2783.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/tas2783-sdw.c new file +932 -0
932 lines not on this page · raw message
sound/soc/codecs/tas2783.h new file +106 -0
106 lines not on this page · raw message
Signature · 1 line
2.34.1
Mark Brown
maintainerQuoted 22 lines · Shenghao Ding
The ASoC component provides the majority of the functionality of the device, all the audio functions.
sound/soc/codecs/tas2783-sdw.c new file +19
-0+static const struct reg_default tas2783_reg_defaults[] = { +/* Default values for ROM mode. Activated. */ + {0x8002 ,0x1a },/* AMP inactive. */ + {0x8097 ,0xc8 }, + {0x80b5 ,0x74 }, + {0x8099 ,0x20 }, + {0xfe8d ,0x0d }, + {0xfebe ,0x4a }, + {0x8230 ,0x00 }, + {0x8231 ,0x00 }, + {0x8232 ,0x00 }, + {0x8233 ,0x01 }, + {0x8418 ,0x00 },/* Set volume to 0 dB. */ + {0x8419 ,0x00 }, + {0x841a ,0x00 }, + {0x841b ,0x00 }, + {0x8428 ,0x40 },/* Unmute channel */ + {0x8429 ,0x00 }, + {0x842a ,0x00 },
sound/soc/codecs/tas2783-sdw.c line 71
Quoted 10 lines
sound/soc/codecs/tas2783-sdw.c new file +10
-0+ { 0x842b, 0x00 }, + { 0x8548, 0x00 }, /* Set volume to 0 dB. */ + { 0x8549, 0x00 }, + { 0x854a, 0x00 }, + { 0x854b, 0x00 }, + { 0x8558, 0x40 }, /* Unmute channel */ + { 0x8559, 0x00 }, + { 0x855a, 0x00 }, + { 0x855b, 0x00 }, + { 0x800a, 0x3a }, /* Enable both channel */
These comments sound like this register default table is not actually the physical default register values that the chip has...
sound/soc/codecs/tas2783-sdw.c line 118
Quoted 8 lines
sound/soc/codecs/tas2783-sdw.c new file +8
-0+static const struct regmap_config tasdevice_regmap = { + .reg_bits =32 , + .val_bits =8 , + .readable_reg = tas2783_readable_register, + .volatile_reg = tas2783_volatile_register, + .max_register =0x44ffffff , + .reg_defaults = tas2783_reg_defaults, + .num_reg_defaults =ARRAY_SIZE (tas2783_reg_defaults),
...but this is set as the register defaults. This will cause problems with things like cache sync where we don't write values out if they're not the defaults. We also try to keep default settings from the silicon except in the most obvious cases, it avoids issues with trying to work out what to set and accomodate different use cases for different systems.
If you do need to set non-default values then either just regular writes during probe or a regmap patch would do it.
sound/soc/codecs/tas2783-sdw.c line 121
Quoted 3 lines
sound/soc/codecs/tas2783-sdw.c new file +3
-0+ .cache_type = REGCACHE_RBTREE, + .use_single_read = true, + .use_single_write = true,
REGCACHE_MAPLE is generally the most sensible choice for modern devices
- it's a newer and fancier data structure underlying it and there's only a few cases with low end devices, mostly doing block I/O which this doesn't support, where the RBTREE cache is still better.
sound/soc/codecs/tas2783-sdw.c line 187
Quoted 11 lines
sound/soc/codecs/tas2783-sdw.c new file +11
-0+u16 dev_info; +int ret; + +if (!tas_dev->sdw_peripheral) { +dev_err (tas_dev->dev,"%s: peripheral doesn't exist.\n" , + __func__); +return ; + } + + dev_info = tas_dev->sdw_peripheral->bus->link_id | + tas_dev->sdw_peripheral->id.unique_id <<16 ;
I'm kind of surprised dev_info works as a variable name without something getting upset that it aliases the function of the same name.