Lines Matching +full:digital +full:- +full:input +full:- +full:open +full:- +full:circuit +full:- +full:detection
1 // SPDX-License-Identifier: GPL-2.0-or-later
36 * supplied by external clock provided by Xilinx array and MK73-1 PLL frequency
40 * arrangement allows to generate independent clock signal for AK4114's input
41 * rate detection circuit. As a result, Juli, unlike most other
42 * ice1724+ak4114-based cards, detects spdif input rate correctly.
44 * parameter according to the actual input rate.
46 * Juli uses the remaining three stereo-channels of its DAC to optionally
47 * monitor analog input, digital input, and digital output. The corresponding
57 * researching and fixing the input monitors
120 * Initial setup of the conversion array GPIO <-> rate
163 * If SPDIF capture and slaved to SPDIF-IN, setting runtime rate
169 struct juli_spec *spec = ice->spec; in juli_spdif_in_open()
170 struct snd_pcm_runtime *runtime = substream->runtime; in juli_spdif_in_open()
173 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK || in juli_spdif_in_open()
174 !ice->is_spdif_master(ice)) in juli_spdif_in_open()
176 rate = snd_ak4114_external_rate(spec->ak4114); in juli_spdif_in_open()
177 if (rate >= runtime->hw.rate_min && rate <= runtime->hw.rate_max) { in juli_spdif_in_open()
178 runtime->hw.rate_min = rate; in juli_spdif_in_open()
179 runtime->hw.rate_max = rate; in juli_spdif_in_open()
198 struct snd_ice1712 *ice = ak->private_data[0]; in juli_akm_write()
212 struct snd_ice1712 *ice = ak->private_data[0]; in juli_akm_set_rate_val()
213 struct juli_spec *spec = ice->spec; in juli_akm_set_rate_val()
215 if (rate == 0) /* no hint - S/PDIF input is master or the new spdif in juli_akm_set_rate_val()
216 input rate undetected, simply return */ in juli_akm_set_rate_val()
231 old_gpio = ice->gpio.get_data(ice); in juli_akm_set_rate_val()
233 /* dev_dbg(ice->card->dev, "JULI - ak5385 set_rate_val: new gpio 0x%x\n", in juli_akm_set_rate_val()
235 ice->gpio.set_data(ice, new_gpio); in juli_akm_set_rate_val()
254 snd_ak4114_reinit(spec->ak4114); in juli_akm_set_rate_val()
260 #define MONITOR_DIG_IN_VOLUME "Monitor Digital In Volume"
261 #define MONITOR_DIG_OUT_VOLUME "Monitor Digital Out Volume"
273 .num_dacs = 8, /* DAC1 - analog out
274 DAC2 - analog in monitor
275 DAC3 - digital out monitor
276 DAC4 - digital in monitor
294 val = ice->gpio.get_data(ice) & (unsigned int) kcontrol->private_value; in juli_mute_get()
295 if (kcontrol->private_value == GPIO_MUTE_CONTROL) in juli_mute_get()
297 ucontrol->value.integer.value[0] = (val) ? 0 : 1; in juli_mute_get()
300 ucontrol->value.integer.value[0] = (val) ? 1 : 0; in juli_mute_get()
309 old_gpio = ice->gpio.get_data(ice); in juli_mute_put()
310 if (ucontrol->value.integer.value[0]) { in juli_mute_put()
312 if (kcontrol->private_value == GPIO_MUTE_CONTROL) { in juli_mute_put()
315 /* un-smuting DAC */ in juli_mute_put()
316 snd_akm4xxx_write(ice->akm, 0, 0x01, 0x01); in juli_mute_put()
320 (unsigned int) kcontrol->private_value; in juli_mute_put()
323 if (kcontrol->private_value == GPIO_MUTE_CONTROL) { in juli_mute_put()
327 snd_akm4xxx_write(ice->akm, 0, 0x01, 0x03); in juli_mute_put()
331 ~((unsigned int) kcontrol->private_value); in juli_mute_put()
333 /* dev_dbg(ice->card->dev, in juli_mute_put()
334 "JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, " in juli_mute_put()
336 (unsigned int)ucontrol->value.integer.value[0], old_gpio, in juli_mute_put()
339 ice->gpio.set_data(ice, new_gpio); in juli_mute_put()
357 * operation is coded in OSS Juli driver, only Digital Out monitor
358 * seems to work. Surprisingly, Analog input monitor outputs Digital
363 * by the manufacturer is correct - I2S from ADC and AK4114
368 * an alternative possibility - the unused I2S ICE output channels
369 * switched to HW-IN/SPDIF-IN and providing the monitoring signal to
370 * the DAC - to no avail. The I2S outputs seem to be unconnected.
384 .name = "Monitor Digital Out Switch",
392 .name = "Monitor Digital In Switch",
409 DECLARE_TLV_DB_SCALE(juli_master_db_scale, -6350, 50, 1);
413 struct juli_spec *spec = ice->spec; in juli_add_controls()
423 err = snd_ctl_add(ice->card, in juli_add_controls()
432 return -ENOMEM; in juli_add_controls()
433 err = snd_ctl_add(ice->card, vmaster); in juli_add_controls()
436 err = snd_ctl_add_followers(ice->card, vmaster, follower_vols); in juli_add_controls()
441 return snd_ak4114_build(spec->ak4114, NULL, in juli_add_controls()
442 ice->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); in juli_add_controls()
452 struct snd_akm4xxx *ak = ice->akm; in juli_resume()
453 struct juli_spec *spec = ice->spec; in juli_resume()
454 /* akm4358 un-reset, un-mute */ in juli_resume()
457 snd_ak4114_resume(spec->ak4114); in juli_resume()
463 struct snd_akm4xxx *ak = ice->akm; in juli_suspend()
464 struct juli_spec *spec = ice->spec; in juli_suspend()
465 /* akm4358 reset and soft-mute */ in juli_suspend()
467 snd_ak4114_suspend(spec->ak4114); in juli_suspend()
478 return (ice->gpio.get_data(ice) & GPIO_INTERNAL_CLOCK) ? 0 : 1; in juli_is_spdif_master()
486 result = ice->gpio.get_data(ice) & GPIO_RATE_MASK; in juli_get_rate()
499 old = ice->gpio.get_data(ice); in juli_set_rate()
501 /* dev_dbg(ice->card->dev, "JULI - set_rate: old %x, new %x\n", in juli_set_rate()
505 ice->gpio.set_data(ice, new); in juli_set_rate()
506 /* switching to external clock - supplied by external circuits */ in juli_set_rate()
518 /* setting clock to external - SPDIF */
522 old = ice->gpio.get_data(ice); in juli_set_spdif_clock()
524 ice->gpio.set_data(ice, (old & ~GPIO_RATE_MASK) | GPIO_MULTI_1X | in juli_set_spdif_clock()
529 /* Called when ak4114 detects change in the input SPDIF stream */
533 struct snd_ice1712 *ice = ak4114->change_callback_private; in juli_ak4114_change()
535 if (ice->is_spdif_master(ice) && c1) { in juli_ak4114_change()
538 /* dev_dbg(ice->card->dev, "ak4114 - input rate changed to %d\n", in juli_ak4114_change()
540 juli_akm_set_rate_val(ice->akm, rate); in juli_ak4114_change()
565 return -ENOMEM; in juli_init()
566 ice->spec = spec; in juli_init()
568 err = snd_ak4114_create(ice->card, in juli_init()
572 ice, &spec->ak4114); in juli_init()
576 spec->ak4114->change_callback = juli_ak4114_change; in juli_init()
577 spec->ak4114->change_callback_private = ice; in juli_init()
579 spec->ak4114->check_flags = 0; in juli_init()
583 * it seems that the analog doughter board detection does not work reliably, so in juli_init()
587 spec->analog = (ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT) ? 0 : 1; in juli_init()
589 spec->analog = 1; in juli_init()
592 if (spec->analog) { in juli_init()
593 dev_info(ice->card->dev, "juli@: analog I/O detected\n"); in juli_init()
594 ice->num_total_dacs = 2; in juli_init()
595 ice->num_total_adcs = 2; in juli_init()
597 ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); in juli_init()
598 ak = ice->akm; in juli_init()
600 return -ENOMEM; in juli_init()
601 ice->akm_codecs = 1; in juli_init()
608 ice->hw_rates = &juli_rates_info; in juli_init()
609 ice->is_spdif_master = juli_is_spdif_master; in juli_init()
610 ice->get_rate = juli_get_rate; in juli_init()
611 ice->set_rate = juli_set_rate; in juli_init()
612 ice->set_mclk = juli_set_mclk; in juli_init()
613 ice->set_spdif_clock = juli_set_spdif_clock; in juli_init()
615 ice->spdif.ops.open = juli_spdif_in_open; in juli_init()
618 ice->pm_resume = juli_resume; in juli_init()
619 ice->pm_suspend = juli_suspend; in juli_init()
620 ice->pm_suspend_enabled = 1; in juli_init()
637 [ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, spdif-in */
638 [ICE_EEP2_GPIO_DIR] = 0x9f, /* 5, 6:inputs; 7, 4-0 outputs*/
641 [ICE_EEP2_GPIO_MASK] = 0x60, /* 5, 6: locked; 7, 4-0 writable */
642 [ICE_EEP2_GPIO_MASK1] = 0x00, /* 0-7 writable */