Skip to content

Commit 3b8bd50

Browse files
committed
Merge branch 'for-linus' into for-next
Back-merge for applying a cleanup to core/control Signed-off-by: Takashi Iwai <[email protected]>
2 parents ef21e17 + 5a23699 commit 3b8bd50

File tree

6 files changed

+122
-9
lines changed

6 files changed

+122
-9
lines changed

sound/core/control.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ static int snd_ctl_elem_read(struct snd_card *card,
889889

890890
index_offset = snd_ctl_get_ioff(kctl, &control->id);
891891
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)
893893
return -EPERM;
894894

895895
snd_ctl_build_ioff(&control->id, kctl, index_offset);

sound/core/seq/seq_clientmgr.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
10031003
{
10041004
struct snd_seq_client *client = file->private_data;
10051005
int written = 0, len;
1006-
int err = -EINVAL;
1006+
int err;
10071007
struct snd_seq_event event;
10081008

10091009
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,
10181018

10191019
/* allocate the pool now if the pool is not allocated yet */
10201020
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)
10221025
return -ENOMEM;
10231026
}
10241027

10251028
/* only process whole events */
1029+
err = -EINVAL;
10261030
while (count >= sizeof(struct snd_seq_event)) {
10271031
/* Read in the event header from the user */
10281032
len = sizeof(event);

sound/pci/hda/hda_intel.c

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static const struct kernel_param_ops param_ops_xint = {
181181
};
182182
#define param_check_xint param_check_int
183183

184-
static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
184+
static int power_save = -1;
185185
module_param(power_save, xint, 0644);
186186
MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
187187
"(in second, 0 = disable).");
@@ -2186,6 +2186,24 @@ static int azx_probe(struct pci_dev *pci,
21862186
return err;
21872187
}
21882188

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+
*/
2196+
static 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+
21892207
/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */
21902208
static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = {
21912209
[AZX_DRIVER_NVIDIA] = 8,
@@ -2198,6 +2216,7 @@ static int azx_probe_continue(struct azx *chip)
21982216
struct hdac_bus *bus = azx_bus(chip);
21992217
struct pci_dev *pci = chip->pci;
22002218
int dev = chip->dev_index;
2219+
int val;
22012220
int err;
22022221

22032222
hda->probe_continued = 1;
@@ -2278,7 +2297,22 @@ static int azx_probe_continue(struct azx *chip)
22782297

22792298
chip->running = 1;
22802299
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);
22822316
if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo)
22832317
pm_runtime_put_autosuspend(&pci->dev);
22842318

sound/pci/hda/patch_realtek.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3465,6 +3465,19 @@ static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
34653465
spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
34663466
}
34673467

3468+
static 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+
34683481
static void alc269_fixup_hweq(struct hda_codec *codec,
34693482
const struct hda_fixup *fix, int action)
34703483
{
@@ -4984,13 +4997,14 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec,
49844997

49854998
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
49864999
spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5000+
snd_hda_apply_pincfgs(codec, pincfgs);
5001+
} else if (action == HDA_FIXUP_ACT_INIT) {
49875002
/* Enable DOCK device */
49885003
snd_hda_codec_write(codec, 0x17, 0,
49895004
AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
49905005
/* Enable DOCK device */
49915006
snd_hda_codec_write(codec, 0x19, 0,
49925007
AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
4993-
snd_hda_apply_pincfgs(codec, pincfgs);
49945008
}
49955009
}
49965010

@@ -5373,6 +5387,7 @@ enum {
53735387
ALC269_FIXUP_LIFEBOOK_EXTMIC,
53745388
ALC269_FIXUP_LIFEBOOK_HP_PIN,
53755389
ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
5390+
ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
53765391
ALC269_FIXUP_AMIC,
53775392
ALC269_FIXUP_DMIC,
53785393
ALC269VB_FIXUP_AMIC,
@@ -5579,6 +5594,10 @@ static const struct hda_fixup alc269_fixups[] = {
55795594
.type = HDA_FIXUP_FUNC,
55805595
.v.func = alc269_fixup_pincfg_no_hp_to_lineout,
55815596
},
5597+
[ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5598+
.type = HDA_FIXUP_FUNC,
5599+
.v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5600+
},
55825601
[ALC269_FIXUP_AMIC] = {
55835602
.type = HDA_FIXUP_PINS,
55845603
.v.pins = (const struct hda_pintbl[]) {
@@ -6453,6 +6472,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
64536472
SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
64546473
SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
64556474
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),
64566476
SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
64576477
SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
64586478
SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),

sound/usb/quirks-table.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3325,4 +3325,51 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
33253325
}
33263326
},
33273327

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+
33283375
#undef USB_DEVICE_VENDOR_SPEC

sound/x86/intel_hdmi_audio.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,17 @@
5050
/*standard module options for ALSA. This module supports only one card*/
5151
static int hdmi_card_index = SNDRV_DEFAULT_IDX1;
5252
static char *hdmi_card_id = SNDRV_DEFAULT_STR1;
53+
static bool single_port;
5354

5455
module_param_named(index, hdmi_card_index, int, 0444);
5556
MODULE_PARM_DESC(index,
5657
"Index value for INTEL Intel HDMI Audio controller.");
5758
module_param_named(id, hdmi_card_id, charp, 0444);
5859
MODULE_PARM_DESC(id,
5960
"ID string for INTEL Intel HDMI Audio controller.");
61+
module_param(single_port, bool, 0444);
62+
MODULE_PARM_DESC(single_port,
63+
"Single-port mode (for compatibility)");
6064

6165
/*
6266
* 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)
15791583
static void notify_audio_lpe(struct platform_device *pdev, int port)
15801584
{
15811585
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;
15831591

15841592
schedule_work(&ctx->hdmi_audio_wq);
15851593
}
@@ -1816,15 +1824,15 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
18161824
init_channel_allocations();
18171825

18181826
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;
18201828

18211829
for_each_port(card_ctx, port) {
18221830
struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port];
18231831
int i;
18241832

18251833
ctx->card_ctx = card_ctx;
18261834
ctx->dev = card_ctx->dev;
1827-
ctx->port = port;
1835+
ctx->port = single_port ? -1 : port;
18281836
ctx->pipe = -1;
18291837

18301838
INIT_WORK(&ctx->hdmi_audio_wq, had_audio_wq);

0 commit comments

Comments
 (0)