Skip to contentSkip to conversation

imac27 12,2 (2011) model for patch_cirrus.c

PATCH Applied Jérémy Lal 2 participants 10 messages Dec 29, 2011 – Jan 9, 2012 Sound

lore
Share & tools
lore
#0 lore raw

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).

Regards,
Jérémy.

sound/pci/hda/patch_cirrus.c renamed from sound/pci/hda/patch_cirrus.c.orig +53 -0
@@ -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",
 };
@@ -1345,10 +1347,55 @@
 	{} /* terminator */
 };
 
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },
+	{ 0x02, 0x101e9700 },
+	{ 0x03, 0x901f9700 },
+	{ 0x04, 0xf01ca700 },
+	{ 0x05, 0x101da700 },
+	{ 0x06, 0x011ea700 },
+	{ 0x07, 0x021fa700 },
+	{ 0x08, 0x801cb700 },
+	{ 0x09, 0x001db700 },
+	{ 0x0a, 0x101eb700 },
+	{ 0x0b, 0x901fb700 },
+	{ 0x0c, 0x5017c700 },
+	{ 0x0d, 0x101dc700 },
+	{ 0x0e, 0x811ec700 },
+	{ 0x0f, 0x021fc700 },
+	{ 0x10, 0x301cd700 },
+	{ 0x11, 0x101dd700 },
+	{ 0x12, 0xa11ed700 },
+	{ 0x13, 0x031fd700 },
+	{ 0x14, 0xf01ce700 },
+	{ 0x15, 0x111de700 },
+	{ 0x16, 0x961ee700 },
+	{ 0x17, 0x771fe700 },
+	{ 0x18, 0xf01cf700 },
+	{ 0x19, 0x111df700 },
+	{ 0x1a, 0xc51ef700 },
+	{ 0x1b, 0x041f0701 },
+	{ 0x1c, 0xf01c0701 },
+	{ 0x1d, 0x101d0701 },
+	{ 0x1e, 0x451e0701 },
+	{ 0x1f, 0x041f0701 },
+	{ 0x20, 0xf01c2701 },
+	{ 0x21, 0x111d2701 },
+	{ 0x22, 0x961e2701 },
+	{ 0x23, 0x771f2701 },
+	{ 0x24, 0xf01c5701 },
+	{ 0x25, 0x001d5701 },
+	{ 0x26, 0x001e5701 },
+	{ 0x27, 0x401f5701 },
+	{} /* terminator */
+};
+
 static const struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
 	[CS420X_MBP53] = mbp53_pincfgs,
 	[CS420X_MBP55] = mbp55_pincfgs,
 	[CS420X_IMAC27] = imac27_pincfgs,
+	[CS420X_IMAC27_122] = imac27_122_pincfgs,
 };
 
 static void fix_pincfg(struct hda_codec *codec, int model,
@@ -1392,6 +1439,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;
 	}
 
#1 lore raw

At Thu, 29 Dec 2011 13:00:01 +0100,

Quoted 10 lines · Jérémy Lal

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.

Quoted 3 lines
sound/pci/hda/patch_cirrus.c renamed from sound/pci/hda/patch_cirrus.c.orig +3 -0
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },

(snip)

sound/pci/hda/patch_cirrus.c line 1392

Quoted 3 lines
sound/pci/hda/patch_cirrus.c renamed from sound/pci/hda/patch_cirrus.c.orig +3 -0
+	{ 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.

thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
Quoted 19 lines · Takashi Iwai

At Thu, 29 Dec 2011 13:00:01 +0100,

Quoted 10 lines · Jérémy Lal

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.

Quoted 3 lines
(quoted diff) +3 -0
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },

(snip)

Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	{ 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.

sound/pci/hda/patch_cirrus.c +8 -0
@@ -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;
 	}
 

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw

At Mon, 09 Jan 2012 14:53:10 +0100,

Quoted 29 lines · Jérémy Lal
Quoted 19 lines · Takashi Iwai

At Thu, 29 Dec 2011 13:00:01 +0100,

Quoted 10 lines · Jérémy Lal

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.

Quoted 3 lines
(quoted diff) +3 -0
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },

(snip)

Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	{ 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.

Quoted 6 lines

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.

OK, that's much better.
Could you give the patch with a proper changelog and your sign-off so that I can merge it now?

Also, I guess your device should be identified via PCI SSID. Could you check whether the device has a unique PCI SSID (check lspci output), and add the corresponding entry to cs420x_cfg_tbl[]? If it's about 10de:xxxx, it should be unique. If it's 8086:xxxx, then we'd need to check the codec SSID instead of PCI SSID.

thanks,

Takashi

Quoted 24 lines
sound/pci/hda/patch_cirrus.c +2 -0
@@ -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 =

sound/pci/hda/patch_cirrus.c line 1405

Quoted 10 lines
sound/pci/hda/patch_cirrus.c +6 -0
 			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;
 	}
 

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw
Quoted 34 lines · Takashi Iwai

