Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoc: tas2781: Set "Speaker Force Firmware Load" as the common kcontrol for both tas27871 and tas2563

Set "Speaker Force Firmware Load" as the common kcontrol
for both tas27871 and tas2563 and move it into newly-created
tasdevice_snd_controls, and keep the digital gain and analog
gain in tas2781_snd_controls.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20240704094939.1824-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Shenghao Ding and committed by
Mark Brown
cabf0b0c 5080808c

+22 -7
+22 -7
sound/soc/codecs/tas2781-i2c.c
··· 104 104 return tasdevice_amp_putvol(tas_priv, ucontrol, mc); 105 105 } 106 106 107 - static int tas2781_force_fwload_get(struct snd_kcontrol *kcontrol, 107 + static int tasdev_force_fwload_get(struct snd_kcontrol *kcontrol, 108 108 struct snd_ctl_elem_value *ucontrol) 109 109 { 110 110 struct snd_soc_component *component = ··· 119 119 return 0; 120 120 } 121 121 122 - static int tas2781_force_fwload_put(struct snd_kcontrol *kcontrol, 122 + static int tasdev_force_fwload_put(struct snd_kcontrol *kcontrol, 123 123 struct snd_ctl_elem_value *ucontrol) 124 124 { 125 125 struct snd_soc_component *component = ··· 140 140 return change; 141 141 } 142 142 143 + static const struct snd_kcontrol_new tasdevice_snd_controls[] = { 144 + SOC_SINGLE_BOOL_EXT("Speaker Force Firmware Load", 0, 145 + tasdev_force_fwload_get, tasdev_force_fwload_put), 146 + }; 147 + 143 148 static const struct snd_kcontrol_new tas2781_snd_controls[] = { 144 149 SOC_SINGLE_RANGE_EXT_TLV("Speaker Analog Gain", TAS2781_AMP_LEVEL, 145 150 1, 0, 20, 0, tas2781_amp_getvol, ··· 152 147 SOC_SINGLE_RANGE_EXT_TLV("Speaker Digital Gain", TAS2781_DVC_LVL, 153 148 0, 0, 200, 1, tas2781_digital_getvol, 154 149 tas2781_digital_putvol, dvc_tlv), 155 - SOC_SINGLE_BOOL_EXT("Speaker Force Firmware Load", 0, 156 - tas2781_force_fwload_get, tas2781_force_fwload_put), 157 150 }; 158 151 159 152 static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol, ··· 593 590 static int tasdevice_codec_probe(struct snd_soc_component *codec) 594 591 { 595 592 struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); 593 + int rc; 594 + 595 + if (tas_priv->chip_id == TAS2781) { 596 + rc = snd_soc_add_component_controls(codec, 597 + tas2781_snd_controls, 598 + ARRAY_SIZE(tas2781_snd_controls)); 599 + if (rc < 0) { 600 + dev_err(tas_priv->dev, "%s: Add control err rc = %d", 601 + __func__, rc); 602 + return rc; 603 + } 604 + } 596 605 597 606 tas_priv->name_prefix = codec->name_prefix; 598 607 return tascodec_init(tas_priv, codec, THIS_MODULE, tasdevice_fw_ready); ··· 632 617 soc_codec_driver_tasdevice = { 633 618 .probe = tasdevice_codec_probe, 634 619 .remove = tasdevice_codec_remove, 635 - .controls = tas2781_snd_controls, 636 - .num_controls = ARRAY_SIZE(tas2781_snd_controls), 620 + .controls = tasdevice_snd_controls, 621 + .num_controls = ARRAY_SIZE(tasdevice_snd_controls), 637 622 .dapm_widgets = tasdevice_dapm_widgets, 638 623 .num_dapm_widgets = ARRAY_SIZE(tasdevice_dapm_widgets), 639 624 .dapm_routes = tasdevice_audio_map, ··· 774 759 775 760 static struct i2c_driver tasdevice_i2c_driver = { 776 761 .driver = { 777 - .name = "tas2781-codec", 762 + .name = "tasdev-codec", 778 763 .of_match_table = of_match_ptr(tasdevice_of_match), 779 764 #ifdef CONFIG_ACPI 780 765 .acpi_match_table = ACPI_PTR(tasdevice_acpi_match),