wm8731.c (aa0258adf6078a41a3db06f4e498253aff64d151) wm8731.c (3598aad5470deb5eb4f643ef89abb9b172803e76)
1/*
2 * wm8731.c -- WM8731 ALSA SoC Audio driver
3 *
4 * Copyright 2005 Openedhand Ltd.
5 * Copyright 2006-12 Wolfson Microelectronics, plc
6 *
7 * Author: Richard Purdie <richard@openedhand.com>
8 *

--- 105 unchanged lines hidden (view full) ---

114 best, wm8731_deemph[best]);
115
116 return snd_soc_update_bits(codec, WM8731_APDIGI, 0x6, val);
117}
118
119static int wm8731_get_deemph(struct snd_kcontrol *kcontrol,
120 struct snd_ctl_elem_value *ucontrol)
121{
1/*
2 * wm8731.c -- WM8731 ALSA SoC Audio driver
3 *
4 * Copyright 2005 Openedhand Ltd.
5 * Copyright 2006-12 Wolfson Microelectronics, plc
6 *
7 * Author: Richard Purdie <richard@openedhand.com>
8 *

--- 105 unchanged lines hidden (view full) ---

114 best, wm8731_deemph[best]);
115
116 return snd_soc_update_bits(codec, WM8731_APDIGI, 0x6, val);
117}
118
119static int wm8731_get_deemph(struct snd_kcontrol *kcontrol,
120 struct snd_ctl_elem_value *ucontrol)
121{
122 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
122 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
123 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
124
125 ucontrol->value.enumerated.item[0] = wm8731->deemph;
126
127 return 0;
128}
129
130static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
131 struct snd_ctl_elem_value *ucontrol)
132{
123 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
124
125 ucontrol->value.enumerated.item[0] = wm8731->deemph;
126
127 return 0;
128}
129
130static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
131 struct snd_ctl_elem_value *ucontrol)
132{
133 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
133 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
134 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
135 int deemph = ucontrol->value.enumerated.item[0];
136 int ret = 0;
137
138 if (deemph > 1)
139 return -EINVAL;
140
141 mutex_lock(&codec->mutex);

--- 439 unchanged lines hidden (view full) ---

581static int wm8731_probe(struct snd_soc_codec *codec)
582{
583 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
584 int ret = 0, i;
585
586 for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++)
587 wm8731->supplies[i].supply = wm8731_supply_names[i];
588
134 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
135 int deemph = ucontrol->value.enumerated.item[0];
136 int ret = 0;
137
138 if (deemph > 1)
139 return -EINVAL;
140
141 mutex_lock(&codec->mutex);

--- 439 unchanged lines hidden (view full) ---

581static int wm8731_probe(struct snd_soc_codec *codec)
582{
583 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
584 int ret = 0, i;
585
586 for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++)
587 wm8731->supplies[i].supply = wm8731_supply_names[i];
588
589 ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8731->supplies),
589 ret = devm_regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8731->supplies),
590 wm8731->supplies);
591 if (ret != 0) {
592 dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
593 return ret;
594 }
595
596 ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies),
597 wm8731->supplies);
598 if (ret != 0) {
599 dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
590 wm8731->supplies);
591 if (ret != 0) {
592 dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
593 return ret;
594 }
595
596 ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies),
597 wm8731->supplies);
598 if (ret != 0) {
599 dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
600 goto err_regulator_get;
600 return ret;
601 }
602
603 ret = wm8731_reset(codec);
604 if (ret < 0) {
605 dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
606 goto err_regulator_enable;
607 }
608

--- 10 unchanged lines hidden (view full) ---

619
620 /* Regulators will have been enabled by bias management */
621 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
622
623 return 0;
624
625err_regulator_enable:
626 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
601 }
602
603 ret = wm8731_reset(codec);
604 if (ret < 0) {
605 dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
606 goto err_regulator_enable;
607 }
608

--- 10 unchanged lines hidden (view full) ---

619
620 /* Regulators will have been enabled by bias management */
621 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
622
623 return 0;
624
625err_regulator_enable:
626 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
627err_regulator_get:
628 regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
629
630 return ret;
631}
632
633/* power down chip */
634static int wm8731_remove(struct snd_soc_codec *codec)
635{
636 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
637
638 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
639
640 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
627
628 return ret;
629}
630
631/* power down chip */
632static int wm8731_remove(struct snd_soc_codec *codec)
633{
634 struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
635
636 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
637
638 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
641 regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
642
643 return 0;
644}
645
646static struct snd_soc_codec_driver soc_codec_dev_wm8731 = {
647 .probe = wm8731_probe,
648 .remove = wm8731_remove,
649 .suspend = wm8731_suspend,

--- 169 unchanged lines hidden ---
639
640 return 0;
641}
642
643static struct snd_soc_codec_driver soc_codec_dev_wm8731 = {
644 .probe = wm8731_probe,
645 .remove = wm8731_remove,
646 .suspend = wm8731_suspend,

--- 169 unchanged lines hidden ---