]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ALSA: hda - Added HP HDX16/HDX18 notebook support for HDA codecs (82HD71)
authorChristoph Plattner <christoph.plattner@gmx.at>
Sun, 8 Mar 2009 22:19:05 +0000 (23:19 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 10 Mar 2009 06:35:20 +0000 (07:35 +0100)
Added codec recognition of HP HDX platforms and added support of the
MUTE LED (orange/white). For this feature the CONFIG_SND_HDA_POWER_SAVE
is needed to use event handling for mute control.

Signed-off-by: Christoph Plattner <christoph.plattner@gmx.at>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_sigmatel.c

index 123bcf7c3b244d84be5842167807a60a5de2d365..fb9f4ccba885d5fb6c112d797418aa978bae93ec 100644 (file)
@@ -99,6 +99,7 @@ enum {
        STAC_DELL_M4_3,
        STAC_HP_M4,
        STAC_HP_DV5,
+       STAC_HP_HDX,
        STAC_92HD71BXX_MODELS
 };
 
@@ -1828,6 +1829,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
        [STAC_DELL_M4_3]        = dell_m4_3_pin_configs,
        [STAC_HP_M4]            = NULL,
        [STAC_HP_DV5]           = NULL,
+       [STAC_HP_HDX]           = NULL,
 };
 
 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
@@ -1838,6 +1840,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
        [STAC_DELL_M4_3] = "dell-m4-3",
        [STAC_HP_M4] = "hp-m4",
        [STAC_HP_DV5] = "hp-dv5",
+       [STAC_HP_HDX] = "hp-hdx",
 };
 
 static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
@@ -1852,6 +1855,10 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
                      "HP dv4-7", STAC_HP_DV5),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
                      "HP mini 1000", STAC_HP_M4),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
+                               "HP HDX", STAC_HP_HDX),  /* HDX16 */
+       SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
+                               "HP HDX", STAC_HP_HDX),  /* HDX18 */
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
                                "unknown Dell", STAC_DELL_M4_1),
        SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
@@ -4472,6 +4479,41 @@ static int stac92xx_resume(struct hda_codec *codec)
        return 0;
 }
 
+
+/*
+ * using power check for controlling mute led of HP HDX notebooks
+ * check for mute state only on Speakers (nid = 0x10)
+ *
+ * For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise
+ * the LED is NOT working properly !
+ */
+
+#ifdef CONFIG_SND_HDA_POWER_SAVE
+static int stac92xx_check_power_status (struct hda_codec * codec, hda_nid_t nid)
+{
+       struct sigmatel_spec *spec = codec->spec;
+       
+       /* only handle on HP HDX */
+       if (spec->board_config != STAC_HP_HDX)
+               return 0;
+       
+       if (nid == 0x10)
+       {
+               if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0)  & 
+                   HDA_AMP_MUTE)
+                       spec->gpio_data &= ~0x08;  /* orange */
+               else
+                       spec->gpio_data |= 0x08;   /* white */
+               
+               stac_gpio_set(codec, spec->gpio_mask, 
+                             spec->gpio_dir, 
+                             spec->gpio_data);
+       }
+
+       return 0;
+}
+#endif
+
 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
 {
        struct sigmatel_spec *spec = codec->spec;
@@ -4493,6 +4535,9 @@ static struct hda_codec_ops stac92xx_patch_ops = {
        .suspend = stac92xx_suspend,
        .resume = stac92xx_resume,
 #endif
+#ifdef CONFIG_SND_HDA_POWER_SAVE
+       .check_power_status = stac92xx_check_power_status,
+#endif
 };
 
 static int patch_stac9200(struct hda_codec *codec)
@@ -5089,6 +5134,13 @@ again:
                /* no output amps */
                spec->num_pwrs = 0;
                /* fallthru */
+       case 0x111d76b2: /* Codec of HP HDX16/HDX18 */
+
+               /* orange/white mute led on GPIO3, orange=0, white=1 */
+               spec->gpio_mask |= 0x08;
+               spec->gpio_dir  |= 0x08;
+               spec->gpio_data |= 0x08;  /* set to white */
+               /* fallthru */
        default:
                memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer,
                       sizeof(stac92hd71bxx_dmux_amixer));
@@ -5143,6 +5195,11 @@ again:
                snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
                stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN);
                break;
+       case STAC_HP_HDX:
+               spec->num_dmics = 1;
+               spec->num_dmuxes = 1;
+               spec->num_smuxes = 1;
+               break;
        };
 
        spec->multiout.dac_nids = spec->dac_nids;