[ALSA] add codec-specific controls for UCB1400
authorMike Rapoport <mike@compulab.co.il>
Thu, 29 Jun 2006 15:15:33 +0000 (17:15 +0200)
committerJaroslav Kysela <perex@suse.cz>
Sat, 23 Sep 2006 08:37:12 +0000 (10:37 +0200)
This patch adds some codec-specific controls for Philips UCB1400 codec.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/pci/ac97/ac97_codec.c
sound/pci/ac97/ac97_patch.c
sound/pci/ac97/ac97_patch.h

index f82c636e99a9f214a751f2c031e632e378dcfc4e..e5d062d640dfcf9b7ba71d43647669ffc5a64e01 100644 (file)
@@ -156,7 +156,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
 { 0x4e534300, 0xffffffff, "LM4540,43,45,46,48",        NULL,           NULL }, // only guess --jk
 { 0x4e534331, 0xffffffff, "LM4549",            NULL,           NULL },
 { 0x4e534350, 0xffffffff, "LM4550",            patch_lm4550,   NULL }, // volume wrap fix 
-{ 0x50534304, 0xffffffff, "UCB1400",           NULL,           NULL },
+{ 0x50534304, 0xffffffff, "UCB1400",           patch_ucb1400,  NULL },
 { 0x53494c20, 0xffffffe0, "Si3036,8",          mpatch_si3036,  mpatch_si3036, AC97_MODEM_PATCH },
 { 0x54524102, 0xffffffff, "TR28022",           NULL,           NULL },
 { 0x54524106, 0xffffffff, "TR28026",           NULL,           NULL },
index 094cfc1f3a190157b7bd7c0e3436cf00a9dcf858..5267b006c5c854c6b393b110b8bed0a284b5ba29 100644 (file)
@@ -2872,3 +2872,41 @@ int patch_lm4550(struct snd_ac97 *ac97)
        ac97->res_table = lm4550_restbl;
        return 0;
 }
+
+/* 
+ *  UCB1400 codec (http://www.semiconductors.philips.com/acrobat_download/datasheets/UCB1400-02.pdf)
+ */
+static const struct snd_kcontrol_new snd_ac97_controls_ucb1400[] = {
+/* enable/disable headphone driver which allows direct connection to
+   stereo headphone without the use of external DC blocking
+   capacitors */
+AC97_SINGLE("Headphone Driver", 0x6a, 6, 1, 0),
+/* Filter used to compensate the DC offset is added in the ADC to remove idle
+   tones from the audio band. */
+AC97_SINGLE("DC Filter", 0x6a, 4, 1, 0),
+/* Control smart-low-power mode feature. Allows automatic power down
+   of unused blocks in the ADC analog front end and the PLL. */
+AC97_SINGLE("Smart Low Power Mode", 0x6c, 4, 3, 0),
+};
+
+static int patch_ucb1400_specific(struct snd_ac97 * ac97)
+{
+       int idx, err;
+       for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_ucb1400); idx++)
+               if ((err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_ucb1400[idx], ac97))) < 0)
+                       return err;
+       return 0;
+}
+
+static struct snd_ac97_build_ops patch_ucb1400_ops = {
+       .build_specific = patch_ucb1400_specific,
+};
+
+int patch_ucb1400(struct snd_ac97 * ac97)
+{
+       ac97->build_ops = &patch_ucb1400_ops;
+       /* enable headphone driver and smart low power mode by default */
+       snd_ac97_write(ac97, 0x6a, 0x0050);
+       snd_ac97_write(ac97, 0x6c, 0x0030);
+       return 0;
+}
index adcaa04586cbb500de7feeaaa893f36db7af97c6..741979217207501992d8e9493923ff0bfb498f0f 100644 (file)
@@ -58,5 +58,6 @@ int patch_cm9780(struct snd_ac97 * ac97);
 int patch_vt1616(struct snd_ac97 * ac97);
 int patch_vt1617a(struct snd_ac97 * ac97);
 int patch_it2646(struct snd_ac97 * ac97);
+int patch_ucb1400(struct snd_ac97 * ac97);
 int mpatch_si3036(struct snd_ac97 * ac97);
 int patch_lm4550(struct snd_ac97 * ac97);