sound fixes for 4.4

A slightly higher volume than a new year's wish, but not too
 worrisome: a large LOC is only for HD-audio device-specific quirks,
 so fairly safe to apply.  The rest ASoC fixes are all trivial and
 small; a simple replacement of mutex call with nested lock version,
 a few Arizona and Realtek codec fixes, and a regression fix for
 Skylake firmware handling.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWjmpaAAoJEGwxgFQ9KSmkypcP/AsZgxRp9kU7xBKcymZR6ldi
 OtXse9Irie7/Da23v98VfOmC0SF1RYDnEO+yDi3ud31ZGyqcwCMBrcO1ZrvuQw1w
 3LDsUdVsOJyD2bK/u9pDy+HfZQ62I+IVN/lwQ3eA4fimxae5M+6Ptt4q6tAiOVul
 mk6sf+aVIIpGRJDV0icVj+S+N1o05PhukEPCrzi8NgLjN6QYwOeaIEQa6/ymZjfe
 mcYG7SQsyyxGtdDpGEebZtQJVxmYY93qnLDykikLsNquCJKRX4GGWZqZn2dVF73M
 afZWt921+CvPdLIabQYgjPpqMniFR/XbGXuXYhLtADbb806SFmy68Dvfs29u9qDH
 ZwmsMcvwx/CjeyuZGicbjlApND9pA5RHGkL4qE2hCxkrrBrfWPfVKsa5DKUMthiy
 vIUTBQohgMQE+H1N6S1vd+4itnUdMaxhF4+yV1oIzHtAo1m+bHR6Mzein3O9lS9o
 7ch028nrhDZZZNOMl3vsbCS8R9KAXKSpojwgCZ94QwY8xSelXXiLQY05ggA1U5Bo
 w7Uqnn3AnvGieORv3ZZ0TKEQSGO6rxMUB+L8PsrJEiC8F3tkSr9yYVQzXxo69Qhs
 jQXAREwdwarugVj+ER8rIyFfJ9rd1+8yZT3oRr+WhmaXvuQ6CoGrQ/P0+VsMUSxC
 RJKBEeGjaFRhc2NedGO7
 =XSAp
 -----END PGP SIGNATURE-----

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

Pull sound fixes from Takashi Iwai:
 "A slightly higher volume than a new year's wish, but not too
  worrisome: a large LOC is only for HD-audio device-specific quirks, so
  fairly safe to apply.  The rest ASoC fixes are all trivial and small;
  a simple replacement of mutex call with nested lock version, a few
  Arizona and Realtek codec fixes, and a regression fix for Skylake
  firmware handling"

* tag 'sound-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ASoC: Intel: Skylake: Fix the memory leak
  ASoC: Intel: Skylake: Revert previous broken fix memory leak fix
  ASoC: Use nested lock for snd_soc_dapm_mutex_lock
  ASoC: rt5645: add sys clk detection
  ALSA: hda - Add keycode map for alc input device
  ALSA: hda - Add mic mute hotkey quirk for Lenovo ThinkCentre AIO
  ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz
This commit is contained in:
Linus Torvalds 2016-01-08 11:52:18 -08:00
commit 4054f64c93
8 changed files with 104 additions and 18 deletions

View File

@ -1655,7 +1655,7 @@ extern const struct dev_pm_ops snd_soc_pm_ops;
/* Helper functions */
static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
{
mutex_lock(&dapm->card->dapm_mutex);
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
}
static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)

View File