At Mon, 09 Jan 2012 14:53:10 +0100,

Quoted 32 lines · Jérémy Lal
Quoted 19 lines · Takashi Iwai

At Thu, 29 Dec 2011 13:00:01 +0100,

Quoted 10 lines · Jérémy Lal

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.

Quoted 3 lines
(quoted diff) +3 -0
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },

(snip)

Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	{ 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.

Quoted 7 lines
Quoted 3 lines

A kernel with the following patch and
options snd-hda-intel model=imac27_122
is enough to get sound working.

OK, that's much better.
Could you give the patch with a proper changelog and your sign-off so that I can merge it now?

ALSA: hda/cirrus - support for iMac12,1 and 12,2 models

Those models just need to have headphones on GPI02 instead of GPI01, and use BIOS pincfgs.

---

sound/pci/hda/patch_cirrus.c +8 -0
@@ -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;
 	}
 
Quoted 5 lines

Also, I guess your device should be identified via PCI SSID. Could you check whether the device has a unique PCI SSID (check lspci output), and add the corresponding entry to cs420x_cfg_tbl[]? If it's about 10de:xxxx, it should be unique. If it's 8086:xxxx, then we'd need to check the codec SSID instead of PCI SSID.

The PCI SSID is 8086:1c20
How can i get the codec SSID ?

Jérémy.

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw

At Mon, 09 Jan 2012 15:26:07 +0100,

Quoted 85 lines · Jérémy Lal
Quoted 34 lines · Takashi Iwai

At Mon, 09 Jan 2012 14:53:10 +0100,

Quoted 32 lines · Jérémy Lal
Quoted 19 lines · Takashi Iwai

At Thu, 29 Dec 2011 13:00:01 +0100,

Quoted 10 lines · Jérémy Lal

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.

Quoted 3 lines
(quoted diff) +3 -0
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },

(snip)

Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	{ 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.

Quoted 7 lines
Quoted 3 lines

A kernel with the following patch and
options snd-hda-intel model=imac27_122
is enough to get sound working.

OK, that's much better.
Could you give the patch with a proper changelog and your sign-off so that I can merge it now?

ALSA: hda/cirrus - support for iMac12,1 and 12,2 models

Those models just need to have headphones on GPI02 instead of GPI01, and use BIOS pincfgs.

---

sound/pci/hda/patch_cirrus.c +8 -0
@@ -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;
 	}
 
Quoted 8 lines
Quoted 5 lines

Also, I guess your device should be identified via PCI SSID. Could you check whether the device has a unique PCI SSID (check lspci output), and add the corresponding entry to cs420x_cfg_tbl[]? If it's about 10de:xxxx, it should be unique. If it's 8086:xxxx, then we'd need to check the codec SSID instead of PCI SSID.

The PCI SSID is 8086:1c20
How can i get the codec SSID ?

Check /proc/asound/card0/codec#* file. This id should be added to
cs420x_codec_cfg_tbl[], but before the entry SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE)
which matches all 106b:*.

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#6 lore raw
Quoted 96 lines · Takashi Iwai

At Mon, 09 Jan 2012 15:26:07 +0100,

Quoted 85 lines · Jérémy Lal
Quoted 34 lines · Takashi Iwai

At Mon, 09 Jan 2012 14:53:10 +0100,

Quoted 32 lines · Jérémy Lal
Quoted 19 lines · Takashi Iwai

At Thu, 29 Dec 2011 13:00:01 +0100,

Quoted 10 lines · Jérémy Lal

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.

Quoted 3 lines
(quoted diff) +3 -0
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },

(snip)

Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	{ 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.

Quoted 7 lines
Quoted 3 lines

A kernel with the following patch and
options snd-hda-intel model=imac27_122
is enough to get sound working.

OK, that's much better.
Could you give the patch with a proper changelog and your sign-off so that I can merge it now?

ALSA: hda/cirrus - support for iMac12,1 and 12,2 models

Those models just need to have headphones on GPI02 instead of GPI01, and use BIOS pincfgs.

---

sound/pci/hda/patch_cirrus.c +8 -0
@@ -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;
 	}
 
Quoted 8 lines
Quoted 5 lines

