18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *   ALSA driver for ICEnsemble ICE1712 (Envy24)
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *   Lowlevel functions for M-Audio Delta 1010, 1010E, 44, 66, 66E, Dio2496,
68c2ecf20Sopenharmony_ci *			    Audiophile, Digigram VX442
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci *	Copyright (c) 2000 Jaroslav Kysela <perex@perex.cz>
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/delay.h>
128c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
138c2ecf20Sopenharmony_ci#include <linux/init.h>
148c2ecf20Sopenharmony_ci#include <linux/slab.h>
158c2ecf20Sopenharmony_ci#include <linux/mutex.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include <sound/core.h>
188c2ecf20Sopenharmony_ci#include <sound/cs8427.h>
198c2ecf20Sopenharmony_ci#include <sound/asoundef.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#include "ice1712.h"
228c2ecf20Sopenharmony_ci#include "delta.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define SND_CS8403
258c2ecf20Sopenharmony_ci#include <sound/cs8403.h>
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/*
298c2ecf20Sopenharmony_ci * CS8427 via SPI mode (for Audiophile), emulated I2C
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* send 8 bits */
338c2ecf20Sopenharmony_cistatic void ap_cs8427_write_byte(struct snd_ice1712 *ice, unsigned char data, unsigned char tmp)
348c2ecf20Sopenharmony_ci{
358c2ecf20Sopenharmony_ci	int idx;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	for (idx = 7; idx >= 0; idx--) {
388c2ecf20Sopenharmony_ci		tmp &= ~(ICE1712_DELTA_AP_DOUT|ICE1712_DELTA_AP_CCLK);
398c2ecf20Sopenharmony_ci		if (data & (1 << idx))
408c2ecf20Sopenharmony_ci			tmp |= ICE1712_DELTA_AP_DOUT;
418c2ecf20Sopenharmony_ci		snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
428c2ecf20Sopenharmony_ci		udelay(5);
438c2ecf20Sopenharmony_ci		tmp |= ICE1712_DELTA_AP_CCLK;
448c2ecf20Sopenharmony_ci		snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
458c2ecf20Sopenharmony_ci		udelay(5);
468c2ecf20Sopenharmony_ci	}
478c2ecf20Sopenharmony_ci}
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* read 8 bits */
508c2ecf20Sopenharmony_cistatic unsigned char ap_cs8427_read_byte(struct snd_ice1712 *ice, unsigned char tmp)
518c2ecf20Sopenharmony_ci{
528c2ecf20Sopenharmony_ci	unsigned char data = 0;
538c2ecf20Sopenharmony_ci	int idx;
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	for (idx = 7; idx >= 0; idx--) {
568c2ecf20Sopenharmony_ci		tmp &= ~ICE1712_DELTA_AP_CCLK;
578c2ecf20Sopenharmony_ci		snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
588c2ecf20Sopenharmony_ci		udelay(5);
598c2ecf20Sopenharmony_ci		if (snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_DELTA_AP_DIN)
608c2ecf20Sopenharmony_ci			data |= 1 << idx;
618c2ecf20Sopenharmony_ci		tmp |= ICE1712_DELTA_AP_CCLK;
628c2ecf20Sopenharmony_ci		snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
638c2ecf20Sopenharmony_ci		udelay(5);
648c2ecf20Sopenharmony_ci	}
658c2ecf20Sopenharmony_ci	return data;
668c2ecf20Sopenharmony_ci}
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci/* assert chip select */
698c2ecf20Sopenharmony_cistatic unsigned char ap_cs8427_codec_select(struct snd_ice1712 *ice)
708c2ecf20Sopenharmony_ci{
718c2ecf20Sopenharmony_ci	unsigned char tmp;
728c2ecf20Sopenharmony_ci	tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
738c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
748c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010E:
758c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010LT:
768c2ecf20Sopenharmony_ci		tmp &= ~ICE1712_DELTA_1010LT_CS;
778c2ecf20Sopenharmony_ci		tmp |= ICE1712_DELTA_1010LT_CCLK | ICE1712_DELTA_1010LT_CS_CS8427;
788c2ecf20Sopenharmony_ci		break;
798c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_AUDIOPHILE:
808c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA410:
818c2ecf20Sopenharmony_ci		tmp |= ICE1712_DELTA_AP_CCLK | ICE1712_DELTA_AP_CS_CODEC;
828c2ecf20Sopenharmony_ci		tmp &= ~ICE1712_DELTA_AP_CS_DIGITAL;
838c2ecf20Sopenharmony_ci		break;
848c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66E:
858c2ecf20Sopenharmony_ci		tmp |= ICE1712_DELTA_66E_CCLK | ICE1712_DELTA_66E_CS_CHIP_A |
868c2ecf20Sopenharmony_ci		       ICE1712_DELTA_66E_CS_CHIP_B;
878c2ecf20Sopenharmony_ci		tmp &= ~ICE1712_DELTA_66E_CS_CS8427;
888c2ecf20Sopenharmony_ci		break;
898c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_VX442:
908c2ecf20Sopenharmony_ci		tmp |= ICE1712_VX442_CCLK | ICE1712_VX442_CODEC_CHIP_A | ICE1712_VX442_CODEC_CHIP_B;
918c2ecf20Sopenharmony_ci		tmp &= ~ICE1712_VX442_CS_DIGITAL;
928c2ecf20Sopenharmony_ci		break;
938c2ecf20Sopenharmony_ci	}
948c2ecf20Sopenharmony_ci	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
958c2ecf20Sopenharmony_ci	udelay(5);
968c2ecf20Sopenharmony_ci	return tmp;
978c2ecf20Sopenharmony_ci}
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci/* deassert chip select */
1008c2ecf20Sopenharmony_cistatic void ap_cs8427_codec_deassert(struct snd_ice1712 *ice, unsigned char tmp)
1018c2ecf20Sopenharmony_ci{
1028c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
1038c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010E:
1048c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010LT:
1058c2ecf20Sopenharmony_ci		tmp &= ~ICE1712_DELTA_1010LT_CS;
1068c2ecf20Sopenharmony_ci		tmp |= ICE1712_DELTA_1010LT_CS_NONE;
1078c2ecf20Sopenharmony_ci		break;
1088c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_AUDIOPHILE:
1098c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA410:
1108c2ecf20Sopenharmony_ci		tmp |= ICE1712_DELTA_AP_CS_DIGITAL;
1118c2ecf20Sopenharmony_ci		break;
1128c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66E:
1138c2ecf20Sopenharmony_ci		tmp |= ICE1712_DELTA_66E_CS_CS8427;
1148c2ecf20Sopenharmony_ci		break;
1158c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_VX442:
1168c2ecf20Sopenharmony_ci		tmp |= ICE1712_VX442_CS_DIGITAL;
1178c2ecf20Sopenharmony_ci		break;
1188c2ecf20Sopenharmony_ci	}
1198c2ecf20Sopenharmony_ci	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
1208c2ecf20Sopenharmony_ci}
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci/* sequential write */
1238c2ecf20Sopenharmony_cistatic int ap_cs8427_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count)
1248c2ecf20Sopenharmony_ci{
1258c2ecf20Sopenharmony_ci	struct snd_ice1712 *ice = device->bus->private_data;
1268c2ecf20Sopenharmony_ci	int res = count;
1278c2ecf20Sopenharmony_ci	unsigned char tmp;
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci	mutex_lock(&ice->gpio_mutex);
1308c2ecf20Sopenharmony_ci	tmp = ap_cs8427_codec_select(ice);
1318c2ecf20Sopenharmony_ci	ap_cs8427_write_byte(ice, (device->addr << 1) | 0, tmp); /* address + write mode */
1328c2ecf20Sopenharmony_ci	while (count-- > 0)
1338c2ecf20Sopenharmony_ci		ap_cs8427_write_byte(ice, *bytes++, tmp);
1348c2ecf20Sopenharmony_ci	ap_cs8427_codec_deassert(ice, tmp);
1358c2ecf20Sopenharmony_ci	mutex_unlock(&ice->gpio_mutex);
1368c2ecf20Sopenharmony_ci	return res;
1378c2ecf20Sopenharmony_ci}
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci/* sequential read */
1408c2ecf20Sopenharmony_cistatic int ap_cs8427_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count)
1418c2ecf20Sopenharmony_ci{
1428c2ecf20Sopenharmony_ci	struct snd_ice1712 *ice = device->bus->private_data;
1438c2ecf20Sopenharmony_ci	int res = count;
1448c2ecf20Sopenharmony_ci	unsigned char tmp;
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci	mutex_lock(&ice->gpio_mutex);
1478c2ecf20Sopenharmony_ci	tmp = ap_cs8427_codec_select(ice);
1488c2ecf20Sopenharmony_ci	ap_cs8427_write_byte(ice, (device->addr << 1) | 1, tmp); /* address + read mode */
1498c2ecf20Sopenharmony_ci	while (count-- > 0)
1508c2ecf20Sopenharmony_ci		*bytes++ = ap_cs8427_read_byte(ice, tmp);
1518c2ecf20Sopenharmony_ci	ap_cs8427_codec_deassert(ice, tmp);
1528c2ecf20Sopenharmony_ci	mutex_unlock(&ice->gpio_mutex);
1538c2ecf20Sopenharmony_ci	return res;
1548c2ecf20Sopenharmony_ci}
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_cistatic int ap_cs8427_probeaddr(struct snd_i2c_bus *bus, unsigned short addr)
1578c2ecf20Sopenharmony_ci{
1588c2ecf20Sopenharmony_ci	if (addr == 0x10)
1598c2ecf20Sopenharmony_ci		return 1;
1608c2ecf20Sopenharmony_ci	return -ENOENT;
1618c2ecf20Sopenharmony_ci}
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_cistatic const struct snd_i2c_ops ap_cs8427_i2c_ops = {
1648c2ecf20Sopenharmony_ci	.sendbytes = ap_cs8427_sendbytes,
1658c2ecf20Sopenharmony_ci	.readbytes = ap_cs8427_readbytes,
1668c2ecf20Sopenharmony_ci	.probeaddr = ap_cs8427_probeaddr,
1678c2ecf20Sopenharmony_ci};
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci/*
1708c2ecf20Sopenharmony_ci */
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_cistatic void snd_ice1712_delta_cs8403_spdif_write(struct snd_ice1712 *ice, unsigned char bits)
1738c2ecf20Sopenharmony_ci{
1748c2ecf20Sopenharmony_ci	unsigned char tmp, mask1, mask2;
1758c2ecf20Sopenharmony_ci	int idx;
1768c2ecf20Sopenharmony_ci	/* send byte to transmitter */
1778c2ecf20Sopenharmony_ci	mask1 = ICE1712_DELTA_SPDIF_OUT_STAT_CLOCK;
1788c2ecf20Sopenharmony_ci	mask2 = ICE1712_DELTA_SPDIF_OUT_STAT_DATA;
1798c2ecf20Sopenharmony_ci	mutex_lock(&ice->gpio_mutex);
1808c2ecf20Sopenharmony_ci	tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
1818c2ecf20Sopenharmony_ci	for (idx = 7; idx >= 0; idx--) {
1828c2ecf20Sopenharmony_ci		tmp &= ~(mask1 | mask2);
1838c2ecf20Sopenharmony_ci		if (bits & (1 << idx))
1848c2ecf20Sopenharmony_ci			tmp |= mask2;
1858c2ecf20Sopenharmony_ci		snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
1868c2ecf20Sopenharmony_ci		udelay(100);
1878c2ecf20Sopenharmony_ci		tmp |= mask1;
1888c2ecf20Sopenharmony_ci		snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
1898c2ecf20Sopenharmony_ci		udelay(100);
1908c2ecf20Sopenharmony_ci	}
1918c2ecf20Sopenharmony_ci	tmp &= ~mask1;
1928c2ecf20Sopenharmony_ci	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
1938c2ecf20Sopenharmony_ci	mutex_unlock(&ice->gpio_mutex);
1948c2ecf20Sopenharmony_ci}
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_cistatic void delta_spdif_default_get(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
1988c2ecf20Sopenharmony_ci{
1998c2ecf20Sopenharmony_ci	snd_cs8403_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_bits);
2008c2ecf20Sopenharmony_ci}
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_cistatic int delta_spdif_default_put(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
2038c2ecf20Sopenharmony_ci{
2048c2ecf20Sopenharmony_ci	unsigned int val;
2058c2ecf20Sopenharmony_ci	int change;
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci	val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
2088c2ecf20Sopenharmony_ci	spin_lock_irq(&ice->reg_lock);
2098c2ecf20Sopenharmony_ci	change = ice->spdif.cs8403_bits != val;
2108c2ecf20Sopenharmony_ci	ice->spdif.cs8403_bits = val;
2118c2ecf20Sopenharmony_ci	if (change && ice->playback_pro_substream == NULL) {
2128c2ecf20Sopenharmony_ci		spin_unlock_irq(&ice->reg_lock);
2138c2ecf20Sopenharmony_ci		snd_ice1712_delta_cs8403_spdif_write(ice, val);
2148c2ecf20Sopenharmony_ci	} else {
2158c2ecf20Sopenharmony_ci		spin_unlock_irq(&ice->reg_lock);
2168c2ecf20Sopenharmony_ci	}
2178c2ecf20Sopenharmony_ci	return change;
2188c2ecf20Sopenharmony_ci}
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_cistatic void delta_spdif_stream_get(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
2218c2ecf20Sopenharmony_ci{
2228c2ecf20Sopenharmony_ci	snd_cs8403_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_stream_bits);
2238c2ecf20Sopenharmony_ci}
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_cistatic int delta_spdif_stream_put(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
2268c2ecf20Sopenharmony_ci{
2278c2ecf20Sopenharmony_ci	unsigned int val;
2288c2ecf20Sopenharmony_ci	int change;
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci	val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958);
2318c2ecf20Sopenharmony_ci	spin_lock_irq(&ice->reg_lock);
2328c2ecf20Sopenharmony_ci	change = ice->spdif.cs8403_stream_bits != val;
2338c2ecf20Sopenharmony_ci	ice->spdif.cs8403_stream_bits = val;
2348c2ecf20Sopenharmony_ci	if (change && ice->playback_pro_substream != NULL) {
2358c2ecf20Sopenharmony_ci		spin_unlock_irq(&ice->reg_lock);
2368c2ecf20Sopenharmony_ci		snd_ice1712_delta_cs8403_spdif_write(ice, val);
2378c2ecf20Sopenharmony_ci	} else {
2388c2ecf20Sopenharmony_ci		spin_unlock_irq(&ice->reg_lock);
2398c2ecf20Sopenharmony_ci	}
2408c2ecf20Sopenharmony_ci	return change;
2418c2ecf20Sopenharmony_ci}
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/*
2458c2ecf20Sopenharmony_ci * AK4524 on Delta 44 and 66 to choose the chip mask
2468c2ecf20Sopenharmony_ci */
2478c2ecf20Sopenharmony_cistatic void delta_ak4524_lock(struct snd_akm4xxx *ak, int chip)
2488c2ecf20Sopenharmony_ci{
2498c2ecf20Sopenharmony_ci        struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
2508c2ecf20Sopenharmony_ci        struct snd_ice1712 *ice = ak->private_data[0];
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci	snd_ice1712_save_gpio_status(ice);
2538c2ecf20Sopenharmony_ci	priv->cs_mask =
2548c2ecf20Sopenharmony_ci	priv->cs_addr = chip == 0 ? ICE1712_DELTA_CODEC_CHIP_A :
2558c2ecf20Sopenharmony_ci				    ICE1712_DELTA_CODEC_CHIP_B;
2568c2ecf20Sopenharmony_ci}
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci/*
2598c2ecf20Sopenharmony_ci * AK4524 on Delta1010LT to choose the chip address
2608c2ecf20Sopenharmony_ci */
2618c2ecf20Sopenharmony_cistatic void delta1010lt_ak4524_lock(struct snd_akm4xxx *ak, int chip)
2628c2ecf20Sopenharmony_ci{
2638c2ecf20Sopenharmony_ci        struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
2648c2ecf20Sopenharmony_ci        struct snd_ice1712 *ice = ak->private_data[0];
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci	snd_ice1712_save_gpio_status(ice);
2678c2ecf20Sopenharmony_ci	priv->cs_mask = ICE1712_DELTA_1010LT_CS;
2688c2ecf20Sopenharmony_ci	priv->cs_addr = chip << 4;
2698c2ecf20Sopenharmony_ci}
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci/*
2728c2ecf20Sopenharmony_ci * AK4524 on Delta66 rev E to choose the chip address
2738c2ecf20Sopenharmony_ci */
2748c2ecf20Sopenharmony_cistatic void delta66e_ak4524_lock(struct snd_akm4xxx *ak, int chip)
2758c2ecf20Sopenharmony_ci{
2768c2ecf20Sopenharmony_ci	struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
2778c2ecf20Sopenharmony_ci	struct snd_ice1712 *ice = ak->private_data[0];
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci	snd_ice1712_save_gpio_status(ice);
2808c2ecf20Sopenharmony_ci	priv->cs_mask =
2818c2ecf20Sopenharmony_ci	priv->cs_addr = chip == 0 ? ICE1712_DELTA_66E_CS_CHIP_A :
2828c2ecf20Sopenharmony_ci				    ICE1712_DELTA_66E_CS_CHIP_B;
2838c2ecf20Sopenharmony_ci}
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci/*
2868c2ecf20Sopenharmony_ci * AK4528 on VX442 to choose the chip mask
2878c2ecf20Sopenharmony_ci */
2888c2ecf20Sopenharmony_cistatic void vx442_ak4524_lock(struct snd_akm4xxx *ak, int chip)
2898c2ecf20Sopenharmony_ci{
2908c2ecf20Sopenharmony_ci        struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
2918c2ecf20Sopenharmony_ci        struct snd_ice1712 *ice = ak->private_data[0];
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci	snd_ice1712_save_gpio_status(ice);
2948c2ecf20Sopenharmony_ci	priv->cs_mask =
2958c2ecf20Sopenharmony_ci	priv->cs_addr = chip == 0 ? ICE1712_VX442_CODEC_CHIP_A :
2968c2ecf20Sopenharmony_ci				    ICE1712_VX442_CODEC_CHIP_B;
2978c2ecf20Sopenharmony_ci}
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci/*
3008c2ecf20Sopenharmony_ci * change the DFS bit according rate for Delta1010
3018c2ecf20Sopenharmony_ci */
3028c2ecf20Sopenharmony_cistatic void delta_1010_set_rate_val(struct snd_ice1712 *ice, unsigned int rate)
3038c2ecf20Sopenharmony_ci{
3048c2ecf20Sopenharmony_ci	unsigned char tmp, tmp2;
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci	if (rate == 0)	/* no hint - S/PDIF input is master, simply return */
3078c2ecf20Sopenharmony_ci		return;
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci	mutex_lock(&ice->gpio_mutex);
3108c2ecf20Sopenharmony_ci	tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
3118c2ecf20Sopenharmony_ci	tmp2 = tmp & ~ICE1712_DELTA_DFS;
3128c2ecf20Sopenharmony_ci	if (rate > 48000)
3138c2ecf20Sopenharmony_ci		tmp2 |= ICE1712_DELTA_DFS;
3148c2ecf20Sopenharmony_ci	if (tmp != tmp2)
3158c2ecf20Sopenharmony_ci		snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp2);
3168c2ecf20Sopenharmony_ci	mutex_unlock(&ice->gpio_mutex);
3178c2ecf20Sopenharmony_ci}
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci/*
3208c2ecf20Sopenharmony_ci * change the rate of AK4524 on Delta 44/66, AP, 1010LT
3218c2ecf20Sopenharmony_ci */
3228c2ecf20Sopenharmony_cistatic void delta_ak4524_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
3238c2ecf20Sopenharmony_ci{
3248c2ecf20Sopenharmony_ci	unsigned char tmp, tmp2;
3258c2ecf20Sopenharmony_ci	struct snd_ice1712 *ice = ak->private_data[0];
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci	if (rate == 0)	/* no hint - S/PDIF input is master, simply return */
3288c2ecf20Sopenharmony_ci		return;
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci	/* check before reset ak4524 to avoid unnecessary clicks */
3318c2ecf20Sopenharmony_ci	mutex_lock(&ice->gpio_mutex);
3328c2ecf20Sopenharmony_ci	tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
3338c2ecf20Sopenharmony_ci	mutex_unlock(&ice->gpio_mutex);
3348c2ecf20Sopenharmony_ci	tmp2 = tmp & ~ICE1712_DELTA_DFS;
3358c2ecf20Sopenharmony_ci	if (rate > 48000)
3368c2ecf20Sopenharmony_ci		tmp2 |= ICE1712_DELTA_DFS;
3378c2ecf20Sopenharmony_ci	if (tmp == tmp2)
3388c2ecf20Sopenharmony_ci		return;
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci	/* do it again */
3418c2ecf20Sopenharmony_ci	snd_akm4xxx_reset(ak, 1);
3428c2ecf20Sopenharmony_ci	mutex_lock(&ice->gpio_mutex);
3438c2ecf20Sopenharmony_ci	tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ~ICE1712_DELTA_DFS;
3448c2ecf20Sopenharmony_ci	if (rate > 48000)
3458c2ecf20Sopenharmony_ci		tmp |= ICE1712_DELTA_DFS;
3468c2ecf20Sopenharmony_ci	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
3478c2ecf20Sopenharmony_ci	mutex_unlock(&ice->gpio_mutex);
3488c2ecf20Sopenharmony_ci	snd_akm4xxx_reset(ak, 0);
3498c2ecf20Sopenharmony_ci}
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci/*
3528c2ecf20Sopenharmony_ci * change the rate of AK4524 on VX442
3538c2ecf20Sopenharmony_ci */
3548c2ecf20Sopenharmony_cistatic void vx442_ak4524_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
3558c2ecf20Sopenharmony_ci{
3568c2ecf20Sopenharmony_ci	unsigned char val;
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci	val = (rate > 48000) ? 0x65 : 0x60;
3598c2ecf20Sopenharmony_ci	if (snd_akm4xxx_get(ak, 0, 0x02) != val ||
3608c2ecf20Sopenharmony_ci	    snd_akm4xxx_get(ak, 1, 0x02) != val) {
3618c2ecf20Sopenharmony_ci		snd_akm4xxx_reset(ak, 1);
3628c2ecf20Sopenharmony_ci		snd_akm4xxx_write(ak, 0, 0x02, val);
3638c2ecf20Sopenharmony_ci		snd_akm4xxx_write(ak, 1, 0x02, val);
3648c2ecf20Sopenharmony_ci		snd_akm4xxx_reset(ak, 0);
3658c2ecf20Sopenharmony_ci	}
3668c2ecf20Sopenharmony_ci}
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci/*
3708c2ecf20Sopenharmony_ci * SPDIF ops for Delta 1010, Dio, 66
3718c2ecf20Sopenharmony_ci */
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci/* open callback */
3748c2ecf20Sopenharmony_cistatic void delta_open_spdif(struct snd_ice1712 *ice, struct snd_pcm_substream *substream)
3758c2ecf20Sopenharmony_ci{
3768c2ecf20Sopenharmony_ci	ice->spdif.cs8403_stream_bits = ice->spdif.cs8403_bits;
3778c2ecf20Sopenharmony_ci}
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci/* set up */
3808c2ecf20Sopenharmony_cistatic void delta_setup_spdif(struct snd_ice1712 *ice, int rate)
3818c2ecf20Sopenharmony_ci{
3828c2ecf20Sopenharmony_ci	unsigned long flags;
3838c2ecf20Sopenharmony_ci	unsigned int tmp;
3848c2ecf20Sopenharmony_ci	int change;
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci	spin_lock_irqsave(&ice->reg_lock, flags);
3878c2ecf20Sopenharmony_ci	tmp = ice->spdif.cs8403_stream_bits;
3888c2ecf20Sopenharmony_ci	if (tmp & 0x01)		/* consumer */
3898c2ecf20Sopenharmony_ci		tmp &= (tmp & 0x01) ? ~0x06 : ~0x18;
3908c2ecf20Sopenharmony_ci	switch (rate) {
3918c2ecf20Sopenharmony_ci	case 32000: tmp |= (tmp & 0x01) ? 0x04 : 0x00; break;
3928c2ecf20Sopenharmony_ci	case 44100: tmp |= (tmp & 0x01) ? 0x00 : 0x10; break;
3938c2ecf20Sopenharmony_ci	case 48000: tmp |= (tmp & 0x01) ? 0x02 : 0x08; break;
3948c2ecf20Sopenharmony_ci	default: tmp |= (tmp & 0x01) ? 0x00 : 0x18; break;
3958c2ecf20Sopenharmony_ci	}
3968c2ecf20Sopenharmony_ci	change = ice->spdif.cs8403_stream_bits != tmp;
3978c2ecf20Sopenharmony_ci	ice->spdif.cs8403_stream_bits = tmp;
3988c2ecf20Sopenharmony_ci	spin_unlock_irqrestore(&ice->reg_lock, flags);
3998c2ecf20Sopenharmony_ci	if (change)
4008c2ecf20Sopenharmony_ci		snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif.stream_ctl->id);
4018c2ecf20Sopenharmony_ci	snd_ice1712_delta_cs8403_spdif_write(ice, tmp);
4028c2ecf20Sopenharmony_ci}
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ci#define snd_ice1712_delta1010lt_wordclock_status_info \
4058c2ecf20Sopenharmony_ci	snd_ctl_boolean_mono_info
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_cistatic int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol *kcontrol,
4088c2ecf20Sopenharmony_ci			 struct snd_ctl_elem_value *ucontrol)
4098c2ecf20Sopenharmony_ci{
4108c2ecf20Sopenharmony_ci	char reg = 0x10; /* CS8427 receiver error register */
4118c2ecf20Sopenharmony_ci	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci	if (snd_i2c_sendbytes(ice->cs8427, &reg, 1) != 1)
4148c2ecf20Sopenharmony_ci		dev_err(ice->card->dev,
4158c2ecf20Sopenharmony_ci			"unable to send register 0x%x byte to CS8427\n", reg);
4168c2ecf20Sopenharmony_ci	snd_i2c_readbytes(ice->cs8427, &reg, 1);
4178c2ecf20Sopenharmony_ci	ucontrol->value.integer.value[0] = (reg & CS8427_UNLOCK) ? 1 : 0;
4188c2ecf20Sopenharmony_ci	return 0;
4198c2ecf20Sopenharmony_ci}
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_status =
4228c2ecf20Sopenharmony_ci{
4238c2ecf20Sopenharmony_ci	.access =	(SNDRV_CTL_ELEM_ACCESS_READ),
4248c2ecf20Sopenharmony_ci	.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
4258c2ecf20Sopenharmony_ci	.name =         "Word Clock Status",
4268c2ecf20Sopenharmony_ci	.info =		snd_ice1712_delta1010lt_wordclock_status_info,
4278c2ecf20Sopenharmony_ci	.get =		snd_ice1712_delta1010lt_wordclock_status_get,
4288c2ecf20Sopenharmony_ci};
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/*
4318c2ecf20Sopenharmony_ci * initialize the chips on M-Audio cards
4328c2ecf20Sopenharmony_ci */
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_cistatic const struct snd_akm4xxx akm_audiophile = {
4358c2ecf20Sopenharmony_ci	.type = SND_AK4528,
4368c2ecf20Sopenharmony_ci	.num_adcs = 2,
4378c2ecf20Sopenharmony_ci	.num_dacs = 2,
4388c2ecf20Sopenharmony_ci	.ops = {
4398c2ecf20Sopenharmony_ci		.set_rate_val = delta_ak4524_set_rate_val
4408c2ecf20Sopenharmony_ci	}
4418c2ecf20Sopenharmony_ci};
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_cistatic const struct snd_ak4xxx_private akm_audiophile_priv = {
4448c2ecf20Sopenharmony_ci	.caddr = 2,
4458c2ecf20Sopenharmony_ci	.cif = 0,
4468c2ecf20Sopenharmony_ci	.data_mask = ICE1712_DELTA_AP_DOUT,
4478c2ecf20Sopenharmony_ci	.clk_mask = ICE1712_DELTA_AP_CCLK,
4488c2ecf20Sopenharmony_ci	.cs_mask = ICE1712_DELTA_AP_CS_CODEC,
4498c2ecf20Sopenharmony_ci	.cs_addr = ICE1712_DELTA_AP_CS_CODEC,
4508c2ecf20Sopenharmony_ci	.cs_none = 0,
4518c2ecf20Sopenharmony_ci	.add_flags = ICE1712_DELTA_AP_CS_DIGITAL,
4528c2ecf20Sopenharmony_ci	.mask_flags = 0,
4538c2ecf20Sopenharmony_ci};
4548c2ecf20Sopenharmony_ci
4558c2ecf20Sopenharmony_cistatic const struct snd_akm4xxx akm_delta410 = {
4568c2ecf20Sopenharmony_ci	.type = SND_AK4529,
4578c2ecf20Sopenharmony_ci	.num_adcs = 2,
4588c2ecf20Sopenharmony_ci	.num_dacs = 8,
4598c2ecf20Sopenharmony_ci	.ops = {
4608c2ecf20Sopenharmony_ci		.set_rate_val = delta_ak4524_set_rate_val
4618c2ecf20Sopenharmony_ci	}
4628c2ecf20Sopenharmony_ci};
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_cistatic const struct snd_ak4xxx_private akm_delta410_priv = {
4658c2ecf20Sopenharmony_ci	.caddr = 0,
4668c2ecf20Sopenharmony_ci	.cif = 0,
4678c2ecf20Sopenharmony_ci	.data_mask = ICE1712_DELTA_AP_DOUT,
4688c2ecf20Sopenharmony_ci	.clk_mask = ICE1712_DELTA_AP_CCLK,
4698c2ecf20Sopenharmony_ci	.cs_mask = ICE1712_DELTA_AP_CS_CODEC,
4708c2ecf20Sopenharmony_ci	.cs_addr = ICE1712_DELTA_AP_CS_CODEC,
4718c2ecf20Sopenharmony_ci	.cs_none = 0,
4728c2ecf20Sopenharmony_ci	.add_flags = ICE1712_DELTA_AP_CS_DIGITAL,
4738c2ecf20Sopenharmony_ci	.mask_flags = 0,
4748c2ecf20Sopenharmony_ci};
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_cistatic const struct snd_akm4xxx akm_delta1010lt = {
4778c2ecf20Sopenharmony_ci	.type = SND_AK4524,
4788c2ecf20Sopenharmony_ci	.num_adcs = 8,
4798c2ecf20Sopenharmony_ci	.num_dacs = 8,
4808c2ecf20Sopenharmony_ci	.ops = {
4818c2ecf20Sopenharmony_ci		.lock = delta1010lt_ak4524_lock,
4828c2ecf20Sopenharmony_ci		.set_rate_val = delta_ak4524_set_rate_val
4838c2ecf20Sopenharmony_ci	}
4848c2ecf20Sopenharmony_ci};
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_cistatic const struct snd_ak4xxx_private akm_delta1010lt_priv = {
4878c2ecf20Sopenharmony_ci	.caddr = 2,
4888c2ecf20Sopenharmony_ci	.cif = 0, /* the default level of the CIF pin from AK4524 */
4898c2ecf20Sopenharmony_ci	.data_mask = ICE1712_DELTA_1010LT_DOUT,
4908c2ecf20Sopenharmony_ci	.clk_mask = ICE1712_DELTA_1010LT_CCLK,
4918c2ecf20Sopenharmony_ci	.cs_mask = 0,
4928c2ecf20Sopenharmony_ci	.cs_addr = 0, /* set later */
4938c2ecf20Sopenharmony_ci	.cs_none = ICE1712_DELTA_1010LT_CS_NONE,
4948c2ecf20Sopenharmony_ci	.add_flags = 0,
4958c2ecf20Sopenharmony_ci	.mask_flags = 0,
4968c2ecf20Sopenharmony_ci};
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_cistatic const struct snd_akm4xxx akm_delta66e = {
4998c2ecf20Sopenharmony_ci	.type = SND_AK4524,
5008c2ecf20Sopenharmony_ci	.num_adcs = 4,
5018c2ecf20Sopenharmony_ci	.num_dacs = 4,
5028c2ecf20Sopenharmony_ci	.ops = {
5038c2ecf20Sopenharmony_ci		.lock = delta66e_ak4524_lock,
5048c2ecf20Sopenharmony_ci		.set_rate_val = delta_ak4524_set_rate_val
5058c2ecf20Sopenharmony_ci	}
5068c2ecf20Sopenharmony_ci};
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_cistatic const struct snd_ak4xxx_private akm_delta66e_priv = {
5098c2ecf20Sopenharmony_ci	.caddr = 2,
5108c2ecf20Sopenharmony_ci	.cif = 0, /* the default level of the CIF pin from AK4524 */
5118c2ecf20Sopenharmony_ci	.data_mask = ICE1712_DELTA_66E_DOUT,
5128c2ecf20Sopenharmony_ci	.clk_mask = ICE1712_DELTA_66E_CCLK,
5138c2ecf20Sopenharmony_ci	.cs_mask = 0,
5148c2ecf20Sopenharmony_ci	.cs_addr = 0, /* set later */
5158c2ecf20Sopenharmony_ci	.cs_none = 0,
5168c2ecf20Sopenharmony_ci	.add_flags = 0,
5178c2ecf20Sopenharmony_ci	.mask_flags = 0,
5188c2ecf20Sopenharmony_ci};
5198c2ecf20Sopenharmony_ci
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_cistatic const struct snd_akm4xxx akm_delta44 = {
5228c2ecf20Sopenharmony_ci	.type = SND_AK4524,
5238c2ecf20Sopenharmony_ci	.num_adcs = 4,
5248c2ecf20Sopenharmony_ci	.num_dacs = 4,
5258c2ecf20Sopenharmony_ci	.ops = {
5268c2ecf20Sopenharmony_ci		.lock = delta_ak4524_lock,
5278c2ecf20Sopenharmony_ci		.set_rate_val = delta_ak4524_set_rate_val
5288c2ecf20Sopenharmony_ci	}
5298c2ecf20Sopenharmony_ci};
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_cistatic const struct snd_ak4xxx_private akm_delta44_priv = {
5328c2ecf20Sopenharmony_ci	.caddr = 2,
5338c2ecf20Sopenharmony_ci	.cif = 0, /* the default level of the CIF pin from AK4524 */
5348c2ecf20Sopenharmony_ci	.data_mask = ICE1712_DELTA_CODEC_SERIAL_DATA,
5358c2ecf20Sopenharmony_ci	.clk_mask = ICE1712_DELTA_CODEC_SERIAL_CLOCK,
5368c2ecf20Sopenharmony_ci	.cs_mask = 0,
5378c2ecf20Sopenharmony_ci	.cs_addr = 0, /* set later */
5388c2ecf20Sopenharmony_ci	.cs_none = 0,
5398c2ecf20Sopenharmony_ci	.add_flags = 0,
5408c2ecf20Sopenharmony_ci	.mask_flags = 0,
5418c2ecf20Sopenharmony_ci};
5428c2ecf20Sopenharmony_ci
5438c2ecf20Sopenharmony_cistatic const struct snd_akm4xxx akm_vx442 = {
5448c2ecf20Sopenharmony_ci	.type = SND_AK4524,
5458c2ecf20Sopenharmony_ci	.num_adcs = 4,
5468c2ecf20Sopenharmony_ci	.num_dacs = 4,
5478c2ecf20Sopenharmony_ci	.ops = {
5488c2ecf20Sopenharmony_ci		.lock = vx442_ak4524_lock,
5498c2ecf20Sopenharmony_ci		.set_rate_val = vx442_ak4524_set_rate_val
5508c2ecf20Sopenharmony_ci	}
5518c2ecf20Sopenharmony_ci};
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_cistatic const struct snd_ak4xxx_private akm_vx442_priv = {
5548c2ecf20Sopenharmony_ci	.caddr = 2,
5558c2ecf20Sopenharmony_ci	.cif = 0,
5568c2ecf20Sopenharmony_ci	.data_mask = ICE1712_VX442_DOUT,
5578c2ecf20Sopenharmony_ci	.clk_mask = ICE1712_VX442_CCLK,
5588c2ecf20Sopenharmony_ci	.cs_mask = 0,
5598c2ecf20Sopenharmony_ci	.cs_addr = 0, /* set later */
5608c2ecf20Sopenharmony_ci	.cs_none = 0,
5618c2ecf20Sopenharmony_ci	.add_flags = 0,
5628c2ecf20Sopenharmony_ci	.mask_flags = 0,
5638c2ecf20Sopenharmony_ci};
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci#ifdef CONFIG_PM_SLEEP
5668c2ecf20Sopenharmony_cistatic int snd_ice1712_delta_resume(struct snd_ice1712 *ice)
5678c2ecf20Sopenharmony_ci{
5688c2ecf20Sopenharmony_ci	unsigned char akm_img_bak[AK4XXX_IMAGE_SIZE];
5698c2ecf20Sopenharmony_ci	unsigned char akm_vol_bak[AK4XXX_IMAGE_SIZE];
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci	/* init spdif */
5728c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
5738c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_AUDIOPHILE:
5748c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA410:
5758c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010E:
5768c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010LT:
5778c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_VX442:
5788c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66E:
5798c2ecf20Sopenharmony_ci		snd_cs8427_init(ice->i2c, ice->cs8427);
5808c2ecf20Sopenharmony_ci		break;
5818c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010:
5828c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_MEDIASTATION:
5838c2ecf20Sopenharmony_ci		/* nothing */
5848c2ecf20Sopenharmony_ci		break;
5858c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTADIO2496:
5868c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66:
5878c2ecf20Sopenharmony_ci		/* Set spdif defaults */
5888c2ecf20Sopenharmony_ci		snd_ice1712_delta_cs8403_spdif_write(ice, ice->spdif.cs8403_bits);
5898c2ecf20Sopenharmony_ci		break;
5908c2ecf20Sopenharmony_ci	}
5918c2ecf20Sopenharmony_ci
5928c2ecf20Sopenharmony_ci	/* init codec and restore registers */
5938c2ecf20Sopenharmony_ci	if (ice->akm_codecs) {
5948c2ecf20Sopenharmony_ci		memcpy(akm_img_bak, ice->akm->images, sizeof(akm_img_bak));
5958c2ecf20Sopenharmony_ci		memcpy(akm_vol_bak, ice->akm->volumes, sizeof(akm_vol_bak));
5968c2ecf20Sopenharmony_ci		snd_akm4xxx_init(ice->akm);
5978c2ecf20Sopenharmony_ci		memcpy(ice->akm->images, akm_img_bak, sizeof(akm_img_bak));
5988c2ecf20Sopenharmony_ci		memcpy(ice->akm->volumes, akm_vol_bak, sizeof(akm_vol_bak));
5998c2ecf20Sopenharmony_ci		snd_akm4xxx_reset(ice->akm, 0);
6008c2ecf20Sopenharmony_ci	}
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci	return 0;
6038c2ecf20Sopenharmony_ci}
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_cistatic int snd_ice1712_delta_suspend(struct snd_ice1712 *ice)
6068c2ecf20Sopenharmony_ci{
6078c2ecf20Sopenharmony_ci	if (ice->akm_codecs) /* reset & mute codec */
6088c2ecf20Sopenharmony_ci		snd_akm4xxx_reset(ice->akm, 1);
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_ci	return 0;
6118c2ecf20Sopenharmony_ci}
6128c2ecf20Sopenharmony_ci#endif
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_cistatic int snd_ice1712_delta_init(struct snd_ice1712 *ice)
6158c2ecf20Sopenharmony_ci{
6168c2ecf20Sopenharmony_ci	int err;
6178c2ecf20Sopenharmony_ci	struct snd_akm4xxx *ak;
6188c2ecf20Sopenharmony_ci	unsigned char tmp;
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci	if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010 &&
6218c2ecf20Sopenharmony_ci	    ice->eeprom.gpiodir == 0x7b)
6228c2ecf20Sopenharmony_ci		ice->eeprom.subvendor = ICE1712_SUBDEVICE_DELTA1010E;
6238c2ecf20Sopenharmony_ci
6248c2ecf20Sopenharmony_ci	if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA66 &&
6258c2ecf20Sopenharmony_ci	    ice->eeprom.gpiodir == 0xfb)
6268c2ecf20Sopenharmony_ci	    	ice->eeprom.subvendor = ICE1712_SUBDEVICE_DELTA66E;
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_ci	/* determine I2C, DACs and ADCs */
6298c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
6308c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_AUDIOPHILE:
6318c2ecf20Sopenharmony_ci		ice->num_total_dacs = 2;
6328c2ecf20Sopenharmony_ci		ice->num_total_adcs = 2;
6338c2ecf20Sopenharmony_ci		break;
6348c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA410:
6358c2ecf20Sopenharmony_ci		ice->num_total_dacs = 8;
6368c2ecf20Sopenharmony_ci		ice->num_total_adcs = 2;
6378c2ecf20Sopenharmony_ci		break;
6388c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA44:
6398c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66:
6408c2ecf20Sopenharmony_ci		ice->num_total_dacs = ice->omni ? 8 : 4;
6418c2ecf20Sopenharmony_ci		ice->num_total_adcs = ice->omni ? 8 : 4;
6428c2ecf20Sopenharmony_ci		break;
6438c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010:
6448c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010E:
6458c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010LT:
6468c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_MEDIASTATION:
6478c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_EDIROLDA2496:
6488c2ecf20Sopenharmony_ci		ice->num_total_dacs = 8;
6498c2ecf20Sopenharmony_ci		ice->num_total_adcs = 8;
6508c2ecf20Sopenharmony_ci		break;
6518c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTADIO2496:
6528c2ecf20Sopenharmony_ci		ice->num_total_dacs = 4;	/* two AK4324 codecs */
6538c2ecf20Sopenharmony_ci		break;
6548c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_VX442:
6558c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66E:	/* omni not supported yet */
6568c2ecf20Sopenharmony_ci		ice->num_total_dacs = 4;
6578c2ecf20Sopenharmony_ci		ice->num_total_adcs = 4;
6588c2ecf20Sopenharmony_ci		break;
6598c2ecf20Sopenharmony_ci	}
6608c2ecf20Sopenharmony_ci#ifdef CONFIG_PM_SLEEP
6618c2ecf20Sopenharmony_ci	ice->pm_resume = snd_ice1712_delta_resume;
6628c2ecf20Sopenharmony_ci	ice->pm_suspend = snd_ice1712_delta_suspend;
6638c2ecf20Sopenharmony_ci	ice->pm_suspend_enabled = 1;
6648c2ecf20Sopenharmony_ci#endif
6658c2ecf20Sopenharmony_ci	/* initialize the SPI clock to high */
6668c2ecf20Sopenharmony_ci	tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
6678c2ecf20Sopenharmony_ci	tmp |= ICE1712_DELTA_AP_CCLK;
6688c2ecf20Sopenharmony_ci	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
6698c2ecf20Sopenharmony_ci	udelay(5);
6708c2ecf20Sopenharmony_ci
6718c2ecf20Sopenharmony_ci	/* initialize spdif */
6728c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
6738c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_AUDIOPHILE:
6748c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA410:
6758c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010E:
6768c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010LT:
6778c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_VX442:
6788c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66E:
6798c2ecf20Sopenharmony_ci		if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
6808c2ecf20Sopenharmony_ci			dev_err(ice->card->dev, "unable to create I2C bus\n");
6818c2ecf20Sopenharmony_ci			return err;
6828c2ecf20Sopenharmony_ci		}
6838c2ecf20Sopenharmony_ci		ice->i2c->private_data = ice;
6848c2ecf20Sopenharmony_ci		ice->i2c->ops = &ap_cs8427_i2c_ops;
6858c2ecf20Sopenharmony_ci		if ((err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR)) < 0)
6868c2ecf20Sopenharmony_ci			return err;
6878c2ecf20Sopenharmony_ci		break;
6888c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010:
6898c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_MEDIASTATION:
6908c2ecf20Sopenharmony_ci		ice->gpio.set_pro_rate = delta_1010_set_rate_val;
6918c2ecf20Sopenharmony_ci		break;
6928c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTADIO2496:
6938c2ecf20Sopenharmony_ci		ice->gpio.set_pro_rate = delta_1010_set_rate_val;
6948c2ecf20Sopenharmony_ci		fallthrough;
6958c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66:
6968c2ecf20Sopenharmony_ci		ice->spdif.ops.open = delta_open_spdif;
6978c2ecf20Sopenharmony_ci		ice->spdif.ops.setup_rate = delta_setup_spdif;
6988c2ecf20Sopenharmony_ci		ice->spdif.ops.default_get = delta_spdif_default_get;
6998c2ecf20Sopenharmony_ci		ice->spdif.ops.default_put = delta_spdif_default_put;
7008c2ecf20Sopenharmony_ci		ice->spdif.ops.stream_get = delta_spdif_stream_get;
7018c2ecf20Sopenharmony_ci		ice->spdif.ops.stream_put = delta_spdif_stream_put;
7028c2ecf20Sopenharmony_ci		/* Set spdif defaults */
7038c2ecf20Sopenharmony_ci		snd_ice1712_delta_cs8403_spdif_write(ice, ice->spdif.cs8403_bits);
7048c2ecf20Sopenharmony_ci		break;
7058c2ecf20Sopenharmony_ci	}
7068c2ecf20Sopenharmony_ci
7078c2ecf20Sopenharmony_ci	/* no analog? */
7088c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
7098c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010:
7108c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010E:
7118c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTADIO2496:
7128c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_MEDIASTATION:
7138c2ecf20Sopenharmony_ci		return 0;
7148c2ecf20Sopenharmony_ci	}
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_ci	/* second stage of initialization, analog parts and others */
7178c2ecf20Sopenharmony_ci	ak = ice->akm = kmalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
7188c2ecf20Sopenharmony_ci	if (! ak)
7198c2ecf20Sopenharmony_ci		return -ENOMEM;
7208c2ecf20Sopenharmony_ci	ice->akm_codecs = 1;
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
7238c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_AUDIOPHILE:
7248c2ecf20Sopenharmony_ci		err = snd_ice1712_akm4xxx_init(ak, &akm_audiophile, &akm_audiophile_priv, ice);
7258c2ecf20Sopenharmony_ci		break;
7268c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA410:
7278c2ecf20Sopenharmony_ci		err = snd_ice1712_akm4xxx_init(ak, &akm_delta410, &akm_delta410_priv, ice);
7288c2ecf20Sopenharmony_ci		break;
7298c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010LT:
7308c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_EDIROLDA2496:
7318c2ecf20Sopenharmony_ci		err = snd_ice1712_akm4xxx_init(ak, &akm_delta1010lt, &akm_delta1010lt_priv, ice);
7328c2ecf20Sopenharmony_ci		break;
7338c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66:
7348c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA44:
7358c2ecf20Sopenharmony_ci		err = snd_ice1712_akm4xxx_init(ak, &akm_delta44, &akm_delta44_priv, ice);
7368c2ecf20Sopenharmony_ci		break;
7378c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_VX442:
7388c2ecf20Sopenharmony_ci		err = snd_ice1712_akm4xxx_init(ak, &akm_vx442, &akm_vx442_priv, ice);
7398c2ecf20Sopenharmony_ci		break;
7408c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66E:
7418c2ecf20Sopenharmony_ci		err = snd_ice1712_akm4xxx_init(ak, &akm_delta66e, &akm_delta66e_priv, ice);
7428c2ecf20Sopenharmony_ci		break;
7438c2ecf20Sopenharmony_ci	default:
7448c2ecf20Sopenharmony_ci		snd_BUG();
7458c2ecf20Sopenharmony_ci		return -EINVAL;
7468c2ecf20Sopenharmony_ci	}
7478c2ecf20Sopenharmony_ci
7488c2ecf20Sopenharmony_ci	return err;
7498c2ecf20Sopenharmony_ci}
7508c2ecf20Sopenharmony_ci
7518c2ecf20Sopenharmony_ci
7528c2ecf20Sopenharmony_ci/*
7538c2ecf20Sopenharmony_ci * additional controls for M-Audio cards
7548c2ecf20Sopenharmony_ci */
7558c2ecf20Sopenharmony_ci
7568c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_select =
7578c2ecf20Sopenharmony_ciICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0);
7588c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_select =
7598c2ecf20Sopenharmony_ciICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK, 0, 0);
7608c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_status =
7618c2ecf20Sopenharmony_ciICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE);
7628c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new snd_ice1712_deltadio2496_spdif_in_select =
7638c2ecf20Sopenharmony_ciICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0, 0);
7648c2ecf20Sopenharmony_cistatic const struct snd_kcontrol_new snd_ice1712_delta_spdif_in_status =
7658c2ecf20Sopenharmony_ciICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Delta IEC958 Input Status", 0, ICE1712_DELTA_SPDIF_IN_STAT, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE);
7668c2ecf20Sopenharmony_ci
7678c2ecf20Sopenharmony_ci
7688c2ecf20Sopenharmony_cistatic int snd_ice1712_delta_add_controls(struct snd_ice1712 *ice)
7698c2ecf20Sopenharmony_ci{
7708c2ecf20Sopenharmony_ci	int err;
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci	/* 1010 and dio specific controls */
7738c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
7748c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010:
7758c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_MEDIASTATION:
7768c2ecf20Sopenharmony_ci		err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010_wordclock_select, ice));
7778c2ecf20Sopenharmony_ci		if (err < 0)
7788c2ecf20Sopenharmony_ci			return err;
7798c2ecf20Sopenharmony_ci		err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010_wordclock_status, ice));
7808c2ecf20Sopenharmony_ci		if (err < 0)
7818c2ecf20Sopenharmony_ci			return err;
7828c2ecf20Sopenharmony_ci		break;
7838c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTADIO2496:
7848c2ecf20Sopenharmony_ci		err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_deltadio2496_spdif_in_select, ice));
7858c2ecf20Sopenharmony_ci		if (err < 0)
7868c2ecf20Sopenharmony_ci			return err;
7878c2ecf20Sopenharmony_ci		break;
7888c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010E:
7898c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010LT:
7908c2ecf20Sopenharmony_ci		err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010lt_wordclock_select, ice));
7918c2ecf20Sopenharmony_ci		if (err < 0)
7928c2ecf20Sopenharmony_ci			return err;
7938c2ecf20Sopenharmony_ci		err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta1010lt_wordclock_status, ice));
7948c2ecf20Sopenharmony_ci		if (err < 0)
7958c2ecf20Sopenharmony_ci			return err;
7968c2ecf20Sopenharmony_ci		break;
7978c2ecf20Sopenharmony_ci	}
7988c2ecf20Sopenharmony_ci
7998c2ecf20Sopenharmony_ci	/* normal spdif controls */
8008c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
8018c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010:
8028c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTADIO2496:
8038c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66:
8048c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_MEDIASTATION:
8058c2ecf20Sopenharmony_ci		err = snd_ice1712_spdif_build_controls(ice);
8068c2ecf20Sopenharmony_ci		if (err < 0)
8078c2ecf20Sopenharmony_ci			return err;
8088c2ecf20Sopenharmony_ci		break;
8098c2ecf20Sopenharmony_ci	}
8108c2ecf20Sopenharmony_ci
8118c2ecf20Sopenharmony_ci	/* spdif status in */
8128c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
8138c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010:
8148c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTADIO2496:
8158c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66:
8168c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_MEDIASTATION:
8178c2ecf20Sopenharmony_ci		err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_delta_spdif_in_status, ice));
8188c2ecf20Sopenharmony_ci		if (err < 0)
8198c2ecf20Sopenharmony_ci			return err;
8208c2ecf20Sopenharmony_ci		break;
8218c2ecf20Sopenharmony_ci	}
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci	/* ak4524 controls */
8248c2ecf20Sopenharmony_ci	switch (ice->eeprom.subvendor) {
8258c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA1010LT:
8268c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_AUDIOPHILE:
8278c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA410:
8288c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA44:
8298c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66:
8308c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_VX442:
8318c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_DELTA66E:
8328c2ecf20Sopenharmony_ci	case ICE1712_SUBDEVICE_EDIROLDA2496:
8338c2ecf20Sopenharmony_ci		err = snd_ice1712_akm4xxx_build_controls(ice);
8348c2ecf20Sopenharmony_ci		if (err < 0)
8358c2ecf20Sopenharmony_ci			return err;
8368c2ecf20Sopenharmony_ci		break;
8378c2ecf20Sopenharmony_ci	}
8388c2ecf20Sopenharmony_ci
8398c2ecf20Sopenharmony_ci	return 0;
8408c2ecf20Sopenharmony_ci}
8418c2ecf20Sopenharmony_ci
8428c2ecf20Sopenharmony_ci
8438c2ecf20Sopenharmony_ci/* entry point */
8448c2ecf20Sopenharmony_cistruct snd_ice1712_card_info snd_ice1712_delta_cards[] = {
8458c2ecf20Sopenharmony_ci	{
8468c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_DELTA1010,
8478c2ecf20Sopenharmony_ci		.name = "M Audio Delta 1010",
8488c2ecf20Sopenharmony_ci		.model = "delta1010",
8498c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
8508c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
8518c2ecf20Sopenharmony_ci	},
8528c2ecf20Sopenharmony_ci	{
8538c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_DELTADIO2496,
8548c2ecf20Sopenharmony_ci		.name = "M Audio Delta DiO 2496",
8558c2ecf20Sopenharmony_ci		.model = "dio2496",
8568c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
8578c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
8588c2ecf20Sopenharmony_ci		.no_mpu401 = 1,
8598c2ecf20Sopenharmony_ci	},
8608c2ecf20Sopenharmony_ci	{
8618c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_DELTA66,
8628c2ecf20Sopenharmony_ci		.name = "M Audio Delta 66",
8638c2ecf20Sopenharmony_ci		.model = "delta66",
8648c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
8658c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
8668c2ecf20Sopenharmony_ci		.no_mpu401 = 1,
8678c2ecf20Sopenharmony_ci	},
8688c2ecf20Sopenharmony_ci	{
8698c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_DELTA44,
8708c2ecf20Sopenharmony_ci		.name = "M Audio Delta 44",
8718c2ecf20Sopenharmony_ci		.model = "delta44",
8728c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
8738c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
8748c2ecf20Sopenharmony_ci		.no_mpu401 = 1,
8758c2ecf20Sopenharmony_ci	},
8768c2ecf20Sopenharmony_ci	{
8778c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_AUDIOPHILE,
8788c2ecf20Sopenharmony_ci		.name = "M Audio Audiophile 24/96",
8798c2ecf20Sopenharmony_ci		.model = "audiophile",
8808c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
8818c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
8828c2ecf20Sopenharmony_ci	},
8838c2ecf20Sopenharmony_ci	{
8848c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_DELTA410,
8858c2ecf20Sopenharmony_ci		.name = "M Audio Delta 410",
8868c2ecf20Sopenharmony_ci		.model = "delta410",
8878c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
8888c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
8898c2ecf20Sopenharmony_ci	},
8908c2ecf20Sopenharmony_ci	{
8918c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_DELTA1010LT,
8928c2ecf20Sopenharmony_ci		.name = "M Audio Delta 1010LT",
8938c2ecf20Sopenharmony_ci		.model = "delta1010lt",
8948c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
8958c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
8968c2ecf20Sopenharmony_ci	},
8978c2ecf20Sopenharmony_ci	{
8988c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_VX442,
8998c2ecf20Sopenharmony_ci		.name = "Digigram VX442",
9008c2ecf20Sopenharmony_ci		.model = "vx442",
9018c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
9028c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
9038c2ecf20Sopenharmony_ci		.no_mpu401 = 1,
9048c2ecf20Sopenharmony_ci	},
9058c2ecf20Sopenharmony_ci	{
9068c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_MEDIASTATION,
9078c2ecf20Sopenharmony_ci		.name = "Lionstracs Mediastation",
9088c2ecf20Sopenharmony_ci		.model = "mediastation",
9098c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
9108c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
9118c2ecf20Sopenharmony_ci	},
9128c2ecf20Sopenharmony_ci	{
9138c2ecf20Sopenharmony_ci		.subvendor = ICE1712_SUBDEVICE_EDIROLDA2496,
9148c2ecf20Sopenharmony_ci		.name = "Edirol DA2496",
9158c2ecf20Sopenharmony_ci		.model = "da2496",
9168c2ecf20Sopenharmony_ci		.chip_init = snd_ice1712_delta_init,
9178c2ecf20Sopenharmony_ci		.build_controls = snd_ice1712_delta_add_controls,
9188c2ecf20Sopenharmony_ci	},
9198c2ecf20Sopenharmony_ci	{ } /* terminator */
9208c2ecf20Sopenharmony_ci};
921