diff options
Diffstat (limited to 'sound/soc/codecs/tlv320aic3x.c')
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index aea0cb72d80a..ac73e692a99b 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -314,22 +314,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { | |||
314 | SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), | 314 | SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), |
315 | }; | 315 | }; |
316 | 316 | ||
317 | /* add non dapm controls */ | ||
318 | static int aic3x_add_controls(struct snd_soc_codec *codec) | ||
319 | { | ||
320 | int err, i; | ||
321 | |||
322 | for (i = 0; i < ARRAY_SIZE(aic3x_snd_controls); i++) { | ||
323 | err = snd_ctl_add(codec->card, | ||
324 | snd_soc_cnew(&aic3x_snd_controls[i], | ||
325 | codec, NULL)); | ||
326 | if (err < 0) | ||
327 | return err; | ||
328 | } | ||
329 | |||
330 | return 0; | ||
331 | } | ||
332 | |||
333 | /* Left DAC Mux */ | 317 | /* Left DAC Mux */ |
334 | static const struct snd_kcontrol_new aic3x_left_dac_mux_controls = | 318 | static const struct snd_kcontrol_new aic3x_left_dac_mux_controls = |
335 | SOC_DAPM_ENUM("Route", aic3x_enum[LDAC_ENUM]); | 319 | SOC_DAPM_ENUM("Route", aic3x_enum[LDAC_ENUM]); |
@@ -746,7 +730,7 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, | |||
746 | { | 730 | { |
747 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 731 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
748 | struct snd_soc_device *socdev = rtd->socdev; | 732 | struct snd_soc_device *socdev = rtd->socdev; |
749 | struct snd_soc_codec *codec = socdev->codec; | 733 | struct snd_soc_codec *codec = socdev->card->codec; |
750 | struct aic3x_priv *aic3x = codec->private_data; | 734 | struct aic3x_priv *aic3x = codec->private_data; |
751 | int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0; | 735 | int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0; |
752 | u8 data, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1; | 736 | u8 data, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1; |
@@ -1098,7 +1082,7 @@ EXPORT_SYMBOL_GPL(aic3x_dai); | |||
1098 | static int aic3x_suspend(struct platform_device *pdev, pm_message_t state) | 1082 | static int aic3x_suspend(struct platform_device *pdev, pm_message_t state) |
1099 | { | 1083 | { |
1100 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 1084 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
1101 | struct snd_soc_codec *codec = socdev->codec; | 1085 | struct snd_soc_codec *codec = socdev->card->codec; |
1102 | 1086 | ||
1103 | aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1087 | aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); |
1104 | 1088 | ||
@@ -1108,7 +1092,7 @@ static int aic3x_suspend(struct platform_device *pdev, pm_message_t state) | |||
1108 | static int aic3x_resume(struct platform_device *pdev) | 1092 | static int aic3x_resume(struct platform_device *pdev) |
1109 | { | 1093 | { |
1110 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 1094 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
1111 | struct snd_soc_codec *codec = socdev->codec; | 1095 | struct snd_soc_codec *codec = socdev->card->codec; |
1112 | int i; | 1096 | int i; |
1113 | u8 data[2]; | 1097 | u8 data[2]; |
1114 | u8 *cache = codec->reg_cache; | 1098 | u8 *cache = codec->reg_cache; |
@@ -1131,7 +1115,7 @@ static int aic3x_resume(struct platform_device *pdev) | |||
1131 | */ | 1115 | */ |
1132 | static int aic3x_init(struct snd_soc_device *socdev) | 1116 | static int aic3x_init(struct snd_soc_device *socdev) |
1133 | { | 1117 | { |
1134 | struct snd_soc_codec *codec = socdev->codec; | 1118 | struct snd_soc_codec *codec = socdev->card->codec; |
1135 | struct aic3x_setup_data *setup = socdev->codec_data; | 1119 | struct aic3x_setup_data *setup = socdev->codec_data; |
1136 | int reg, ret = 0; | 1120 | int reg, ret = 0; |
1137 | 1121 | ||
@@ -1227,7 +1211,8 @@ static int aic3x_init(struct snd_soc_device *socdev) | |||
1227 | aic3x_write(codec, AIC3X_GPIO1_REG, (setup->gpio_func[0] & 0xf) << 4); | 1211 | aic3x_write(codec, AIC3X_GPIO1_REG, (setup->gpio_func[0] & 0xf) << 4); |
1228 | aic3x_write(codec, AIC3X_GPIO2_REG, (setup->gpio_func[1] & 0xf) << 4); | 1212 | aic3x_write(codec, AIC3X_GPIO2_REG, (setup->gpio_func[1] & 0xf) << 4); |
1229 | 1213 | ||
1230 | aic3x_add_controls(codec); | 1214 | snd_soc_add_controls(codec, aic3x_snd_controls, |
1215 | ARRAY_SIZE(aic3x_snd_controls)); | ||
1231 | aic3x_add_widgets(codec); | 1216 | aic3x_add_widgets(codec); |
1232 | ret = snd_soc_init_card(socdev); | 1217 | ret = snd_soc_init_card(socdev); |
1233 | if (ret < 0) { | 1218 | if (ret < 0) { |
@@ -1261,7 +1246,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, | |||
1261 | const struct i2c_device_id *id) | 1246 | const struct i2c_device_id *id) |
1262 | { | 1247 | { |
1263 | struct snd_soc_device *socdev = aic3x_socdev; | 1248 | struct snd_soc_device *socdev = aic3x_socdev; |
1264 | struct snd_soc_codec *codec = socdev->codec; | 1249 | struct snd_soc_codec *codec = socdev->card->codec; |
1265 | int ret; | 1250 | int ret; |
1266 | 1251 | ||
1267 | i2c_set_clientdata(i2c, codec); | 1252 | i2c_set_clientdata(i2c, codec); |
@@ -1366,7 +1351,7 @@ static int aic3x_probe(struct platform_device *pdev) | |||
1366 | } | 1351 | } |
1367 | 1352 | ||
1368 | codec->private_data = aic3x; | 1353 | codec->private_data = aic3x; |
1369 | socdev->codec = codec; | 1354 | socdev->card->codec = codec; |
1370 | mutex_init(&codec->mutex); | 1355 | mutex_init(&codec->mutex); |
1371 | INIT_LIST_HEAD(&codec->dapm_widgets); | 1356 | INIT_LIST_HEAD(&codec->dapm_widgets); |
1372 | INIT_LIST_HEAD(&codec->dapm_paths); | 1357 | INIT_LIST_HEAD(&codec->dapm_paths); |
@@ -1392,7 +1377,7 @@ static int aic3x_probe(struct platform_device *pdev) | |||
1392 | static int aic3x_remove(struct platform_device *pdev) | 1377 | static int aic3x_remove(struct platform_device *pdev) |
1393 | { | 1378 | { |
1394 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 1379 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
1395 | struct snd_soc_codec *codec = socdev->codec; | 1380 | struct snd_soc_codec *codec = socdev->card->codec; |
1396 | 1381 | ||
1397 | /* power down chip */ | 1382 | /* power down chip */ |
1398 | if (codec->control_data) | 1383 | if (codec->control_data) |