Lines Matching +full:spdif +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Lowlevel functions for M-Audio Delta 1010, 1010E, 44, 66, 66E, Dio2496,
37 for (idx = 7; idx >= 0; idx--) {
55 for (idx = 7; idx >= 0; idx--) {
73 switch (ice->eeprom.subvendor) {
102 switch (ice->eeprom.subvendor) {
125 struct snd_ice1712 *ice = device->bus->private_data;
129 guard(mutex)(&ice->gpio_mutex);
131 ap_cs8427_write_byte(ice, (device->addr << 1) | 0, tmp); /* address + write mode */
132 while (count-- > 0)
141 struct snd_ice1712 *ice = device->bus->private_data;
145 guard(mutex)(&ice->gpio_mutex);
147 ap_cs8427_write_byte(ice, (device->addr << 1) | 1, tmp); /* address + read mode */
148 while (count-- > 0)
158 return -ENOENT;
177 guard(mutex)(&ice->gpio_mutex);
179 for (idx = 7; idx >= 0; idx--) {
196 snd_cs8403_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_bits);
204 val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
205 scoped_guard(spinlock_irq, &ice->reg_lock) {
206 change = ice->spdif.cs8403_bits != val;
207 ice->spdif.cs8403_bits = val;
208 if (!change || ice->playback_pro_substream)
217 snd_cs8403_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_stream_bits);
225 val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
226 scoped_guard(spinlock_irq, &ice->reg_lock) {
227 change = ice->spdif.cs8403_stream_bits != val;
228 ice->spdif.cs8403_stream_bits = val;
229 if (!change || ice->playback_pro_substream)
242 struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
243 struct snd_ice1712 *ice = ak->private_data[0];
246 priv->cs_mask =
247 priv->cs_addr = chip == 0 ? ICE1712_DELTA_CODEC_CHIP_A :
256 struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
257 struct snd_ice1712 *ice = ak->private_data[0];
260 priv->cs_mask = ICE1712_DELTA_1010LT_CS;
261 priv->cs_addr = chip << 4;
269 struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
270 struct snd_ice1712 *ice = ak->private_data[0];
273 priv->cs_mask =
274 priv->cs_addr = chip == 0 ? ICE1712_DELTA_66E_CS_CHIP_A :
283 struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
284 struct snd_ice1712 *ice = ak->private_data[0];
287 priv->cs_mask =
288 priv->cs_addr = chip == 0 ? ICE1712_VX442_CODEC_CHIP_A :
299 if (rate == 0) /* no hint - S/PDIF input is master, simply return */
302 guard(mutex)(&ice->gpio_mutex);
317 struct snd_ice1712 *ice = ak->private_data[0];
319 if (rate == 0) /* no hint - S/PDIF input is master, simply return */
323 scoped_guard(mutex, &ice->gpio_mutex) {
334 scoped_guard(mutex, &ice->gpio_mutex) {
362 * SPDIF ops for Delta 1010, Dio, 66
368 ice->spdif.cs8403_stream_bits = ice->spdif.cs8403_bits;
377 scoped_guard(spinlock_irqsave, &ice->reg_lock) {
378 tmp = ice->spdif.cs8403_stream_bits;
387 change = ice->spdif.cs8403_stream_bits != tmp;
388 ice->spdif.cs8403_stream_bits = tmp;
391 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif.stream_ctl->id);
404 if (snd_i2c_sendbytes(ice->cs8427, ®, 1) != 1)
405 dev_err(ice->card->dev,
407 snd_i2c_readbytes(ice->cs8427, ®, 1);
408 ucontrol->value.integer.value[0] = (reg & CS8427_UNLOCK) ? 1 : 0;
422 * initialize the chips on M-Audio cards
427 .num_adcs = 2,
428 .num_dacs = 2,
435 .caddr = 2,
448 .num_adcs = 2,
478 .caddr = 2,
500 .caddr = 2,
523 .caddr = 2,
545 .caddr = 2,
562 /* init spdif */
563 switch (ice->eeprom.subvendor) {
570 snd_cs8427_init(ice->i2c, ice->cs8427);
578 /* Set spdif defaults */
579 snd_ice1712_delta_cs8403_spdif_write(ice, ice->spdif.cs8403_bits);
584 if (ice->akm_codecs) {
585 memcpy(akm_img_bak, ice->akm->images, sizeof(akm_img_bak));
586 memcpy(akm_vol_bak, ice->akm->volumes, sizeof(akm_vol_bak));
587 snd_akm4xxx_init(ice->akm);
588 memcpy(ice->akm->images, akm_img_bak, sizeof(akm_img_bak));
589 memcpy(ice->akm->volumes, akm_vol_bak, sizeof(akm_vol_bak));
590 snd_akm4xxx_reset(ice->akm, 0);
598 if (ice->akm_codecs) /* reset & mute codec */
599 snd_akm4xxx_reset(ice->akm, 1);
611 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010 &&
612 ice->eeprom.gpiodir == 0x7b)
613 ice->eeprom.subvendor = ICE1712_SUBDEVICE_DELTA1010E;
615 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA66 &&
616 ice->eeprom.gpiodir == 0xfb)
617 ice->eeprom.subvendor = ICE1712_SUBDEVICE_DELTA66E;
620 switch (ice->eeprom.subvendor) {
622 ice->num_total_dacs = 2;
623 ice->num_total_adcs = 2;
626 ice->num_total_dacs = 8;
627 ice->num_total_adcs = 2;
631 ice->num_total_dacs = ice->omni ? 8 : 4;
632 ice->num_total_adcs = ice->omni ? 8 : 4;
639 ice->num_total_dacs = 8;
640 ice->num_total_adcs = 8;
643 ice->num_total_dacs = 4; /* two AK4324 codecs */
647 ice->num_total_dacs = 4;
648 ice->num_total_adcs = 4;
652 ice->pm_resume = snd_ice1712_delta_resume;
653 ice->pm_suspend = snd_ice1712_delta_suspend;
654 ice->pm_suspend_enabled = 1;
662 /* initialize spdif */
663 switch (ice->eeprom.subvendor) {
670 err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c);
672 dev_err(ice->card->dev, "unable to create I2C bus\n");
675 ice->i2c->private_data = ice;
676 ice->i2c->ops = &ap_cs8427_i2c_ops;
683 ice->gpio.set_pro_rate = delta_1010_set_rate_val;
686 ice->gpio.set_pro_rate = delta_1010_set_rate_val;
689 ice->spdif.ops.open = delta_open_spdif;
690 ice->spdif.ops.setup_rate = delta_setup_spdif;
691 ice->spdif.ops.default_get = delta_spdif_default_get;
692 ice->spdif.ops.default_put = delta_spdif_default_put;
693 ice->spdif.ops.stream_get = delta_spdif_stream_get;
694 ice->spdif.ops.stream_put = delta_spdif_stream_put;
695 /* Set spdif defaults */
696 snd_ice1712_delta_cs8403_spdif_write(ice, ice->spdif.cs8403_bits);
701 switch (ice->eeprom.subvendor) {
710 ak = ice->akm = kmalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
712 return -ENOMEM;
713 ice->akm_codecs = 1;
715 switch (ice->eeprom.subvendor) {
738 return -EINVAL;
746 * additional controls for M-Audio cards
766 switch (ice->eeprom.subvendor) {
769 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010_wordclock_select, ice));
772 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010_wordclock_status, ice));
777 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_deltadio2496_spdif_in_select, ice));
783 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010lt_wordclock_select, ice));
786 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010lt_wordclock_status, ice));
792 /* normal spdif controls */
793 switch (ice->eeprom.subvendor) {
804 /* spdif status in */
805 switch (ice->eeprom.subvendor) {
810 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta_spdif_in_status, ice));
817 switch (ice->eeprom.subvendor) {