]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ALSA: Allow to force model to intel-mac-v3 in snd_hda_intel (sigmatel).
authorNicolas Boichat <nicolas@boichat.ch>
Mon, 21 Jul 2008 14:18:01 +0000 (22:18 +0800)
committerTakashi Iwai <tiwai@suse.de>
Sun, 27 Jul 2008 08:22:27 +0000 (10:22 +0200)
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: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Documentation/sound/alsa/ALSA-Configuration.txt
sound/pci/hda/patch_sigmatel.c

index 72aff61e731509d7c87f3a3913aa3b4e965ab9c5..6f6d117ac7e22cd2d9fc981f0fc8542d824d1db8 100644 (file)
@@ -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-v4  Intel Mac Type 4
          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)
          macbook       Intel Mac Book (eq. type 5)
          macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3)
index 08cb77f51880a31265c46cf66691715cfbf5dd55..7fdafcb0015d8e9030c13c27b9d060c16ff9b39d 100644 (file)
@@ -94,6 +94,9 @@ enum {
        STAC_INTEL_MAC_V3,
        STAC_INTEL_MAC_V4,
        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 */
        STAC_MACMINI,
        STAC_MACBOOK,
@@ -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_V4] = intel_mac_v4_pin_configs,
        [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs,
+       [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs,
        /* for backward compatibility */
        [STAC_MACMINI] = intel_mac_v3_pin_configs,
        [STAC_MACBOOK] = intel_mac_v5_pin_configs,
@@ -1505,6 +1509,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = {
        [STAC_INTEL_MAC_V3] = "intel-mac-v3",
        [STAC_INTEL_MAC_V4] = "intel-mac-v4",
        [STAC_INTEL_MAC_V5] = "intel-mac-v5",
+       [STAC_INTEL_MAC_AUTO] = "intel-mac-auto",
        /* for backward compatibility */
        [STAC_MACMINI]  = "macmini",
        [STAC_MACBOOK]  = "macbook",
@@ -1576,9 +1581,9 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = {
        SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
                      "Intel D945P", STAC_D945GTP5),
        /* other systems  */
-       /* Apple Mac Mini (early 2006) */
+       /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
        SND_PCI_QUIRK(0x8384, 0x7680,
-                     "Mac Mini", STAC_INTEL_MAC_V3),
+                     "Mac", STAC_INTEL_MAC_AUTO),
        /* Dell systems  */
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
                      "unknown Dell", STAC_922X_DELL_D81),
@@ -3725,7 +3730,7 @@ static int patch_stac922x(struct hda_codec *codec)
        spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
                                                        stac922x_models,
                                                        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_data = 0x03;
                /* Intel Macs have all same PCI SSID, so we need to check
@@ -3757,6 +3762,9 @@ static int patch_stac922x(struct hda_codec *codec)
                case 0x106b2200:
                        spec->board_config = STAC_INTEL_MAC_V5;
                        break;
+               default:
+                       spec->board_config = STAC_INTEL_MAC_V3;
+                       break;
                }
        }