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