Also, I guess your device should be identified via PCI SSID. Could you check whether the device has a unique PCI SSID (check lspci output), and add the corresponding entry to cs420x_cfg_tbl[]? If it's about 10de:xxxx, it should be unique. If it's 8086:xxxx, then we'd need to check the codec SSID instead of PCI SSID.

The PCI SSID is 8086:1c20
How can i get the codec SSID ?

Quoted 7 lines

Check /proc/asound/card0/codec#* file. This id should be added to
cs420x_codec_cfg_tbl[], but before the entry SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE)
which matches all 106b:*.

Takashi

I get
Vendor Id: 0x10134206
Subsystem Id: 0x106b2000

However this code does not work :

sound/pci/hda/patch_cirrus.c +9 -0
@@ -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",
 };
@@ -1294,6 +1296,7 @@
 };
 
 static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = {
+	SND_PCI_QUIRK_VENDOR(0x106b2000, "iMac 12,2", CS420X_IMAC27_122),
 	SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
 	{} /* terminator */
 };
@@ -1392,6 +1395,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;
 	}
 

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#7 lore raw

At Mon, 09 Jan 2012 16:18:02 +0100,

Quoted 131 lines · Jérémy Lal
Quoted 96 lines · Takashi Iwai

At Mon, 09 Jan 2012 15:26:07 +0100,

Quoted 85 lines · Jérémy Lal
Quoted 34 lines · Takashi Iwai

At Mon, 09 Jan 2012 14:53:10 +0100,

Quoted 32 lines · Jérémy Lal
Quoted 19 lines · Takashi Iwai

At Thu, 29 Dec 2011 13:00:01 +0100,

Quoted 10 lines · Jérémy Lal

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.

Quoted 3 lines
(quoted diff) +3 -0
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },

(snip)

Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	{ 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.

Quoted 7 lines
Quoted 3 lines

A kernel with the following patch and
options snd-hda-intel model=imac27_122
is enough to get sound working.

OK, that's much better.
Could you give the patch with a proper changelog and your sign-off so that I can merge it now?

ALSA: hda/cirrus - support for iMac12,1 and 12,2 models

Those models just need to have headphones on GPI02 instead of GPI01, and use BIOS pincfgs.

---

sound/pci/hda/patch_cirrus.c +8 -0
@@ -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;
 	}
 
Quoted 8 lines
Quoted 5 lines

Also, I guess your device should be identified via PCI SSID. Could you check whether the device has a unique PCI SSID (check lspci output), and add the corresponding entry to cs420x_cfg_tbl[]? If it's about 10de:xxxx, it should be unique. If it's 8086:xxxx, then we'd need to check the codec SSID instead of PCI SSID.

The PCI SSID is 8086:1c20
How can i get the codec SSID ?

Quoted 7 lines

Check /proc/asound/card0/codec#* file. This id should be added to
cs420x_codec_cfg_tbl[], but before the entry SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE)
which matches all 106b:*.

Takashi

I get
Vendor Id: 0x10134206
Subsystem Id: 0x106b2000

However this code does not work :

sound/pci/hda/patch_cirrus.c +2 -0
@@ -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",
 };

sound/pci/hda/patch_cirrus.c line 1299

Quoted 4 lines
sound/pci/hda/patch_cirrus.c +1 -0
@@ -1294,6 +1296,7 @@
 };
 
 static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = {
+	SND_PCI_QUIRK_VENDOR(0x106b2000, "iMac 12,2", CS420X_IMAC27_122),

You must pass

	SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),

instead.

Takashi

Quoted 7 lines
sound/pci/hda/patch_cirrus.c +0 -0
 	SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
 	{} /* terminator */
 };
@@ -1392,6 +1395,12 @@
 		spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */
 		spec->gpio_mask = spec->gpio_dir =

sound/pci/hda/patch_cirrus.c line 1406

Quoted 10 lines
sound/pci/hda/patch_cirrus.c +6 -0
 			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;
 	}
 

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#8 lore raw
Quoted 75 lines · Takashi Iwai

At Mon, 09 Jan 2012 16:18:02 +0100,

Quoted 73 lines · Jérémy Lal
Quoted 52 lines · Takashi Iwai

At Mon, 09 Jan 2012 15:26:07 +0100,

Quoted 50 lines · Jérémy Lal
Quoted 47 lines · Takashi Iwai

At Mon, 09 Jan 2012 14:53:10 +0100,

Quoted 29 lines · Jérémy Lal
Quoted 19 lines · Takashi Iwai

At Thu, 29 Dec 2011 13:00:01 +0100,

Quoted 10 lines · Jérémy Lal

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.

Quoted 3 lines
(quoted diff) +3 -0
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },

