18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *   ALSA driver for VT1720/VT1724 (Envy24PT/Envy24HT)
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *   Lowlevel functions for VT1720-based motherboards
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *	Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/delay.h>
118c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
128c2ecf20Sopenharmony_ci#include <linux/init.h>
138c2ecf20Sopenharmony_ci#include <sound/core.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include "ice1712.h"
168c2ecf20Sopenharmony_ci#include "envy24ht.h"
178c2ecf20Sopenharmony_ci#include "vt1720_mobo.h"
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistatic int k8x800_init(struct snd_ice1712 *ice)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	ice->vt1720 = 1;
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci	/* VT1616 codec */
258c2ecf20Sopenharmony_ci	ice->num_total_dacs = 6;
268c2ecf20Sopenharmony_ci	ice->num_total_adcs = 2;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	/* WM8728 codec */
298c2ecf20Sopenharmony_ci	/* FIXME: TODO */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	return 0;
328c2ecf20Sopenharmony_ci}
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic int k8x800_add_controls(struct snd_ice1712 *ice)
358c2ecf20Sopenharmony_ci{
368c2ecf20Sopenharmony_ci	/* FIXME: needs some quirks for VT1616? */
378c2ecf20Sopenharmony_ci	return 0;
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* EEPROM image */
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistatic const unsigned char k8x800_eeprom[] = {
438c2ecf20Sopenharmony_ci	[ICE_EEP2_SYSCONF]     = 0x01,	/* clock 256, 1ADC, 2DACs */
448c2ecf20Sopenharmony_ci	[ICE_EEP2_ACLINK]      = 0x02,	/* ACLINK, packed */
458c2ecf20Sopenharmony_ci	[ICE_EEP2_I2S]         = 0x00,	/* - */
468c2ecf20Sopenharmony_ci	[ICE_EEP2_SPDIF]       = 0x00,	/* - */
478c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_DIR]    = 0xff,
488c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_DIR1]   = 0xff,
498c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_DIR2]   = 0x00,	/* - */
508c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_MASK]   = 0xff,
518c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_MASK1]  = 0xff,
528c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_MASK2]  = 0x00,	/* - */
538c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_STATE]  = 0x00,
548c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_STATE1] = 0x00,
558c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_STATE2] = 0x00,	/* - */
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistatic const unsigned char sn25p_eeprom[] = {
598c2ecf20Sopenharmony_ci	[ICE_EEP2_SYSCONF]     = 0x01,	/* clock 256, 1ADC, 2DACs */
608c2ecf20Sopenharmony_ci	[ICE_EEP2_ACLINK]      = 0x02,	/* ACLINK, packed */
618c2ecf20Sopenharmony_ci	[ICE_EEP2_I2S]         = 0x00,	/* - */
628c2ecf20Sopenharmony_ci	[ICE_EEP2_SPDIF]       = 0x41,	/* - */
638c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_DIR]    = 0xff,
648c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_DIR1]   = 0xff,
658c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_DIR2]   = 0x00,	/* - */
668c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_MASK]   = 0xff,
678c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_MASK1]  = 0xff,
688c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_MASK2]  = 0x00,	/* - */
698c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_STATE]  = 0x00,
708c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_STATE1] = 0x00,
718c2ecf20Sopenharmony_ci	[ICE_EEP2_GPIO_STATE2] = 0x00,	/* - */
728c2ecf20Sopenharmony_ci};
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* entry point */
768c2ecf20Sopenharmony_cistruct snd_ice1712_card_info snd_vt1720_mobo_cards[] = {
778c2ecf20Sopenharmony_ci	{
788c2ecf20Sopenharmony_ci		.subvendor = VT1720_SUBDEVICE_K8X800,
798c2ecf20Sopenharmony_ci		.name = "Albatron K8X800 Pro II",
808c2ecf20Sopenharmony_ci		.model = "k8x800",
818c2ecf20Sopenharmony_ci		.chip_init = k8x800_init,
828c2ecf20Sopenharmony_ci		.build_controls = k8x800_add_controls,
838c2ecf20Sopenharmony_ci		.eeprom_size = sizeof(k8x800_eeprom),
848c2ecf20Sopenharmony_ci		.eeprom_data = k8x800_eeprom,
858c2ecf20Sopenharmony_ci	},
868c2ecf20Sopenharmony_ci	{
878c2ecf20Sopenharmony_ci		.subvendor = VT1720_SUBDEVICE_ZNF3_150,
888c2ecf20Sopenharmony_ci		.name = "Chaintech ZNF3-150",
898c2ecf20Sopenharmony_ci		/* identical with k8x800 */
908c2ecf20Sopenharmony_ci		.chip_init = k8x800_init,
918c2ecf20Sopenharmony_ci		.build_controls = k8x800_add_controls,
928c2ecf20Sopenharmony_ci		.eeprom_size = sizeof(k8x800_eeprom),
938c2ecf20Sopenharmony_ci		.eeprom_data = k8x800_eeprom,
948c2ecf20Sopenharmony_ci	},
958c2ecf20Sopenharmony_ci	{
968c2ecf20Sopenharmony_ci		.subvendor = VT1720_SUBDEVICE_ZNF3_250,
978c2ecf20Sopenharmony_ci		.name = "Chaintech ZNF3-250",
988c2ecf20Sopenharmony_ci		/* identical with k8x800 */
998c2ecf20Sopenharmony_ci		.chip_init = k8x800_init,
1008c2ecf20Sopenharmony_ci		.build_controls = k8x800_add_controls,
1018c2ecf20Sopenharmony_ci		.eeprom_size = sizeof(k8x800_eeprom),
1028c2ecf20Sopenharmony_ci		.eeprom_data = k8x800_eeprom,
1038c2ecf20Sopenharmony_ci	},
1048c2ecf20Sopenharmony_ci	{
1058c2ecf20Sopenharmony_ci		.subvendor = VT1720_SUBDEVICE_9CJS,
1068c2ecf20Sopenharmony_ci		.name = "Chaintech 9CJS",
1078c2ecf20Sopenharmony_ci		/* identical with k8x800 */
1088c2ecf20Sopenharmony_ci		.chip_init = k8x800_init,
1098c2ecf20Sopenharmony_ci		.build_controls = k8x800_add_controls,
1108c2ecf20Sopenharmony_ci		.eeprom_size = sizeof(k8x800_eeprom),
1118c2ecf20Sopenharmony_ci		.eeprom_data = k8x800_eeprom,
1128c2ecf20Sopenharmony_ci	},
1138c2ecf20Sopenharmony_ci	{
1148c2ecf20Sopenharmony_ci		.subvendor = VT1720_SUBDEVICE_SN25P,
1158c2ecf20Sopenharmony_ci		.name = "Shuttle SN25P",
1168c2ecf20Sopenharmony_ci		.model = "sn25p",
1178c2ecf20Sopenharmony_ci		.chip_init = k8x800_init,
1188c2ecf20Sopenharmony_ci		.build_controls = k8x800_add_controls,
1198c2ecf20Sopenharmony_ci		.eeprom_size = sizeof(k8x800_eeprom),
1208c2ecf20Sopenharmony_ci		.eeprom_data = sn25p_eeprom,
1218c2ecf20Sopenharmony_ci	},
1228c2ecf20Sopenharmony_ci	{ } /* terminator */
1238c2ecf20Sopenharmony_ci};
1248c2ecf20Sopenharmony_ci
125