Lines Matching +full:spdif +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0-or-later
44 struct snd_ice1712 *ice = bus->private_data;
56 struct snd_ice1712 *ice = bus->private_data;
62 struct snd_ice1712 *ice = bus->private_data;
79 struct snd_ice1712 *ice = bus->private_data;
85 switch (ice->eeprom.subvendor) {
98 struct snd_ice1712 *ice = bus->private_data;
104 struct snd_ice1712 *ice = bus->private_data;
111 ice->gpio.direction &= ~(ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA);
112 ice->gpio.direction |= mask;
113 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->gpio.direction);
131 /* AK4524 chip select; address 0x48 bit 0-3 */
134 struct ews_spec *spec = ice->spec;
138 return -EINVAL;
139 snd_i2c_lock(ice->i2c);
140 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1)
144 if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF2], &ndata, 1)
147 snd_i2c_unlock(ice->i2c);
151 snd_i2c_unlock(ice->i2c);
152 dev_err(ice->card->dev,
154 return -EIO;
160 struct snd_ice1712 *ice = ak->private_data[0];
164 dev_err(ice->card->dev, "fatal error (ews88mt chip select)\n");
170 ice->gpio.direction | tmp);
177 struct snd_ice1712 *ice = ak->private_data[0];
186 struct snd_ice1712 *ice = ak->private_data[0];
194 ice->gpio.direction | tmp);
201 struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
202 struct snd_ice1712 *ice = ak->private_data[0];
205 tmp = priv->cs_mask = priv->cs_addr = (1 << chip) & ICE1712_6FIRE_AK4524_CS_MASK;
210 ice->gpio.direction | tmp);
220 struct ews_spec *spec = ice->spec;
221 unsigned char bytes[2];
223 snd_i2c_lock(ice->i2c);
224 switch (ice->eeprom.subvendor) {
229 if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_CS8404], &bits, 1)
234 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], bytes, 2)
235 != 2)
239 if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_88D],
240 bytes, 2) != 2)
246 snd_i2c_unlock(ice->i2c);
254 snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_bits);
262 val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
263 scoped_guard(spinlock_irq, &ice->reg_lock) {
264 change = ice->spdif.cs8403_bits != val;
265 ice->spdif.cs8403_bits = val;
266 if (!change || ice->playback_pro_substream)
275 snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_stream_bits);
283 val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
284 scoped_guard(spinlock_irq, &ice->reg_lock) {
285 change = ice->spdif.cs8403_stream_bits != val;
286 ice->spdif.cs8403_stream_bits = val;
287 if (!change || ice->playback_pro_substream)
298 ice->spdif.cs8403_stream_bits = ice->spdif.cs8403_bits;
301 /* set up SPDIF for EWS88MT / EWS88D */
307 scoped_guard(spinlock_irqsave, &ice->reg_lock) {
308 tmp = ice->spdif.cs8403_stream_bits;
317 change = ice->spdif.cs8403_stream_bits != tmp;
318 ice->spdif.cs8403_stream_bits = tmp;
321 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif.stream_ctl->id);
339 .caddr = 2,
351 .num_adcs = 2,
352 .num_dacs = 2,
360 .caddr = 2,
381 .caddr = 2,
399 #define PCF9554_REG_POLARITY 2
411 switch (ice->eeprom.subvendor) {
413 ice->num_total_dacs = 2;
414 ice->num_total_adcs = 2;
420 ice->num_total_dacs = 8;
421 ice->num_total_adcs = 8;
425 ice->num_total_dacs = 8;
426 ice->num_total_adcs = 8;
429 ice->num_total_dacs = 6;
430 ice->num_total_adcs = 6;
436 return -ENOMEM;
437 ice->spec = spec;
440 err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c);
442 dev_err(ice->card->dev, "unable to create I2C bus\n");
445 ice->i2c->private_data = ice;
446 ice->i2c->hw_ops.bit = &snd_ice1712_ewx_cs8427_bit_ops;
449 switch (ice->eeprom.subvendor) {
451 err = snd_i2c_device_create(ice->i2c, "PCF9554",
453 &spec->i2cdevs[EWS_I2C_6FIRE]);
455 dev_err(ice->card->dev,
466 err = snd_i2c_device_create(ice->i2c, "CS8404",
468 &spec->i2cdevs[EWS_I2C_CS8404]);
471 err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)",
473 &spec->i2cdevs[EWS_I2C_PCF1]);
476 err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)",
478 &spec->i2cdevs[EWS_I2C_PCF2]);
487 err = snd_i2c_device_create(ice->i2c, "PCF8575",
489 &spec->i2cdevs[EWS_I2C_88D]);
495 /* set up SPDIF interface */
496 switch (ice->eeprom.subvendor) {
501 snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
507 snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
515 ice->spdif.ops.open = ews88_open_spdif;
516 ice->spdif.ops.setup_rate = ews88_setup_spdif;
517 ice->spdif.ops.default_get = ews88_spdif_default_get;
518 ice->spdif.ops.default_put = ews88_spdif_default_put;
519 ice->spdif.ops.stream_get = ews88_spdif_stream_get;
520 ice->spdif.ops.stream_put = ews88_spdif_stream_put;
521 /* Set spdif defaults */
522 snd_ice1712_ews_cs8404_spdif_write(ice, ice->spdif.cs8403_bits);
527 switch (ice->eeprom.subvendor) {
533 ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
535 return -ENOMEM;
536 ice->akm_codecs = 1;
538 switch (ice->eeprom.subvendor) {
562 /* i/o sensitivity - this callback is shared among other devices, too */
565 static const char * const texts[2] = {
566 "+4dBu", "-10dBV",
568 return snd_ctl_enum_info(uinfo, 1, 2, texts);
574 unsigned char mask = kcontrol->private_value & 0xff;
577 ucontrol->value.enumerated.item[0] = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & mask ? 1 : 0;
585 unsigned char mask = kcontrol->private_value & 0xff;
588 if (kcontrol->private_value & (1 << 31))
589 return -EPERM;
590 nval = ucontrol->value.enumerated.item[0] ? mask : 0;
626 struct ews_spec *spec = ice->spec;
629 snd_i2c_lock(ice->i2c);
630 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) {
631 snd_i2c_unlock(ice->i2c);
632 return -EIO;
634 snd_i2c_unlock(ice->i2c);
635 ucontrol->value.enumerated.item[0] = data & ICE1712_EWS88MT_OUTPUT_SENSE ? 1 : 0; /* high = -10dBV, low = +4dBu */
643 struct ews_spec *spec = ice->spec;
646 snd_i2c_lock(ice->i2c);
647 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) {
648 snd_i2c_unlock(ice->i2c);
649 return -EIO;
651 ndata = (data & ~ICE1712_EWS88MT_OUTPUT_SENSE) | (ucontrol->value.enumerated.item[0] ? ICE1712_EWS88MT_OUTPUT_SENSE : 0);
652 if (ndata != data && snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF2],
654 snd_i2c_unlock(ice->i2c);
655 return -EIO;
657 snd_i2c_unlock(ice->i2c);
665 struct ews_spec *spec = ice->spec;
666 int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
671 snd_i2c_lock(ice->i2c);
672 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) {
673 snd_i2c_unlock(ice->i2c);
674 return -EIO;
676 /* reversed; high = +4dBu, low = -10dBV */
677 ucontrol->value.enumerated.item[0] = data & (1 << channel) ? 0 : 1;
678 snd_i2c_unlock(ice->i2c);
686 struct ews_spec *spec = ice->spec;
687 int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
692 snd_i2c_lock(ice->i2c);
693 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) {
694 snd_i2c_unlock(ice->i2c);
695 return -EIO;
697 ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel));
698 if (ndata != data && snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF1],
700 snd_i2c_unlock(ice->i2c);
701 return -EIO;
703 snd_i2c_unlock(ice->i2c);
734 struct ews_spec *spec = ice->spec;
735 int shift = kcontrol->private_value & 0xff;
736 int invert = (kcontrol->private_value >> 8) & 1;
737 unsigned char data[2];
739 snd_i2c_lock(ice->i2c);
740 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) {
741 snd_i2c_unlock(ice->i2c);
742 return -EIO;
744 snd_i2c_unlock(ice->i2c);
748 ucontrol->value.integer.value[0] = data[0];
755 struct ews_spec *spec = ice->spec;
756 int shift = kcontrol->private_value & 0xff;
757 int invert = (kcontrol->private_value >> 8) & 1;
758 unsigned char data[2], ndata[2];
761 snd_i2c_lock(ice->i2c);
762 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) {
763 snd_i2c_unlock(ice->i2c);
764 return -EIO;
768 if (! ucontrol->value.integer.value[0])
771 if (ucontrol->value.integer.value[0])
776 snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) {
777 snd_i2c_unlock(ice->i2c);
778 return -EIO;
780 snd_i2c_unlock(ice->i2c);
797 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT External Master Clock", 2, 0, 0),
810 struct ews_spec *spec = ice->spec;
812 snd_i2c_lock(ice->i2c);
814 if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) {
815 snd_i2c_unlock(ice->i2c);
816 dev_err(ice->card->dev, "cannot send pca\n");
817 return -EIO;
821 if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) {
822 snd_i2c_unlock(ice->i2c);
823 dev_err(ice->card->dev, "cannot read pca\n");
824 return -EIO;
826 snd_i2c_unlock(ice->i2c);
832 unsigned char bytes[2];
833 struct ews_spec *spec = ice->spec;
835 snd_i2c_lock(ice->i2c);
838 if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], bytes, 2) != 2) {
839 snd_i2c_unlock(ice->i2c);
840 return -EIO;
842 snd_i2c_unlock(ice->i2c);
851 int shift = kcontrol->private_value & 0xff;
852 int invert = (kcontrol->private_value >> 8) & 1;
861 ucontrol->value.integer.value[0] = data;
868 int shift = kcontrol->private_value & 0xff;
869 int invert = (kcontrol->private_value >> 8) & 1;
876 if (ucontrol->value.integer.value[0])
903 ucontrol->value.integer.value[0] = data & 3;
916 ndata |= (ucontrol->value.integer.value[0] & 3);
942 DMX6FIRE_CONTROL("Front Digital Input Switch", 2, 1),
955 /* all terratec cards have spdif, but cs8427 module builds it's own controls */
956 if (ice->cs8427 == NULL) {
963 switch (ice->eeprom.subvendor) {
977 switch (ice->eeprom.subvendor) {
980 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ewx2496_controls[idx], ice));
989 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88mt_input_sense, ice));
992 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88mt_output_sense, ice));
998 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_controls[idx], ice));
1005 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_6fire_controls[idx], ice));
1065 .mpu401_1_name = "MIDI-Front DMX6fire",