@ -67,6 +67,10 @@ enum {
ALC_HEADSET_TYPE_OMTP,
};
enum {
ALC_KEY_MICMUTE_INDEX,
};
struct alc_customize_define {
unsigned int sku_cfg;
unsigned char port_connectivity;
@ -123,6 +127,7 @@ struct alc_spec {
unsigned int pll_coef_idx, pll_coef_bit;
unsigned int coef0;
struct input_dev *kb_dev;
u8 alc_mute_keycode_map[1];
};
/*
@ -3462,12 +3467,43 @@ static void gpio2_mic_hotkey_event(struct hda_codec *codec,
/* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
send both key on and key off event for every interrupt. */
input_report_key(spec->kb_dev, KEY_MICMUTE, 1);
input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
input_sync(spec->kb_dev);
input_report_key(spec->kb_dev, KEY_MICMUTE, 0);
input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
input_sync(spec->kb_dev);
}
static int alc_register_micmute_input_device(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
int i;
spec->kb_dev = input_allocate_device();
if (!spec->kb_dev) {
codec_err(codec, "Out of memory (input_allocate_device)\n");
return -ENOMEM;
}
spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
spec->kb_dev->name = "Microphone Mute Button";
spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
spec->kb_dev->keycode = spec->alc_mute_keycode_map;
for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
if (input_register_device(spec->kb_dev)) {
codec_err(codec, "input_register_device failed\n");
input_free_device(spec->kb_dev);
spec->kb_dev = NULL;
return -ENOMEM;
}
return 0;
}
static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
@ -3485,20 +3521,8 @@ static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
struct alc_spec *spec = codec->spec;
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
spec->kb_dev = input_allocate_device();
if (!spec->kb_dev) {
codec_err(codec, "Out of memory (input_allocate_device)\n");
if (alc_register_micmute_input_device(codec) != 0)
return;
}
spec->kb_dev->name = "Microphone Mute Button";
spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
spec->kb_dev->keybit[BIT_WORD(KEY_MICMUTE)] = BIT_MASK(KEY_MICMUTE);
if (input_register_device(spec->kb_dev)) {
codec_err(codec, "input_register_device failed\n");
input_free_device(spec->kb_dev);
spec->kb_dev = NULL;
return;
}
snd_hda_add_verbs(codec, gpio_init);
snd_hda_codec_write_cache(codec, codec->core.afg, 0,
@ -3528,6 +3552,47 @@ static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
}
}
static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
/* Line2 = mic mute hotkey
GPIO2 = mic mute LED */
static const struct hda_verb gpio_init[] = {
{ 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
{ 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
{}
};
struct alc_spec *spec = codec->spec;
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
if (alc_register_micmute_input_device(codec) != 0)
return;
snd_hda_add_verbs(codec, gpio_init);
snd_hda_jack_detect_enable_callback(codec, 0x1b,
gpio2_mic_hotkey_event);
spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
spec->gpio_led = 0;
spec->mute_led_polarity = 0;
spec->gpio_mic_led_mask = 0x04;
return;
}
if (!spec->kb_dev)
return;
switch (action) {
case HDA_FIXUP_ACT_PROBE:
spec->init_amp = ALC_INIT_DEFAULT;
break;
case HDA_FIXUP_ACT_FREE:
input_unregister_device(spec->kb_dev);
spec->kb_dev = NULL;
}
}
static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
@ -4628,6 +4693,7 @@ enum {
ALC275_FIXUP_DELL_XPS,
ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
ALC293_FIXUP_LENOVO_SPK_NOISE,
ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
};
static const struct hda_fixup alc269_fixups[] = {
@ -5237,6 +5303,10 @@ static const struct hda_fixup alc269_fixups[] = {
.chained = true,
.chain_id = ALC269_FIXUP_THINKPAD_ACPI
},
[ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
.type = HDA_FIXUP_FUNC,
.v.func = alc233_fixup_lenovo_line2_mic_hotkey,
},
};
static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@ -5386,6 +5456,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),

View File

@ -1537,7 +1537,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
bool reconfig;
unsigned int aif_tx_state, aif_rx_state;
if (params_rate(params) % 8000)
if (params_rate(params) % 4000)
rates = &arizona_44k1_bclk_rates[0];
else
rates = &arizona_48k_bclk_rates[0];

View File

@ -1667,9 +1667,13 @@ static int rt5645_spk_event(struct snd_soc_dapm_widget *w,
RT5645_PWR_CLS_D_L,
RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R |
RT5645_PWR_CLS_D_L);
snd_soc_update_bits(codec, RT5645_GEN_CTRL3,
RT5645_DET_CLK_MASK, RT5645_DET_CLK_MODE1);
break;
case SND_SOC_DAPM_PRE_PMD:
snd_soc_update_bits(codec, RT5645_GEN_CTRL3,
RT5645_DET_CLK_MASK, RT5645_DET_CLK_DIS);
snd_soc_write(codec, RT5645_EQ_CTRL2, 0);
snd_soc_update_bits(codec, RT5645_PWR_DIG1,
RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R |

View File

@ -2122,6 +2122,10 @@ enum {
/* General Control3 (0xfc) */
#define RT5645_JD_PSV_MODE (0x1 << 12)
#define RT5645_IRQ_CLK_GATE_CTRL (0x1 << 11)
#define RT5645_DET_CLK_MASK (0x3 << 9)
#define RT5645_DET_CLK_DIS (0x0 << 9)
#define RT5645_DET_CLK_MODE1 (0x1 << 9)
#define RT5645_DET_CLK_MODE2 (0x2 << 9)
#define RT5645_MICINDET_MANU (0x1 << 7)
#define RT5645_RING2_SLEEVE_GND (0x1 << 5)

View File

@ -1240,7 +1240,6 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
*/
ret = snd_soc_tplg_component_load(&platform->component,
&skl_tplg_ops, fw, 0);
release_firmware(fw);
if (ret < 0) {
dev_err(bus->dev, "tplg component load failed%d\n", ret);
return -EINVAL;
@ -1249,5 +1248,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
skl->resource.max_mcps = SKL_MAX_MCPS;
skl->resource.max_mem = SKL_FW_MAX_MEM;
skl->tplg = fw;
return 0;
}

View File

@ -25,6 +25,7 @@
#include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <linux/platform_device.h>
#include <linux/firmware.h>
#include <sound/pcm.h>
#include "skl.h"
@ -520,6 +521,9 @@ static void skl_remove(struct pci_dev *pci)
struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
struct skl *skl = ebus_to_skl(ebus);
if (skl->tplg)
release_firmware(skl->tplg);
if (pci_dev_run_wake(pci))
pm_runtime_get_noresume(&pci->dev);
pci_dev_put(pci);

View File

@ -68,6 +68,8 @@ struct skl {
struct skl_dsp_resource resource;
struct list_head ppl_list;
struct list_head dapm_path_list;
const struct firmware *tplg;
};
#define skl_to_ebus(s) (&(s)->ebus)