Lines Matching refs:ice
58 struct snd_ice1712 *ice = bus->private_data; in ewx_i2c_setlines() local
64 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp); in ewx_i2c_setlines()
70 struct snd_ice1712 *ice = bus->private_data; in ewx_i2c_getclock() local
71 return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_CLOCK ? 1 : 0; in ewx_i2c_getclock()
76 struct snd_ice1712 *ice = bus->private_data; in ewx_i2c_getdata() local
79 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_RW); in ewx_i2c_getdata()
80 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, 0); in ewx_i2c_getdata()
83 bit = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_DATA ? 1 : 0; in ewx_i2c_getdata()
85 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ICE1712_EWX2496_RW); in ewx_i2c_getdata()
87 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_SERIAL_CLOCK); in ewx_i2c_getdata()
93 struct snd_ice1712 *ice = bus->private_data; in ewx_i2c_start() local
96 snd_ice1712_save_gpio_status(ice); in ewx_i2c_start()
99 switch (ice->eeprom.subvendor) { in ewx_i2c_start()
107 snd_ice1712_gpio_write_bits(ice, mask, mask); in ewx_i2c_start()
112 struct snd_ice1712 *ice = bus->private_data; in ewx_i2c_stop() local
113 snd_ice1712_restore_gpio_status(ice); in ewx_i2c_stop()
118 struct snd_ice1712 *ice = bus->private_data; in ewx_i2c_direction() local
125 ice->gpio.direction &= ~(ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA); in ewx_i2c_direction()
126 ice->gpio.direction |= mask; in ewx_i2c_direction()
127 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->gpio.direction); in ewx_i2c_direction()
128 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~mask); in ewx_i2c_direction()
146 static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mask) in snd_ice1712_ews88mt_chip_select() argument
148 struct ews_spec *spec = ice->spec; in snd_ice1712_ews88mt_chip_select()
153 snd_i2c_lock(ice->i2c); in snd_ice1712_ews88mt_chip_select()
161 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_chip_select()
165 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_chip_select()
166 dev_err(ice->card->dev, in snd_ice1712_ews88mt_chip_select()
174 struct snd_ice1712 *ice = ak->private_data[0]; in ews88mt_ak4524_lock() local
177 if (snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f) < 0) in ews88mt_ak4524_lock()
178 dev_err(ice->card->dev, "fatal error (ews88mt chip select)\n"); in ews88mt_ak4524_lock()
179 snd_ice1712_save_gpio_status(ice); in ews88mt_ak4524_lock()
183 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, in ews88mt_ak4524_lock()
184 ice->gpio.direction | tmp); in ews88mt_ak4524_lock()
185 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~tmp); in ews88mt_ak4524_lock()
191 struct snd_ice1712 *ice = ak->private_data[0]; in ews88mt_ak4524_unlock() local
192 snd_ice1712_restore_gpio_status(ice); in ews88mt_ak4524_unlock()
194 snd_ice1712_ews88mt_chip_select(ice, 0x0f); in ews88mt_ak4524_unlock()
200 struct snd_ice1712 *ice = ak->private_data[0]; in ewx2496_ak4524_lock() local
202 snd_ice1712_save_gpio_status(ice); in ewx2496_ak4524_lock()
207 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, in ewx2496_ak4524_lock()
208 ice->gpio.direction | tmp); in ewx2496_ak4524_lock()
209 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~tmp); in ewx2496_ak4524_lock()
216 struct snd_ice1712 *ice = ak->private_data[0]; in dmx6fire_ak4524_lock() local
218 snd_ice1712_save_gpio_status(ice); in dmx6fire_ak4524_lock()
223 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, in dmx6fire_ak4524_lock()
224 ice->gpio.direction | tmp); in dmx6fire_ak4524_lock()
225 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~tmp); in dmx6fire_ak4524_lock()
232 static void snd_ice1712_ews_cs8404_spdif_write(struct snd_ice1712 *ice, unsigned char bits) in snd_ice1712_ews_cs8404_spdif_write() argument
234 struct ews_spec *spec = ice->spec; in snd_ice1712_ews_cs8404_spdif_write()
237 snd_i2c_lock(ice->i2c); in snd_ice1712_ews_cs8404_spdif_write()
238 switch (ice->eeprom.subvendor) { in snd_ice1712_ews_cs8404_spdif_write()
260 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews_cs8404_spdif_write()
266 static void ews88_spdif_default_get(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol) in ews88_spdif_default_get() argument
268 snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_bits); in ews88_spdif_default_get()
271 static int ews88_spdif_default_put(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol) in ews88_spdif_default_put() argument
277 spin_lock_irq(&ice->reg_lock); in ews88_spdif_default_put()
278 change = ice->spdif.cs8403_bits != val; in ews88_spdif_default_put()
279 ice->spdif.cs8403_bits = val; in ews88_spdif_default_put()
280 if (change && ice->playback_pro_substream == NULL) { in ews88_spdif_default_put()
281 spin_unlock_irq(&ice->reg_lock); in ews88_spdif_default_put()
282 snd_ice1712_ews_cs8404_spdif_write(ice, val); in ews88_spdif_default_put()
284 spin_unlock_irq(&ice->reg_lock); in ews88_spdif_default_put()
289 static void ews88_spdif_stream_get(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol) in ews88_spdif_stream_get() argument
291 snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_stream_bits); in ews88_spdif_stream_get()
294 static int ews88_spdif_stream_put(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol) in ews88_spdif_stream_put() argument
300 spin_lock_irq(&ice->reg_lock); in ews88_spdif_stream_put()
301 change = ice->spdif.cs8403_stream_bits != val; in ews88_spdif_stream_put()
302 ice->spdif.cs8403_stream_bits = val; in ews88_spdif_stream_put()
303 if (change && ice->playback_pro_substream != NULL) { in ews88_spdif_stream_put()
304 spin_unlock_irq(&ice->reg_lock); in ews88_spdif_stream_put()
305 snd_ice1712_ews_cs8404_spdif_write(ice, val); in ews88_spdif_stream_put()
307 spin_unlock_irq(&ice->reg_lock); in ews88_spdif_stream_put()
314 static void ews88_open_spdif(struct snd_ice1712 *ice, struct snd_pcm_substream *substream) in ews88_open_spdif() argument
316 ice->spdif.cs8403_stream_bits = ice->spdif.cs8403_bits; in ews88_open_spdif()
320 static void ews88_setup_spdif(struct snd_ice1712 *ice, int rate) in ews88_setup_spdif() argument
326 spin_lock_irqsave(&ice->reg_lock, flags); in ews88_setup_spdif()
327 tmp = ice->spdif.cs8403_stream_bits; in ews88_setup_spdif()
336 change = ice->spdif.cs8403_stream_bits != tmp; in ews88_setup_spdif()
337 ice->spdif.cs8403_stream_bits = tmp; in ews88_setup_spdif()
338 spin_unlock_irqrestore(&ice->reg_lock, flags); in ews88_setup_spdif()
340 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif.stream_ctl->id); in ews88_setup_spdif()
341 snd_ice1712_ews_cs8404_spdif_write(ice, tmp); in ews88_setup_spdif()
421 static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char da…
423 static int snd_ice1712_ews_init(struct snd_ice1712 *ice) in snd_ice1712_ews_init() argument
430 switch (ice->eeprom.subvendor) { in snd_ice1712_ews_init()
432 ice->num_total_dacs = 2; in snd_ice1712_ews_init()
433 ice->num_total_adcs = 2; in snd_ice1712_ews_init()
439 ice->num_total_dacs = 8; in snd_ice1712_ews_init()
440 ice->num_total_adcs = 8; in snd_ice1712_ews_init()
444 ice->num_total_dacs = 8; in snd_ice1712_ews_init()
445 ice->num_total_adcs = 8; in snd_ice1712_ews_init()
448 ice->num_total_dacs = 6; in snd_ice1712_ews_init()
449 ice->num_total_adcs = 6; in snd_ice1712_ews_init()
456 ice->spec = spec; in snd_ice1712_ews_init()
459 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { in snd_ice1712_ews_init()
460 dev_err(ice->card->dev, "unable to create I2C bus\n"); in snd_ice1712_ews_init()
463 ice->i2c->private_data = ice; in snd_ice1712_ews_init()
464 ice->i2c->hw_ops.bit = &snd_ice1712_ewx_cs8427_bit_ops; in snd_ice1712_ews_init()
467 switch (ice->eeprom.subvendor) { in snd_ice1712_ews_init()
469 err = snd_i2c_device_create(ice->i2c, "PCF9554", in snd_ice1712_ews_init()
473 dev_err(ice->card->dev, in snd_ice1712_ews_init()
477 snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80); in snd_ice1712_ews_init()
484 err = snd_i2c_device_create(ice->i2c, "CS8404", in snd_ice1712_ews_init()
489 err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)", in snd_ice1712_ews_init()
494 err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)", in snd_ice1712_ews_init()
500 if ((err = snd_ice1712_ews88mt_chip_select(ice, 0x0f)) < 0) in snd_ice1712_ews_init()
504 err = snd_i2c_device_create(ice->i2c, "PCF8575", in snd_ice1712_ews_init()
513 switch (ice->eeprom.subvendor) { in snd_ice1712_ews_init()
515 if ((err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR)) < 0) in snd_ice1712_ews_init()
517 …snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP… in snd_ice1712_ews_init()
520 if ((err = snd_ice1712_init_cs8427(ice, ICE1712_6FIRE_CS8427_ADDR)) < 0) in snd_ice1712_ews_init()
522 …snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP… in snd_ice1712_ews_init()
530 ice->spdif.ops.open = ews88_open_spdif; in snd_ice1712_ews_init()
531 ice->spdif.ops.setup_rate = ews88_setup_spdif; in snd_ice1712_ews_init()
532 ice->spdif.ops.default_get = ews88_spdif_default_get; in snd_ice1712_ews_init()
533 ice->spdif.ops.default_put = ews88_spdif_default_put; in snd_ice1712_ews_init()
534 ice->spdif.ops.stream_get = ews88_spdif_stream_get; in snd_ice1712_ews_init()
535 ice->spdif.ops.stream_put = ews88_spdif_stream_put; in snd_ice1712_ews_init()
537 snd_ice1712_ews_cs8404_spdif_write(ice, ice->spdif.cs8403_bits); in snd_ice1712_ews_init()
542 switch (ice->eeprom.subvendor) { in snd_ice1712_ews_init()
548 ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); in snd_ice1712_ews_init()
551 ice->akm_codecs = 1; in snd_ice1712_ews_init()
553 switch (ice->eeprom.subvendor) { in snd_ice1712_ews_init()
558 err = snd_ice1712_akm4xxx_init(ak, &akm_ews88mt, &akm_ews88mt_priv, ice); in snd_ice1712_ews_init()
561 err = snd_ice1712_akm4xxx_init(ak, &akm_ewx2496, &akm_ewx2496_priv, ice); in snd_ice1712_ews_init()
564 err = snd_ice1712_akm4xxx_init(ak, &akm_6fire, &akm_6fire_priv, ice); in snd_ice1712_ews_init()
588 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_ewx_io_sense_get() local
591 snd_ice1712_save_gpio_status(ice); in snd_ice1712_ewx_io_sense_get()
592 ucontrol->value.enumerated.item[0] = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & mask ? 1 : 0; in snd_ice1712_ewx_io_sense_get()
593 snd_ice1712_restore_gpio_status(ice); in snd_ice1712_ewx_io_sense_get()
599 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_ewx_io_sense_put() local
606 snd_ice1712_save_gpio_status(ice); in snd_ice1712_ewx_io_sense_put()
607 val = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); in snd_ice1712_ewx_io_sense_put()
609 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, nval); in snd_ice1712_ewx_io_sense_put()
610 snd_ice1712_restore_gpio_status(ice); in snd_ice1712_ewx_io_sense_put()
640 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_ews88mt_output_sense_get() local
641 struct ews_spec *spec = ice->spec; in snd_ice1712_ews88mt_output_sense_get()
644 snd_i2c_lock(ice->i2c); in snd_ice1712_ews88mt_output_sense_get()
646 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_output_sense_get()
649 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_output_sense_get()
657 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_ews88mt_output_sense_put() local
658 struct ews_spec *spec = ice->spec; in snd_ice1712_ews88mt_output_sense_put()
661 snd_i2c_lock(ice->i2c); in snd_ice1712_ews88mt_output_sense_put()
663 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_output_sense_put()
669 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_output_sense_put()
672 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_output_sense_put()
679 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_ews88mt_input_sense_get() local
680 struct ews_spec *spec = ice->spec; in snd_ice1712_ews88mt_input_sense_get()
686 snd_i2c_lock(ice->i2c); in snd_ice1712_ews88mt_input_sense_get()
688 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_input_sense_get()
693 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_input_sense_get()
700 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_ews88mt_input_sense_put() local
701 struct ews_spec *spec = ice->spec; in snd_ice1712_ews88mt_input_sense_put()
707 snd_i2c_lock(ice->i2c); in snd_ice1712_ews88mt_input_sense_put()
709 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_input_sense_put()
715 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_input_sense_put()
718 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88mt_input_sense_put()
748 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_ews88d_control_get() local
749 struct ews_spec *spec = ice->spec; in snd_ice1712_ews88d_control_get()
754 snd_i2c_lock(ice->i2c); in snd_ice1712_ews88d_control_get()
756 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88d_control_get()
759 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88d_control_get()
769 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_ews88d_control_put() local
770 struct ews_spec *spec = ice->spec; in snd_ice1712_ews88d_control_put()
776 snd_i2c_lock(ice->i2c); in snd_ice1712_ews88d_control_put()
778 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88d_control_put()
792 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88d_control_put()
795 snd_i2c_unlock(ice->i2c); in snd_ice1712_ews88d_control_put()
822 static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg) in snd_ice1712_6fire_read_pca() argument
825 struct ews_spec *spec = ice->spec; in snd_ice1712_6fire_read_pca()
827 snd_i2c_lock(ice->i2c); in snd_ice1712_6fire_read_pca()
832 snd_i2c_unlock(ice->i2c); in snd_ice1712_6fire_read_pca()
833 dev_err(ice->card->dev, "cannot read pca\n"); in snd_ice1712_6fire_read_pca()
836 snd_i2c_unlock(ice->i2c); in snd_ice1712_6fire_read_pca()
840 static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char da… in snd_ice1712_6fire_write_pca() argument
843 struct ews_spec *spec = ice->spec; in snd_ice1712_6fire_write_pca()
845 snd_i2c_lock(ice->i2c); in snd_ice1712_6fire_write_pca()
849 snd_i2c_unlock(ice->i2c); in snd_ice1712_6fire_write_pca()
852 snd_i2c_unlock(ice->i2c); in snd_ice1712_6fire_write_pca()
860 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_6fire_control_get() local
865 if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0) in snd_ice1712_6fire_control_get()
876 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_6fire_control_put() local
881 if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0) in snd_ice1712_6fire_control_put()
889 snd_ice1712_6fire_write_pca(ice, PCF9554_REG_OUTPUT, (unsigned char)ndata); in snd_ice1712_6fire_control_put()
905 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_6fire_select_input_get() local
908 if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0) in snd_ice1712_6fire_select_input_get()
916 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); in snd_ice1712_6fire_select_input_put() local
919 if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0) in snd_ice1712_6fire_select_input_put()
924 snd_ice1712_6fire_write_pca(ice, PCF9554_REG_OUTPUT, (unsigned char)ndata); in snd_ice1712_6fire_select_input_put()
956 static int snd_ice1712_ews_add_controls(struct snd_ice1712 *ice) in snd_ice1712_ews_add_controls() argument
962 if (ice->cs8427 == NULL) { in snd_ice1712_ews_add_controls()
963 err = snd_ice1712_spdif_build_controls(ice); in snd_ice1712_ews_add_controls()
969 switch (ice->eeprom.subvendor) { in snd_ice1712_ews_add_controls()
976 err = snd_ice1712_akm4xxx_build_controls(ice); in snd_ice1712_ews_add_controls()
983 switch (ice->eeprom.subvendor) { in snd_ice1712_ews_add_controls()
986 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ewx2496_controls[idx], ice)); in snd_ice1712_ews_add_controls()
995 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88mt_input_sense, ice)); in snd_ice1712_ews_add_controls()
998 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88mt_output_sense, ice)); in snd_ice1712_ews_add_controls()
1004 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_controls[idx], ice)); in snd_ice1712_ews_add_controls()
1011 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_6fire_controls[idx], ice)); in snd_ice1712_ews_add_controls()