diff options
author | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-11-27 23:23:52 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-11-27 23:23:52 -0500 |
commit | b5a20aa2657063cbf3b47fc700603180de4bb554 (patch) | |
tree | 9419fb851cda53a7f1fd67a3697bdf8550df19e4 /sound/pci | |
parent | cc09c0dc57de7f7d2ed89d480b5653e5f6a32f2c (diff) | |
parent | ed313489badef16d700f5a3be50e8fd8f8294bc8 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_beep.c | 8 | ||||
-rw-r--r-- | sound/pci/hda/hda_beep.h | 1 | ||||
-rw-r--r-- | sound/pci/hda/hda_proc.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 1 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 184 | ||||
-rw-r--r-- | sound/pci/pcxhr/pcxhr.c | 5 | ||||
-rw-r--r-- | sound/pci/rme9652/hdsp.c | 27 |
8 files changed, 184 insertions, 46 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 9b77b3e0fa98..3ecd7e797dee 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -37,6 +37,9 @@ static void snd_hda_generate_beep(struct work_struct *work) | |||
37 | container_of(work, struct hda_beep, beep_work); | 37 | container_of(work, struct hda_beep, beep_work); |
38 | struct hda_codec *codec = beep->codec; | 38 | struct hda_codec *codec = beep->codec; |
39 | 39 | ||
40 | if (!beep->enabled) | ||
41 | return; | ||
42 | |||
40 | /* generate tone */ | 43 | /* generate tone */ |
41 | snd_hda_codec_write_cache(codec, beep->nid, 0, | 44 | snd_hda_codec_write_cache(codec, beep->nid, 0, |
42 | AC_VERB_SET_BEEP_CONTROL, beep->tone); | 45 | AC_VERB_SET_BEEP_CONTROL, beep->tone); |
@@ -85,6 +88,10 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
85 | snprintf(beep->phys, sizeof(beep->phys), | 88 | snprintf(beep->phys, sizeof(beep->phys), |
86 | "card%d/codec#%d/beep0", codec->bus->card->number, codec->addr); | 89 | "card%d/codec#%d/beep0", codec->bus->card->number, codec->addr); |
87 | input_dev = input_allocate_device(); | 90 | input_dev = input_allocate_device(); |
91 | if (!input_dev) { | ||
92 | kfree(beep); | ||
93 | return -ENOMEM; | ||
94 | } | ||
88 | 95 | ||
89 | /* setup digital beep device */ | 96 | /* setup digital beep device */ |
90 | input_dev->name = "HDA Digital PCBeep"; | 97 | input_dev->name = "HDA Digital PCBeep"; |
@@ -115,6 +122,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
115 | beep->nid = nid; | 122 | beep->nid = nid; |
116 | beep->dev = input_dev; | 123 | beep->dev = input_dev; |
117 | beep->codec = codec; | 124 | beep->codec = codec; |
125 | beep->enabled = 1; | ||
118 | codec->beep = beep; | 126 | codec->beep = beep; |
119 | 127 | ||
120 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); | 128 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); |
diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h index de4036e6e710..b9679f081cae 100644 --- a/sound/pci/hda/hda_beep.h +++ b/sound/pci/hda/hda_beep.h | |||
@@ -31,6 +31,7 @@ struct hda_beep { | |||
31 | char phys[32]; | 31 | char phys[32]; |
32 | int tone; | 32 | int tone; |
33 | int nid; | 33 | int nid; |
34 | int enabled; | ||
34 | struct work_struct beep_work; /* scheduled task for beep event */ | 35 | struct work_struct beep_work; /* scheduled task for beep event */ |
35 | }; | 36 | }; |
36 | 37 | ||
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 743d77922bce..c39af986bff1 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -483,6 +483,8 @@ static void print_gpio(struct snd_info_buffer *buffer, | |||
483 | (gpio & AC_GPIO_UNSOLICITED) ? 1 : 0, | 483 | (gpio & AC_GPIO_UNSOLICITED) ? 1 : 0, |
484 | (gpio & AC_GPIO_WAKE) ? 1 : 0); | 484 | (gpio & AC_GPIO_WAKE) ? 1 : 0); |
485 | max = gpio & AC_GPIO_IO_COUNT; | 485 | max = gpio & AC_GPIO_IO_COUNT; |
486 | if (!max || max > 8) | ||
487 | return; | ||
486 | enable = snd_hda_codec_read(codec, nid, 0, | 488 | enable = snd_hda_codec_read(codec, nid, 0, |
487 | AC_VERB_GET_GPIO_MASK, 0); | 489 | AC_VERB_GET_GPIO_MASK, 0); |
488 | direction = snd_hda_codec_read(codec, nid, 0, | 490 | direction = snd_hda_codec_read(codec, nid, 0, |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index d3fd432cb3ea..686c77491dea 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -3861,6 +3861,8 @@ static const char *ad1884a_models[AD1884A_MODELS] = { | |||
3861 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | 3861 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { |
3862 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), | 3862 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), |
3863 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), | 3863 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), |
3864 | SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), | ||
3865 | SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), | ||
3864 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), | 3866 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), |
3865 | {} | 3867 | {} |
3866 | }; | 3868 | }; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a4666c96a44f..a378c0145125 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -8469,6 +8469,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8469 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 8469 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
8470 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | 8470 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
8471 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), | 8471 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
8472 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | ||
8472 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | 8473 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
8473 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | 8474 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
8474 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | 8475 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index e6085915d86d..9563b5bbb272 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -36,9 +36,11 @@ | |||
36 | #include "hda_beep.h" | 36 | #include "hda_beep.h" |
37 | 37 | ||
38 | #define NUM_CONTROL_ALLOC 32 | 38 | #define NUM_CONTROL_ALLOC 32 |
39 | |||
40 | #define STAC_VREF_EVENT 0x00 | ||
41 | #define STAC_INSERT_EVENT 0x10 | ||
39 | #define STAC_PWR_EVENT 0x20 | 42 | #define STAC_PWR_EVENT 0x20 |
40 | #define STAC_HP_EVENT 0x30 | 43 | #define STAC_HP_EVENT 0x30 |
41 | #define STAC_VREF_EVENT 0x40 | ||
42 | 44 | ||
43 | enum { | 45 | enum { |
44 | STAC_REF, | 46 | STAC_REF, |
@@ -212,7 +214,7 @@ struct sigmatel_spec { | |||
212 | /* i/o switches */ | 214 | /* i/o switches */ |
213 | unsigned int io_switch[2]; | 215 | unsigned int io_switch[2]; |
214 | unsigned int clfe_swap; | 216 | unsigned int clfe_swap; |
215 | unsigned int hp_switch; | 217 | unsigned int hp_switch; /* NID of HP as line-out */ |
216 | unsigned int aloopback; | 218 | unsigned int aloopback; |
217 | 219 | ||
218 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 220 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
@@ -1686,6 +1688,10 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | |||
1686 | /* SigmaTel reference board */ | 1688 | /* SigmaTel reference board */ |
1687 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1689 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1688 | "DFI LanParty", STAC_92HD71BXX_REF), | 1690 | "DFI LanParty", STAC_92HD71BXX_REF), |
1691 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, | ||
1692 | "HP dv5", STAC_HP_M4), | ||
1693 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, | ||
1694 | "HP dv7", STAC_HP_M4), | ||
1689 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, | 1695 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
1690 | "unknown HP", STAC_HP_M4), | 1696 | "unknown HP", STAC_HP_M4), |
1691 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, | 1697 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
@@ -2443,7 +2449,7 @@ static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, | |||
2443 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2444 | struct sigmatel_spec *spec = codec->spec; | 2450 | struct sigmatel_spec *spec = codec->spec; |
2445 | 2451 | ||
2446 | ucontrol->value.integer.value[0] = spec->hp_switch; | 2452 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
2447 | return 0; | 2453 | return 0; |
2448 | } | 2454 | } |
2449 | 2455 | ||
@@ -2452,8 +2458,9 @@ static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, | |||
2452 | { | 2458 | { |
2453 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2454 | struct sigmatel_spec *spec = codec->spec; | 2460 | struct sigmatel_spec *spec = codec->spec; |
2455 | 2461 | int nid = kcontrol->private_value; | |
2456 | spec->hp_switch = ucontrol->value.integer.value[0]; | 2462 | |
2463 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; | ||
2457 | 2464 | ||
2458 | /* check to be sure that the ports are upto date with | 2465 | /* check to be sure that the ports are upto date with |
2459 | * switch changes | 2466 | * switch changes |
@@ -2586,8 +2593,10 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { | |||
2586 | }; | 2593 | }; |
2587 | 2594 | ||
2588 | /* add dynamic controls */ | 2595 | /* add dynamic controls */ |
2589 | static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, | 2596 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, |
2590 | int idx, const char *name, unsigned long val) | 2597 | struct snd_kcontrol_new *ktemp, |
2598 | int idx, const char *name, | ||
2599 | unsigned long val) | ||
2591 | { | 2600 | { |
2592 | struct snd_kcontrol_new *knew; | 2601 | struct snd_kcontrol_new *knew; |
2593 | 2602 | ||
@@ -2606,20 +2615,29 @@ static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, | |||
2606 | } | 2615 | } |
2607 | 2616 | ||
2608 | knew = &spec->kctl_alloc[spec->num_kctl_used]; | 2617 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
2609 | *knew = stac92xx_control_templates[type]; | 2618 | *knew = *ktemp; |
2610 | knew->index = idx; | 2619 | knew->index = idx; |
2611 | knew->name = kstrdup(name, GFP_KERNEL); | 2620 | knew->name = kstrdup(name, GFP_KERNEL); |
2612 | if (! knew->name) | 2621 | if (!knew->name) |
2613 | return -ENOMEM; | 2622 | return -ENOMEM; |
2614 | knew->private_value = val; | 2623 | knew->private_value = val; |
2615 | spec->num_kctl_used++; | 2624 | spec->num_kctl_used++; |
2616 | return 0; | 2625 | return 0; |
2617 | } | 2626 | } |
2618 | 2627 | ||
2628 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, | ||
2629 | int type, int idx, const char *name, | ||
2630 | unsigned long val) | ||
2631 | { | ||
2632 | return stac92xx_add_control_temp(spec, | ||
2633 | &stac92xx_control_templates[type], | ||
2634 | idx, name, val); | ||
2635 | } | ||
2636 | |||
2619 | 2637 | ||
2620 | /* add dynamic controls */ | 2638 | /* add dynamic controls */ |
2621 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, | 2639 | static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, |
2622 | const char *name, unsigned long val) | 2640 | const char *name, unsigned long val) |
2623 | { | 2641 | { |
2624 | return stac92xx_add_control_idx(spec, type, 0, name, val); | 2642 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
2625 | } | 2643 | } |
@@ -2862,7 +2880,8 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2862 | if (cfg->hp_outs > 1) { | 2880 | if (cfg->hp_outs > 1) { |
2863 | err = stac92xx_add_control(spec, | 2881 | err = stac92xx_add_control(spec, |
2864 | STAC_CTL_WIDGET_HP_SWITCH, | 2882 | STAC_CTL_WIDGET_HP_SWITCH, |
2865 | "Headphone as Line Out Switch", 0); | 2883 | "Headphone as Line Out Switch", |
2884 | cfg->hp_pins[cfg->hp_outs - 1]); | ||
2866 | if (err < 0) | 2885 | if (err < 0) |
2867 | return err; | 2886 | return err; |
2868 | } | 2887 | } |
@@ -3060,6 +3079,43 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, | |||
3060 | return 0; | 3079 | return 0; |
3061 | } | 3080 | } |
3062 | 3081 | ||
3082 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
3083 | #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info | ||
3084 | |||
3085 | static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, | ||
3086 | struct snd_ctl_elem_value *ucontrol) | ||
3087 | { | ||
3088 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
3089 | ucontrol->value.integer.value[0] = codec->beep->enabled; | ||
3090 | return 0; | ||
3091 | } | ||
3092 | |||
3093 | static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, | ||
3094 | struct snd_ctl_elem_value *ucontrol) | ||
3095 | { | ||
3096 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
3097 | int enabled = !!ucontrol->value.integer.value[0]; | ||
3098 | if (codec->beep->enabled != enabled) { | ||
3099 | codec->beep->enabled = enabled; | ||
3100 | return 1; | ||
3101 | } | ||
3102 | return 0; | ||
3103 | } | ||
3104 | |||
3105 | static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { | ||
3106 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3107 | .info = stac92xx_dig_beep_switch_info, | ||
3108 | .get = stac92xx_dig_beep_switch_get, | ||
3109 | .put = stac92xx_dig_beep_switch_put, | ||
3110 | }; | ||
3111 | |||
3112 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) | ||
3113 | { | ||
3114 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, | ||
3115 | 0, "PC Beep Playback Switch", 0); | ||
3116 | } | ||
3117 | #endif | ||
3118 | |||
3063 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) | 3119 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
3064 | { | 3120 | { |
3065 | struct sigmatel_spec *spec = codec->spec; | 3121 | struct sigmatel_spec *spec = codec->spec; |
@@ -3366,6 +3422,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3366 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | 3422 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
3367 | if (spec->digbeep_nid > 0) { | 3423 | if (spec->digbeep_nid > 0) { |
3368 | hda_nid_t nid = spec->digbeep_nid; | 3424 | hda_nid_t nid = spec->digbeep_nid; |
3425 | unsigned int caps; | ||
3369 | 3426 | ||
3370 | err = stac92xx_auto_create_beep_ctls(codec, nid); | 3427 | err = stac92xx_auto_create_beep_ctls(codec, nid); |
3371 | if (err < 0) | 3428 | if (err < 0) |
@@ -3373,6 +3430,14 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3373 | err = snd_hda_attach_beep_device(codec, nid); | 3430 | err = snd_hda_attach_beep_device(codec, nid); |
3374 | if (err < 0) | 3431 | if (err < 0) |
3375 | return err; | 3432 | return err; |
3433 | /* if no beep switch is available, make its own one */ | ||
3434 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); | ||
3435 | if (codec->beep && | ||
3436 | !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { | ||
3437 | err = stac92xx_beep_switch_ctl(codec); | ||
3438 | if (err < 0) | ||
3439 | return err; | ||
3440 | } | ||
3376 | } | 3441 | } |
3377 | #endif | 3442 | #endif |
3378 | 3443 | ||
@@ -3530,6 +3595,12 @@ static int stac9200_parse_auto_config(struct hda_codec *codec) | |||
3530 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) | 3595 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
3531 | return err; | 3596 | return err; |
3532 | 3597 | ||
3598 | if (spec->num_muxes > 0) { | ||
3599 | err = stac92xx_auto_create_mux_input_ctls(codec); | ||
3600 | if (err < 0) | ||
3601 | return err; | ||
3602 | } | ||
3603 | |||
3533 | if (spec->autocfg.dig_out_pin) | 3604 | if (spec->autocfg.dig_out_pin) |
3534 | spec->multiout.dig_out_nid = 0x05; | 3605 | spec->multiout.dig_out_nid = 0x05; |
3535 | if (spec->autocfg.dig_in_pin) | 3606 | if (spec->autocfg.dig_in_pin) |
@@ -3647,14 +3718,18 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3647 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 3718 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
3648 | hda_nid_t nid = cfg->input_pins[i]; | 3719 | hda_nid_t nid = cfg->input_pins[i]; |
3649 | if (nid) { | 3720 | if (nid) { |
3650 | unsigned int pinctl = snd_hda_codec_read(codec, nid, | 3721 | unsigned int pinctl; |
3651 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 3722 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { |
3652 | /* if PINCTL already set then skip */ | 3723 | /* for mic pins, force to initialize */ |
3653 | if (pinctl & AC_PINCAP_IN) | 3724 | pinctl = stac92xx_get_vref(codec, nid); |
3654 | continue; | 3725 | } else { |
3655 | pinctl = AC_PINCTL_IN_EN; | 3726 | pinctl = snd_hda_codec_read(codec, nid, 0, |
3656 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) | 3727 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
3657 | pinctl |= stac92xx_get_vref(codec, nid); | 3728 | /* if PINCTL already set then skip */ |
3729 | if (pinctl & AC_PINCTL_IN_EN) | ||
3730 | continue; | ||
3731 | } | ||
3732 | pinctl |= AC_PINCTL_IN_EN; | ||
3658 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | 3733 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
3659 | } | 3734 | } |
3660 | } | 3735 | } |
@@ -3776,11 +3851,30 @@ static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid) | |||
3776 | return 0; | 3851 | return 0; |
3777 | } | 3852 | } |
3778 | 3853 | ||
3854 | /* return non-zero if the hp-pin of the given array index isn't | ||
3855 | * a jack-detection target | ||
3856 | */ | ||
3857 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) | ||
3858 | { | ||
3859 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
3860 | |||
3861 | /* ignore sensing of shared line and mic jacks */ | ||
3862 | if (spec->line_switch && | ||
3863 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_LINE]) | ||
3864 | return 1; | ||
3865 | if (spec->mic_switch && | ||
3866 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_MIC]) | ||
3867 | return 1; | ||
3868 | /* ignore if the pin is set as line-out */ | ||
3869 | if (cfg->hp_pins[i] == spec->hp_switch) | ||
3870 | return 1; | ||
3871 | return 0; | ||
3872 | } | ||
3873 | |||
3779 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | 3874 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) |
3780 | { | 3875 | { |
3781 | struct sigmatel_spec *spec = codec->spec; | 3876 | struct sigmatel_spec *spec = codec->spec; |
3782 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3877 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3783 | int nid = cfg->hp_pins[cfg->hp_outs - 1]; | ||
3784 | int i, presence; | 3878 | int i, presence; |
3785 | 3879 | ||
3786 | presence = 0; | 3880 | presence = 0; |
@@ -3791,15 +3885,16 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3791 | for (i = 0; i < cfg->hp_outs; i++) { | 3885 | for (i = 0; i < cfg->hp_outs; i++) { |
3792 | if (presence) | 3886 | if (presence) |
3793 | break; | 3887 | break; |
3794 | if (spec->hp_switch && cfg->hp_pins[i] == nid) | 3888 | if (no_hp_sensing(spec, i)) |
3795 | break; | 3889 | continue; |
3796 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); | 3890 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); |
3797 | } | 3891 | } |
3798 | 3892 | ||
3799 | if (presence) { | 3893 | if (presence) { |
3800 | /* disable lineouts, enable hp */ | 3894 | /* disable lineouts */ |
3801 | if (spec->hp_switch) | 3895 | if (spec->hp_switch) |
3802 | stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3896 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
3897 | AC_PINCTL_OUT_EN); | ||
3803 | for (i = 0; i < cfg->line_outs; i++) | 3898 | for (i = 0; i < cfg->line_outs; i++) |
3804 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], | 3899 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
3805 | AC_PINCTL_OUT_EN); | 3900 | AC_PINCTL_OUT_EN); |
@@ -3811,9 +3906,10 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3811 | spec->gpio_dir, spec->gpio_data & | 3906 | spec->gpio_dir, spec->gpio_data & |
3812 | ~spec->eapd_mask); | 3907 | ~spec->eapd_mask); |
3813 | } else { | 3908 | } else { |
3814 | /* enable lineouts, disable hp */ | 3909 | /* enable lineouts */ |
3815 | if (spec->hp_switch) | 3910 | if (spec->hp_switch) |
3816 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3911 | stac92xx_set_pinctl(codec, spec->hp_switch, |
3912 | AC_PINCTL_OUT_EN); | ||
3817 | for (i = 0; i < cfg->line_outs; i++) | 3913 | for (i = 0; i < cfg->line_outs; i++) |
3818 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], | 3914 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
3819 | AC_PINCTL_OUT_EN); | 3915 | AC_PINCTL_OUT_EN); |
@@ -3825,8 +3921,16 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3825 | spec->gpio_dir, spec->gpio_data | | 3921 | spec->gpio_dir, spec->gpio_data | |
3826 | spec->eapd_mask); | 3922 | spec->eapd_mask); |
3827 | } | 3923 | } |
3828 | if (!spec->hp_switch && cfg->hp_outs > 1 && presence) | 3924 | /* toggle hp outs */ |
3829 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3925 | for (i = 0; i < cfg->hp_outs; i++) { |
3926 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; | ||
3927 | if (no_hp_sensing(spec, i)) | ||
3928 | continue; | ||
3929 | if (presence) | ||
3930 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); | ||
3931 | else | ||
3932 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); | ||
3933 | } | ||
3830 | } | 3934 | } |
3831 | 3935 | ||
3832 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | 3936 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) |
@@ -4378,6 +4482,13 @@ again: | |||
4378 | stac92xx_set_config_regs(codec); | 4482 | stac92xx_set_config_regs(codec); |
4379 | } | 4483 | } |
4380 | 4484 | ||
4485 | if (spec->board_config > STAC_92HD71BXX_REF) { | ||
4486 | /* GPIO0 = EAPD */ | ||
4487 | spec->gpio_mask = 0x01; | ||
4488 | spec->gpio_dir = 0x01; | ||
4489 | spec->gpio_data = 0x01; | ||
4490 | } | ||
4491 | |||
4381 | switch (codec->vendor_id) { | 4492 | switch (codec->vendor_id) { |
4382 | case 0x111d76b6: /* 4 Port without Analog Mixer */ | 4493 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
4383 | case 0x111d76b7: | 4494 | case 0x111d76b7: |
@@ -4388,10 +4499,10 @@ again: | |||
4388 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 4499 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
4389 | break; | 4500 | break; |
4390 | case 0x111d7608: /* 5 Port with Analog Mixer */ | 4501 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
4391 | switch (codec->subsystem_id) { | 4502 | switch (spec->board_config) { |
4392 | case 0x103c361a: | 4503 | case STAC_HP_M4: |
4393 | /* Enable VREF power saving on GPIO1 detect */ | 4504 | /* Enable VREF power saving on GPIO1 detect */ |
4394 | snd_hda_codec_write(codec, codec->afg, 0, | 4505 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4395 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); | 4506 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
4396 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 4507 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4397 | AC_VERB_SET_UNSOLICITED_ENABLE, | 4508 | AC_VERB_SET_UNSOLICITED_ENABLE, |
@@ -4437,13 +4548,6 @@ again: | |||
4437 | spec->aloopback_mask = 0x50; | 4548 | spec->aloopback_mask = 0x50; |
4438 | spec->aloopback_shift = 0; | 4549 | spec->aloopback_shift = 0; |
4439 | 4550 | ||
4440 | if (spec->board_config > STAC_92HD71BXX_REF) { | ||
4441 | /* GPIO0 = EAPD */ | ||
4442 | spec->gpio_mask = 0x01; | ||
4443 | spec->gpio_dir = 0x01; | ||
4444 | spec->gpio_data = 0x01; | ||
4445 | } | ||
4446 | |||
4447 | spec->powerdown_adcs = 1; | 4551 | spec->powerdown_adcs = 1; |
4448 | spec->digbeep_nid = 0x26; | 4552 | spec->digbeep_nid = 0x26; |
4449 | spec->mux_nids = stac92hd71bxx_mux_nids; | 4553 | spec->mux_nids = stac92hd71bxx_mux_nids; |
@@ -4791,7 +4895,7 @@ static int patch_stac9205(struct hda_codec *codec) | |||
4791 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); | 4895 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); |
4792 | 4896 | ||
4793 | /* Enable unsol response for GPIO4/Dock HP connection */ | 4897 | /* Enable unsol response for GPIO4/Dock HP connection */ |
4794 | snd_hda_codec_write(codec, codec->afg, 0, | 4898 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4795 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); | 4899 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
4796 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 4900 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4797 | AC_VERB_SET_UNSOLICITED_ENABLE, | 4901 | AC_VERB_SET_UNSOLICITED_ENABLE, |
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 0e06c6c9fcc0..73de6e989b3d 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c | |||
@@ -1229,8 +1229,11 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id | |||
1229 | return -ENOMEM; | 1229 | return -ENOMEM; |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | if (snd_BUG_ON(pci_id->driver_data >= PCI_ID_LAST)) | 1232 | if (snd_BUG_ON(pci_id->driver_data >= PCI_ID_LAST)) { |
1233 | kfree(mgr); | ||
1234 | pci_disable_device(pci); | ||
1233 | return -ENODEV; | 1235 | return -ENODEV; |
1236 | } | ||
1234 | card_name = pcxhr_board_params[pci_id->driver_data].board_name; | 1237 | card_name = pcxhr_board_params[pci_id->driver_data].board_name; |
1235 | mgr->playback_chips = pcxhr_board_params[pci_id->driver_data].playback_chips; | 1238 | mgr->playback_chips = pcxhr_board_params[pci_id->driver_data].playback_chips; |
1236 | mgr->capture_chips = pcxhr_board_params[pci_id->driver_data].capture_chips; | 1239 | mgr->capture_chips = pcxhr_board_params[pci_id->driver_data].capture_chips; |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index d723543beadd..736246f98acc 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -4548,11 +4548,20 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4548 | { | 4548 | { |
4549 | struct hdsp *hdsp = (struct hdsp *)hw->private_data; | 4549 | struct hdsp *hdsp = (struct hdsp *)hw->private_data; |
4550 | void __user *argp = (void __user *)arg; | 4550 | void __user *argp = (void __user *)arg; |
4551 | int err; | ||
4551 | 4552 | ||
4552 | switch (cmd) { | 4553 | switch (cmd) { |
4553 | case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: { | 4554 | case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: { |
4554 | struct hdsp_peak_rms __user *peak_rms = (struct hdsp_peak_rms __user *)arg; | 4555 | struct hdsp_peak_rms __user *peak_rms = (struct hdsp_peak_rms __user *)arg; |
4555 | 4556 | ||
4557 | err = hdsp_check_for_iobox(hdsp); | ||
4558 | if (err < 0) | ||
4559 | return err; | ||
4560 | |||
4561 | err = hdsp_check_for_firmware(hdsp, 1); | ||
4562 | if (err < 0) | ||
4563 | return err; | ||
4564 | |||
4556 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { | 4565 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { |
4557 | snd_printk(KERN_ERR "Hammerfall-DSP: firmware needs to be uploaded to the card.\n"); | 4566 | snd_printk(KERN_ERR "Hammerfall-DSP: firmware needs to be uploaded to the card.\n"); |
4558 | return -EINVAL; | 4567 | return -EINVAL; |
@@ -4572,10 +4581,14 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4572 | unsigned long flags; | 4581 | unsigned long flags; |
4573 | int i; | 4582 | int i; |
4574 | 4583 | ||
4575 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { | 4584 | err = hdsp_check_for_iobox(hdsp); |
4576 | snd_printk(KERN_ERR "Hammerfall-DSP: Firmware needs to be uploaded to the card.\n"); | 4585 | if (err < 0) |
4577 | return -EINVAL; | 4586 | return err; |
4578 | } | 4587 | |
4588 | err = hdsp_check_for_firmware(hdsp, 1); | ||
4589 | if (err < 0) | ||
4590 | return err; | ||
4591 | |||
4579 | spin_lock_irqsave(&hdsp->lock, flags); | 4592 | spin_lock_irqsave(&hdsp->lock, flags); |
4580 | info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp); | 4593 | info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp); |
4581 | info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp); | 4594 | info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp); |
@@ -5045,6 +5058,10 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5045 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ | 5058 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ |
5046 | ssleep(2); | 5059 | ssleep(2); |
5047 | 5060 | ||
5061 | err = hdsp_check_for_iobox(hdsp); | ||
5062 | if (err < 0) | ||
5063 | return err; | ||
5064 | |||
5048 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { | 5065 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { |
5049 | #ifdef HDSP_FW_LOADER | 5066 | #ifdef HDSP_FW_LOADER |
5050 | if ((err = hdsp_request_fw_loader(hdsp)) < 0) | 5067 | if ((err = hdsp_request_fw_loader(hdsp)) < 0) |
@@ -5057,7 +5074,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5057 | /* init is complete, we return */ | 5074 | /* init is complete, we return */ |
5058 | return 0; | 5075 | return 0; |
5059 | #endif | 5076 | #endif |
5060 | /* no iobox connected, we defer initialization */ | 5077 | /* we defer initialization */ |
5061 | snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n"); | 5078 | snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n"); |
5062 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) | 5079 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) |
5063 | return err; | 5080 | return err; |