diff options
Diffstat (limited to 'sound/soc/codecs/wm8750.c')
-rw-r--r-- | sound/soc/codecs/wm8750.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index 5997fa68e0d5..b64509b01a49 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c | |||
@@ -231,21 +231,6 @@ SOC_SINGLE("Mono Playback Volume", WM8750_MOUTV, 0, 127, 0), | |||
231 | 231 | ||
232 | }; | 232 | }; |
233 | 233 | ||
234 | /* add non dapm controls */ | ||
235 | static int wm8750_add_controls(struct snd_soc_codec *codec) | ||
236 | { | ||
237 | int err, i; | ||
238 | |||
239 | for (i = 0; i < ARRAY_SIZE(wm8750_snd_controls); i++) { | ||
240 | err = snd_ctl_add(codec->card, | ||
241 | snd_soc_cnew(&wm8750_snd_controls[i], | ||
242 | codec, NULL)); | ||
243 | if (err < 0) | ||
244 | return err; | ||
245 | } | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | /* | 234 | /* |
250 | * DAPM Controls | 235 | * DAPM Controls |
251 | */ | 236 | */ |
@@ -619,7 +604,7 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream, | |||
619 | { | 604 | { |
620 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 605 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
621 | struct snd_soc_device *socdev = rtd->socdev; | 606 | struct snd_soc_device *socdev = rtd->socdev; |
622 | struct snd_soc_codec *codec = socdev->codec; | 607 | struct snd_soc_codec *codec = socdev->card->codec; |
623 | struct wm8750_priv *wm8750 = codec->private_data; | 608 | struct wm8750_priv *wm8750 = codec->private_data; |
624 | u16 iface = wm8750_read_reg_cache(codec, WM8750_IFACE) & 0x1f3; | 609 | u16 iface = wm8750_read_reg_cache(codec, WM8750_IFACE) & 0x1f3; |
625 | u16 srate = wm8750_read_reg_cache(codec, WM8750_SRATE) & 0x1c0; | 610 | u16 srate = wm8750_read_reg_cache(codec, WM8750_SRATE) & 0x1c0; |
@@ -694,6 +679,13 @@ static int wm8750_set_bias_level(struct snd_soc_codec *codec, | |||
694 | #define WM8750_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ | 679 | #define WM8750_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ |
695 | SNDRV_PCM_FMTBIT_S24_LE) | 680 | SNDRV_PCM_FMTBIT_S24_LE) |
696 | 681 | ||
682 | static struct snd_soc_dai_ops wm8750_dai_ops = { | ||
683 | .hw_params = wm8750_pcm_hw_params, | ||
684 | .digital_mute = wm8750_mute, | ||
685 | .set_fmt = wm8750_set_dai_fmt, | ||
686 | .set_sysclk = wm8750_set_dai_sysclk, | ||
687 | }; | ||
688 | |||
697 | struct snd_soc_dai wm8750_dai = { | 689 | struct snd_soc_dai wm8750_dai = { |
698 | .name = "WM8750", | 690 | .name = "WM8750", |
699 | .playback = { | 691 | .playback = { |
@@ -708,12 +700,7 @@ struct snd_soc_dai wm8750_dai = { | |||
708 | .channels_max = 2, | 700 | .channels_max = 2, |
709 | .rates = WM8750_RATES, | 701 | .rates = WM8750_RATES, |
710 | .formats = WM8750_FORMATS,}, | 702 | .formats = WM8750_FORMATS,}, |
711 | .ops = { | 703 | .ops = &wm8750_dai_ops, |
712 | .hw_params = wm8750_pcm_hw_params, | ||
713 | .digital_mute = wm8750_mute, | ||
714 | .set_fmt = wm8750_set_dai_fmt, | ||
715 | .set_sysclk = wm8750_set_dai_sysclk, | ||
716 | }, | ||
717 | }; | 704 | }; |
718 | EXPORT_SYMBOL_GPL(wm8750_dai); | 705 | EXPORT_SYMBOL_GPL(wm8750_dai); |
719 | 706 | ||
@@ -727,7 +714,7 @@ static void wm8750_work(struct work_struct *work) | |||
727 | static int wm8750_suspend(struct platform_device *pdev, pm_message_t state) | 714 | static int wm8750_suspend(struct platform_device *pdev, pm_message_t state) |
728 | { | 715 | { |
729 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 716 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
730 | struct snd_soc_codec *codec = socdev->codec; | 717 | struct snd_soc_codec *codec = socdev->card->codec; |
731 | 718 | ||
732 | wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); | 719 | wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); |
733 | return 0; | 720 | return 0; |
@@ -736,7 +723,7 @@ static int wm8750_suspend(struct platform_device *pdev, pm_message_t state) | |||
736 | static int wm8750_resume(struct platform_device *pdev) | 723 | static int wm8750_resume(struct platform_device *pdev) |
737 | { | 724 | { |
738 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 725 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
739 | struct snd_soc_codec *codec = socdev->codec; | 726 | struct snd_soc_codec *codec = socdev->card->codec; |
740 | int i; | 727 | int i; |
741 | u8 data[2]; | 728 | u8 data[2]; |
742 | u16 *cache = codec->reg_cache; | 729 | u16 *cache = codec->reg_cache; |
@@ -769,7 +756,7 @@ static int wm8750_resume(struct platform_device *pdev) | |||
769 | */ | 756 | */ |
770 | static int wm8750_init(struct snd_soc_device *socdev) | 757 | static int wm8750_init(struct snd_soc_device *socdev) |
771 | { | 758 | { |
772 | struct snd_soc_codec *codec = socdev->codec; | 759 | struct snd_soc_codec *codec = socdev->card->codec; |
773 | int reg, ret = 0; | 760 | int reg, ret = 0; |
774 | 761 | ||
775 | codec->name = "WM8750"; | 762 | codec->name = "WM8750"; |
@@ -816,7 +803,8 @@ static int wm8750_init(struct snd_soc_device *socdev) | |||
816 | reg = wm8750_read_reg_cache(codec, WM8750_RINVOL); | 803 | reg = wm8750_read_reg_cache(codec, WM8750_RINVOL); |
817 | wm8750_write(codec, WM8750_RINVOL, reg | 0x0100); | 804 | wm8750_write(codec, WM8750_RINVOL, reg | 0x0100); |
818 | 805 | ||
819 | wm8750_add_controls(codec); | 806 | snd_soc_add_controls(codec, wm8750_snd_controls, |
807 | ARRAY_SIZE(wm8750_snd_controls)); | ||
820 | wm8750_add_widgets(codec); | 808 | wm8750_add_widgets(codec); |
821 | ret = snd_soc_init_card(socdev); | 809 | ret = snd_soc_init_card(socdev); |
822 | if (ret < 0) { | 810 | if (ret < 0) { |
@@ -850,7 +838,7 @@ static int wm8750_i2c_probe(struct i2c_client *i2c, | |||
850 | const struct i2c_device_id *id) | 838 | const struct i2c_device_id *id) |
851 | { | 839 | { |
852 | struct snd_soc_device *socdev = wm8750_socdev; | 840 | struct snd_soc_device *socdev = wm8750_socdev; |
853 | struct snd_soc_codec *codec = socdev->codec; | 841 | struct snd_soc_codec *codec = socdev->card->codec; |
854 | int ret; | 842 | int ret; |
855 | 843 | ||
856 | i2c_set_clientdata(i2c, codec); | 844 | i2c_set_clientdata(i2c, codec); |
@@ -931,7 +919,7 @@ err_driver: | |||
931 | static int __devinit wm8750_spi_probe(struct spi_device *spi) | 919 | static int __devinit wm8750_spi_probe(struct spi_device *spi) |
932 | { | 920 | { |
933 | struct snd_soc_device *socdev = wm8750_socdev; | 921 | struct snd_soc_device *socdev = wm8750_socdev; |
934 | struct snd_soc_codec *codec = socdev->codec; | 922 | struct snd_soc_codec *codec = socdev->card->codec; |
935 | int ret; | 923 | int ret; |
936 | 924 | ||
937 | codec->control_data = spi; | 925 | codec->control_data = spi; |
@@ -1003,7 +991,7 @@ static int wm8750_probe(struct platform_device *pdev) | |||
1003 | } | 991 | } |
1004 | 992 | ||
1005 | codec->private_data = wm8750; | 993 | codec->private_data = wm8750; |
1006 | socdev->codec = codec; | 994 | socdev->card->codec = codec; |
1007 | mutex_init(&codec->mutex); | 995 | mutex_init(&codec->mutex); |
1008 | INIT_LIST_HEAD(&codec->dapm_widgets); | 996 | INIT_LIST_HEAD(&codec->dapm_widgets); |
1009 | INIT_LIST_HEAD(&codec->dapm_paths); | 997 | INIT_LIST_HEAD(&codec->dapm_paths); |
@@ -1057,7 +1045,7 @@ static int run_delayed_work(struct delayed_work *dwork) | |||
1057 | static int wm8750_remove(struct platform_device *pdev) | 1045 | static int wm8750_remove(struct platform_device *pdev) |
1058 | { | 1046 | { |
1059 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 1047 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
1060 | struct snd_soc_codec *codec = socdev->codec; | 1048 | struct snd_soc_codec *codec = socdev->card->codec; |
1061 | 1049 | ||
1062 | if (codec->control_data) | 1050 | if (codec->control_data) |
1063 | wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1051 | wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); |