aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/ssm2602.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/ssm2602.c')
-rw-r--r--sound/soc/codecs/ssm2602.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 29d0906a924a..b47ed4f6ab20 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -140,6 +140,7 @@ SOC_DOUBLE_R("Capture Volume", SSM2602_LINVOL, SSM2602_RINVOL, 0, 31, 0),
140SOC_DOUBLE_R("Capture Switch", SSM2602_LINVOL, SSM2602_RINVOL, 7, 1, 1), 140SOC_DOUBLE_R("Capture Switch", SSM2602_LINVOL, SSM2602_RINVOL, 7, 1, 1),
141 141
142SOC_SINGLE("Mic Boost (+20dB)", SSM2602_APANA, 0, 1, 0), 142SOC_SINGLE("Mic Boost (+20dB)", SSM2602_APANA, 0, 1, 0),
143SOC_SINGLE("Mic Boost2 (+20dB)", SSM2602_APANA, 7, 1, 0),
143SOC_SINGLE("Mic Switch", SSM2602_APANA, 1, 1, 1), 144SOC_SINGLE("Mic Switch", SSM2602_APANA, 1, 1, 1),
144 145
145SOC_SINGLE("Sidetone Playback Volume", SSM2602_APANA, 6, 3, 1), 146SOC_SINGLE("Sidetone Playback Volume", SSM2602_APANA, 6, 3, 1),
@@ -277,7 +278,7 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
277 struct snd_soc_pcm_runtime *rtd = substream->private_data; 278 struct snd_soc_pcm_runtime *rtd = substream->private_data;
278 struct snd_soc_device *socdev = rtd->socdev; 279 struct snd_soc_device *socdev = rtd->socdev;
279 struct snd_soc_codec *codec = socdev->card->codec; 280 struct snd_soc_codec *codec = socdev->card->codec;
280 struct ssm2602_priv *ssm2602 = codec->private_data; 281 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
281 struct i2c_client *i2c = codec->control_data; 282 struct i2c_client *i2c = codec->control_data;
282 u16 iface = ssm2602_read_reg_cache(codec, SSM2602_IFACE) & 0xfff3; 283 u16 iface = ssm2602_read_reg_cache(codec, SSM2602_IFACE) & 0xfff3;
283 int i = get_coeff(ssm2602->sysclk, params_rate(params)); 284 int i = get_coeff(ssm2602->sysclk, params_rate(params));
@@ -322,7 +323,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
322 struct snd_soc_pcm_runtime *rtd = substream->private_data; 323 struct snd_soc_pcm_runtime *rtd = substream->private_data;
323 struct snd_soc_device *socdev = rtd->socdev; 324 struct snd_soc_device *socdev = rtd->socdev;
324 struct snd_soc_codec *codec = socdev->card->codec; 325 struct snd_soc_codec *codec = socdev->card->codec;
325 struct ssm2602_priv *ssm2602 = codec->private_data; 326 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
326 struct i2c_client *i2c = codec->control_data; 327 struct i2c_client *i2c = codec->control_data;
327 struct snd_pcm_runtime *master_runtime; 328 struct snd_pcm_runtime *master_runtime;
328 329
@@ -373,7 +374,7 @@ static void ssm2602_shutdown(struct snd_pcm_substream *substream,
373 struct snd_soc_pcm_runtime *rtd = substream->private_data; 374 struct snd_soc_pcm_runtime *rtd = substream->private_data;
374 struct snd_soc_device *socdev = rtd->socdev; 375 struct snd_soc_device *socdev = rtd->socdev;
375 struct snd_soc_codec *codec = socdev->card->codec; 376 struct snd_soc_codec *codec = socdev->card->codec;
376 struct ssm2602_priv *ssm2602 = codec->private_data; 377 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
377 378
378 /* deactivate */ 379 /* deactivate */
379 if (!codec->active) 380 if (!codec->active)
@@ -401,7 +402,7 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
401 int clk_id, unsigned int freq, int dir) 402 int clk_id, unsigned int freq, int dir)
402{ 403{
403 struct snd_soc_codec *codec = codec_dai->codec; 404 struct snd_soc_codec *codec = codec_dai->codec;
404 struct ssm2602_priv *ssm2602 = codec->private_data; 405 struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
405 switch (freq) { 406 switch (freq) {
406 case 11289600: 407 case 11289600:
407 case 12000000: 408 case 12000000:
@@ -559,7 +560,6 @@ static int ssm2602_resume(struct platform_device *pdev)
559 codec->hw_write(codec->control_data, data, 2); 560 codec->hw_write(codec->control_data, data, 2);
560 } 561 }
561 ssm2602_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 562 ssm2602_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
562 ssm2602_set_bias_level(codec, codec->suspend_bias_level);
563 return 0; 563 return 0;
564} 564}
565 565
@@ -605,8 +605,7 @@ static int ssm2602_init(struct snd_soc_device *socdev)
605 reg = ssm2602_read_reg_cache(codec, SSM2602_ROUT1V); 605 reg = ssm2602_read_reg_cache(codec, SSM2602_ROUT1V);
606 ssm2602_write(codec, SSM2602_ROUT1V, reg | ROUT1V_RLHP_BOTH); 606 ssm2602_write(codec, SSM2602_ROUT1V, reg | ROUT1V_RLHP_BOTH);
607 /*select Line in as default input*/ 607 /*select Line in as default input*/
608 ssm2602_write(codec, SSM2602_APANA, 608 ssm2602_write(codec, SSM2602_APANA, APANA_SELECT_DAC |
609 APANA_ENABLE_MIC_BOOST2 | APANA_SELECT_DAC |
610 APANA_ENABLE_MIC_BOOST); 609 APANA_ENABLE_MIC_BOOST);
611 ssm2602_write(codec, SSM2602_PWR, 0); 610 ssm2602_write(codec, SSM2602_PWR, 0);
612 611
@@ -727,7 +726,7 @@ static int ssm2602_probe(struct platform_device *pdev)
727 return -ENOMEM; 726 return -ENOMEM;
728 } 727 }
729 728
730 codec->private_data = ssm2602; 729 snd_soc_codec_set_drvdata(codec, ssm2602);
731 socdev->card->codec = codec; 730 socdev->card->codec = codec;
732 mutex_init(&codec->mutex); 731 mutex_init(&codec->mutex);
733 INIT_LIST_HEAD(&codec->dapm_widgets); 732 INIT_LIST_HEAD(&codec->dapm_widgets);
@@ -760,7 +759,7 @@ static int ssm2602_remove(struct platform_device *pdev)
760 i2c_unregister_device(codec->control_data); 759 i2c_unregister_device(codec->control_data);
761 i2c_del_driver(&ssm2602_i2c_driver); 760 i2c_del_driver(&ssm2602_i2c_driver);
762#endif 761#endif
763 kfree(codec->private_data); 762 kfree(snd_soc_codec_get_drvdata(codec));
764 kfree(codec); 763 kfree(codec);
765 764
766 return 0; 765 return 0;