aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-02-28 02:17:38 -0500
committerTakashi Iwai <tiwai@suse.de>2018-02-28 02:17:54 -0500
commit3b8bd500c9953c59e892c41edffeef1f5099e189 (patch)
tree230c1af6bc6f5d2ed440e5f7265c0f7cbba8b825
parentef21e1750158558d8369067e94d02d285011c37e (diff)
parent5a23699a39abc5328921a81b89383d088f6ba9cc (diff)
Merge branch 'for-linus' into for-next
Back-merge for applying a cleanup to core/control Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/core/control.c2
-rw-r--r--sound/core/seq/seq_clientmgr.c8
-rw-r--r--sound/pci/hda/hda_intel.c38
-rw-r--r--sound/pci/hda/patch_realtek.c22
-rw-r--r--sound/usb/quirks-table.h47
-rw-r--r--sound/x86/intel_hdmi_audio.c14
6 files changed, 122 insertions, 9 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 0b3026d937b1..8a77620a3854 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -889,7 +889,7 @@ static int snd_ctl_elem_read(struct snd_card *card,
889 889
890 index_offset = snd_ctl_get_ioff(kctl, &control->id); 890 index_offset = snd_ctl_get_ioff(kctl, &control->id);
891 vd = &kctl->vd[index_offset]; 891 vd = &kctl->vd[index_offset];
892 if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_READ) && kctl->get == NULL) 892 if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_READ) || kctl->get == NULL)
893 return -EPERM; 893 return -EPERM;
894 894
895 snd_ctl_build_ioff(&control->id, kctl, index_offset); 895 snd_ctl_build_ioff(&control->id, kctl, index_offset);
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 60db32785f62..04d4db44fae5 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1003,7 +1003,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
1003{ 1003{
1004 struct snd_seq_client *client = file->private_data; 1004 struct snd_seq_client *client = file->private_data;
1005 int written = 0, len; 1005 int written = 0, len;
1006 int err = -EINVAL; 1006 int err;
1007 struct snd_seq_event event; 1007 struct snd_seq_event event;
1008 1008
1009 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT)) 1009 if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT))
@@ -1018,11 +1018,15 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
1018 1018
1019 /* allocate the pool now if the pool is not allocated yet */ 1019 /* allocate the pool now if the pool is not allocated yet */
1020 if (client->pool->size > 0 && !snd_seq_write_pool_allocated(client)) { 1020 if (client->pool->size > 0 && !snd_seq_write_pool_allocated(client)) {
1021 if (snd_seq_pool_init(client->pool) < 0) 1021 mutex_lock(&client->ioctl_mutex);
1022 err = snd_seq_pool_init(client->pool);
1023 mutex_unlock(&client->ioctl_mutex);
1024 if (err < 0)
1022 return -ENOMEM; 1025 return -ENOMEM;
1023 } 1026 }
1024 1027
1025 /* only process whole events */ 1028 /* only process whole events */
1029 err = -EINVAL;
1026 while (count >= sizeof(struct snd_seq_event)) { 1030 while (count >= sizeof(struct snd_seq_event)) {
1027 /* Read in the event header from the user */ 1031 /* Read in the event header from the user */
1028 len = sizeof(event); 1032 len = sizeof(event);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index c71dcacea807..96143df19b21 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -181,7 +181,7 @@ static const struct kernel_param_ops param_ops_xint = {
181}; 181};
182#define param_check_xint param_check_int 182#define param_check_xint param_check_int
183 183
184static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; 184static int power_save = -1;
185module_param(power_save, xint, 0644); 185module_param(power_save, xint, 0644);
186MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " 186MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
187 "(in second, 0 = disable)."); 187 "(in second, 0 = disable).");
@@ -2186,6 +2186,24 @@ out_free:
2186 return err; 2186 return err;
2187} 2187}
2188 2188
2189#ifdef CONFIG_PM
2190/* On some boards setting power_save to a non 0 value leads to clicking /
2191 * popping sounds when ever we enter/leave powersaving mode. Ideally we would
2192 * figure out how to avoid these sounds, but that is not always feasible.
2193 * So we keep a list of devices where we disable powersaving as its known
2194 * to causes problems on these devices.
2195 */
2196static struct snd_pci_quirk power_save_blacklist[] = {
2197 /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */
2198 SND_PCI_QUIRK(0x1849, 0x0c0c, "Asrock B85M-ITX", 0),
2199 /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */
2200 SND_PCI_QUIRK(0x1043, 0x8733, "Asus Prime X370-Pro", 0),
2201 /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */
2202 SND_PCI_QUIRK(0x17aa, 0x2227, "Lenovo X1 Carbon 3rd Gen", 0),
2203 {}
2204};
2205#endif /* CONFIG_PM */
2206
2189/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ 2207/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */
2190static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { 2208static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = {
2191 [AZX_DRIVER_NVIDIA] = 8, 2209 [AZX_DRIVER_NVIDIA] = 8,
@@ -2198,6 +2216,7 @@ static int azx_probe_continue(struct azx *chip)
2198 struct hdac_bus *bus = azx_bus(chip); 2216 struct hdac_bus *bus = azx_bus(chip);
2199 struct pci_dev *pci = chip->pci; 2217 struct pci_dev *pci = chip->pci;
2200 int dev = chip->dev_index; 2218 int dev = chip->dev_index;
2219 int val;
2201 int err; 2220 int err;
2202 2221
2203 hda->probe_continued = 1; 2222 hda->probe_continued = 1;
@@ -2278,7 +2297,22 @@ static int azx_probe_continue(struct azx *chip)
2278 2297
2279 chip->running = 1; 2298 chip->running = 1;
2280 azx_add_card_list(chip); 2299 azx_add_card_list(chip);
2281 snd_hda_set_power_save(&chip->bus, power_save * 1000); 2300
2301 val = power_save;
2302#ifdef CONFIG_PM
2303 if (val == -1) {
2304 const struct snd_pci_quirk *q;
2305
2306 val = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
2307 q = snd_pci_quirk_lookup(chip->pci, power_save_blacklist);
2308 if (q && val) {
2309 dev_info(chip->card->dev, "device %04x:%04x is on the power_save blacklist, forcing power_save to 0\n",
2310 q->subvendor, q->subdevice);
2311 val = 0;
2312 }
2313 }
2314#endif /* CONFIG_PM */
2315 snd_hda_set_power_save(&chip->bus, val * 1000);
2282 if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo) 2316 if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo)
2283 pm_runtime_put_autosuspend(&pci->dev); 2317 pm_runtime_put_autosuspend(&pci->dev);
2284 2318
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 32938ca8e5e3..b9c93fa0a51c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3465,6 +3465,19 @@ static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
3465 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; 3465 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3466} 3466}
3467 3467
3468static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3469 const struct hda_fixup *fix,
3470 int action)
3471{
3472 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3473 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3474
3475 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3476 snd_hda_codec_set_pincfg(codec, 0x19,
3477 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3478 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3479}
3480
3468static void alc269_fixup_hweq(struct hda_codec *codec, 3481static void alc269_fixup_hweq(struct hda_codec *codec,
3469 const struct hda_fixup *fix, int action) 3482 const struct hda_fixup *fix, int action)
3470{ 3483{
@@ -4984,13 +4997,14 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec,
4984 4997
4985 if (action == HDA_FIXUP_ACT_PRE_PROBE) { 4998 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4986 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; 4999 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5000 snd_hda_apply_pincfgs(codec, pincfgs);
5001 } else if (action == HDA_FIXUP_ACT_INIT) {
4987 /* Enable DOCK device */ 5002 /* Enable DOCK device */
4988 snd_hda_codec_write(codec, 0x17, 0, 5003 snd_hda_codec_write(codec, 0x17, 0,
4989 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0); 5004 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
4990 /* Enable DOCK device */ 5005 /* Enable DOCK device */
4991 snd_hda_codec_write(codec, 0x19, 0, 5006 snd_hda_codec_write(codec, 0x19, 0,
4992 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0); 5007 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
4993 snd_hda_apply_pincfgs(codec, pincfgs);
4994 } 5008 }
4995} 5009}
4996 5010
@@ -5373,6 +5387,7 @@ enum {
5373 ALC269_FIXUP_LIFEBOOK_EXTMIC, 5387 ALC269_FIXUP_LIFEBOOK_EXTMIC,
5374 ALC269_FIXUP_LIFEBOOK_HP_PIN, 5388 ALC269_FIXUP_LIFEBOOK_HP_PIN,
5375 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT, 5389 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
5390 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
5376 ALC269_FIXUP_AMIC, 5391 ALC269_FIXUP_AMIC,
5377 ALC269_FIXUP_DMIC, 5392 ALC269_FIXUP_DMIC,
5378 ALC269VB_FIXUP_AMIC, 5393 ALC269VB_FIXUP_AMIC,
@@ -5579,6 +5594,10 @@ static const struct hda_fixup alc269_fixups[] = {
5579 .type = HDA_FIXUP_FUNC, 5594 .type = HDA_FIXUP_FUNC,
5580 .v.func = alc269_fixup_pincfg_no_hp_to_lineout, 5595 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5581 }, 5596 },
5597 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5598 .type = HDA_FIXUP_FUNC,
5599 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5600 },
5582 [ALC269_FIXUP_AMIC] = { 5601 [ALC269_FIXUP_AMIC] = {
5583 .type = HDA_FIXUP_PINS, 5602 .type = HDA_FIXUP_PINS,
5584 .v.pins = (const struct hda_pintbl[]) { 5603 .v.pins = (const struct hda_pintbl[]) {
@@ -6453,6 +6472,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6453 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT), 6472 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
6454 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), 6473 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
6455 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), 6474 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
6475 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
6456 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), 6476 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
6457 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE), 6477 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
6458 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), 6478 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 50252046b01d..754e632a27bd 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -3325,4 +3325,51 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
3325 } 3325 }
3326}, 3326},
3327 3327
3328{
3329 /*
3330 * Bower's & Wilkins PX headphones only support the 48 kHz sample rate
3331 * even though it advertises more. The capture interface doesn't work
3332 * even on windows.
3333 */
3334 USB_DEVICE(0x19b5, 0x0021),
3335 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
3336 .ifnum = QUIRK_ANY_INTERFACE,
3337 .type = QUIRK_COMPOSITE,
3338 .data = (const struct snd_usb_audio_quirk[]) {
3339 {
3340 .ifnum = 0,
3341 .type = QUIRK_AUDIO_STANDARD_MIXER,
3342 },
3343 /* Capture */
3344 {
3345 .ifnum = 1,
3346 .type = QUIRK_IGNORE_INTERFACE,
3347 },
3348 /* Playback */
3349 {
3350 .ifnum = 2,
3351 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
3352 .data = &(const struct audioformat) {
3353 .formats = SNDRV_PCM_FMTBIT_S16_LE,
3354 .channels = 2,
3355 .iface = 2,
3356 .altsetting = 1,
3357 .altset_idx = 1,
3358 .attributes = UAC_EP_CS_ATTR_FILL_MAX |
3359 UAC_EP_CS_ATTR_SAMPLE_RATE,
3360 .endpoint = 0x03,
3361 .ep_attr = USB_ENDPOINT_XFER_ISOC,
3362 .rates = SNDRV_PCM_RATE_48000,
3363 .rate_min = 48000,
3364 .rate_max = 48000,
3365 .nr_rates = 1,
3366 .rate_table = (unsigned int[]) {
3367 48000
3368 }
3369 }
3370 },
3371 }
3372 }
3373},
3374
3328#undef USB_DEVICE_VENDOR_SPEC 3375#undef USB_DEVICE_VENDOR_SPEC
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index a0951505c7f5..96115c401292 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -50,6 +50,7 @@
50/*standard module options for ALSA. This module supports only one card*/ 50/*standard module options for ALSA. This module supports only one card*/
51static int hdmi_card_index = SNDRV_DEFAULT_IDX1; 51static int hdmi_card_index = SNDRV_DEFAULT_IDX1;
52static char *hdmi_card_id = SNDRV_DEFAULT_STR1; 52static char *hdmi_card_id = SNDRV_DEFAULT_STR1;
53static bool single_port;
53 54
54module_param_named(index, hdmi_card_index, int, 0444); 55module_param_named(index, hdmi_card_index, int, 0444);
55MODULE_PARM_DESC(index, 56MODULE_PARM_DESC(index,
@@ -57,6 +58,9 @@ MODULE_PARM_DESC(index,
57module_param_named(id, hdmi_card_id, charp, 0444); 58module_param_named(id, hdmi_card_id, charp, 0444);
58MODULE_PARM_DESC(id, 59MODULE_PARM_DESC(id,
59 "ID string for INTEL Intel HDMI Audio controller."); 60 "ID string for INTEL Intel HDMI Audio controller.");
61module_param(single_port, bool, 0444);
62MODULE_PARM_DESC(single_port,
63 "Single-port mode (for compatibility)");
60 64
61/* 65/*
62 * ELD SA bits in the CEA Speaker Allocation data block 66 * ELD SA bits in the CEA Speaker Allocation data block
@@ -1579,7 +1583,11 @@ static irqreturn_t display_pipe_interrupt_handler(int irq, void *dev_id)
1579static void notify_audio_lpe(struct platform_device *pdev, int port) 1583static void notify_audio_lpe(struct platform_device *pdev, int port)
1580{ 1584{
1581 struct snd_intelhad_card *card_ctx = platform_get_drvdata(pdev); 1585 struct snd_intelhad_card *card_ctx = platform_get_drvdata(pdev);
1582 struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port]; 1586 struct snd_intelhad *ctx;
1587
1588 ctx = &card_ctx->pcm_ctx[single_port ? 0 : port];
1589 if (single_port)
1590 ctx->port = port;
1583 1591
1584 schedule_work(&ctx->hdmi_audio_wq); 1592 schedule_work(&ctx->hdmi_audio_wq);
1585} 1593}
@@ -1816,7 +1824,7 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
1816 init_channel_allocations(); 1824 init_channel_allocations();
1817 1825
1818 card_ctx->num_pipes = pdata->num_pipes; 1826 card_ctx->num_pipes = pdata->num_pipes;
1819 card_ctx->num_ports = pdata->num_ports; 1827 card_ctx->num_ports = single_port ? 1 : pdata->num_ports;
1820 1828
1821 for_each_port(card_ctx, port) { 1829 for_each_port(card_ctx, port) {
1822 struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port]; 1830 struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port];
@@ -1824,7 +1832,7 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
1824 1832
1825 ctx->card_ctx = card_ctx; 1833 ctx->card_ctx = card_ctx;
1826 ctx->dev = card_ctx->dev; 1834 ctx->dev = card_ctx->dev;
1827 ctx->port = port; 1835 ctx->port = single_port ? -1 : port;
1828 ctx->pipe = -1; 1836 ctx->pipe = -1;
1829 1837
1830 INIT_WORK(&ctx->hdmi_audio_wq, had_audio_wq); 1838 INIT_WORK(&ctx->hdmi_audio_wq, had_audio_wq);