All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davide Gironi <davide.gironi@gmail.com>
To: linux-sound@vger.kernel.org
Cc: perex@perex.cz, tiwai@suse.com, Davide Gironi <davide.gironi@gmail.com>
Subject: [PATCH v2 1/2] ALSA: ice1712: add a board-specific EEPROM initialization hook
Date: Wed, 28 Oct 2026 19:24:09 +0100	[thread overview]
Message-ID: <20261028183155.787599-2-davide.gironi@gmail.com> (raw)
In-Reply-To: <20261028183155.787599-1-davide.gironi@gmail.com>

Add an eeprom_init callback to card info and call it after reading the
EEPROM but before generic chip setup. Move the existing DMX6Fire fixup
into the EWS driver.

Assisted-by: Pi:gpt-6-luna
Signed-off-by: Davide Gironi <davide.gironi@gmail.com>
---
 sound/pci/ice1712/ews.c     | 14 ++++++++++++++
 sound/pci/ice1712/ice1712.c | 31 ++++++++++++++++++++++---------
 sound/pci/ice1712/ice1712.h |  1 +
 3 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c
index 1dffcb0..62574c3 100644
--- a/sound/pci/ice1712/ews.c
+++ b/sound/pci/ice1712/ews.c
@@ -1012,6 +1012,19 @@ static int snd_ice1712_ews_add_controls(struct snd_ice1712 *ice)
 }
 
 
+static int snd_ice1712_ews_eeprom_init(struct snd_ice1712 *ice)
+{
+	if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE &&
+	    !ice->dxr_enable) {
+		/* Set EEPROM value to limit active ADCs and DACs to 6;
+		 * also disable AC'97 as no hardware in standard 6fire card/box.
+		 * DXR extensions are not currently supported.
+		 */
+		ice->eeprom.data[ICE_EEP1_CODEC] = 0x3a;
+	}
+	return 0;
+}
+
 /* entry point */
 struct snd_ice1712_card_info snd_ice1712_ews_cards[] = {
 	{
@@ -1060,6 +1073,7 @@ struct snd_ice1712_card_info snd_ice1712_ews_cards[] = {
 		.subvendor = ICE1712_SUBDEVICE_DMX6FIRE,
 		.name = "TerraTec DMX6Fire",
 		.model = "dmx6fire",
+		.eeprom_init = snd_ice1712_ews_eeprom_init,
 		.chip_init = snd_ice1712_ews_init,
 		.build_controls = snd_ice1712_ews_add_controls,
 		.mpu401_1_name = "MIDI-Front DMX6fire",
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 376df1a..6cc38ee 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2283,19 +2283,28 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
 
 
 
+static int snd_ice1712_init_eeprom(struct snd_ice1712 *ice)
+{
+	const struct snd_ice1712_card_info * const *tbl, *c;
+
+	for (tbl = card_tables; *tbl; tbl++) {
+		for (c = *tbl; c->subvendor; c++) {
+			if (c->subvendor != ice->eeprom.subvendor)
+				continue;
+			if (c->eeprom_init)
+				return c->eeprom_init(ice);
+			return 0;
+		}
+	}
+	return 0;
+}
+
 static int snd_ice1712_chip_init(struct snd_ice1712 *ice)
 {
 	outb(ICE1712_RESET | ICE1712_NATIVE, ICEREG(ice, CONTROL));
 	udelay(200);
 	outb(ICE1712_NATIVE, ICEREG(ice, CONTROL));
 	udelay(200);
-	if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE &&
-	    !ice->dxr_enable)
-		/*  Set eeprom value to limit active ADCs and DACs to 6;
-		 *  Also disable AC97 as no hardware in standard 6fire card/box
-		 *  Note: DXR extensions are not currently supported
-		 */
-		ice->eeprom.data[ICE_EEP1_CODEC] = 0x3a;
 	pci_write_config_byte(ice->pci, 0x60, ice->eeprom.data[ICE_EEP1_CODEC]);
 	pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]);
 	pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]);
@@ -2502,8 +2511,12 @@ static int snd_ice1712_create(struct snd_card *card,
 	card->sync_irq = ice->irq;
 	card->private_free = snd_ice1712_free;
 
-	if (snd_ice1712_read_eeprom(ice, modelname) < 0)
-		return -EIO;
+	err = snd_ice1712_read_eeprom(ice, modelname);
+	if (err < 0)
+		return err;
+	err = snd_ice1712_init_eeprom(ice);
+	if (err < 0)
+		return err;
 	if (snd_ice1712_chip_init(ice) < 0)
 		return -EIO;
 
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h
index cd02710..6e9c13b 100644
--- a/sound/pci/ice1712/ice1712.h
+++ b/sound/pci/ice1712/ice1712.h
@@ -509,6 +509,7 @@ struct snd_ice1712_card_info {
 	const char *name;
 	const char *model;
 	const char *driver;
+	int (*eeprom_init)(struct snd_ice1712 *ice);
 	int (*chip_init)(struct snd_ice1712 *);
 	void (*chip_exit)(struct snd_ice1712 *);
 	int (*build_controls)(struct snd_ice1712 *);

  reply	other threads:[~2026-10-28 18:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24 11:27 [PATCH] ASoC: ice1712: add TerraTec PHASE 88 support root
2026-10-26  7:59 ` Takashi Iwai
2026-10-28 18:24   ` [PATCH v2 0/2] ALSA: ice1712: support the TerraTec PHASE 88 Davide Gironi
2026-10-28 18:24     ` Davide Gironi [this message]
2026-10-28 18:24     ` [PATCH v2 2/2] ALSA: ice1712: add TerraTec PHASE 88 support Davide Gironi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261028183155.787599-2-davide.gironi@gmail.com \
    --to=davide.gironi@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.