Lines Matching +full:4 +full:- +full:switch
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * wm9712.c -- ALSA Soc WM9712 codec support
5 * Copyright 2006-12 Wolfson Microelectronics PLC.
76 switch (reg) { in wm9712_volatile_reg()
115 static const DECLARE_TLV_DB_SCALE(main_tlv, -3450, 150, 0);
119 SOC_ENUM_SINGLE(AC97_PCI_SVID, 14, 4, wm9712_alc_select),
120 SOC_ENUM_SINGLE(AC97_VIDEO, 12, 4, wm9712_alc_mux),
121 SOC_ENUM_SINGLE(AC97_AUX, 9, 4, wm9712_out3_src),
123 SOC_ENUM_SINGLE(AC97_REC_SEL, 12, 4, wm9712_rec_adc),
126 SOC_ENUM_SINGLE(AC97_MIC, 5, 4, wm9712_mic),
135 SOC_SINGLE("Speaker Playback Switch", AC97_MASTER, 15, 1, 1),
137 SOC_SINGLE("Headphone Playback Switch", AC97_HEADPHONE, 15, 1, 1),
140 SOC_SINGLE("Speaker Playback ZC Switch", AC97_MASTER, 7, 1, 0),
141 SOC_SINGLE("Speaker Playback Invert Switch", AC97_MASTER, 6, 1, 0),
142 SOC_SINGLE("Headphone Playback ZC Switch", AC97_HEADPHONE, 7, 1, 0),
143 SOC_SINGLE("Mono Playback ZC Switch", AC97_MASTER_MONO, 7, 1, 0),
145 SOC_SINGLE("Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1),
149 SOC_SINGLE("ALC Decay Time", AC97_CODEC_CLASS_REV, 4, 15, 0),
154 SOC_SINGLE("ALC ZC Switch", AC97_PCI_SVID, 8, 1, 0),
155 SOC_SINGLE("ALC NG Switch", AC97_PCI_SVID, 7, 1, 0),
162 SOC_SINGLE("Out3 Switch", AC97_AUX, 15, 1, 1),
163 SOC_SINGLE("Out3 ZC Switch", AC97_AUX, 7, 1, 1),
168 SOC_SINGLE("PCBeep Bypass Phone Volume", AC97_PC_BEEP, 4, 7, 1),
172 SOC_SINGLE("Aux Playback Phone Volume", AC97_CD, 4, 7, 1),
177 SOC_SINGLE_TLV("Capture Boost Switch", AC97_REC_SEL, 14, 1, 0, boost_tlv),
178 SOC_SINGLE_TLV("Capture to Phone Boost Switch", AC97_REC_SEL, 11, 1, 1,
181 SOC_SINGLE("3D Upper Cut-off Switch", AC97_3D_CONTROL, 5, 1, 1),
182 SOC_SINGLE("3D Lower Cut-off Switch", AC97_3D_CONTROL, 4, 1, 1),
186 SOC_SINGLE("Bass Cut-off Switch", AC97_MASTER_TONE, 12, 1, 1),
187 SOC_SINGLE("Tone Cut-off Switch", AC97_MASTER_TONE, 4, 1, 1),
188 SOC_SINGLE("Playback Attenuate (-6dB) Switch", AC97_MASTER_TONE, 6, 1, 0),
192 SOC_SINGLE("Capture Switch", AC97_REC_GAIN, 15, 1, 1),
195 SOC_SINGLE("Capture ZC Switch", AC97_REC_GAIN, 7, 1, 0),
221 unsigned int val = ucontrol->value.integer.value[0]; in wm9712_hp_mixer_put()
223 (struct soc_mixer_control *)kcontrol->private_value; in wm9712_hp_mixer_put()
228 mixer = mc->shift >> 8; in wm9712_hp_mixer_put()
229 shift = mc->shift & 0xff; in wm9712_hp_mixer_put()
232 mutex_lock(&wm9712->lock); in wm9712_hp_mixer_put()
233 old = wm9712->hp_mixer[mixer]; in wm9712_hp_mixer_put()
234 if (ucontrol->value.integer.value[0]) in wm9712_hp_mixer_put()
235 wm9712->hp_mixer[mixer] |= mask; in wm9712_hp_mixer_put()
237 wm9712->hp_mixer[mixer] &= ~mask; in wm9712_hp_mixer_put()
239 change = old != wm9712->hp_mixer[mixer]; in wm9712_hp_mixer_put()
244 if ((wm9712->hp_mixer[0] & mask) || in wm9712_hp_mixer_put()
245 (wm9712->hp_mixer[1] & mask)) in wm9712_hp_mixer_put()
254 mutex_unlock(&wm9712->lock); in wm9712_hp_mixer_put()
266 (struct soc_mixer_control *)kcontrol->private_value; in wm9712_hp_mixer_get()
269 mixer = mc->shift >> 8; in wm9712_hp_mixer_get()
270 shift = mc->shift & 0xff; in wm9712_hp_mixer_get()
272 ucontrol->value.integer.value[0] = in wm9712_hp_mixer_get()
273 (wm9712->hp_mixer[mixer] >> shift) & 1; in wm9712_hp_mixer_get()
288 WM9712_HP_MIXER_CTRL("PCBeep Bypass Switch", HPL_MIXER, 5),
289 WM9712_HP_MIXER_CTRL("Aux Playback Switch", HPL_MIXER, 4),
290 WM9712_HP_MIXER_CTRL("Phone Bypass Switch", HPL_MIXER, 3),
291 WM9712_HP_MIXER_CTRL("Line Bypass Switch", HPL_MIXER, 2),
292 WM9712_HP_MIXER_CTRL("PCM Playback Switch", HPL_MIXER, 1),
293 WM9712_HP_MIXER_CTRL("Mic Sidetone Switch", HPL_MIXER, 0),
298 WM9712_HP_MIXER_CTRL("PCBeep Bypass Switch", HPR_MIXER, 5),
299 WM9712_HP_MIXER_CTRL("Aux Playback Switch", HPR_MIXER, 4),
300 WM9712_HP_MIXER_CTRL("Phone Bypass Switch", HPR_MIXER, 3),
301 WM9712_HP_MIXER_CTRL("Line Bypass Switch", HPR_MIXER, 2),
302 WM9712_HP_MIXER_CTRL("PCM Playback Switch", HPR_MIXER, 1),
303 WM9712_HP_MIXER_CTRL("Mic Sidetone Switch", HPR_MIXER, 0),
308 SOC_DAPM_SINGLE("PCBeep Bypass Switch", AC97_PC_BEEP, 11, 1, 1),
309 SOC_DAPM_SINGLE("Aux Playback Switch", AC97_CD, 11, 1, 1),
310 SOC_DAPM_SINGLE("Phone Bypass Switch", AC97_PHONE, 14, 1, 1),
311 SOC_DAPM_SINGLE("Line Bypass Switch", AC97_LINE, 14, 1, 1),
312 SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PCM, 14, 1, 1),
317 SOC_DAPM_SINGLE("PCBeep Bypass Switch", AC97_PC_BEEP, 7, 1, 1),
318 SOC_DAPM_SINGLE("Aux Playback Switch", AC97_CD, 7, 1, 1),
319 SOC_DAPM_SINGLE("Line Bypass Switch", AC97_LINE, 13, 1, 1),
320 SOC_DAPM_SINGLE("PCM Playback Switch", AC97_PCM, 13, 1, 1),
321 SOC_DAPM_SINGLE("Mic 1 Sidetone Switch", AC97_MIC, 14, 1, 1),
322 SOC_DAPM_SINGLE("Mic 2 Sidetone Switch", AC97_MIC, 13, 1, 1),
339 SOC_DAPM_ENUM("Route", wm9712_enum[4]);
392 SND_SOC_DAPM_PGA("Headphone PGA", AC97_INT_PAGING, 4, 1, NULL, 0),
415 /* virtual mixer - mixes left & right channels for spk and mono */
420 {"Left HP Mixer", "PCBeep Bypass Switch", "PCBEEP"},
421 {"Left HP Mixer", "Aux Playback Switch", "Aux DAC"},
422 {"Left HP Mixer", "Phone Bypass Switch", "Phone PGA"},
423 {"Left HP Mixer", "Line Bypass Switch", "Line PGA"},
424 {"Left HP Mixer", "PCM Playback Switch", "Left DAC"},
425 {"Left HP Mixer", "Mic Sidetone Switch", "Mic PGA"},
429 {"Right HP Mixer", "PCBeep Bypass Switch", "PCBEEP"},
430 {"Right HP Mixer", "Aux Playback Switch", "Aux DAC"},
431 {"Right HP Mixer", "Phone Bypass Switch", "Phone PGA"},
432 {"Right HP Mixer", "Line Bypass Switch", "Line PGA"},
433 {"Right HP Mixer", "PCM Playback Switch", "Right DAC"},
434 {"Right HP Mixer", "Mic Sidetone Switch", "Mic PGA"},
438 {"Speaker Mixer", "PCBeep Bypass Switch", "PCBEEP"},
439 {"Speaker Mixer", "Line Bypass Switch", "Line PGA"},
440 {"Speaker Mixer", "PCM Playback Switch", "AC97 Mixer"},
441 {"Speaker Mixer", "Phone Bypass Switch", "Phone PGA"},
442 {"Speaker Mixer", "Aux Playback Switch", "Aux DAC"},
445 {"Phone Mixer", "PCBeep Bypass Switch", "PCBEEP"},
446 {"Phone Mixer", "Line Bypass Switch", "Line PGA"},
447 {"Phone Mixer", "Aux Playback Switch", "Aux DAC"},
448 {"Phone Mixer", "PCM Playback Switch", "AC97 Mixer"},
449 {"Phone Mixer", "Mic 1 Sidetone Switch", "Mic PGA"},
450 {"Phone Mixer", "Mic 2 Sidetone Switch", "Mic PGA"},
526 struct snd_soc_component *component = dai->component; in ac97_prepare()
528 struct snd_pcm_runtime *runtime = substream->runtime; in ac97_prepare()
532 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in ac97_prepare()
537 return snd_soc_component_write(component, reg, runtime->rate); in ac97_prepare()
543 struct snd_soc_component *component = dai->component; in ac97_aux_prepare()
544 struct snd_pcm_runtime *runtime = substream->runtime; in ac97_aux_prepare()
549 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) in ac97_aux_prepare()
550 return -ENODEV; in ac97_aux_prepare()
552 return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate); in ac97_aux_prepare()
569 .name = "wm9712-hifi",
585 .name = "wm9712-aux",
599 switch (level) { in wm9712_set_bias_level()
620 ret = snd_ac97_reset(wm9712->ac97, true, WM9712_VENDOR_ID, in wm9712_soc_resume()
638 if (wm9712->mfd_pdata) { in wm9712_soc_probe()
639 wm9712->ac97 = wm9712->mfd_pdata->ac97; in wm9712_soc_probe()
640 regmap = wm9712->mfd_pdata->regmap; in wm9712_soc_probe()
644 wm9712->ac97 = snd_soc_new_ac97_component(component, WM9712_VENDOR_ID, in wm9712_soc_probe()
646 if (IS_ERR(wm9712->ac97)) { in wm9712_soc_probe()
647 ret = PTR_ERR(wm9712->ac97); in wm9712_soc_probe()
648 dev_err(component->dev, in wm9712_soc_probe()
653 regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config); in wm9712_soc_probe()
655 snd_soc_free_ac97_component(wm9712->ac97); in wm9712_soc_probe()
659 return -ENXIO; in wm9712_soc_probe()
674 if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS) && !wm9712->mfd_pdata) { in wm9712_soc_remove()
676 snd_soc_free_ac97_component(wm9712->ac97); in wm9712_soc_remove()
701 wm9712 = devm_kzalloc(&pdev->dev, sizeof(*wm9712), GFP_KERNEL); in wm9712_probe()
703 return -ENOMEM; in wm9712_probe()
705 mutex_init(&wm9712->lock); in wm9712_probe()
707 wm9712->mfd_pdata = dev_get_platdata(&pdev->dev); in wm9712_probe()
710 return devm_snd_soc_register_component(&pdev->dev, in wm9712_probe()
716 .name = "wm9712-codec",