Commit af94ce06 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: hda - Fix resume of GPIO unsol event for STAC/IDT
  ALSA: hda - Add quirks for HP Pavilion DV models
  ALSA: hda - Fix GPIO initialization in patch_stac92hd71bxx()
  ALSA: hda - Check model type instead of SSID in patch_92hd71bxx()
  ALSA: sound/pci/pcxhr/pcxhr.c: introduce missing kfree and pci_disable_device
  ALSA: hda: STAC_VREF_EVENT value change
  ALSA: hda - Missing NULL check in hda_beep.c
  ALSA: hda - Add digital beep playback switch for STAC/IDT codecs
parents 4e14e833 ef71b1b8
...@@ -37,6 +37,9 @@ static void snd_hda_generate_beep(struct work_struct *work) ...@@ -37,6 +37,9 @@ static void snd_hda_generate_beep(struct work_struct *work)
container_of(work, struct hda_beep, beep_work); container_of(work, struct hda_beep, beep_work);
struct hda_codec *codec = beep->codec; struct hda_codec *codec = beep->codec;
if (!beep->enabled)
return;
/* generate tone */ /* generate tone */
snd_hda_codec_write_cache(codec, beep->nid, 0, snd_hda_codec_write_cache(codec, beep->nid, 0,
AC_VERB_SET_BEEP_CONTROL, beep->tone); AC_VERB_SET_BEEP_CONTROL, beep->tone);
...@@ -85,6 +88,10 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) ...@@ -85,6 +88,10 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
snprintf(beep->phys, sizeof(beep->phys), snprintf(beep->phys, sizeof(beep->phys),
"card%d/codec#%d/beep0", codec->bus->card->number, codec->addr); "card%d/codec#%d/beep0", codec->bus->card->number, codec->addr);
input_dev = input_allocate_device(); input_dev = input_allocate_device();
if (!input_dev) {
kfree(beep);
return -ENOMEM;
}
/* setup digital beep device */ /* setup digital beep device */
input_dev->name = "HDA Digital PCBeep"; input_dev->name = "HDA Digital PCBeep";
...@@ -115,6 +122,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) ...@@ -115,6 +122,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
beep->nid = nid; beep->nid = nid;
beep->dev = input_dev; beep->dev = input_dev;
beep->codec = codec; beep->codec = codec;
beep->enabled = 1;
codec->beep = beep; codec->beep = beep;
INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); INIT_WORK(&beep->beep_work, &snd_hda_generate_beep);
......
...@@ -31,6 +31,7 @@ struct hda_beep { ...@@ -31,6 +31,7 @@ struct hda_beep {
char phys[32]; char phys[32];
int tone; int tone;
int nid; int nid;
int enabled;
struct work_struct beep_work; /* scheduled task for beep event */ struct work_struct beep_work; /* scheduled task for beep event */
}; };
......
...@@ -36,9 +36,11 @@ ...@@ -36,9 +36,11 @@
#include "hda_beep.h" #include "hda_beep.h"
#define NUM_CONTROL_ALLOC 32 #define NUM_CONTROL_ALLOC 32
#define STAC_VREF_EVENT 0x00
#define STAC_INSERT_EVENT 0x10
#define STAC_PWR_EVENT 0x20 #define STAC_PWR_EVENT 0x20
#define STAC_HP_EVENT 0x30 #define STAC_HP_EVENT 0x30
#define STAC_VREF_EVENT 0x40
enum { enum {
STAC_REF, STAC_REF,
...@@ -1686,6 +1688,10 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { ...@@ -1686,6 +1688,10 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
/* SigmaTel reference board */ /* SigmaTel reference board */
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
"DFI LanParty", STAC_92HD71BXX_REF), "DFI LanParty", STAC_92HD71BXX_REF),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2,
"HP dv5", STAC_HP_M4),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4,
"HP dv7", STAC_HP_M4),
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
"unknown HP", STAC_HP_M4), "unknown HP", STAC_HP_M4),
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
...@@ -2587,8 +2593,10 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { ...@@ -2587,8 +2593,10 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = {
}; };
/* add dynamic controls */ /* add dynamic controls */
static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
int idx, const char *name, unsigned long val) struct snd_kcontrol_new *ktemp,
int idx, const char *name,
unsigned long val)
{ {
struct snd_kcontrol_new *knew; struct snd_kcontrol_new *knew;
...@@ -2607,20 +2615,29 @@ static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, ...@@ -2607,20 +2615,29 @@ static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type,
} }
knew = &spec->kctl_alloc[spec->num_kctl_used]; knew = &spec->kctl_alloc[spec->num_kctl_used];
*knew = stac92xx_control_templates[type]; *knew = *ktemp;
knew->index = idx; knew->index = idx;
knew->name = kstrdup(name, GFP_KERNEL); knew->name = kstrdup(name, GFP_KERNEL);
if (! knew->name) if (!knew->name)
return -ENOMEM; return -ENOMEM;
knew->private_value = val; knew->private_value = val;
spec->num_kctl_used++; spec->num_kctl_used++;
return 0; return 0;
} }
static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,
int type, int idx, const char *name,
unsigned long val)
{
return stac92xx_add_control_temp(spec,
&stac92xx_control_templates[type],
idx, name, val);
}
/* add dynamic controls */ /* add dynamic controls */
static int stac92xx_add_control(struct sigmatel_spec *spec, int type, static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
const char *name, unsigned long val) const char *name, unsigned long val)
{ {
return stac92xx_add_control_idx(spec, type, 0, name, val); return stac92xx_add_control_idx(spec, type, 0, name, val);
} }
...@@ -3062,6 +3079,43 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, ...@@ -3062,6 +3079,43 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
return 0; return 0;
} }
#ifdef CONFIG_SND_HDA_INPUT_BEEP
#define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] = codec->beep->enabled;
return 0;
}
static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
int enabled = !!ucontrol->value.integer.value[0];
if (codec->beep->enabled != enabled) {
codec->beep->enabled = enabled;
return 1;
}
return 0;
}
static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.info = stac92xx_dig_beep_switch_info,
.get = stac92xx_dig_beep_switch_get,
.put = stac92xx_dig_beep_switch_put,
};
static int stac92xx_beep_switch_ctl(struct hda_codec *codec)
{
return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl,
0, "PC Beep Playback Switch", 0);
}
#endif
static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
{ {
struct sigmatel_spec *spec = codec->spec; struct sigmatel_spec *spec = codec->spec;
...@@ -3368,6 +3422,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out ...@@ -3368,6 +3422,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
#ifdef CONFIG_SND_HDA_INPUT_BEEP #ifdef CONFIG_SND_HDA_INPUT_BEEP
if (spec->digbeep_nid > 0) { if (spec->digbeep_nid > 0) {
hda_nid_t nid = spec->digbeep_nid; hda_nid_t nid = spec->digbeep_nid;
unsigned int caps;
err = stac92xx_auto_create_beep_ctls(codec, nid); err = stac92xx_auto_create_beep_ctls(codec, nid);
if (err < 0) if (err < 0)
...@@ -3375,6 +3430,14 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out ...@@ -3375,6 +3430,14 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
err = snd_hda_attach_beep_device(codec, nid); err = snd_hda_attach_beep_device(codec, nid);
if (err < 0) if (err < 0)
return err; return err;
/* if no beep switch is available, make its own one */
caps = query_amp_caps(codec, nid, HDA_OUTPUT);
if (codec->beep &&
!((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) {
err = stac92xx_beep_switch_ctl(codec);
if (err < 0)
return err;
}
} }
#endif #endif
...@@ -4419,6 +4482,13 @@ again: ...@@ -4419,6 +4482,13 @@ again:
stac92xx_set_config_regs(codec); stac92xx_set_config_regs(codec);
} }
if (spec->board_config > STAC_92HD71BXX_REF) {
/* GPIO0 = EAPD */
spec->gpio_mask = 0x01;
spec->gpio_dir = 0x01;
spec->gpio_data = 0x01;
}
switch (codec->vendor_id) { switch (codec->vendor_id) {
case 0x111d76b6: /* 4 Port without Analog Mixer */ case 0x111d76b6: /* 4 Port without Analog Mixer */
case 0x111d76b7: case 0x111d76b7:
...@@ -4429,10 +4499,10 @@ again: ...@@ -4429,10 +4499,10 @@ again:
codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
break; break;
case 0x111d7608: /* 5 Port with Analog Mixer */ case 0x111d7608: /* 5 Port with Analog Mixer */
switch (codec->subsystem_id) { switch (spec->board_config) {
case 0x103c361a: case STAC_HP_M4:
/* Enable VREF power saving on GPIO1 detect */ /* Enable VREF power saving on GPIO1 detect */
snd_hda_codec_write(codec, codec->afg, 0, snd_hda_codec_write_cache(codec, codec->afg, 0,
AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
snd_hda_codec_write_cache(codec, codec->afg, 0, snd_hda_codec_write_cache(codec, codec->afg, 0,
AC_VERB_SET_UNSOLICITED_ENABLE, AC_VERB_SET_UNSOLICITED_ENABLE,
...@@ -4478,13 +4548,6 @@ again: ...@@ -4478,13 +4548,6 @@ again:
spec->aloopback_mask = 0x50; spec->aloopback_mask = 0x50;
spec->aloopback_shift = 0; spec->aloopback_shift = 0;
if (spec->board_config > STAC_92HD71BXX_REF) {
/* GPIO0 = EAPD */
spec->gpio_mask = 0x01;
spec->gpio_dir = 0x01;
spec->gpio_data = 0x01;
}
spec->powerdown_adcs = 1; spec->powerdown_adcs = 1;
spec->digbeep_nid = 0x26; spec->digbeep_nid = 0x26;
spec->mux_nids = stac92hd71bxx_mux_nids; spec->mux_nids = stac92hd71bxx_mux_nids;
...@@ -4832,7 +4895,7 @@ static int patch_stac9205(struct hda_codec *codec) ...@@ -4832,7 +4895,7 @@ static int patch_stac9205(struct hda_codec *codec)
stac92xx_set_config_reg(codec, 0x20, 0x1c410030); stac92xx_set_config_reg(codec, 0x20, 0x1c410030);
/* Enable unsol response for GPIO4/Dock HP connection */ /* Enable unsol response for GPIO4/Dock HP connection */
snd_hda_codec_write(codec, codec->afg, 0, snd_hda_codec_write_cache(codec, codec->afg, 0,
AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
snd_hda_codec_write_cache(codec, codec->afg, 0, snd_hda_codec_write_cache(codec, codec->afg, 0,
AC_VERB_SET_UNSOLICITED_ENABLE, AC_VERB_SET_UNSOLICITED_ENABLE,
......
...@@ -1229,8 +1229,11 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id ...@@ -1229,8 +1229,11 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id
return -ENOMEM; return -ENOMEM;
} }
if (snd_BUG_ON(pci_id->driver_data >= PCI_ID_LAST)) if (snd_BUG_ON(pci_id->driver_data >= PCI_ID_LAST)) {
kfree(mgr);
pci_disable_device(pci);
return -ENODEV; return -ENODEV;
}
card_name = pcxhr_board_params[pci_id->driver_data].board_name; card_name = pcxhr_board_params[pci_id->driver_data].board_name;
mgr->playback_chips = pcxhr_board_params[pci_id->driver_data].playback_chips; mgr->playback_chips = pcxhr_board_params[pci_id->driver_data].playback_chips;
mgr->capture_chips = pcxhr_board_params[pci_id->driver_data].capture_chips; mgr->capture_chips = pcxhr_board_params[pci_id->driver_data].capture_chips;
......
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