aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-08 14:52:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-08 14:52:18 -0500
commit4054f64c937b1be46e41cbdfa61954be6f811252 (patch)
tree195089cdadee99efba1feb26abb5a4993b8ca631
parent02006f7a7a715af10974a30b7ad8e6ee340f954c (diff)
parent3f37b26f8d57756b591383a9d8ce1cd628bc773c (diff)
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
-rw-r--r--include/sound/soc.h2
-rw-r--r--sound/pci/hda/patch_realtek.c101
-rw-r--r--sound/soc/codecs/arizona.c2
-rw-r--r--sound/soc/codecs/rt5645.c4
-rw-r--r--sound/soc/codecs/rt5645.h4
-rw-r--r--sound/soc/intel/skylake/skl-topology.c3
-rw-r--r--sound/soc/intel/skylake/skl.c4
-rw-r--r--sound/soc/intel/skylake/skl.h2
8 files changed, 104 insertions, 18 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a8b4b9c8b1d2..fb955e69a78e 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1655,7 +1655,7 @@ extern const struct dev_pm_ops snd_soc_pm_ops;
1655/* Helper functions */ 1655/* Helper functions */
1656static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm) 1656static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
1657{ 1657{
1658 mutex_lock(&dapm->card->dapm_mutex); 1658 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
1659} 1659}
1660 1660
1661static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm) 1661static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fe96428aa403..3a89d82f8057 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -67,6 +67,10 @@ enum {
67 ALC_HEADSET_TYPE_OMTP, 67 ALC_HEADSET_TYPE_OMTP,
68}; 68};
69 69
70enum {
71 ALC_KEY_MICMUTE_INDEX,
72};
73
70struct alc_customize_define { 74struct alc_customize_define {
71 unsigned int sku_cfg; 75 unsigned int sku_cfg;
72 unsigned char port_connectivity; 76 unsigned char port_connectivity;
@@ -123,6 +127,7 @@ struct alc_spec {
123 unsigned int pll_coef_idx, pll_coef_bit; 127 unsigned int pll_coef_idx, pll_coef_bit;
124 unsigned int coef0; 128 unsigned int coef0;
125 struct input_dev *kb_dev; 129 struct input_dev *kb_dev;
130 u8 alc_mute_keycode_map[1];
126}; 131};
127 132
128/* 133/*
@@ -3462,12 +3467,43 @@ static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3462 3467
3463 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore 3468 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3464 send both key on and key off event for every interrupt. */ 3469 send both key on and key off event for every interrupt. */
3465 input_report_key(spec->kb_dev, KEY_MICMUTE, 1); 3470 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
3466 input_sync(spec->kb_dev); 3471 input_sync(spec->kb_dev);
3467 input_report_key(spec->kb_dev, KEY_MICMUTE, 0); 3472 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
3468 input_sync(spec->kb_dev); 3473 input_sync(spec->kb_dev);
3469} 3474}
3470 3475
3476static int alc_register_micmute_input_device(struct hda_codec *codec)
3477{
3478 struct alc_spec *spec = codec->spec;
3479 int i;
3480
3481 spec->kb_dev = input_allocate_device();
3482 if (!spec->kb_dev) {
3483 codec_err(codec, "Out of memory (input_allocate_device)\n");
3484 return -ENOMEM;
3485 }
3486
3487 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3488
3489 spec->kb_dev->name = "Microphone Mute Button";
3490 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
3491 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3492 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3493 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3494 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3495 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
3496
3497 if (input_register_device(spec->kb_dev)) {
3498 codec_err(codec, "input_register_device failed\n");
3499 input_free_device(spec->kb_dev);
3500 spec->kb_dev = NULL;
3501 return -ENOMEM;
3502 }
3503
3504 return 0;
3505}
3506
3471static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, 3507static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3472 const struct hda_fixup *fix, int action) 3508 const struct hda_fixup *fix, int action)
3473{ 3509{
@@ -3485,20 +3521,8 @@ static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3485 struct alc_spec *spec = codec->spec; 3521 struct alc_spec *spec = codec->spec;
3486 3522
3487 if (action == HDA_FIXUP_ACT_PRE_PROBE) { 3523 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3488 spec->kb_dev = input_allocate_device(); 3524 if (alc_register_micmute_input_device(codec) != 0)
3489 if (!spec->kb_dev) {
3490 codec_err(codec, "Out of memory (input_allocate_device)\n");
3491 return; 3525 return;
3492 }
3493 spec->kb_dev->name = "Microphone Mute Button";
3494 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
3495 spec->kb_dev->keybit[BIT_WORD(KEY_MICMUTE)] = BIT_MASK(KEY_MICMUTE);
3496 if (input_register_device(spec->kb_dev)) {
3497 codec_err(codec, "input_register_device failed\n");
3498 input_free_device(spec->kb_dev);
3499 spec->kb_dev = NULL;
3500 return;
3501 }
3502 3526
3503 snd_hda_add_verbs(codec, gpio_init); 3527 snd_hda_add_verbs(codec, gpio_init);
3504 snd_hda_codec_write_cache(codec, codec->core.afg, 0, 3528 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,
3528 } 3552 }
3529} 3553}
3530 3554
3555static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
3556 const struct hda_fixup *fix, int action)
3557{
3558 /* Line2 = mic mute hotkey
3559 GPIO2 = mic mute LED */
3560 static const struct hda_verb gpio_init[] = {
3561 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
3562 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
3563 {}
3564 };
3565
3566 struct alc_spec *spec = codec->spec;
3567
3568 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3569 if (alc_register_micmute_input_device(codec) != 0)
3570 return;
3571
3572 snd_hda_add_verbs(codec, gpio_init);
3573 snd_hda_jack_detect_enable_callback(codec, 0x1b,
3574 gpio2_mic_hotkey_event);
3575
3576 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3577 spec->gpio_led = 0;
3578 spec->mute_led_polarity = 0;
3579 spec->gpio_mic_led_mask = 0x04;
3580 return;
3581 }
3582
3583 if (!spec->kb_dev)
3584 return;
3585
3586 switch (action) {
3587 case HDA_FIXUP_ACT_PROBE:
3588 spec->init_amp = ALC_INIT_DEFAULT;
3589 break;
3590 case HDA_FIXUP_ACT_FREE:
3591 input_unregister_device(spec->kb_dev);
3592 spec->kb_dev = NULL;
3593 }
3594}
3595
3531static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, 3596static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3532 const struct hda_fixup *fix, int action) 3597 const struct hda_fixup *fix, int action)
3533{ 3598{
@@ -4628,6 +4693,7 @@ enum {
4628 ALC275_FIXUP_DELL_XPS, 4693 ALC275_FIXUP_DELL_XPS,
4629 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, 4694 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
4630 ALC293_FIXUP_LENOVO_SPK_NOISE, 4695 ALC293_FIXUP_LENOVO_SPK_NOISE,
4696 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
4631}; 4697};
4632 4698
4633static const struct hda_fixup alc269_fixups[] = { 4699static const struct hda_fixup alc269_fixups[] = {
@@ -5237,6 +5303,10 @@ static const struct hda_fixup alc269_fixups[] = {
5237 .chained = true, 5303 .chained = true,
5238 .chain_id = ALC269_FIXUP_THINKPAD_ACPI 5304 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
5239 }, 5305 },
5306 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
5307 .type = HDA_FIXUP_FUNC,
5308 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
5309 },
5240}; 5310};
5241 5311
5242static const struct snd_pci_quirk alc269_fixup_tbl[] = { 5312static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -5386,6 +5456,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5386 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK), 5456 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
5387 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK), 5457 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
5388 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE), 5458 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
5459 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
5389 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), 5460 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
5390 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), 5461 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
5391 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 5462 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index b3ea24d64c50..93b400800905 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1537,7 +1537,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
1537 bool reconfig; 1537 bool reconfig;
1538 unsigned int aif_tx_state, aif_rx_state; 1538 unsigned int aif_tx_state, aif_rx_state;
1539 1539
1540 if (params_rate(params) % 8000) 1540 if (params_rate(params) % 4000)
1541 rates = &arizona_44k1_bclk_rates[0]; 1541 rates = &arizona_44k1_bclk_rates[0];
1542 else 1542 else
1543 rates = &arizona_48k_bclk_rates[0]; 1543 rates = &arizona_48k_bclk_rates[0];
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index ef76940f9dcb..3e3c7f6be29d 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -1667,9 +1667,13 @@ static int rt5645_spk_event(struct snd_soc_dapm_widget *w,
1667 RT5645_PWR_CLS_D_L, 1667 RT5645_PWR_CLS_D_L,
1668 RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | 1668 RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R |
1669 RT5645_PWR_CLS_D_L); 1669 RT5645_PWR_CLS_D_L);
1670 snd_soc_update_bits(codec, RT5645_GEN_CTRL3,
1671 RT5645_DET_CLK_MASK, RT5645_DET_CLK_MODE1);
1670 break; 1672 break;
1671 1673
1672 case SND_SOC_DAPM_PRE_PMD: 1674 case SND_SOC_DAPM_PRE_PMD:
1675 snd_soc_update_bits(codec, RT5645_GEN_CTRL3,
1676 RT5645_DET_CLK_MASK, RT5645_DET_CLK_DIS);
1673 snd_soc_write(codec, RT5645_EQ_CTRL2, 0); 1677 snd_soc_write(codec, RT5645_EQ_CTRL2, 0);
1674 snd_soc_update_bits(codec, RT5645_PWR_DIG1, 1678 snd_soc_update_bits(codec, RT5645_PWR_DIG1,
1675 RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R | 1679 RT5645_PWR_CLS_D | RT5645_PWR_CLS_D_R |
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h
index 093e46d559fb..205e0715c99a 100644
--- a/sound/soc/codecs/rt5645.h
+++ b/sound/soc/codecs/rt5645.h
@@ -2122,6 +2122,10 @@ enum {
2122/* General Control3 (0xfc) */ 2122/* General Control3 (0xfc) */
2123#define RT5645_JD_PSV_MODE (0x1 << 12) 2123#define RT5645_JD_PSV_MODE (0x1 << 12)
2124#define RT5645_IRQ_CLK_GATE_CTRL (0x1 << 11) 2124#define RT5645_IRQ_CLK_GATE_CTRL (0x1 << 11)
2125#define RT5645_DET_CLK_MASK (0x3 << 9)
2126#define RT5645_DET_CLK_DIS (0x0 << 9)
2127#define RT5645_DET_CLK_MODE1 (0x1 << 9)
2128#define RT5645_DET_CLK_MODE2 (0x2 << 9)
2125#define RT5645_MICINDET_MANU (0x1 << 7) 2129#define RT5645_MICINDET_MANU (0x1 << 7)
2126#define RT5645_RING2_SLEEVE_GND (0x1 << 5) 2130#define RT5645_RING2_SLEEVE_GND (0x1 << 5)
2127 2131
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index ffea427aeca8..ad4d0f82603e 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -1240,7 +1240,6 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
1240 */ 1240 */
1241 ret = snd_soc_tplg_component_load(&platform->component, 1241 ret = snd_soc_tplg_component_load(&platform->component,
1242 &skl_tplg_ops, fw, 0); 1242 &skl_tplg_ops, fw, 0);
1243 release_firmware(fw);
1244 if (ret < 0) { 1243 if (ret < 0) {
1245 dev_err(bus->dev, "tplg component load failed%d\n", ret); 1244 dev_err(bus->dev, "tplg component load failed%d\n", ret);
1246 return -EINVAL; 1245 return -EINVAL;
@@ -1249,5 +1248,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
1249 skl->resource.max_mcps = SKL_MAX_MCPS; 1248 skl->resource.max_mcps = SKL_MAX_MCPS;
1250 skl->resource.max_mem = SKL_FW_MAX_MEM; 1249 skl->resource.max_mem = SKL_FW_MAX_MEM;
1251 1250
1251 skl->tplg = fw;
1252
1252 return 0; 1253 return 0;
1253} 1254}
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 5319529aedf7..caa69c4598a6 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -25,6 +25,7 @@
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/pm_runtime.h> 26#include <linux/pm_runtime.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/firmware.h>
28#include <sound/pcm.h> 29#include <sound/pcm.h>
29#include "skl.h" 30#include "skl.h"
30 31
@@ -520,6 +521,9 @@ static void skl_remove(struct pci_dev *pci)
520 struct hdac_ext_bus *ebus = pci_get_drvdata(pci); 521 struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
521 struct skl *skl = ebus_to_skl(ebus); 522 struct skl *skl = ebus_to_skl(ebus);
522 523
524 if (skl->tplg)
525 release_firmware(skl->tplg);
526
523 if (pci_dev_run_wake(pci)) 527 if (pci_dev_run_wake(pci))
524 pm_runtime_get_noresume(&pci->dev); 528 pm_runtime_get_noresume(&pci->dev);
525 pci_dev_put(pci); 529 pci_dev_put(pci);
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index dd2e79ae45a8..a0709e344d44 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -68,6 +68,8 @@ struct skl {
68 struct skl_dsp_resource resource; 68 struct skl_dsp_resource resource;
69 struct list_head ppl_list; 69 struct list_head ppl_list;
70 struct list_head dapm_path_list; 70 struct list_head dapm_path_list;
71
72 const struct firmware *tplg;
71}; 73};
72 74
73#define skl_to_ebus(s) (&(s)->ebus) 75#define skl_to_ebus(s) (&(s)->ebus)