Lines Matching +full:ac +full:- +full:detect +full:- +full:gpios

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
34 * VT1722 (Envy24GT) - 6 outputs, 4 inputs (only 2 used), 24-bit/96kHz
42 * AC-Link configuration ICE_EEP2_ACLINK=0x80
60 * 2-channel DAC used for main output and stereo ADC (with 10-channel MUX)
63 * MODE (pin16) -- GND
64 * CE (pin17) -- GND I2C mode (address=0x34)
65 * DI (pin18) -- SDA (VT1722 pin70)
66 * CL (pin19) -- SCLK (VT1722 pin71)
69 * 6-channel DAC used for rear & center/LFE outputs (only 4 channels used)
71 * MODE (pin 1) -- GPIO19 (VT1722 pin99)
72 * ML/I2S (pin11) -- GPIO18 (VT1722 pin98)
73 * MC/IWL (pin12) -- GPIO17 (VT1722 pin97)
74 * MD/DM (pin13) -- GPIO16 (VT1722 pin96)
75 * MUTE (pin14) -- GPIO20 (VT1722 pin101)
82 * 5.1ch name -- output connector color -- device (-D option)
84 * FRONT 2ch -- green -- plughw:0,0
85 * CENTER(Lch) SUBWOOFER(Rch) -- orange -- plughw:0,2,0
86 * REAR 2ch -- black -- plughw:0,2,1
89 /* codec access low-level functions */
107 struct snd_ice1712 *ice = spec->ice; in psc724_wm8766_write()
114 snd_ice1712_gpio_set_dir(ice, ice->gpio.direction | PSC724_SPI_MASK); in psc724_wm8766_write()
115 snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask & ~PSC724_SPI_MASK); in psc724_wm8766_write()
150 snd_vt1724_write_i2c(spec->ice, 0x34, addr, data); in psc724_wm8776_write()
158 struct psc724_spec *spec = ice->spec; in psc724_set_master_switch()
160 spec->mute_all = !on; in psc724_set_master_switch()
170 struct psc724_spec *spec = ice->spec; in psc724_get_master_switch()
172 return !spec->mute_all; in psc724_get_master_switch()
179 struct psc724_spec *spec = ice->spec; in psc724_set_jack_state()
182 u16 power = spec->wm8776.regs[WM8776_REG_PWRDOWN] & ~WM8776_PWR_HPPD; in psc724_set_jack_state()
187 snd_wm8776_set_power(&spec->wm8776, power); in psc724_set_jack_state()
188 spec->hp_connected = hp_connected; in psc724_set_jack_state()
194 kctl = snd_ctl_find_id(ice->card, &elem_id); in psc724_set_jack_state()
195 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); in psc724_set_jack_state()
197 strlcpy(elem_id.name, spec->wm8776.ctl[WM8776_CTL_HP_SW].name, in psc724_set_jack_state()
199 kctl = snd_ctl_find_id(ice->card, &elem_id); in psc724_set_jack_state()
200 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); in psc724_set_jack_state()
207 struct snd_ice1712 *ice = spec->ice; in psc724_update_hp_jack_state()
210 schedule_delayed_work(&spec->hp_work, msecs_to_jiffies(JACK_INTERVAL)); in psc724_update_hp_jack_state()
211 if (hp_connected == spec->hp_connected) in psc724_update_hp_jack_state()
218 struct psc724_spec *spec = ice->spec; in psc724_set_jack_detection()
220 if (spec->jack_detect == on) in psc724_set_jack_detection()
223 spec->jack_detect = on; in psc724_set_jack_detection()
227 schedule_delayed_work(&spec->hp_work, in psc724_set_jack_detection()
230 cancel_delayed_work_sync(&spec->hp_work); in psc724_set_jack_detection()
235 struct psc724_spec *spec = ice->spec; in psc724_get_jack_detection()
237 return spec->jack_detect; in psc724_get_jack_detection()
265 int n = kcontrol->private_value; in psc724_ctl_get()
267 ucontrol->value.integer.value[0] = psc724_cont[n].get(ice); in psc724_ctl_get()
276 int n = kcontrol->private_value; in psc724_ctl_put()
278 psc724_cont[n].set(ice, ucontrol->value.integer.value[0]); in psc724_ctl_put()
285 static const char *front_zc = "Front Zero Cross Detect Playback Switch";
286 static const char *front_izd = "Front Infinite Zero Detect Playback Switch";
302 static const char *rear_clfe_izd = "Rear Infinite Zero Detect Playback Switch";
303 static const char *rear_clfe_zc = "Rear Zero Cross Detect Playback Switch";
310 struct psc724_spec *spec = ice->spec; in psc724_add_controls()
312 spec->wm8776.ctl[WM8776_CTL_DAC_VOL].name = front_volume; in psc724_add_controls()
313 spec->wm8776.ctl[WM8776_CTL_DAC_SW].name = front_switch; in psc724_add_controls()
314 spec->wm8776.ctl[WM8776_CTL_DAC_ZC_SW].name = front_zc; in psc724_add_controls()
315 spec->wm8776.ctl[WM8776_CTL_AUX_SW].name = NULL; in psc724_add_controls()
316 spec->wm8776.ctl[WM8776_CTL_DAC_IZD_SW].name = front_izd; in psc724_add_controls()
317 spec->wm8776.ctl[WM8776_CTL_PHASE_SW].name = front_phase; in psc724_add_controls()
318 spec->wm8776.ctl[WM8776_CTL_DEEMPH_SW].name = front_deemph; in psc724_add_controls()
319 spec->wm8776.ctl[WM8776_CTL_INPUT1_SW].name = ain1_switch; in psc724_add_controls()
320 spec->wm8776.ctl[WM8776_CTL_INPUT2_SW].name = ain2_switch; in psc724_add_controls()
321 spec->wm8776.ctl[WM8776_CTL_INPUT3_SW].name = ain3_switch; in psc724_add_controls()
322 spec->wm8776.ctl[WM8776_CTL_INPUT4_SW].name = ain4_switch; in psc724_add_controls()
323 spec->wm8776.ctl[WM8776_CTL_INPUT5_SW].name = ain5_switch; in psc724_add_controls()
324 snd_wm8776_build_controls(&spec->wm8776); in psc724_add_controls()
325 spec->wm8766.ctl[WM8766_CTL_CH1_VOL].name = rear_volume; in psc724_add_controls()
326 spec->wm8766.ctl[WM8766_CTL_CH2_VOL].name = clfe_volume; in psc724_add_controls()
327 spec->wm8766.ctl[WM8766_CTL_CH3_VOL].name = NULL; in psc724_add_controls()
328 spec->wm8766.ctl[WM8766_CTL_CH1_SW].name = rear_switch; in psc724_add_controls()
329 spec->wm8766.ctl[WM8766_CTL_CH2_SW].name = clfe_switch; in psc724_add_controls()
330 spec->wm8766.ctl[WM8766_CTL_CH3_SW].name = NULL; in psc724_add_controls()
331 spec->wm8766.ctl[WM8766_CTL_PHASE1_SW].name = rear_phase; in psc724_add_controls()
332 spec->wm8766.ctl[WM8766_CTL_PHASE2_SW].name = clfe_phase; in psc724_add_controls()
333 spec->wm8766.ctl[WM8766_CTL_PHASE3_SW].name = NULL; in psc724_add_controls()
334 spec->wm8766.ctl[WM8766_CTL_DEEMPH1_SW].name = rear_deemph; in psc724_add_controls()
335 spec->wm8766.ctl[WM8766_CTL_DEEMPH2_SW].name = clfe_deemph; in psc724_add_controls()
336 spec->wm8766.ctl[WM8766_CTL_DEEMPH3_SW].name = NULL; in psc724_add_controls()
337 spec->wm8766.ctl[WM8766_CTL_IZD_SW].name = rear_clfe_izd; in psc724_add_controls()
338 spec->wm8766.ctl[WM8766_CTL_ZC_SW].name = rear_clfe_zc; in psc724_add_controls()
339 snd_wm8766_build_controls(&spec->wm8766); in psc724_add_controls()
352 return -ENOMEM; in psc724_add_controls()
353 err = snd_ctl_add(ice->card, ctl); in psc724_add_controls()
363 struct psc724_spec *spec = ice->spec; in psc724_set_pro_rate()
365 snd_wm8776_volume_restore(&spec->wm8776); in psc724_set_pro_rate()
366 snd_wm8766_volume_restore(&spec->wm8766); in psc724_set_pro_rate()
374 struct psc724_spec *spec = ice->spec; in psc724_resume()
376 snd_wm8776_resume(&spec->wm8776); in psc724_resume()
377 snd_wm8766_resume(&spec->wm8766); in psc724_resume()
391 return -ENOMEM; in psc724_init()
392 ice->spec = spec; in psc724_init()
393 spec->ice = ice; in psc724_init()
395 ice->num_total_dacs = 6; in psc724_init()
396 ice->num_total_adcs = 2; in psc724_init()
397 spec->wm8776.ops.write = psc724_wm8776_write; in psc724_init()
398 spec->wm8776.card = ice->card; in psc724_init()
399 snd_wm8776_init(&spec->wm8776); in psc724_init()
400 spec->wm8766.ops.write = psc724_wm8766_write; in psc724_init()
401 spec->wm8766.card = ice->card; in psc724_init()
403 ice->pm_resume = psc724_resume; in psc724_init()
404 ice->pm_suspend_enabled = 1; in psc724_init()
406 snd_wm8766_init(&spec->wm8766); in psc724_init()
407 snd_wm8766_set_if(&spec->wm8766, in psc724_init()
409 ice->gpio.set_pro_rate = psc724_set_pro_rate; in psc724_init()
410 INIT_DELAYED_WORK(&spec->hp_work, psc724_update_hp_jack_state); in psc724_init()
417 struct psc724_spec *spec = ice->spec; in psc724_exit()
419 cancel_delayed_work_sync(&spec->hp_work); in psc724_exit()
422 /* PSC724 has buggy EEPROM (no 96&192kHz, all FFh GPIOs), so override it here */
427 [ICE_EEP2_SPDIF] = 0xc1, /* spdif out-en, out-int, no input */
431 [ICE_EEP2_GPIO_MASK] = 0xff, /* read-only */
432 [ICE_EEP2_GPIO_MASK1] = 0xff, /* read-only */