aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320aic23.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-03-28 20:22:18 -0400
committerDave Airlie <airlied@redhat.com>2009-03-28 20:22:18 -0400
commit90f959bcb386da2c71613dcefc6a285e054a539e (patch)
treeee3e9dd4111d4aad12e579cb0c2c159114dff263 /sound/soc/codecs/tlv320aic23.c
parent41f13fe81dd1b08723ab9f3fc3c7f29cfa81f1a5 (diff)
parent07d43ba98621f08e252a48c96b258b4d572b0257 (diff)
drm: merge Linux master into HEAD
Conflicts: drivers/gpu/drm/drm_info.c drivers/gpu/drm/drm_proc.c drivers/gpu/drm/i915/i915_gem_debugfs.c
Diffstat (limited to 'sound/soc/codecs/tlv320aic23.c')
-rw-r--r--sound/soc/codecs/tlv320aic23.c57
1 files changed, 21 insertions, 36 deletions
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index cfdea007c4cb..c3f4afb5d017 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -183,24 +183,6 @@ static const struct snd_kcontrol_new tlv320aic23_snd_controls[] = {
183 SOC_ENUM("Playback De-emphasis", tlv320aic23_deemph), 183 SOC_ENUM("Playback De-emphasis", tlv320aic23_deemph),
184}; 184};
185 185
186/* add non dapm controls */
187static int tlv320aic23_add_controls(struct snd_soc_codec *codec)
188{
189
190 int err, i;
191
192 for (i = 0; i < ARRAY_SIZE(tlv320aic23_snd_controls); i++) {
193 err = snd_ctl_add(codec->card,
194 snd_soc_cnew(&tlv320aic23_snd_controls[i],
195 codec, NULL));
196 if (err < 0)
197 return err;
198 }
199
200 return 0;
201
202}
203
204/* PGA Mixer controls for Line and Mic switch */ 186/* PGA Mixer controls for Line and Mic switch */
205static const struct snd_kcontrol_new tlv320aic23_output_mixer_controls[] = { 187static const struct snd_kcontrol_new tlv320aic23_output_mixer_controls[] = {
206 SOC_DAPM_SINGLE("Line Bypass Switch", TLV320AIC23_ANLG, 3, 1, 0), 188 SOC_DAPM_SINGLE("Line Bypass Switch", TLV320AIC23_ANLG, 3, 1, 0),
@@ -423,7 +405,7 @@ static int tlv320aic23_hw_params(struct snd_pcm_substream *substream,
423{ 405{
424 struct snd_soc_pcm_runtime *rtd = substream->private_data; 406 struct snd_soc_pcm_runtime *rtd = substream->private_data;
425 struct snd_soc_device *socdev = rtd->socdev; 407 struct snd_soc_device *socdev = rtd->socdev;
426 struct snd_soc_codec *codec = socdev->codec; 408 struct snd_soc_codec *codec = socdev->card->codec;
427 u16 iface_reg; 409 u16 iface_reg;
428 int ret; 410 int ret;
429 struct aic23 *aic23 = container_of(codec, struct aic23, codec); 411 struct aic23 *aic23 = container_of(codec, struct aic23, codec);
@@ -471,7 +453,7 @@ static int tlv320aic23_pcm_prepare(struct snd_pcm_substream *substream,
471{ 453{
472 struct snd_soc_pcm_runtime *rtd = substream->private_data; 454 struct snd_soc_pcm_runtime *rtd = substream->private_data;
473 struct snd_soc_device *socdev = rtd->socdev; 455 struct snd_soc_device *socdev = rtd->socdev;
474 struct snd_soc_codec *codec = socdev->codec; 456 struct snd_soc_codec *codec = socdev->card->codec;
475 457
476 /* set active */ 458 /* set active */
477 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0001); 459 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0001);
@@ -484,7 +466,7 @@ static void tlv320aic23_shutdown(struct snd_pcm_substream *substream,
484{ 466{
485 struct snd_soc_pcm_runtime *rtd = substream->private_data; 467 struct snd_soc_pcm_runtime *rtd = substream->private_data;
486 struct snd_soc_device *socdev = rtd->socdev; 468 struct snd_soc_device *socdev = rtd->socdev;
487 struct snd_soc_codec *codec = socdev->codec; 469 struct snd_soc_codec *codec = socdev->card->codec;
488 struct aic23 *aic23 = container_of(codec, struct aic23, codec); 470 struct aic23 *aic23 = container_of(codec, struct aic23, codec);
489 471
490 /* deactivate */ 472 /* deactivate */
@@ -598,6 +580,15 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec,
598#define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 580#define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
599 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) 581 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
600 582
583static struct snd_soc_dai_ops tlv320aic23_dai_ops = {
584 .prepare = tlv320aic23_pcm_prepare,
585 .hw_params = tlv320aic23_hw_params,
586 .shutdown = tlv320aic23_shutdown,
587 .digital_mute = tlv320aic23_mute,
588 .set_fmt = tlv320aic23_set_dai_fmt,
589 .set_sysclk = tlv320aic23_set_dai_sysclk,
590};
591
601struct snd_soc_dai tlv320aic23_dai = { 592struct snd_soc_dai tlv320aic23_dai = {
602 .name = "tlv320aic23", 593 .name = "tlv320aic23",
603 .playback = { 594 .playback = {
@@ -612,14 +603,7 @@ struct snd_soc_dai tlv320aic23_dai = {
612 .channels_max = 2, 603 .channels_max = 2,
613 .rates = AIC23_RATES, 604 .rates = AIC23_RATES,
614 .formats = AIC23_FORMATS,}, 605 .formats = AIC23_FORMATS,},
615 .ops = { 606 .ops = &tlv320aic23_dai_ops,
616 .prepare = tlv320aic23_pcm_prepare,
617 .hw_params = tlv320aic23_hw_params,
618 .shutdown = tlv320aic23_shutdown,
619 .digital_mute = tlv320aic23_mute,
620 .set_fmt = tlv320aic23_set_dai_fmt,
621 .set_sysclk = tlv320aic23_set_dai_sysclk,
622 }
623}; 607};
624EXPORT_SYMBOL_GPL(tlv320aic23_dai); 608EXPORT_SYMBOL_GPL(tlv320aic23_dai);
625 609
@@ -627,7 +611,7 @@ static int tlv320aic23_suspend(struct platform_device *pdev,
627 pm_message_t state) 611 pm_message_t state)
628{ 612{
629 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 613 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
630 struct snd_soc_codec *codec = socdev->codec; 614 struct snd_soc_codec *codec = socdev->card->codec;
631 615
632 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0); 616 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0);
633 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF); 617 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -638,7 +622,7 @@ static int tlv320aic23_suspend(struct platform_device *pdev,
638static int tlv320aic23_resume(struct platform_device *pdev) 622static int tlv320aic23_resume(struct platform_device *pdev)
639{ 623{
640 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 624 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
641 struct snd_soc_codec *codec = socdev->codec; 625 struct snd_soc_codec *codec = socdev->card->codec;
642 int i; 626 int i;
643 u16 reg; 627 u16 reg;
644 628
@@ -660,7 +644,7 @@ static int tlv320aic23_resume(struct platform_device *pdev)
660 */ 644 */
661static int tlv320aic23_init(struct snd_soc_device *socdev) 645static int tlv320aic23_init(struct snd_soc_device *socdev)
662{ 646{
663 struct snd_soc_codec *codec = socdev->codec; 647 struct snd_soc_codec *codec = socdev->card->codec;
664 int ret = 0; 648 int ret = 0;
665 u16 reg; 649 u16 reg;
666 650
@@ -718,7 +702,8 @@ static int tlv320aic23_init(struct snd_soc_device *socdev)
718 702
719 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x1); 703 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x1);
720 704
721 tlv320aic23_add_controls(codec); 705 snd_soc_add_controls(codec, tlv320aic23_snd_controls,
706 ARRAY_SIZE(tlv320aic23_snd_controls));
722 tlv320aic23_add_widgets(codec); 707 tlv320aic23_add_widgets(codec);
723 ret = snd_soc_init_card(socdev); 708 ret = snd_soc_init_card(socdev);
724 if (ret < 0) { 709 if (ret < 0) {
@@ -746,7 +731,7 @@ static int tlv320aic23_codec_probe(struct i2c_client *i2c,
746 const struct i2c_device_id *i2c_id) 731 const struct i2c_device_id *i2c_id)
747{ 732{
748 struct snd_soc_device *socdev = tlv320aic23_socdev; 733 struct snd_soc_device *socdev = tlv320aic23_socdev;
749 struct snd_soc_codec *codec = socdev->codec; 734 struct snd_soc_codec *codec = socdev->card->codec;
750 int ret; 735 int ret;
751 736
752 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 737 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -804,7 +789,7 @@ static int tlv320aic23_probe(struct platform_device *pdev)
804 if (aic23 == NULL) 789 if (aic23 == NULL)
805 return -ENOMEM; 790 return -ENOMEM;
806 codec = &aic23->codec; 791 codec = &aic23->codec;
807 socdev->codec = codec; 792 socdev->card->codec = codec;
808 mutex_init(&codec->mutex); 793 mutex_init(&codec->mutex);
809 INIT_LIST_HEAD(&codec->dapm_widgets); 794 INIT_LIST_HEAD(&codec->dapm_widgets);
810 INIT_LIST_HEAD(&codec->dapm_paths); 795 INIT_LIST_HEAD(&codec->dapm_paths);
@@ -823,7 +808,7 @@ static int tlv320aic23_probe(struct platform_device *pdev)
823static int tlv320aic23_remove(struct platform_device *pdev) 808static int tlv320aic23_remove(struct platform_device *pdev)
824{ 809{
825 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 810 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
826 struct snd_soc_codec *codec = socdev->codec; 811 struct snd_soc_codec *codec = socdev->card->codec;
827 struct aic23 *aic23 = container_of(codec, struct aic23, codec); 812 struct aic23 *aic23 = container_of(codec, struct aic23, codec);
828 813
829 if (codec->control_data) 814 if (codec->control_data)