On 09/01/2012 11:34, Takashi Iwai wrote:
At Thu, 29 Dec 2011 13:00:01 +0100, Jérémy Lal wrote:
Hi, it'd be glad to have patch_cirrus.c recognize model=imac27_122, (i'm adding a model because it's harder to auto-detect it), please find attached patch, tested on linux 3.2-rc7. I don't know anything about pin configs, just that it works with the ones in the patch. Note that i tried with model=auto (no sound) and model=imac27 (front speakers not muted when headphones are plugged in, and surround speakers not properly detected).
Thanks for the patch. But I see a problem in the code, i.e.
+static const struct cs_pincfg imac27_122_pincfgs[] = {
- { 0x00, 0x821c9700 },
- { 0x01, 0x011d9700 },
(snip)
- { 0x27, 0x401f5701 },
- {} /* terminator */
+};
This looks obviously wrong. The pincfg table should contain only the default pin-configuration values for pin widgets while you are setting some values to all widgets. Please minimize this entry.
It's working without overriding pin-configurations :) I tested almost everything except digital input/output.
A kernel with the following patch and options snd-hda-intel model=imac27_122 is enough to get sound working.
--- linux-source-3.2-rc7.orig/sound/pci/hda/patch_cirrus.c 2011-12-24 06:51:06.000000000 +0100 +++ linux-source-3.2-rc7/sound/pci/hda/patch_cirrus.c 2012-01-09 12:40:53.026430475 +0100 @@ -78,6 +78,7 @@ CS420X_MBP53, CS420X_MBP55, CS420X_IMAC27, + CS420X_IMAC27_122, CS420X_APPLE, CS420X_AUTO, CS420X_MODELS @@ -1278,6 +1279,7 @@ [CS420X_MBP53] = "mbp53", [CS420X_MBP55] = "mbp55", [CS420X_IMAC27] = "imac27", + [CS420X_IMAC27_122] = "imac27_122", [CS420X_APPLE] = "apple", [CS420X_AUTO] = "auto", }; @@ -1392,6 +1394,12 @@ spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ spec->gpio_mask = spec->gpio_dir = spec->gpio_eapd_hp | spec->gpio_eapd_speaker; + break; + case CS420X_IMAC27_122: + spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ + spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ + spec->gpio_mask = spec->gpio_dir = + spec->gpio_eapd_hp | spec->gpio_eapd_speaker; break; }