diff options
Diffstat (limited to 'sound/soc/omap/sdp4430.c')
-rw-r--r-- | sound/soc/omap/sdp4430.c | 50 |
1 files changed, 5 insertions, 45 deletions
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 5d67c25bca5e..b80efb02bfca 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c | |||
@@ -36,8 +36,6 @@ | |||
36 | #include "omap-pcm.h" | 36 | #include "omap-pcm.h" |
37 | #include "../codecs/twl6040.h" | 37 | #include "../codecs/twl6040.h" |
38 | 38 | ||
39 | static int twl6040_power_mode; | ||
40 | |||
41 | static int sdp4430_hw_params(struct snd_pcm_substream *substream, | 39 | static int sdp4430_hw_params(struct snd_pcm_substream *substream, |
42 | struct snd_pcm_hw_params *params) | 40 | struct snd_pcm_hw_params *params) |
43 | { | 41 | { |
@@ -46,13 +44,13 @@ static int sdp4430_hw_params(struct snd_pcm_substream *substream, | |||
46 | int clk_id, freq; | 44 | int clk_id, freq; |
47 | int ret; | 45 | int ret; |
48 | 46 | ||
49 | if (twl6040_power_mode) { | 47 | clk_id = twl6040_get_clk_id(rtd->codec); |
50 | clk_id = TWL6040_SYSCLK_SEL_HPPLL; | 48 | if (clk_id == TWL6040_SYSCLK_SEL_HPPLL) |
51 | freq = 38400000; | 49 | freq = 38400000; |
52 | } else { | 50 | else if (clk_id == TWL6040_SYSCLK_SEL_LPPLL) |
53 | clk_id = TWL6040_SYSCLK_SEL_LPPLL; | ||
54 | freq = 32768; | 51 | freq = 32768; |
55 | } | 52 | else |
53 | return -EINVAL; | ||
56 | 54 | ||
57 | /* set the codec mclk */ | 55 | /* set the codec mclk */ |
58 | ret = snd_soc_dai_set_sysclk(codec_dai, clk_id, freq, | 56 | ret = snd_soc_dai_set_sysclk(codec_dai, clk_id, freq, |
@@ -83,35 +81,6 @@ static struct snd_soc_jack_pin hs_jack_pins[] = { | |||
83 | }, | 81 | }, |
84 | }; | 82 | }; |
85 | 83 | ||
86 | static int sdp4430_get_power_mode(struct snd_kcontrol *kcontrol, | ||
87 | struct snd_ctl_elem_value *ucontrol) | ||
88 | { | ||
89 | ucontrol->value.integer.value[0] = twl6040_power_mode; | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | static int sdp4430_set_power_mode(struct snd_kcontrol *kcontrol, | ||
94 | struct snd_ctl_elem_value *ucontrol) | ||
95 | { | ||
96 | if (twl6040_power_mode == ucontrol->value.integer.value[0]) | ||
97 | return 0; | ||
98 | |||
99 | twl6040_power_mode = ucontrol->value.integer.value[0]; | ||
100 | |||
101 | return 1; | ||
102 | } | ||
103 | |||
104 | static const char *power_texts[] = {"Low-Power", "High-Performance"}; | ||
105 | |||
106 | static const struct soc_enum sdp4430_enum[] = { | ||
107 | SOC_ENUM_SINGLE_EXT(2, power_texts), | ||
108 | }; | ||
109 | |||
110 | static const struct snd_kcontrol_new sdp4430_controls[] = { | ||
111 | SOC_ENUM_EXT("TWL6040 Power Mode", sdp4430_enum[0], | ||
112 | sdp4430_get_power_mode, sdp4430_set_power_mode), | ||
113 | }; | ||
114 | |||
115 | /* SDP4430 machine DAPM */ | 84 | /* SDP4430 machine DAPM */ |
116 | static const struct snd_soc_dapm_widget sdp4430_twl6040_dapm_widgets[] = { | 85 | static const struct snd_soc_dapm_widget sdp4430_twl6040_dapm_widgets[] = { |
117 | SND_SOC_DAPM_MIC("Ext Mic", NULL), | 86 | SND_SOC_DAPM_MIC("Ext Mic", NULL), |
@@ -154,12 +123,6 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) | |||
154 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 123 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
155 | int ret; | 124 | int ret; |
156 | 125 | ||
157 | /* Add SDP4430 specific controls */ | ||
158 | ret = snd_soc_add_controls(codec, sdp4430_controls, | ||
159 | ARRAY_SIZE(sdp4430_controls)); | ||
160 | if (ret) | ||
161 | return ret; | ||
162 | |||
163 | /* Add SDP4430 specific widgets */ | 126 | /* Add SDP4430 specific widgets */ |
164 | ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets, | 127 | ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets, |
165 | ARRAY_SIZE(sdp4430_twl6040_dapm_widgets)); | 128 | ARRAY_SIZE(sdp4430_twl6040_dapm_widgets)); |
@@ -239,9 +202,6 @@ static int __init sdp4430_soc_init(void) | |||
239 | if (ret) | 202 | if (ret) |
240 | goto err; | 203 | goto err; |
241 | 204 | ||
242 | /* Codec starts in HP mode */ | ||
243 | twl6040_power_mode = 1; | ||
244 | |||
245 | return 0; | 205 | return 0; |
246 | 206 | ||
247 | err: | 207 | err: |