Commit 0d25e369 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'sound-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Again only fixes for HD-audio:
   - regression fixes due to the modularization
   - a few fixups for Dell, Sony and HP laptops
   - a revert of the previous fix as it leads to another regression"

* tag 'sound-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: Revert "ALSA: hda/realtek - Avoid invalid COEFs for ALC271X"
  ALSA: hda - Fix undefined symbol due to builtin/module mixup
  ALSA: hda - Fix mic capture on Sony VAIO Pro 11
  ALSA: hda - Add a headset quirk for Dell XPS 13
  ALSA: hda - Fix inconsistent Mic mute LED
  ALSA: hda - Fix leftover ifdef checks after modularization
parents e8478828 2078600b
......@@ -932,7 +932,7 @@ int snd_hda_bus_new(struct snd_card *card,
}
EXPORT_SYMBOL_GPL(snd_hda_bus_new);
#ifdef CONFIG_SND_HDA_GENERIC
#if IS_ENABLED(CONFIG_SND_HDA_GENERIC)
#define is_generic_config(codec) \
(codec->modelname && !strcmp(codec->modelname, "generic"))
#else
......@@ -1339,23 +1339,15 @@ get_hda_cvt_setup(struct hda_codec *codec, hda_nid_t nid)
/*
* Dynamic symbol binding for the codec parsers
*/
#ifdef MODULE
#define load_parser_sym(sym) ((int (*)(struct hda_codec *))symbol_request(sym))
#define unload_parser_addr(addr) symbol_put_addr(addr)
#else
#define load_parser_sym(sym) (sym)
#define unload_parser_addr(addr) do {} while (0)
#endif
#define load_parser(codec, sym) \
((codec)->parser = load_parser_sym(sym))
((codec)->parser = (int (*)(struct hda_codec *))symbol_request(sym))
static void unload_parser(struct hda_codec *codec)
{
if (codec->parser) {
unload_parser_addr(codec->parser);
if (codec->parser)
symbol_put_addr(codec->parser);
codec->parser = NULL;
}
}
/*
......@@ -1570,7 +1562,7 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec)
EXPORT_SYMBOL_GPL(snd_hda_codec_update_widgets);
#ifdef CONFIG_SND_HDA_CODEC_HDMI
#if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI)
/* if all audio out widgets are digital, let's assume the codec as a HDMI/DP */
static bool is_likely_hdmi_codec(struct hda_codec *codec)
{
......@@ -1620,12 +1612,20 @@ int snd_hda_codec_configure(struct hda_codec *codec)
patch = codec->preset->patch;
if (!patch) {
unload_parser(codec); /* to be sure */
if (is_likely_hdmi_codec(codec))
if (is_likely_hdmi_codec(codec)) {
#if IS_MODULE(CONFIG_SND_HDA_CODEC_HDMI)
patch = load_parser(codec, snd_hda_parse_hdmi_codec);
#ifdef CONFIG_SND_HDA_GENERIC
if (!patch)
#elif IS_BUILTIN(CONFIG_SND_HDA_CODEC_HDMI)
patch = snd_hda_parse_hdmi_codec;
#endif
}
if (!patch) {
#if IS_MODULE(CONFIG_SND_HDA_GENERIC)
patch = load_parser(codec, snd_hda_parse_generic_codec);
#elif IS_BUILTIN(CONFIG_SND_HDA_GENERIC)
patch = snd_hda_parse_generic_codec;
#endif
}
if (!patch) {
printk(KERN_ERR "hda-codec: No codec parser is available\n");
return -ENODEV;
......
......@@ -3269,7 +3269,7 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol,
mutex_unlock(&codec->control_mutex);
snd_hda_codec_flush_cache(codec); /* flush the updates */
if (err >= 0 && spec->cap_sync_hook)
spec->cap_sync_hook(codec, ucontrol);
spec->cap_sync_hook(codec, kcontrol, ucontrol);
return err;
}
......@@ -3390,7 +3390,7 @@ static int cap_single_sw_put(struct snd_kcontrol *kcontrol,
return ret;
if (spec->cap_sync_hook)
spec->cap_sync_hook(codec, ucontrol);
spec->cap_sync_hook(codec, kcontrol, ucontrol);
return ret;
}
......@@ -3795,7 +3795,7 @@ static int mux_select(struct hda_codec *codec, unsigned int adc_idx,
return 0;
snd_hda_activate_path(codec, path, true, false);
if (spec->cap_sync_hook)
spec->cap_sync_hook(codec, NULL);
spec->cap_sync_hook(codec, NULL, NULL);
path_power_down_sync(codec, old_path);
return 1;
}
......@@ -5270,7 +5270,7 @@ static void init_input_src(struct hda_codec *codec)
}
if (spec->cap_sync_hook)
spec->cap_sync_hook(codec, NULL);
spec->cap_sync_hook(codec, NULL, NULL);
}
/* set right pin controls for digital I/O */
......
......@@ -274,6 +274,7 @@ struct hda_gen_spec {
void (*init_hook)(struct hda_codec *codec);
void (*automute_hook)(struct hda_codec *codec);
void (*cap_sync_hook)(struct hda_codec *codec,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
/* PCM hooks */
......
......@@ -198,7 +198,7 @@ MODULE_DESCRIPTION("Intel HDA driver");
#endif
#if defined(CONFIG_PM) && defined(CONFIG_VGA_SWITCHEROO)
#ifdef CONFIG_SND_HDA_CODEC_HDMI
#if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI)
#define SUPPORT_VGA_SWITCHEROO
#endif
#endif
......
......@@ -3291,6 +3291,7 @@ static void cxt_update_headset_mode(struct hda_codec *codec)
}
static void cxt_update_headset_mode_hook(struct hda_codec *codec,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
cxt_update_headset_mode(codec);
......
......@@ -708,6 +708,7 @@ static void alc_inv_dmic_sync(struct hda_codec *codec, bool force)
}
static void alc_inv_dmic_hook(struct hda_codec *codec,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
alc_inv_dmic_sync(codec, false);
......@@ -3218,6 +3219,7 @@ static void alc269_fixup_hp_gpio_mute_hook(void *private_data, int enabled)
/* turn on/off mic-mute LED per capture hook */
static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec *codec,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct alc_spec *spec = codec->spec;
......@@ -3528,6 +3530,7 @@ static void alc_update_headset_mode(struct hda_codec *codec)
}
static void alc_update_headset_mode_hook(struct hda_codec *codec,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
alc_update_headset_mode(codec);
......@@ -4329,6 +4332,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
......@@ -4434,9 +4438,6 @@ static void alc269_fill_coef(struct hda_codec *codec)
if (spec->codec_variant != ALC269_TYPE_ALC269VB)
return;
/* ALC271X doesn't seem to support these COEFs (bko#52181) */
if (!strcmp(codec->chip_name, "ALC271X"))
return;
if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
alc_write_coef_idx(codec, 0xf, 0x960b);
......@@ -5106,6 +5107,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x0623, "Dell", ALC668_FIXUP_AUTO_MUTE),
SND_PCI_QUIRK(0x1028, 0x0624, "Dell", ALC668_FIXUP_AUTO_MUTE),
SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
......
......@@ -194,7 +194,7 @@ struct sigmatel_spec {
int default_polarity;
unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */
bool mic_mute_led_on; /* current mic mute state */
unsigned int mic_enabled; /* current mic mute state (bitmask) */
/* stream */
unsigned int stream_delay;
......@@ -324,19 +324,26 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
/* hook for controlling mic-mute LED GPIO */
static void stac_capture_led_hook(struct hda_codec *codec,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct sigmatel_spec *spec = codec->spec;
bool mute;
unsigned int mask;
bool cur_mute, prev_mute;
if (!ucontrol)
if (!kcontrol || !ucontrol)
return;
mute = !(ucontrol->value.integer.value[0] ||
ucontrol->value.integer.value[1]);
if (spec->mic_mute_led_on != mute) {
spec->mic_mute_led_on = mute;
if (mute)
mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
prev_mute = !spec->mic_enabled;
if (ucontrol->value.integer.value[0] ||
ucontrol->value.integer.value[1])
spec->mic_enabled |= mask;
else
spec->mic_enabled &= ~mask;
cur_mute = !spec->mic_enabled;
if (cur_mute != prev_mute) {
if (cur_mute)
spec->gpio_data |= spec->mic_mute_led_gpio;
else
spec->gpio_data &= ~spec->mic_mute_led_gpio;
......@@ -4462,7 +4469,7 @@ static void stac_setup_gpio(struct hda_codec *codec)
if (spec->mic_mute_led_gpio) {
spec->gpio_mask |= spec->mic_mute_led_gpio;
spec->gpio_dir |= spec->mic_mute_led_gpio;
spec->mic_mute_led_on = true;
spec->mic_enabled = 0;
spec->gpio_data |= spec->mic_mute_led_gpio;
spec->gen.cap_sync_hook = stac_capture_led_hook;
......
......@@ -39,6 +39,7 @@ static void update_tpacpi_mute_led(void *private_data, int enabled)
}
static void update_tpacpi_micmute_led(struct hda_codec *codec,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
if (!ucontrol || !led_set_func)
......
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