ALSA: usb - Add boot quirk for C-Media 6206 USB Audio

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, June 12, 2009 - 12:04 pm

Gitweb:     http://git.kernel.org/linus/92a43793a908f395dc687e6c5fc90d63f999d6d5
Commit:     92a43793a908f395dc687e6c5fc90d63f999d6d5
Parent:     ca85b6ba59b69b7b5adcc64a98bd2478f73b2542
Author:     Dan Allongo <gongo2k1@gmail.com>
AuthorDate: Mon Jun 8 11:21:52 2009 -0400
Committer:  Takashi Iwai <tiwai@suse.de>
CommitDate: Mon Jun 8 19:08:42 2009 +0200

    ALSA: usb - Add boot quirk for C-Media 6206 USB Audio
    
    Added boot quirk for C-Media CM6206 device in snd_usb_audio_probe.
    The function snd_usb_cm6206_boot_quirk sets up six internal 16-bit
    registers in order to initialize the device. Values for the registers
    came from sniffing USB traffic under Windows since only four of the six
    are documented in the datasheet for CM106 and some reserved bits were
    also being set.
    
    [Minor coding-style fixes by tiwai]
    
    Signed-off-by: Dan Allongo <gongo2k1@gmail.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/usbaudio.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index a6b8848..e871217 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -3279,6 +3279,25 @@ static int snd_usb_cm106_boot_quirk(struct usb_device *dev)
 	return snd_usb_cm106_write_int_reg(dev, 2, 0x8004);
 }
 
+/*
+ * C-Media CM6206 is based on CM106 with two additional
+ * registers that are not documented in the data sheet.
+ * Values here are chosen based on sniffing USB traffic
+ * under Windows.
+ */
+static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
+{
+	int err, reg;
+	int val[] = {0x200c, 0x3000, 0xf800, 0x143f, 0x0000, 0x3000};
+
+	for (reg = 0; reg < ARRAY_SIZE(val); reg++) {
+		err = snd_usb_cm106_write_int_reg(dev, reg, val[reg]);
+		if (err < 0)
+			return err;
+	}
+
+	return err;
+}
 
 /*
  * Setup quirks
@@ -3565,6 +3584,12 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
 			goto __err_val;
 	}
 
+	/* C-Media CM6206 / CM106-Like Sound Device */
+	if (id == USB_ID(0x0d8c, 0x0102)) {
+		if (snd_usb_cm6206_boot_quirk(dev) < 0)
+			goto __err_val;
+	}
+
 	/*
 	 * found a config.  now register to ALSA
 	 */
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
ALSA: usb - Add boot quirk for C-Media 6206 USB Audio, Linux Kernel Mailing ..., (Fri Jun 12, 12:04 pm)