diff options
-rw-r--r-- | sound/soc/samsung/neo1973_gta02_wm8753.c | 55 |
1 files changed, 7 insertions, 48 deletions
diff --git a/sound/soc/samsung/neo1973_gta02_wm8753.c b/sound/soc/samsung/neo1973_gta02_wm8753.c index 95ebf812b146..b007dd7902e6 100644 --- a/sound/soc/samsung/neo1973_gta02_wm8753.c +++ b/sound/soc/samsung/neo1973_gta02_wm8753.c | |||
@@ -194,47 +194,14 @@ static struct snd_soc_ops neo1973_gta02_voice_ops = { | |||
194 | .hw_free = neo1973_gta02_voice_hw_free, | 194 | .hw_free = neo1973_gta02_voice_hw_free, |
195 | }; | 195 | }; |
196 | 196 | ||
197 | #define LM4853_AMP 1 | 197 | static int gta02_speaker_enabled; |
198 | #define LM4853_SPK 2 | ||
199 | |||
200 | static u8 lm4853_state; | ||
201 | |||
202 | /* This has no effect, it exists only to maintain compatibility with | ||
203 | * existing ALSA state files. | ||
204 | */ | ||
205 | static int lm4853_set_state(struct snd_kcontrol *kcontrol, | ||
206 | struct snd_ctl_elem_value *ucontrol) | ||
207 | { | ||
208 | int val = ucontrol->value.integer.value[0]; | ||
209 | |||
210 | if (val) | ||
211 | lm4853_state |= LM4853_AMP; | ||
212 | else | ||
213 | lm4853_state &= ~LM4853_AMP; | ||
214 | |||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | static int lm4853_get_state(struct snd_kcontrol *kcontrol, | ||
219 | struct snd_ctl_elem_value *ucontrol) | ||
220 | { | ||
221 | ucontrol->value.integer.value[0] = lm4853_state & LM4853_AMP; | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | 198 | ||
226 | static int lm4853_set_spk(struct snd_kcontrol *kcontrol, | 199 | static int lm4853_set_spk(struct snd_kcontrol *kcontrol, |
227 | struct snd_ctl_elem_value *ucontrol) | 200 | struct snd_ctl_elem_value *ucontrol) |
228 | { | 201 | { |
229 | int val = ucontrol->value.integer.value[0]; | 202 | gta02_speaker_enabled = ucontrol->value.integer.value[0]; |
230 | 203 | ||
231 | if (val) { | 204 | gpio_set_value(GTA02_GPIO_HP_IN, !gta02_speaker_enabled); |
232 | lm4853_state |= LM4853_SPK; | ||
233 | gpio_set_value(GTA02_GPIO_HP_IN, 0); | ||
234 | } else { | ||
235 | lm4853_state &= ~LM4853_SPK; | ||
236 | gpio_set_value(GTA02_GPIO_HP_IN, 1); | ||
237 | } | ||
238 | 205 | ||
239 | return 0; | 206 | return 0; |
240 | } | 207 | } |
@@ -242,14 +209,12 @@ static int lm4853_set_spk(struct snd_kcontrol *kcontrol, | |||
242 | static int lm4853_get_spk(struct snd_kcontrol *kcontrol, | 209 | static int lm4853_get_spk(struct snd_kcontrol *kcontrol, |
243 | struct snd_ctl_elem_value *ucontrol) | 210 | struct snd_ctl_elem_value *ucontrol) |
244 | { | 211 | { |
245 | ucontrol->value.integer.value[0] = (lm4853_state & LM4853_SPK) >> 1; | 212 | ucontrol->value.integer.value[0] = gta02_speaker_enabled; |
246 | |||
247 | return 0; | 213 | return 0; |
248 | } | 214 | } |
249 | 215 | ||
250 | static int lm4853_event(struct snd_soc_dapm_widget *w, | 216 | static int lm4853_event(struct snd_soc_dapm_widget *w, |
251 | struct snd_kcontrol *k, | 217 | struct snd_kcontrol *k, int event) |
252 | int event) | ||
253 | { | 218 | { |
254 | gpio_set_value(GTA02_GPIO_AMP_SHUT, SND_SOC_DAPM_EVENT_OFF(event)); | 219 | gpio_set_value(GTA02_GPIO_AMP_SHUT, SND_SOC_DAPM_EVENT_OFF(event)); |
255 | 220 | ||
@@ -304,13 +269,7 @@ static const struct snd_kcontrol_new wm8753_neo1973_gta02_controls[] = { | |||
304 | SOC_DAPM_PIN_SWITCH("Handset Mic"), | 269 | SOC_DAPM_PIN_SWITCH("Handset Mic"), |
305 | SOC_DAPM_PIN_SWITCH("Handset Spk"), | 270 | SOC_DAPM_PIN_SWITCH("Handset Spk"), |
306 | 271 | ||
307 | /* This has no effect, it exists only to maintain compatibility with | 272 | SOC_SINGLE_BOOL_EXT("Amp Spk Switch", 0, |
308 | * existing ALSA state files. | ||
309 | */ | ||
310 | SOC_SINGLE_EXT("Amp State Switch", 6, 0, 1, 0, | ||
311 | lm4853_get_state, | ||
312 | lm4853_set_state), | ||
313 | SOC_SINGLE_EXT("Amp Spk Switch", 7, 0, 1, 0, | ||
314 | lm4853_get_spk, | 273 | lm4853_get_spk, |
315 | lm4853_set_spk), | 274 | lm4853_set_spk), |
316 | }; | 275 | }; |