(snip)

Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	{ 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.

Quoted 6 lines

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.

OK, that's much better.
Could you give the patch with a proper changelog and your sign-off so that I can merge it now?

Also, I guess your device should be identified via PCI SSID. Could you check whether the device has a unique PCI SSID (check lspci output), and add the corresponding entry to cs420x_cfg_tbl[]? If it's about 10de:xxxx, it should be unique. If it's 8086:xxxx, then we'd need to check the codec SSID instead of PCI SSID.

Quoted 7 lines
Quoted 2 lines

The PCI SSID is 8086:1c20
How can i get the codec SSID ?

Check /proc/asound/card0/codec#* file. This id should be added to
cs420x_codec_cfg_tbl[], but before the entry SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE)
which matches all 106b:*.

I get
Vendor Id: 0x10134206
Subsystem Id: 0x106b2000

However this code does not work :

sound/pci/hda/patch_cirrus.c +0 -0
@@ -1294,6 +1296,7 @@
 };
 
Quoted 6 lines

sound/pci/hda/patch_cirrus.c line 1299

Quoted 2 lines
sound/pci/hda/patch_cirrus.c +1 -0
 static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = {
+	SND_PCI_QUIRK_VENDOR(0x106b2000, "iMac 12,2", CS420X_IMAC27_122),

You must pass

	SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),

instead.

Yes, thank you, this works (updated patch and description) :

ALSA: hda/cirrus - support for iMac12,2 model

This early 2011 model just need to have headphones on GPI02 instead of GPI01, and use BIOS pincfgs.
It is detected by codec SSID.
The iMac12,1 model is known to work the same way, although maybe not with the same codec SSID.

---

sound/pci/hda/patch_cirrus.c +9 -0
@@ -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",
 };
@@ -1294,6 +1296,7 @@
 };
 
 static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = {
+	SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),
 	SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
 	{} /* terminator */
 };
@@ -1392,6 +1395,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;
 	}
 

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Applied
#9 lore raw

At Mon, 09 Jan 2012 17:19:45 +0100,

Quoted 89 lines · Jérémy Lal
Quoted 75 lines · Takashi Iwai

At Mon, 09 Jan 2012 16:18:02 +0100,

Quoted 73 lines · Jérémy Lal
Quoted 52 lines · Takashi Iwai

At Mon, 09 Jan 2012 15:26:07 +0100,

Quoted 50 lines · Jérémy Lal
Quoted 47 lines · Takashi Iwai

At Mon, 09 Jan 2012 14:53:10 +0100,

Quoted 29 lines · Jérémy Lal
Quoted 19 lines · Takashi Iwai

At Thu, 29 Dec 2011 13:00:01 +0100,

Quoted 10 lines · Jérémy Lal

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.

Quoted 3 lines
(quoted diff) +3 -0
+static const struct cs_pincfg imac27_122_pincfgs[] = {
+	{ 0x00, 0x821c9700 },
+	{ 0x01, 0x011d9700 },

(snip)

Quoted 7 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	{ 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.

Quoted 6 lines

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.

OK, that's much better.
Could you give the patch with a proper changelog and your sign-off so that I can merge it now?

Also, I guess your device should be identified via PCI SSID. Could you check whether the device has a unique PCI SSID (check lspci output), and add the corresponding entry to cs420x_cfg_tbl[]? If it's about 10de:xxxx, it should be unique. If it's 8086:xxxx, then we'd need to check the codec SSID instead of PCI SSID.

Quoted 7 lines
Quoted 2 lines

The PCI SSID is 8086:1c20
How can i get the codec SSID ?

Check /proc/asound/card0/codec#* file. This id should be added to
cs420x_codec_cfg_tbl[], but before the entry SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE)
which matches all 106b:*.

I get
Vendor Id: 0x10134206
Subsystem Id: 0x106b2000

However this code does not work :

sound/pci/hda/patch_cirrus.c +0 -0
@@ -1294,6 +1296,7 @@
 };
 
Quoted 6 lines

sound/pci/hda/patch_cirrus.c line 1299

Quoted 2 lines
sound/pci/hda/patch_cirrus.c +1 -0
 static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = {
+	SND_PCI_QUIRK_VENDOR(0x106b2000, "iMac 12,2", CS420X_IMAC27_122),

You must pass

	SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),

instead.

Yes, thank you, this works (updated patch and description) :

ALSA: hda/cirrus - support for iMac12,2 model

Quoted 7 lines

This early 2011 model just need to have headphones on GPI02 instead of GPI01, and use BIOS pincfgs.
It is detected by codec SSID.
The iMac12,1 model is known to work the same way, although maybe not with the same codec SSID.

Thanks, applied now.

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel