Commit 536319af authored by Nicolas Boichat's avatar Nicolas Boichat Committed by Takashi Iwai

ALSA: Allow to force model to intel-mac-v3 in snd_hda_intel (sigmatel).

Currently, even if you pass model=intel-mac-v3 as a module parameter to
snd_hda_intel, the function patch_stac922x (patch_sigmatel.c) will still
try to auto-detect the model type. This is a problem on my MacBook Pro 1st
generation, which needs intel-mac-v3, but sometimes incorrectly reports
0x00000100 as subsystem id, which causes the switch in patch_stac922x to
select intel-mac-v4.

To fix this, I added a new model called intel-mac-auto, so in case no
module parameter is passed, and an Intel Mac board is detected, the
model will be automatically detected, while no detection will be done
if the model is forced to intel-mac-v3.

This problem has been around for quite a while, and I used to fix it
by moving the case statement for 0x00000100 in patch_stac922x so that
intel-mac-v3 is chosen.

Another way to fix the problem would be to check if a module parameter
was set directly in patch_stac922x, using something like this:
if (spec->board_config == STAC_INTEL_MAC_V3 &&
	!codec->bus->modelname) {

But I think it is less elegant (if you prefer that way, I can prepare a
patch).
Signed-off-by: default avatarNicolas Boichat <nicolas@boichat.ch>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b15ebe26
...@@ -1024,6 +1024,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. ...@@ -1024,6 +1024,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
intel-mac-v3 Intel Mac Type 3 intel-mac-v3 Intel Mac Type 3
intel-mac-v4 Intel Mac Type 4 intel-mac-v4 Intel Mac Type 4
intel-mac-v5 Intel Mac Type 5 intel-mac-v5 Intel Mac Type 5
intel-mac-auto Intel Mac (detect type according to subsystem id)
macmini Intel Mac Mini (equivalent with type 3) macmini Intel Mac Mini (equivalent with type 3)
macbook Intel Mac Book (eq. type 5) macbook Intel Mac Book (eq. type 5)
macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3) macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3)
......
...@@ -94,6 +94,9 @@ enum { ...@@ -94,6 +94,9 @@ enum {
STAC_INTEL_MAC_V3, STAC_INTEL_MAC_V3,
STAC_INTEL_MAC_V4, STAC_INTEL_MAC_V4,
STAC_INTEL_MAC_V5, STAC_INTEL_MAC_V5,
STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter
* is given, one of the above models will be
* chosen according to the subsystem id. */
/* for backward compatibility */ /* for backward compatibility */
STAC_MACMINI, STAC_MACMINI,
STAC_MACBOOK, STAC_MACBOOK,
...@@ -1483,6 +1486,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { ...@@ -1483,6 +1486,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
[STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs,
[STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs,
[STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
[STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
/* for backward compatibility */ /* for backward compatibility */
[STAC_MACMINI] = intel_mac_v3_pin_configs, [STAC_MACMINI] = intel_mac_v3_pin_configs,
[STAC_MACBOOK] = intel_mac_v5_pin_configs, [STAC_MACBOOK] = intel_mac_v5_pin_configs,
...@@ -1505,6 +1509,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = { ...@@ -1505,6 +1509,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = {
[STAC_INTEL_MAC_V3] = "intel-mac-v3", [STAC_INTEL_MAC_V3] = "intel-mac-v3",
[STAC_INTEL_MAC_V4] = "intel-mac-v4", [STAC_INTEL_MAC_V4] = "intel-mac-v4",
[STAC_INTEL_MAC_V5] = "intel-mac-v5", [STAC_INTEL_MAC_V5] = "intel-mac-v5",
[STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
/* for backward compatibility */ /* for backward compatibility */
[STAC_MACMINI] = "macmini", [STAC_MACMINI] = "macmini",
[STAC_MACBOOK] = "macbook", [STAC_MACBOOK] = "macbook",
...@@ -1576,9 +1581,9 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { ...@@ -1576,9 +1581,9 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = {
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
"Intel D945P", STAC_D945GTP5), "Intel D945P", STAC_D945GTP5),
/* other systems */ /* other systems */
/* Apple Mac Mini (early 2006) */ /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
SND_PCI_QUIRK(0x8384, 0x7680, SND_PCI_QUIRK(0x8384, 0x7680,
"Mac Mini", STAC_INTEL_MAC_V3), "Mac", STAC_INTEL_MAC_AUTO),
/* Dell systems */ /* Dell systems */
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
"unknown Dell", STAC_922X_DELL_D81), "unknown Dell", STAC_922X_DELL_D81),
...@@ -3725,7 +3730,7 @@ static int patch_stac922x(struct hda_codec *codec) ...@@ -3725,7 +3730,7 @@ static int patch_stac922x(struct hda_codec *codec)
spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
stac922x_models, stac922x_models,
stac922x_cfg_tbl); stac922x_cfg_tbl);
if (spec->board_config == STAC_INTEL_MAC_V3) { if (spec->board_config == STAC_INTEL_MAC_AUTO) {
spec->gpio_mask = spec->gpio_dir = 0x03; spec->gpio_mask = spec->gpio_dir = 0x03;
spec->gpio_data = 0x03; spec->gpio_data = 0x03;
/* Intel Macs have all same PCI SSID, so we need to check /* Intel Macs have all same PCI SSID, so we need to check
...@@ -3757,6 +3762,9 @@ static int patch_stac922x(struct hda_codec *codec) ...@@ -3757,6 +3762,9 @@ static int patch_stac922x(struct hda_codec *codec)
case 0x106b2200: case 0x106b2200:
spec->board_config = STAC_INTEL_MAC_V5; spec->board_config = STAC_INTEL_MAC_V5;
break; break;
default:
spec->board_config = STAC_INTEL_MAC_V3;
break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment