Skip to content

Commit 0308110

Browse files
committed
Merge branch 'fix/misc' into topic/misc
2 parents c731bc9 + 763437a commit 0308110

33 files changed

Lines changed: 222 additions & 120 deletions

‎MAINTAINERS‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5532,6 +5532,7 @@ F: include/media/*7146*
55325532

55335533
SAMSUNG AUDIO (ASoC) DRIVERS
55345534
M: Jassi Brar <jassisinghbrar@gmail.com>
5535+
M: Sangbeom Kim <sbkim73@samsung.com>
55355536
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
55365537
S: Supported
55375538
F: sound/soc/samsung
@@ -7199,6 +7200,9 @@ W: http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices
71997200
S: Supported
72007201
F: Documentation/hwmon/wm83??
72017202
F: drivers/leds/leds-wm83*.c
7203+
F: drivers/input/misc/wm831x-on.c
7204+
F: drivers/input/touchscreen/wm831x-ts.c
7205+
F: drivers/input/touchscreen/wm97*.c
72027206
F: drivers/mfd/wm8*.c
72037207
F: drivers/power/wm83*.c
72047208
F: drivers/rtc/rtc-wm83*.c
@@ -7208,6 +7212,7 @@ F: drivers/watchdog/wm83*_wdt.c
72087212
F: include/linux/mfd/wm831x/
72097213
F: include/linux/mfd/wm8350/
72107214
F: include/linux/mfd/wm8400*
7215+
F: include/linux/wm97xx.h
72117216
F: include/sound/wm????.h
72127217
F: sound/soc/codecs/wm*
72137218

‎sound/aoa/fabrics/layout.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,10 +1073,10 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
10731073
sdev->pcmid = -1;
10741074
list_del(&ldev->list);
10751075
layouts_list_items--;
1076+
kfree(ldev);
10761077
outnodev:
10771078
of_node_put(sound);
10781079
layout_device = NULL;
1079-
kfree(ldev);
10801080
return -ENODEV;
10811081
}
10821082

‎sound/core/pcm_lib.c‎

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,10 @@ static int wait_for_avail(struct snd_pcm_substream *substream,
17611761
snd_pcm_uframes_t avail = 0;
17621762
long wait_time, tout;
17631763

1764+
init_waitqueue_entry(&wait, current);
1765+
set_current_state(TASK_INTERRUPTIBLE);
1766+
add_wait_queue(&runtime->tsleep, &wait);
1767+
17641768
if (runtime->no_period_wakeup)
17651769
wait_time = MAX_SCHEDULE_TIMEOUT;
17661770
else {
@@ -1771,16 +1775,32 @@ static int wait_for_avail(struct snd_pcm_substream *substream,
17711775
}
17721776
wait_time = msecs_to_jiffies(wait_time * 1000);
17731777
}
1774-
init_waitqueue_entry(&wait, current);
1775-
add_wait_queue(&runtime->tsleep, &wait);
1778+
17761779
for (;;) {
17771780
if (signal_pending(current)) {
17781781
err = -ERESTARTSYS;
17791782
break;
17801783
}
1784+
1785+
/*
1786+
* We need to check if space became available already
1787+
* (and thus the wakeup happened already) first to close
1788+
* the race of space already having become available.
1789+
* This check must happen after been added to the waitqueue
1790+
* and having current state be INTERRUPTIBLE.
1791+
*/
1792+
if (is_playback)
1793+
avail = snd_pcm_playback_avail(runtime);
1794+
else
1795+
avail = snd_pcm_capture_avail(runtime);
1796+
if (avail >= runtime->twake)
1797+
break;
17811798
snd_pcm_stream_unlock_irq(substream);
1782-
tout = schedule_timeout_interruptible(wait_time);
1799+
1800+
tout = schedule_timeout(wait_time);
1801+
17831802
snd_pcm_stream_lock_irq(substream);
1803+
set_current_state(TASK_INTERRUPTIBLE);
17841804
switch (runtime->status->state) {
17851805
case SNDRV_PCM_STATE_SUSPENDED:
17861806
err = -ESTRPIPE;
@@ -1806,14 +1826,9 @@ static int wait_for_avail(struct snd_pcm_substream *substream,
18061826
err = -EIO;
18071827
break;
18081828
}
1809-
if (is_playback)
1810-
avail = snd_pcm_playback_avail(runtime);
1811-
else
1812-
avail = snd_pcm_capture_avail(runtime);
1813-
if (avail >= runtime->twake)
1814-
break;
18151829
}
18161830
_endloop:
1831+
set_current_state(TASK_RUNNING);
18171832
remove_wait_queue(&runtime->tsleep, &wait);
18181833
*availp = avail;
18191834
return err;

‎sound/pci/hda/hda_codec.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,13 @@ int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux,
579579
return -1;
580580
}
581581
recursive++;
582-
for (i = 0; i < nums; i++)
582+
for (i = 0; i < nums; i++) {
583+
unsigned int type = get_wcaps_type(get_wcaps(codec, conn[i]));
584+
if (type == AC_WID_PIN || type == AC_WID_AUD_OUT)
585+
continue;
583586
if (snd_hda_get_conn_index(codec, conn[i], nid, recursive) >= 0)
584587
return i;
588+
}
585589
return -1;
586590
}
587591
EXPORT_SYMBOL_HDA(snd_hda_get_conn_index);

‎sound/pci/hda/hda_eld.c‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,17 @@ static int cea_sampling_frequencies[8] = {
144144
SNDRV_PCM_RATE_192000, /* 7: 192000Hz */
145145
};
146146

147-
static unsigned char hdmi_get_eld_byte(struct hda_codec *codec, hda_nid_t nid,
147+
static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid,
148148
int byte_index)
149149
{
150150
unsigned int val;
151151

152152
val = snd_hda_codec_read(codec, nid, 0,
153153
AC_VERB_GET_HDMI_ELDD, byte_index);
154-
155154
#ifdef BE_PARANOID
156155
printk(KERN_INFO "HDMI: ELD data byte %d: 0x%x\n", byte_index, val);
157156
#endif
158-
159-
if ((val & AC_ELDD_ELD_VALID) == 0) {
160-
snd_printd(KERN_INFO "HDMI: invalid ELD data byte %d\n",
161-
byte_index);
162-
val = 0;
163-
}
164-
165-
return val & AC_ELDD_ELD_DATA;
157+
return val;
166158
}
167159

168160
#define GRAB_BITS(buf, byte, lowbit, bits) \
@@ -344,11 +336,26 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
344336
if (!buf)
345337
return -ENOMEM;
346338

347-
for (i = 0; i < size; i++)
348-
buf[i] = hdmi_get_eld_byte(codec, nid, i);
339+
for (i = 0; i < size; i++) {
340+
unsigned int val = hdmi_get_eld_data(codec, nid, i);
341+
if (!(val & AC_ELDD_ELD_VALID)) {
342+
if (!i) {
343+
snd_printd(KERN_INFO
344+
"HDMI: invalid ELD data\n");
345+
ret = -EINVAL;
346+
goto error;
347+
}
348+
snd_printd(KERN_INFO
349+
"HDMI: invalid ELD data byte %d\n", i);
350+
val = 0;
351+
} else
352+
val &= AC_ELDD_ELD_DATA;
353+
buf[i] = val;
354+
}
349355

350356
ret = hdmi_update_eld(eld, buf, size);
351357

358+
error:
352359
kfree(buf);
353360
return ret;
354361
}

‎sound/pci/hda/patch_cirrus.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int is_ext_mic(struct hda_codec *codec, unsigned int idx)
375375
static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
376376
unsigned int *idxp)
377377
{
378-
int i;
378+
int i, idx;
379379
hda_nid_t nid;
380380

381381
nid = codec->start_nid;
@@ -384,9 +384,11 @@ static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
384384
type = get_wcaps_type(get_wcaps(codec, nid));
385385
if (type != AC_WID_AUD_IN)
386386
continue;
387-
*idxp = snd_hda_get_conn_index(codec, nid, pin, false);
388-
if (*idxp >= 0)
387+
idx = snd_hda_get_conn_index(codec, nid, pin, false);
388+
if (idx >= 0) {
389+
*idxp = idx;
389390
return nid;
391+
}
390392
}
391393
return 0;
392394
}
@@ -533,7 +535,7 @@ static int add_volume(struct hda_codec *codec, const char *name,
533535
int index, unsigned int pval, int dir,
534536
struct snd_kcontrol **kctlp)
535537
{
536-
char tmp[32];
538+
char tmp[44];
537539
struct snd_kcontrol_new knew =
538540
HDA_CODEC_VOLUME_IDX(tmp, index, 0, 0, HDA_OUTPUT);
539541
knew.private_value = pval;

‎sound/pci/hda/patch_conexant.c‎

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,6 +3348,8 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t pin,
33483348

33493349
#define MAX_AUTO_DACS 5
33503350

3351+
#define DAC_SLAVE_FLAG 0x8000 /* filled dac is a slave */
3352+
33513353
/* fill analog DAC list from the widget tree */
33523354
static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs)
33533355
{
@@ -3370,16 +3372,26 @@ static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs)
33703372
/* fill pin_dac_pair list from the pin and dac list */
33713373
static int fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins,
33723374
int num_pins, hda_nid_t *dacs, int *rest,
3373-
struct pin_dac_pair *filled, int type)
3375+
struct pin_dac_pair *filled, int nums,
3376+
int type)
33743377
{
3375-
int i, nums;
3378+
int i, start = nums;
33763379

3377-
nums = 0;
3378-
for (i = 0; i < num_pins; i++) {
3380+
for (i = 0; i < num_pins; i++, nums++) {
33793381
filled[nums].pin = pins[i];
33803382
filled[nums].type = type;
33813383
filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest);
3382-
nums++;
3384+
if (filled[nums].dac)
3385+
continue;
3386+
if (filled[start].dac && get_connection_index(codec, pins[i], filled[start].dac) >= 0) {
3387+
filled[nums].dac = filled[start].dac | DAC_SLAVE_FLAG;
3388+
continue;
3389+
}
3390+
if (filled[0].dac && get_connection_index(codec, pins[i], filled[0].dac) >= 0) {
3391+
filled[nums].dac = filled[0].dac | DAC_SLAVE_FLAG;
3392+
continue;
3393+
}
3394+
snd_printdd("Failed to find a DAC for pin 0x%x", pins[i]);
33833395
}
33843396
return nums;
33853397
}
@@ -3395,19 +3407,19 @@ static void cx_auto_parse_output(struct hda_codec *codec)
33953407
rest = fill_cx_auto_dacs(codec, dacs);
33963408
/* parse all analog output pins */
33973409
nums = fill_dacs_for_pins(codec, cfg->line_out_pins, cfg->line_outs,
3398-
dacs, &rest, spec->dac_info,
3399-
AUTO_PIN_LINE_OUT);
3400-
nums += fill_dacs_for_pins(codec, cfg->hp_pins, cfg->hp_outs,
3401-
dacs, &rest, spec->dac_info + nums,
3402-
AUTO_PIN_HP_OUT);
3403-
nums += fill_dacs_for_pins(codec, cfg->speaker_pins, cfg->speaker_outs,
3404-
dacs, &rest, spec->dac_info + nums,
3405-
AUTO_PIN_SPEAKER_OUT);
3410+
dacs, &rest, spec->dac_info, 0,
3411+
AUTO_PIN_LINE_OUT);
3412+
nums = fill_dacs_for_pins(codec, cfg->hp_pins, cfg->hp_outs,
3413+
dacs, &rest, spec->dac_info, nums,
3414+
AUTO_PIN_HP_OUT);
3415+
nums = fill_dacs_for_pins(codec, cfg->speaker_pins, cfg->speaker_outs,
3416+
dacs, &rest, spec->dac_info, nums,
3417+
AUTO_PIN_SPEAKER_OUT);
34063418
spec->dac_info_filled = nums;
34073419
/* fill multiout struct */
34083420
for (i = 0; i < nums; i++) {
34093421
hda_nid_t dac = spec->dac_info[i].dac;
3410-
if (!dac)
3422+
if (!dac || (dac & DAC_SLAVE_FLAG))
34113423
continue;
34123424
switch (spec->dac_info[i].type) {
34133425
case AUTO_PIN_LINE_OUT:
@@ -3862,7 +3874,7 @@ static void cx_auto_parse_input(struct hda_codec *codec)
38623874
}
38633875
if (imux->num_items >= 2 && cfg->num_inputs == imux->num_items)
38643876
cx_auto_check_auto_mic(codec);
3865-
if (imux->num_items > 1 && !spec->auto_mic) {
3877+
if (imux->num_items > 1) {
38663878
for (i = 1; i < imux->num_items; i++) {
38673879
if (spec->imux_info[i].adc != spec->imux_info[0].adc) {
38683880
spec->adc_switching = 1;
@@ -4035,6 +4047,8 @@ static void cx_auto_init_output(struct hda_codec *codec)
40354047
nid = spec->dac_info[i].dac;
40364048
if (!nid)
40374049
nid = spec->multiout.dac_nids[0];
4050+
else if (nid & DAC_SLAVE_FLAG)
4051+
nid &= ~DAC_SLAVE_FLAG;
40384052
select_connection(codec, spec->dac_info[i].pin, nid);
40394053
}
40404054
if (spec->auto_mute) {
@@ -4167,9 +4181,11 @@ static int try_add_pb_volume(struct hda_codec *codec, hda_nid_t dac,
41674181
hda_nid_t pin, const char *name, int idx)
41684182
{
41694183
unsigned int caps;
4170-
caps = query_amp_caps(codec, dac, HDA_OUTPUT);
4171-
if (caps & AC_AMPCAP_NUM_STEPS)
4172-
return cx_auto_add_pb_volume(codec, dac, name, idx);
4184+
if (dac && !(dac & DAC_SLAVE_FLAG)) {
4185+
caps = query_amp_caps(codec, dac, HDA_OUTPUT);
4186+
if (caps & AC_AMPCAP_NUM_STEPS)
4187+
return cx_auto_add_pb_volume(codec, dac, name, idx);
4188+
}
41734189
caps = query_amp_caps(codec, pin, HDA_OUTPUT);
41744190
if (caps & AC_AMPCAP_NUM_STEPS)
41754191
return cx_auto_add_pb_volume(codec, pin, name, idx);
@@ -4191,8 +4207,7 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
41914207
for (i = 0; i < spec->dac_info_filled; i++) {
41924208
const char *label;
41934209
int idx, type;
4194-
if (!spec->dac_info[i].dac)
4195-
continue;
4210+
hda_nid_t dac = spec->dac_info[i].dac;
41964211
type = spec->dac_info[i].type;
41974212
if (type == AUTO_PIN_LINE_OUT)
41984213
type = spec->autocfg.line_out_type;
@@ -4211,7 +4226,7 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
42114226
idx = num_spk++;
42124227
break;
42134228
}
4214-
err = try_add_pb_volume(codec, spec->dac_info[i].dac,
4229+
err = try_add_pb_volume(codec, dac,
42154230
spec->dac_info[i].pin,
42164231
label, idx);
42174232
if (err < 0)

‎sound/pci/hda/patch_realtek.c‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,11 @@ static void alc_hp_automute(struct hda_codec *codec)
565565
{
566566
struct alc_spec *spec = codec->spec;
567567

568-
if (!spec->automute)
569-
return;
570568
spec->jack_present =
571569
detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
572570
spec->autocfg.hp_pins);
571+
if (!spec->automute)
572+
return;
573573
update_speakers(codec);
574574
}
575575

@@ -578,11 +578,11 @@ static void alc_line_automute(struct hda_codec *codec)
578578
{
579579
struct alc_spec *spec = codec->spec;
580580

581-
if (!spec->automute || !spec->detect_line)
582-
return;
583581
spec->line_jack_present =
584582
detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
585583
spec->autocfg.line_out_pins);
584+
if (!spec->automute || !spec->detect_line)
585+
return;
586586
update_speakers(codec);
587587
}
588588

@@ -3083,16 +3083,22 @@ static void alc_auto_init_multi_out(struct hda_codec *codec)
30833083
static void alc_auto_init_extra_out(struct hda_codec *codec)
30843084
{
30853085
struct alc_spec *spec = codec->spec;
3086-
hda_nid_t pin;
3086+
hda_nid_t pin, dac;
30873087

30883088
pin = spec->autocfg.hp_pins[0];
3089-
if (pin)
3090-
alc_auto_set_output_and_unmute(codec, pin, PIN_HP,
3091-
spec->multiout.hp_nid);
3089+
if (pin) {
3090+
dac = spec->multiout.hp_nid;
3091+
if (!dac)
3092+
dac = spec->multiout.dac_nids[0];
3093+
alc_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
3094+
}
30923095
pin = spec->autocfg.speaker_pins[0];
3093-
if (pin)
3094-
alc_auto_set_output_and_unmute(codec, pin, PIN_OUT,
3095-
spec->multiout.extra_out_nid[0]);
3096+
if (pin) {
3097+
dac = spec->multiout.extra_out_nid[0];
3098+
if (!dac)
3099+
dac = spec->multiout.dac_nids[0];
3100+
alc_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
3101+
}
30963102
}
30973103

30983104
/*

0 commit comments

Comments
 (0)