Lines Matching +full:left +full:- +full:shift

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * wm9712.c -- ALSA Soc WM9712 codec support
5 * Copyright 2006-12 Wolfson Microelectronics PLC.
100 static const char *wm9712_alc_select[] = {"None", "Left", "Right", "Stereo"};
101 static const char *wm9712_alc_mux[] = {"Stereo", "Left", "Right", "None"};
102 static const char *wm9712_out3_src[] = {"Left", "VREF", "Left + Right",
105 static const char *wm9712_rec_adc[] = {"Stereo", "Left", "Right", "Mute"};
115 static const DECLARE_TLV_DB_SCALE(main_tlv, -3450, 150, 0);
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),
211 /* We have to create a fake left and right HP mixers because
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()
224 unsigned int mixer, mask, shift, old; in wm9712_hp_mixer_put() local
228 mixer = mc->shift >> 8; in wm9712_hp_mixer_put()
229 shift = mc->shift & 0xff; in wm9712_hp_mixer_put()
230 mask = 1 << shift; 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()
242 update.reg = wm9712_mixer_mute_regs[shift]; 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()
267 unsigned int shift, mixer; in wm9712_hp_mixer_get() local
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()
282 /* Left Headphone Mixers */
337 /* Capture left select */
362 SND_SOC_DAPM_MUX("Left Capture Select", SND_SOC_NOPM, 0, 0,
366 SND_SOC_DAPM_MUX("Left Mic Select Source", SND_SOC_NOPM, 0, 0,
373 SND_SOC_DAPM_MIXER("Left HP Mixer", AC97_INT_PAGING, 9, 1,
383 SND_SOC_DAPM_DAC("Left DAC", "Left HiFi Playback", AC97_INT_PAGING, 14, 1),
386 SND_SOC_DAPM_ADC("Left ADC", "Left HiFi Capture", AC97_INT_PAGING, 12, 1),
411 /* virtual mixer - mixes left & right channels for spk and mono */
412 {"AC97 Mixer", NULL, "Left DAC"},
415 /* Left HP mixer */
416 {"Left HP Mixer", "PCBeep Bypass Switch", "PCBEEP"},
417 {"Left HP Mixer", "Aux Playback Switch", "Aux DAC"},
418 {"Left HP Mixer", "Phone Bypass Switch", "Phone PGA"},
419 {"Left HP Mixer", "Line Bypass Switch", "Line PGA"},
420 {"Left HP Mixer", "PCM Playback Switch", "Left DAC"},
421 {"Left HP Mixer", "Mic Sidetone Switch", "Mic PGA"},
422 {"Left HP Mixer", NULL, "ALC Sidetone Mux"},
458 {"Left Mic Select Source", "Mic 1", "MIC1"},
459 {"Left Mic Select Source", "Mic 2", "MIC2"},
460 {"Left Mic Select Source", "Stereo", "MIC1"},
461 {"Left Mic Select Source", "Differential", "Differential Mic"},
467 /* left capture selector */
468 {"Left Capture Select", "Mic", "MIC1"},
469 {"Left Capture Select", "Speaker Mixer", "Speaker Mixer"},
470 {"Left Capture Select", "Line", "LINEINL"},
471 {"Left Capture Select", "Headphone Mixer", "Left HP Mixer"},
472 {"Left Capture Select", "Phone Mixer", "Phone Mixer"},
473 {"Left Capture Select", "Phone", "PHONE"},
484 {"ALC Sidetone Mux", "Stereo", "Left Capture Select"},
486 {"ALC Sidetone Mux", "Left", "Left Capture Select"},
490 {"Left ADC", NULL, "Left Capture Select"},
496 {"Headphone PGA", NULL, "Left HP Mixer"},
501 {"Mono Mixer", NULL, "Left HP Mixer"},
505 {"Out3 Mux", "Left", "Left HP Mixer"},
507 {"Out3 Mux", "Left + Right", "Mono Mixer"},
522 struct snd_soc_component *component = dai->component; in ac97_prepare()
524 struct snd_pcm_runtime *runtime = substream->runtime; in ac97_prepare()
528 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in ac97_prepare()
533 return snd_soc_component_write(component, reg, runtime->rate); in ac97_prepare()
539 struct snd_soc_component *component = dai->component; in ac97_aux_prepare()
540 struct snd_pcm_runtime *runtime = substream->runtime; in ac97_aux_prepare()
545 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) in ac97_aux_prepare()
546 return -ENODEV; in ac97_aux_prepare()
548 return snd_soc_component_write(component, AC97_PCM_SURR_DAC_RATE, runtime->rate); in ac97_aux_prepare()
565 .name = "wm9712-hifi",
581 .name = "wm9712-aux",
616 ret = snd_ac97_reset(wm9712->ac97, true, WM9712_VENDOR_ID, in wm9712_soc_resume()
634 if (wm9712->mfd_pdata) { in wm9712_soc_probe()
635 wm9712->ac97 = wm9712->mfd_pdata->ac97; in wm9712_soc_probe()
636 regmap = wm9712->mfd_pdata->regmap; in wm9712_soc_probe()
640 wm9712->ac97 = snd_soc_new_ac97_component(component, WM9712_VENDOR_ID, in wm9712_soc_probe()
642 if (IS_ERR(wm9712->ac97)) { in wm9712_soc_probe()
643 ret = PTR_ERR(wm9712->ac97); in wm9712_soc_probe()
644 dev_err(component->dev, in wm9712_soc_probe()
649 regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config); in wm9712_soc_probe()
651 snd_soc_free_ac97_component(wm9712->ac97); in wm9712_soc_probe()
655 return -ENXIO; in wm9712_soc_probe()
670 if (IS_ENABLED(CONFIG_SND_SOC_AC97_BUS) && !wm9712->mfd_pdata) { in wm9712_soc_remove()
672 snd_soc_free_ac97_component(wm9712->ac97); in wm9712_soc_remove()
697 wm9712 = devm_kzalloc(&pdev->dev, sizeof(*wm9712), GFP_KERNEL); in wm9712_probe()
699 return -ENOMEM; in wm9712_probe()
701 mutex_init(&wm9712->lock); in wm9712_probe()
703 wm9712->mfd_pdata = dev_get_platdata(&pdev->dev); in wm9712_probe()
706 return devm_snd_soc_register_component(&pdev->dev, in wm9712_probe()
712 .name = "wm9712-codec",