diff options
Diffstat (limited to 'sound/soc/codecs/tas2781-i2c.c')
| -rw-r--r-- | sound/soc/codecs/tas2781-i2c.c | 106 |
1 files changed, 66 insertions, 40 deletions
diff --git a/sound/soc/codecs/tas2781-i2c.c b/sound/soc/codecs/tas2781-i2c.c index 8f37aa00e62e..d1c76ab0144d 100644 --- a/sound/soc/codecs/tas2781-i2c.c +++ b/sound/soc/codecs/tas2781-i2c.c @@ -105,14 +105,20 @@ static const struct i2c_device_id tasdevice_id[] = { { "tas2120", TAS2120 }, { "tas2320", TAS2320 }, { "tas2563", TAS2563 }, + { "tas2568", TAS2568 }, { "tas2570", TAS2570 }, { "tas2572", TAS2572 }, + { "tas2574", TAS2574 }, { "tas2781", TAS2781 }, { "tas5802", TAS5802 }, + { "tas5806m", TAS5806M }, + { "tas5806md", TAS5806MD }, { "tas5815", TAS5815 }, + { "tas5822", TAS5822 }, { "tas5825", TAS5825 }, { "tas5827", TAS5827 }, { "tas5828", TAS5828 }, + { "tas5830", TAS5830 }, {} }; MODULE_DEVICE_TABLE(i2c, tasdevice_id); @@ -124,14 +130,20 @@ static const struct of_device_id tasdevice_of_match[] = { { .compatible = "ti,tas2120" }, { .compatible = "ti,tas2320" }, { .compatible = "ti,tas2563" }, + { .compatible = "ti,tas2568" }, { .compatible = "ti,tas2570" }, { .compatible = "ti,tas2572" }, + { .compatible = "ti,tas2574" }, { .compatible = "ti,tas2781" }, { .compatible = "ti,tas5802" }, + { .compatible = "ti,tas5806m" }, + { .compatible = "ti,tas5806md" }, { .compatible = "ti,tas5815" }, + { .compatible = "ti,tas5822" }, { .compatible = "ti,tas5825" }, { .compatible = "ti,tas5827" }, { .compatible = "ti,tas5828" }, + { .compatible = "ti,tas5830" }, {}, }; MODULE_DEVICE_TABLE(of, tasdevice_of_match); @@ -151,7 +163,7 @@ MODULE_DEVICE_TABLE(of, tasdevice_of_match); static int tas2781_digital_getvol(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; @@ -162,7 +174,7 @@ static int tas2781_digital_getvol(struct snd_kcontrol *kcontrol, static int tas2781_digital_putvol(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; @@ -173,7 +185,7 @@ static int tas2781_digital_putvol(struct snd_kcontrol *kcontrol, static int tas2781_amp_getvol(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; @@ -184,7 +196,7 @@ static int tas2781_amp_getvol(struct snd_kcontrol *kcontrol, static int tas2781_amp_putvol(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); struct soc_mixer_control *mc = @@ -196,8 +208,7 @@ static int tas2781_amp_putvol(struct snd_kcontrol *kcontrol, static int tasdev_force_fwload_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *component = - snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(component); @@ -211,8 +222,7 @@ static int tasdev_force_fwload_get(struct snd_kcontrol *kcontrol, static int tasdev_force_fwload_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *component = - snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(component); bool change, val = (bool)ucontrol->value.integer.value[0]; @@ -232,7 +242,7 @@ static int tasdev_force_fwload_put(struct snd_kcontrol *kcontrol, static int tasdev_cali_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *priv = snd_soc_component_get_drvdata(comp); struct soc_bytes_ext *bytes_ext = (struct soc_bytes_ext *) kcontrol->private_value; @@ -469,7 +479,7 @@ static void sngl_calib_start(struct tasdevice_priv *tas_priv, int i, static int tas2781_calib_start_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *priv = snd_soc_component_get_drvdata(comp); struct soc_bytes_ext *bytes_ext = (struct soc_bytes_ext *) kcontrol->private_value; @@ -542,7 +552,7 @@ static int tas2563_calib_start_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct bulk_reg_val *q = (struct bulk_reg_val *)tas2563_cali_start_reg; - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp); const int sum = ARRAY_SIZE(tas2563_cali_start_reg); int i, j; @@ -606,7 +616,7 @@ static void tas2563_calib_stop_put(struct tasdevice_priv *tas_priv) static int tasdev_calib_stop_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *priv = snd_soc_component_get_drvdata(comp); guard(mutex)(&priv->codec_lock); @@ -621,7 +631,7 @@ static int tasdev_calib_stop_put(struct snd_kcontrol *kcontrol, static int tasdev_cali_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *priv = snd_soc_component_get_drvdata(comp); struct soc_bytes_ext *bytes_ext = (struct soc_bytes_ext *) kcontrol->private_value; @@ -668,7 +678,7 @@ static int tasdev_cali_data_put(struct snd_kcontrol *kcontrol, static int tas2781_latch_reg_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp); struct i2c_client *clt = (struct i2c_client *)tas_priv->client; struct soc_bytes_ext *bytes_ext = @@ -701,7 +711,7 @@ static int tas2781_latch_reg_get(struct snd_kcontrol *kcontrol, static int tasdev_tf_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp); struct soc_bytes_ext *bytes_ext = (struct soc_bytes_ext *) kcontrol->private_value; @@ -728,7 +738,7 @@ static int tasdev_tf_data_get(struct snd_kcontrol *kcontrol, static int tasdev_re_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp); struct soc_bytes_ext *bytes_ext = (struct soc_bytes_ext *) kcontrol->private_value; @@ -754,7 +764,7 @@ static int tasdev_re_data_get(struct snd_kcontrol *kcontrol, static int tasdev_r0_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp); struct calidata *cali_data = &tas_priv->cali_data; struct soc_bytes_ext *bytes_ext = @@ -777,7 +787,7 @@ static int tasdev_r0_data_get(struct snd_kcontrol *kcontrol, static int tasdev_XMA1_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp); struct tasdevice_fw *tas_fmw = tas_priv->fmw; struct fct_param_address *p = &(tas_fmw->fct_par_addr); @@ -797,7 +807,7 @@ static int tasdev_XMA1_data_get(struct snd_kcontrol *kcontrol, static int tasdev_XMA2_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(comp); struct tasdevice_fw *tas_fmw = tas_priv->fmw; struct fct_param_address *p = &(tas_fmw->fct_par_addr); @@ -827,7 +837,7 @@ static int tasdevice_digital_gain_get( { struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_dev = snd_soc_component_get_drvdata(codec); unsigned int l = 0, r = mc->max; unsigned int target, ar_mid, mid, ar_l, ar_r; @@ -871,7 +881,7 @@ static int tasdevice_digital_gain_put( { struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_dev = snd_soc_component_get_drvdata(codec); int vol = ucontrol->value.integer.value[0]; int status = 0, max = mc->max, rc = 1; @@ -973,7 +983,7 @@ static const struct snd_kcontrol_new tas2563_cali_controls[] = { static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); int ret = 0; @@ -990,7 +1000,7 @@ static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol, static int tasdevice_info_active_num(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; @@ -1015,7 +1025,7 @@ static int tasdevice_info_chip_id(struct snd_kcontrol *kcontrol, static int tasdevice_info_programs(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); struct tasdevice_fw *tas_fw = tas_priv->fmw; @@ -1030,8 +1040,7 @@ static int tasdevice_info_programs(struct snd_kcontrol *kcontrol, static int tasdevice_info_configurations( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - struct snd_soc_component *codec = - snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); struct tasdevice_fw *tas_fw = tas_priv->fmw; @@ -1046,7 +1055,7 @@ static int tasdevice_info_configurations( static int tasdevice_info_profile(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; @@ -1060,7 +1069,7 @@ static int tasdevice_info_profile(struct snd_kcontrol *kcontrol, static int tasdevice_get_profile_id(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); ucontrol->value.integer.value[0] = tas_priv->rcabin.profile_cfg_id; @@ -1071,7 +1080,7 @@ static int tasdevice_get_profile_id(struct snd_kcontrol *kcontrol, static int tasdevice_get_chip_id(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); ucontrol->value.integer.value[0] = tas_priv->chip_id; @@ -1117,7 +1126,7 @@ out: static int tasdevice_program_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); ucontrol->value.integer.value[0] = tas_priv->cur_prog; @@ -1128,7 +1137,7 @@ static int tasdevice_program_get(struct snd_kcontrol *kcontrol, static int tasdevice_program_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); unsigned int nr_program = ucontrol->value.integer.value[0]; int ret = 0; @@ -1145,7 +1154,7 @@ static int tasdevice_configuration_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); ucontrol->value.integer.value[0] = tas_priv->cur_conf; @@ -1157,7 +1166,7 @@ static int tasdevice_configuration_put( struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); unsigned int nr_configuration = ucontrol->value.integer.value[0]; int ret = 0; @@ -1173,7 +1182,7 @@ static int tasdevice_configuration_put( static int tasdevice_active_num_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); struct i2c_client *clt = (struct i2c_client *)tas_priv->client; struct tasdevice *tasdev = tas_priv->tasdevice; @@ -1192,7 +1201,7 @@ static int tasdevice_active_num_get(struct snd_kcontrol *kcontrol, static int tasdevice_active_num_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); + struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); struct tasdevice_priv *tas_priv = snd_soc_component_get_drvdata(codec); int dev_id = ucontrol->value.integer.value[0]; int max = tas_priv->ndev - 1; @@ -1391,7 +1400,7 @@ static int tasdevice_create_cali_ctrls(struct tasdevice_priv *priv) /* * Alloc kcontrol via devm_kzalloc(), which don't manually - * free the kcontrol。 + * free the kcontrol. */ cali_ctrls = devm_kcalloc(priv->dev, nctrls, sizeof(cali_ctrls[0]), GFP_KERNEL); @@ -1644,8 +1653,10 @@ static void tasdevice_fw_ready(const struct firmware *fmw, case TAS2118: case TAS2120: case TAS2320: + case TAS2568: case TAS2570: case TAS2572: + case TAS2574: goto out; } if (tas_priv->name_prefix) @@ -1671,9 +1682,7 @@ static void tasdevice_fw_ready(const struct firmware *fmw, } tas_priv->fw_state = TASDEVICE_DSP_FW_ALL_OK; - /* There is no calibration required for - * TAS5802/TAS5815/TAS5825/TAS5827/TAS5828. - */ + /* There is no calibration required for TAS58XX. */ if (tas_priv->chip_id < TAS5802) { ret = tasdevice_create_cali_ctrls(tas_priv); if (ret) { @@ -1729,10 +1738,14 @@ out: case TAS2563: case TAS2781: case TAS5802: + case TAS5806M: + case TAS5806MD: case TAS5815: + case TAS5822: case TAS5825: case TAS5827: case TAS5828: + case TAS5830: /* If DSP FW fail, DSP kcontrol won't be created. */ tasdevice_dsp_remove(tas_priv); } @@ -1883,8 +1896,10 @@ static int tasdevice_codec_probe(struct snd_soc_component *codec) case TAS2118: case TAS2120: case TAS2320: + case TAS2568: case TAS2570: case TAS2572: + case TAS2574: p = (struct snd_kcontrol_new *)tas2x20_snd_controls; size = ARRAY_SIZE(tas2x20_snd_controls); tas_priv->dvc_tlv_table = tas2x20_dvc_table; @@ -1894,10 +1909,14 @@ static int tasdevice_codec_probe(struct snd_soc_component *codec) size = ARRAY_SIZE(tas2781_snd_controls); break; case TAS5802: + case TAS5806M: + case TAS5806MD: case TAS5815: + case TAS5822: case TAS5825: case TAS5827: case TAS5828: + case TAS5830: p = (struct snd_kcontrol_new *)tas5825_snd_controls; size = ARRAY_SIZE(tas5825_snd_controls); break; @@ -2004,7 +2023,8 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv) dev_err(tas_priv->dev, "%s Can't get reset GPIO\n", __func__); - strcpy(tas_priv->dev_name, tasdevice_id[tas_priv->chip_id].name); + strscpy(tas_priv->dev_name, tasdevice_id[tas_priv->chip_id].name, + sizeof(tas_priv->dev_name)); } static int tasdevice_i2c_probe(struct i2c_client *i2c) @@ -2070,14 +2090,20 @@ static const struct acpi_device_id tasdevice_acpi_match[] = { { "TXNW2120", TAS2120 }, { "TXNW2320", TAS2320 }, { "TXNW2563", TAS2563 }, + { "TXNW2568", TAS2568 }, { "TXNW2570", TAS2570 }, { "TXNW2572", TAS2572 }, + { "TXNW2574", TAS2574 }, { "TXNW2781", TAS2781 }, { "TXNW5802", TAS5802 }, + { "TXNW806M", TAS5806M }, + { "TXNW806D", TAS5806MD }, { "TXNW5815", TAS5815 }, + { "TXNW5822", TAS5822 }, { "TXNW5825", TAS5825 }, { "TXNW5827", TAS5827 }, { "TXNW5828", TAS5828 }, + { "TXNW5830", TAS5830 }, {}, }; |
