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: Nicolas Boichat <nicolas@boichat.ch>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Nicolas Boichat and committed by
Takashi Iwai
536319af b15ebe26

+12 -3
+1
Documentation/sound/alsa/ALSA-Configuration.txt
··· 1024 1024 intel-mac-v3 Intel Mac Type 3 1025 1025 intel-mac-v4 Intel Mac Type 4 1026 1026 intel-mac-v5 Intel Mac Type 5 1027 + intel-mac-auto Intel Mac (detect type according to subsystem id) 1027 1028 macmini Intel Mac Mini (equivalent with type 3) 1028 1029 macbook Intel Mac Book (eq. type 5) 1029 1030 macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3)
+11 -3
sound/pci/hda/patch_sigmatel.c
··· 94 94 STAC_INTEL_MAC_V3, 95 95 STAC_INTEL_MAC_V4, 96 96 STAC_INTEL_MAC_V5, 97 + STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter 98 + * is given, one of the above models will be 99 + * chosen according to the subsystem id. */ 97 100 /* for backward compatibility */ 98 101 STAC_MACMINI, 99 102 STAC_MACBOOK, ··· 1486 1483 [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, 1487 1484 [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, 1488 1485 [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, 1486 + [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs, 1489 1487 /* for backward compatibility */ 1490 1488 [STAC_MACMINI] = intel_mac_v3_pin_configs, 1491 1489 [STAC_MACBOOK] = intel_mac_v5_pin_configs, ··· 1509 1505 [STAC_INTEL_MAC_V3] = "intel-mac-v3", 1510 1506 [STAC_INTEL_MAC_V4] = "intel-mac-v4", 1511 1507 [STAC_INTEL_MAC_V5] = "intel-mac-v5", 1508 + [STAC_INTEL_MAC_AUTO] = "intel-mac-auto", 1512 1509 /* for backward compatibility */ 1513 1510 [STAC_MACMINI] = "macmini", 1514 1511 [STAC_MACBOOK] = "macbook", ··· 1581 1576 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, 1582 1577 "Intel D945P", STAC_D945GTP5), 1583 1578 /* other systems */ 1584 - /* Apple Mac Mini (early 2006) */ 1579 + /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ 1585 1580 SND_PCI_QUIRK(0x8384, 0x7680, 1586 - "Mac Mini", STAC_INTEL_MAC_V3), 1581 + "Mac", STAC_INTEL_MAC_AUTO), 1587 1582 /* Dell systems */ 1588 1583 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, 1589 1584 "unknown Dell", STAC_922X_DELL_D81), ··· 3730 3725 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, 3731 3726 stac922x_models, 3732 3727 stac922x_cfg_tbl); 3733 - if (spec->board_config == STAC_INTEL_MAC_V3) { 3728 + if (spec->board_config == STAC_INTEL_MAC_AUTO) { 3734 3729 spec->gpio_mask = spec->gpio_dir = 0x03; 3735 3730 spec->gpio_data = 0x03; 3736 3731 /* Intel Macs have all same PCI SSID, so we need to check ··· 3761 3756 case 0x106b0a00: 3762 3757 case 0x106b2200: 3763 3758 spec->board_config = STAC_INTEL_MAC_V5; 3759 + break; 3760 + default: 3761 + spec->board_config = STAC_INTEL_MAC_V3; 3764 3762 break; 3765 3763 } 3766 3764 }