ALSA: hda - Add quirk for MacBook Pro 5,5 with CS4206
authorTakashi Iwai <tiwai@suse.de>
Mon, 6 Jul 2009 13:15:22 +0000 (15:15 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 6 Jul 2009 13:18:46 +0000 (15:18 +0200)
Add the default pin configs for MBP55.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Documentation/sound/alsa/HD-Audio-Models.txt
sound/pci/hda/patch_cirrus.c

index a1895d7f3cf7d99651a556f61933cfac8dc45bf0..4d120a66fc76bbbc0a3979b26576e3103f478431 100644 (file)
@@ -381,3 +381,7 @@ STAC9872
 ========
   vaio         VAIO laptop without SPDIF
   auto         BIOS setup (default)
+
+Cirrus Logic CS4206/4207
+========================
+  mbp55                MacBook Pro 5,5
index 404c120991bf38e60662c937de9764883f19a110..b1fd183d760414f7915e86b4dd187a427c7aa564 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 struct cs_spec {
+       int board_config;
        struct auto_pin_cfg autocfg;
        struct hda_multi_out multiout;
        struct snd_kcontrol *vmaster_sw;
@@ -58,6 +59,13 @@ struct cs_spec {
        unsigned int mic_detect:1;
 };
 
+/* available models */
+enum {
+       CS420X_MBP55,
+       CS420X_AUTO,
+       CS420X_MODELS
+};
+
 /* Vendor-specific processing widget */
 #define CS420X_VENDOR_NID      0x11
 #define CS_DIG_OUT1_PIN_NID    0x10
@@ -1038,6 +1046,49 @@ static int cs_parse_auto_config(struct hda_codec *codec)
        return 0;
 }
 
+static const char *cs420x_models[CS420X_MODELS] = {
+       [CS420X_MBP55] = "mbp55",
+       [CS420X_AUTO] = "auto",
+};
+
+
+static struct snd_pci_quirk cs420x_cfg_tbl[] = {
+       SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
+       {} /* terminator */
+};
+
+struct cs_pincfg {
+       hda_nid_t nid;
+       u32 val;
+};
+
+static struct cs_pincfg mbp55_pincfgs[] = {
+       { 0x09, 0x012b4030 },
+       { 0x0a, 0x90100121 },
+       { 0x0b, 0x90100120 },
+       { 0x0c, 0x400000f0 },
+       { 0x0d, 0x90a00110 },
+       { 0x0e, 0x400000f0 },
+       { 0x0f, 0x400000f0 },
+       { 0x10, 0x014be040 },
+       { 0x12, 0x400000f0 },
+       { 0x15, 0x400000f0 },
+       {} /* terminator */
+};
+
+static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
+       [CS420X_MBP55] = mbp55_pincfgs,
+};
+
+static void fix_pincfg(struct hda_codec *codec, int model)
+{
+       const struct cs_pincfg *cfg = cs_pincfgs[model];
+       if (!cfg)
+               return;
+       for (; cfg->nid; cfg++)
+               snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
+}
+
 
 static int patch_cs420x(struct hda_codec *codec)
 {
@@ -1049,6 +1100,12 @@ static int patch_cs420x(struct hda_codec *codec)
                return -ENOMEM;
        codec->spec = spec;
 
+       spec->board_config =
+               snd_hda_check_board_config(codec, CS420X_MODELS,
+                                          cs420x_models, cs420x_cfg_tbl);
+       if (spec->board_config >= 0)
+               fix_pincfg(codec, spec->board_config);
+
        err = cs_parse_auto_config(codec);
        if (err < 0)
                goto error;