ASoc: tas2783A: Add soundwire based codec driver
PATCH v2 1/4 ASoc: tas2783A: Add soundwire based codec driver
TAS2783 is mono digital input class-D Smart Amplifier based on MIPI Alliance Soundwire interface. The driver supports loading the algorithm coefficients for one or more tas2783 chips.
---
v2:
- append Volume to amp gain mixer control
- remove unwanted debug log
--- sound/soc/codecs/Kconfig | 14 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/tas2783-sdw.c | 1417 ++++++++++++++++++++++++++++++++ sound/soc/codecs/tas2783.h | 107 +++ 4 files changed, 1540 insertions(+) create mode 100644 sound/soc/codecs/tas2783-sdw.c create mode 100644 sound/soc/codecs/tas2783.h
sound/soc/codecs/Kconfig +14 -0
@@ -266,6 +266,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_TAS2770 imply SND_SOC_TAS2780 imply SND_SOC_TAS2781_I2C + imply SND_SOC_TAS2783_SDW imply SND_SOC_TAS5086 imply SND_SOC_TAS571X imply SND_SOC_TAS5720
@@ -2074,6 +2075,19 @@ config SND_SOC_TAS2781_I2C algo coefficient setting, for one, two or even multiple TAS2781 chips. +config SND_SOC_TAS2783_SDW + tristate "Texas Instruments TAS2783 speaker amplifier (sdw)" + select SOUNDWIRE + select REGMAP + select REGMAP_SOUNDWIRE + select EFI + select CRC32 + help + Enable support for Texas Instruments TAS2783A Digital input + mono Class-D and DSP-inside audio power amplifiers. TAS2783 + driver implements a flexible and configurable algorithm + cofficient setting, for one, two or multiple TAS2783 chips. + config SND_SOC_TAS5086 tristate "Texas Instruments TAS5086 speaker amplifier" depends on I2C
sound/soc/codecs/Makefile +2 -0
@@ -316,6 +316,7 @@ snd-soc-tas2781-comlib-y := tas2781-comlib.o snd-soc-tas2781-comlib-i2c-y := tas2781-comlib-i2c.o snd-soc-tas2781-fmwlib-y := tas2781-fmwlib.o snd-soc-tas2781-i2c-y := tas2781-i2c.o +snd-soc-tas2783-sdw-y := tas2783-sdw.o snd-soc-tfa9879-y := tfa9879.o snd-soc-tfa989x-y := tfa989x.o snd-soc-tlv320adc3xxx-y := tlv320adc3xxx.o
@@ -732,6 +733,7 @@ obj-$(CONFIG_SND_SOC_TAS2781_COMLIB) += snd-soc-tas2781-comlib.o obj-$(CONFIG_SND_SOC_TAS2781_COMLIB_I2C) += snd-soc-tas2781-comlib-i2c.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_SDW) += snd-soc-tas2783-sdw.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 +1417 -0
1,417 lines not on this page · raw message
sound/soc/codecs/tas2783.h new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 2/4 ASoc: tas2783A: machine driver amp utility for TI devices
Machine driver amp utility file to initialize and support
multiple tas2783a devices are added.
--- include/sound/soc_sdw_utils.h | 8 +++ sound/soc/sdw_utils/Makefile | 3 +- sound/soc/sdw_utils/soc_sdw_ti_amp.c | 93 ++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 sound/soc/sdw_utils/soc_sdw_ti_amp.c
include/sound/soc_sdw_utils.h +8 -0
@@ -248,5 +248,13 @@ int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soint asoc_sdw_cs42l43_dmic_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);int asoc_sdw_cs_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai);int asoc_sdw_maxim_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai); +/* TI */ +int asoc_sdw_ti_amp_init (struct snd_soc_card *card, +struct snd_soc_dai_link *dai_links, +struct asoc_sdw_codec_info *info, +bool playback); +int asoc_sdw_ti_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai); +int asoc_sdw_ti_amp_initial_settings (struct snd_soc_card *card, +const char *name_prefix);#endif
sound/soc/sdw_utils/Makefile +2 -1
@@ -6,5 +6,6 @@ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \ soc_sdw_bridge_cs35l56.o \ soc_sdw_cs42l42.o soc_sdw_cs42l43.o \ soc_sdw_cs_amp.o \ - soc_sdw_maxim.o + soc_sdw_maxim.o \ + soc_sdw_ti_amp.o obj-$(CONFIG_SND_SOC_SDW_UTILS) += snd-soc-sdw-utils.o
sound/soc/sdw_utils/soc_sdw_ti_amp.c new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 3/4 ASoc: tas2783A: add machine driver changes
In reply to Niranjan H YAdd tas2783-codec for codec_info
--- sound/soc/sdw_utils/soc_sdw_utils.c | 38 +++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 10 deletions(-)
sound/soc/sdw_utils/soc_sdw_utils.c +28 -10
@@ -35,12 +35,12 @@ static const struct snd_kcontrol_new generic_spk_controls[] = { SOC_DAPM_PIN_SWITCH("Speaker"), }; -static const struct snd_soc_dapm_widget maxim_widgets[] = { +static const struct snd_soc_dapm_widget lr_spk_widgets[] = {SND_SOC_DAPM_SPK ("Left Spk" ,NULL ),SND_SOC_DAPM_SPK ("Right Spk" ,NULL ), }; -static const struct snd_kcontrol_new maxim_controls[] = { +static const struct snd_kcontrol_new lr_spk_controls[] = {SOC_DAPM_PIN_SWITCH ("Left Spk" ),SOC_DAPM_PIN_SWITCH ("Right Spk" ), };
@@ -58,6 +58,24 @@ static const struct snd_kcontrol_new rt700_controls[] = { };struct asoc_sdw_codec_info codec_info_list[] = { + { + .part_id =0x0000 ,/* TAS2783A */ + .dais = { + { + .direction = {true, true}, + .dai_name ="tas2783-codec" , + .dai_type =SOC_SDW_DAI_TYPE_AMP , + .dailink = {SOC_SDW_AMP_OUT_DAI_ID ,SOC_SDW_AMP_IN_DAI_ID }, + .init = asoc_sdw_ti_amp_init, + .rtd_init = asoc_sdw_ti_spk_rtd_init, + .controls = lr_spk_controls, + .num_controls =ARRAY_SIZE (lr_spk_controls), + .widgets = lr_spk_widgets, + .num_widgets =ARRAY_SIZE (lr_spk_widgets), + }, + }, + .dai_num =1 , + }, { .part_id =0x700 , .dais = {
@@ -450,10 +468,10 @@ struct asoc_sdw_codec_info codec_info_list[] = { .dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_AMP_IN_DAI_ID}, .init = asoc_sdw_maxim_init, .rtd_init = asoc_sdw_maxim_spk_rtd_init, - .controls = maxim_controls, - .num_controls = ARRAY_SIZE(maxim_controls), - .widgets = maxim_widgets, - .num_widgets = ARRAY_SIZE(maxim_widgets), + .controls = lr_spk_controls, + .num_controls = ARRAY_SIZE(lr_spk_controls), + .widgets = lr_spk_widgets, + .num_widgets = ARRAY_SIZE(lr_spk_widgets), }, }, .dai_num = 1,
@@ -469,10 +487,10 @@ struct asoc_sdw_codec_info codec_info_list[] = { .dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID}, .init = asoc_sdw_maxim_init, .rtd_init = asoc_sdw_maxim_spk_rtd_init, - .controls = maxim_controls, - .num_controls = ARRAY_SIZE(maxim_controls), - .widgets = maxim_widgets, - .num_widgets = ARRAY_SIZE(maxim_widgets), + .controls = lr_spk_controls, + .num_controls = ARRAY_SIZE(lr_spk_controls), + .widgets = lr_spk_widgets, + .num_widgets = ARRAY_SIZE(lr_spk_widgets), }, }, .dai_num = 1,
Signature · 1 line
2.25.1
PATCH v2 4/4 tas2783A: Add acpi match changes for Intel MTL
In reply to Niranjan H Yacpi match changes to support tas2783a on mtl
on link 0 for 2 devices
--- .../intel/common/soc-acpi-intel-mtl-match.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+)
sound/soc/intel/common/soc-acpi-intel-mtl-match.c +30 -0
@@ -948,6 +948,30 @@ static const struct snd_soc_acpi_adr_device cs42l42_0_adr[] = { } }; +static const struct snd_soc_acpi_adr_device tas2783_0_adr[] = { + { + .adr =0x0000380102000001ull , + .num_endpoints =1 , + .endpoints = &spk_l_endpoint, + .name_prefix ="tas2783-1" + }, + { + .adr =0x0000390102000001ull , + .num_endpoints =1 , + .endpoints = &spk_r_endpoint, + .name_prefix ="tas2783-2" + } +}; + +static const struct snd_soc_acpi_link_adr tas2783_link0[] = { + { + .mask =BIT (0 ), + .num_adr =ARRAY_SIZE (tas2783_0_adr), + .adr_d = tas2783_0_adr, + }, + {} +}; +static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = {/* Expected order: jack -> amp */ {
@@ -1080,6 +1104,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg", }, + { + .link_mask = BIT(0), + .links = tas2783_link0, + .drv_name = "sof_sdw", + .sof_tplg_filename = "sof-mtl-tas2783.tplg", + }, { .link_mask = GENMASK(3, 0), .links = mtl_rt713_l0_rt1316_l12_rt1713_l3,
Signature · 1 line
2.25.1
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Niranjan,
kernel test robot noticed the following build errors:
[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.17-rc5 next-20250909] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Niranjan-H-Y/ASoc-tas2783A-machine-driver-amp-utility-for-TI-devices/20250909-201553 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20250901051144.1112-1-niranjan.hy%40ti.com patch subject: [PATCH v2 1/4] ASoc: tas2783A: Add soundwire based codec driver config: hexagon-randconfig-002-20250910 (https://download.01.org/0day-ci/archive/20250910/[email protected]/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 7fb1dc08d2f025aad5777bb779dfac1197e9ef87) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250910/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> sound/soc/codecs/tas2783-sdw.c:791:8: error: incompatible pointer types passing 'size_t *' (aka 'unsigned int *') to parameter of type 'unsigned long *' [-Werror,-Wincompatible-pointer-types]
791 | &size, NULL);
| ^~~~~1 error generated.
vim +791 sound/soc/codecs/tas2783-sdw.c
769
770 static s32 tas2783_update_calibdata(struct tas2783_prv *tas_dev)
771 {
772 efi_guid_t efi_guid = TAS2783_CALI_GUID;
773 u32 attr, i, *tmp_val;
774 size_t size;
775 s32 ret;
776 efi_status_t status;
777 static efi_char16_t efi_names[][32] = {
778 L"SmartAmpCalibrationData", L"CALI_DATA"};
779
780 tmp_val = (u32 *)tas_dev->cali_data.data;
781 attr = 0;
782 i = 0;
783
784 /*
785 * In some cases, the calibration is performed in Windows,
786 * and data was saved in UEFI. Linux can access it.
787 */
788 for (i = 0; i < ARRAY_SIZE(efi_names); i++) {
789 size = 0;
790 status = efi.get_variable(efi_names[i], &efi_guid, &attr,
> 791 &size, NULL);
792 if (size > TAS2783_CALIB_DATA_SZ) {
793 dev_err(tas_dev->dev, "cali data too large\n");
794 break;
795 }
796
797 tas_dev->cali_data.read_sz = size;
798 if (status == EFI_BUFFER_TOO_SMALL) {
799 status = efi.get_variable(efi_names[i], &efi_guid, &attr,
800 &tas_dev->cali_data.read_sz,
801 tas_dev->cali_data.data);
802 dev_dbg(tas_dev->dev, "cali get %lu bytes result:%ld\n",
803 tas_dev->cali_data.read_sz, status);
804 }
805 if (status == EFI_SUCCESS)
806 break;
807 }
808
809 if (status != EFI_SUCCESS) {
810 /* Failed got calibration data from EFI. */
811 dev_dbg(tas_dev->dev, "No calibration data in UEFI.");
812 return 0;
813 }
814
815 mutex_lock(&tas_dev->calib_lock);
816 ret = tas2783_validate_calibdata(tas_dev, tas_dev->cali_data.data,
817 tas_dev->cali_data.read_sz);
818 if (!ret)
819 tas2783_set_calib_params_to_device(tas_dev, tmp_val);
820 mutex_unlock(&tas_dev->calib_lock);
821
822 return ret;
823 }
824
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki