Skip to content

Commit 2bff7e9

Browse files
committed
Merge branch 'for-linus' into for-next
Back-merge for applying the more HD-audio quirks on top of the latest code. Signed-off-by: Takashi Iwai <[email protected]>
2 parents 157ab88 + bde1a74 commit 2bff7e9

33 files changed

+485
-267
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13931,6 +13931,7 @@ S: Supported
1393113931
F: Documentation/devicetree/bindings/sound/
1393213932
F: Documentation/sound/soc/
1393313933
F: sound/soc/
13934+
F: include/dt-bindings/sound/
1393413935
F: include/sound/soc*
1393513936

1393613937
SOUNDWIRE SUBSYSTEM

include/sound/pcm_params.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,13 @@ static inline int snd_interval_empty(const struct snd_interval *i)
254254
static inline int snd_interval_single(const struct snd_interval *i)
255255
{
256256
return (i->min == i->max ||
257-
(i->min + 1 == i->max && i->openmax));
257+
(i->min + 1 == i->max && (i->openmin || i->openmax)));
258258
}
259259

260260
static inline int snd_interval_value(const struct snd_interval *i)
261261
{
262+
if (i->openmin && !i->openmax)
263+
return i->max;
262264
return i->min;
263265
}
264266

include/sound/soc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ struct snd_soc_pcm_runtime {
11921192
((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \
11931193
(i)++)
11941194
#define for_each_rtd_codec_dai_rollback(rtd, i, dai) \
1195-
for (; ((i--) >= 0) && ((dai) = rtd->codec_dais[i]);)
1195+
for (; ((--i) >= 0) && ((dai) = rtd->codec_dais[i]);)
11961196

11971197

11981198
/* mixer control */

sound/core/pcm_native.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <sound/timer.h>
3737
#include <sound/minors.h>
3838
#include <linux/uio.h>
39+
#include <linux/delay.h>
3940

4041
#include "pcm_local.h"
4142

@@ -91,12 +92,12 @@ static DECLARE_RWSEM(snd_pcm_link_rwsem);
9192
* and this may lead to a deadlock when the code path takes read sem
9293
* twice (e.g. one in snd_pcm_action_nonatomic() and another in
9394
* snd_pcm_stream_lock()). As a (suboptimal) workaround, let writer to
94-
* spin until it gets the lock.
95+
* sleep until all the readers are completed without blocking by writer.
9596
*/
96-
static inline void down_write_nonblock(struct rw_semaphore *lock)
97+
static inline void down_write_nonfifo(struct rw_semaphore *lock)
9798
{
9899
while (!down_write_trylock(lock))
99-
cond_resched();
100+
msleep(1);
100101
}
101102

102103
#define PCM_LOCK_DEFAULT 0
@@ -1967,7 +1968,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd)
19671968
res = -ENOMEM;
19681969
goto _nolock;
19691970
}
1970-
down_write_nonblock(&snd_pcm_link_rwsem);
1971+
down_write_nonfifo(&snd_pcm_link_rwsem);
19711972
write_lock_irq(&snd_pcm_link_rwlock);
19721973
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN ||
19731974
substream->runtime->status->state != substream1->runtime->status->state ||
@@ -2014,7 +2015,7 @@ static int snd_pcm_unlink(struct snd_pcm_substream *substream)
20142015
struct snd_pcm_substream *s;
20152016
int res = 0;
20162017

2017-
down_write_nonblock(&snd_pcm_link_rwsem);
2018+
down_write_nonfifo(&snd_pcm_link_rwsem);
20182019
write_lock_irq(&snd_pcm_link_rwlock);
20192020
if (!snd_pcm_stream_linked(substream)) {
20202021
res = -EALREADY;
@@ -2369,7 +2370,8 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
23692370

23702371
static void pcm_release_private(struct snd_pcm_substream *substream)
23712372
{
2372-
snd_pcm_unlink(substream);
2373+
if (snd_pcm_stream_linked(substream))
2374+
snd_pcm_unlink(substream);
23732375
}
23742376

23752377
void snd_pcm_release_substream(struct snd_pcm_substream *substream)

sound/pci/hda/hda_intel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,6 +2498,10 @@ static const struct pci_device_id azx_ids[] = {
24982498
/* AMD Hudson */
24992499
{ PCI_DEVICE(0x1022, 0x780d),
25002500
.driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB },
2501+
/* AMD Stoney */
2502+
{ PCI_DEVICE(0x1022, 0x157a),
2503+
.driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |
2504+
AZX_DCAPS_PM_RUNTIME },
25012505
/* AMD Raven */
25022506
{ PCI_DEVICE(0x1022, 0x15e3),
25032507
.driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |

sound/pci/hda/patch_realtek.c

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
388388
case 0x10ec0285:
389389
case 0x10ec0298:
390390
case 0x10ec0289:
391+
case 0x10ec0300:
391392
alc_update_coef_idx(codec, 0x10, 1<<9, 0);
392393
break;
393394
case 0x10ec0275:
@@ -2830,6 +2831,7 @@ enum {
28302831
ALC269_TYPE_ALC215,
28312832
ALC269_TYPE_ALC225,
28322833
ALC269_TYPE_ALC294,
2834+
ALC269_TYPE_ALC300,
28332835
ALC269_TYPE_ALC700,
28342836
};
28352837

@@ -2864,6 +2866,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
28642866
case ALC269_TYPE_ALC215:
28652867
case ALC269_TYPE_ALC225:
28662868
case ALC269_TYPE_ALC294:
2869+
case ALC269_TYPE_ALC300:
28672870
case ALC269_TYPE_ALC700:
28682871
ssids = alc269_ssids;
28692872
break;
@@ -4985,9 +4988,18 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec,
49854988
{ 0x19, 0x21a11010 }, /* dock mic */
49864989
{ }
49874990
};
4991+
/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
4992+
* the speaker output becomes too low by some reason on Thinkpads with
4993+
* ALC298 codec
4994+
*/
4995+
static hda_nid_t preferred_pairs[] = {
4996+
0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
4997+
0
4998+
};
49884999
struct alc_spec *spec = codec->spec;
49895000

49905001
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5002+
spec->gen.preferred_dacs = preferred_pairs;
49915003
spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
49925004
snd_hda_apply_pincfgs(codec, pincfgs);
49935005
} else if (action == HDA_FIXUP_ACT_INIT) {
@@ -5358,6 +5370,16 @@ static void alc274_fixup_bind_dacs(struct hda_codec *codec,
53585370
spec->gen.preferred_dacs = preferred_pairs;
53595371
}
53605372

5373+
/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5374+
static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5375+
const struct hda_fixup *fix, int action)
5376+
{
5377+
if (action != HDA_FIXUP_ACT_PRE_PROBE)
5378+
return;
5379+
5380+
snd_hda_override_wcaps(codec, 0x03, 0);
5381+
}
5382+
53615383
/* for hda_fixup_thinkpad_acpi() */
53625384
#include "thinkpad_helper.c"
53635385

@@ -5492,6 +5514,9 @@ enum {
54925514
ALC255_FIXUP_DELL_HEADSET_MIC,
54935515
ALC295_FIXUP_HP_X360,
54945516
ALC221_FIXUP_HP_HEADSET_MIC,
5517+
ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
5518+
ALC295_FIXUP_HP_AUTO_MUTE,
5519+
ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
54955520
};
54965521

54975522
static const struct hda_fixup alc269_fixups[] = {
@@ -5656,6 +5681,8 @@ static const struct hda_fixup alc269_fixups[] = {
56565681
[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
56575682
.type = HDA_FIXUP_FUNC,
56585683
.v.func = alc269_fixup_hp_mute_led_mic3,
5684+
.chained = true,
5685+
.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
56595686
},
56605687
[ALC269_FIXUP_HP_GPIO_LED] = {
56615688
.type = HDA_FIXUP_FUNC,
@@ -6359,6 +6386,23 @@ static const struct hda_fixup alc269_fixups[] = {
63596386
.chained = true,
63606387
.chain_id = ALC269_FIXUP_HEADSET_MIC
63616388
},
6389+
[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
6390+
.type = HDA_FIXUP_FUNC,
6391+
.v.func = alc285_fixup_invalidate_dacs,
6392+
},
6393+
[ALC295_FIXUP_HP_AUTO_MUTE] = {
6394+
.type = HDA_FIXUP_FUNC,
6395+
.v.func = alc_fixup_auto_mute_via_amp,
6396+
},
6397+
[ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
6398+
.type = HDA_FIXUP_PINS,
6399+
.v.pins = (const struct hda_pintbl[]) {
6400+
{ 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6401+
{ }
6402+
},
6403+
.chained = true,
6404+
.chain_id = ALC269_FIXUP_HEADSET_MIC
6405+
},
63626406
};
63636407

63646408
static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -6373,7 +6417,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
63736417
SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
63746418
SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
63756419
SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
6420+
SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
63766421
SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
6422+
SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6423+
SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6424+
SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
63776425
SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
63786426
SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
63796427
SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
@@ -7032,6 +7080,15 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
70327080
{0x12, 0x90a60130},
70337081
{0x19, 0x03a11020},
70347082
{0x21, 0x0321101f}),
7083+
SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7084+
{0x12, 0x90a60130},
7085+
{0x14, 0x90170110},
7086+
{0x19, 0x04a11040},
7087+
{0x21, 0x04211020}),
7088+
SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7089+
{0x12, 0x90a60130},
7090+
{0x17, 0x90170110},
7091+
{0x21, 0x02211020}),
70357092
SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
70367093
{0x12, 0x90a60120},
70377094
{0x14, 0x90170110},
@@ -7167,6 +7224,37 @@ static void alc269_fill_coef(struct hda_codec *codec)
71677224
alc_update_coef_idx(codec, 0x4, 0, 1<<11);
71687225
}
71697226

7227+
static void alc294_hp_init(struct hda_codec *codec)
7228+
{
7229+
struct alc_spec *spec = codec->spec;
7230+
hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
7231+
int i, val;
7232+
7233+
if (!hp_pin)
7234+
return;
7235+
7236+
snd_hda_codec_write(codec, hp_pin, 0,
7237+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
7238+
7239+
msleep(100);
7240+
7241+
snd_hda_codec_write(codec, hp_pin, 0,
7242+
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
7243+
7244+
alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
7245+
alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
7246+
7247+
/* Wait for depop procedure finish */
7248+
val = alc_read_coefex_idx(codec, 0x58, 0x01);
7249+
for (i = 0; i < 20 && val & 0x0080; i++) {
7250+
msleep(50);
7251+
val = alc_read_coefex_idx(codec, 0x58, 0x01);
7252+
}
7253+
/* Set HP depop to auto mode */
7254+
alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
7255+
msleep(50);
7256+
}
7257+
71707258
/*
71717259
*/
71727260
static int patch_alc269(struct hda_codec *codec)
@@ -7292,13 +7380,19 @@ static int patch_alc269(struct hda_codec *codec)
72927380
spec->codec_variant = ALC269_TYPE_ALC294;
72937381
spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
72947382
alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
7383+
alc294_hp_init(codec);
7384+
break;
7385+
case 0x10ec0300:
7386+
spec->codec_variant = ALC269_TYPE_ALC300;
7387+
spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
72957388
break;
72967389
case 0x10ec0700:
72977390
case 0x10ec0701:
72987391
case 0x10ec0703:
72997392
spec->codec_variant = ALC269_TYPE_ALC700;
73007393
spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
73017394
alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
7395+
alc294_hp_init(codec);
73027396
break;
73037397

73047398
}
@@ -8403,6 +8497,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
84038497
HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
84048498
HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
84058499
HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
8500+
HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
84068501
HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
84078502
HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
84088503
HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),

sound/soc/codecs/hdac_hdmi.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,11 +2187,6 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
21872187
*/
21882188
snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
21892189
AC_PWRST_D3);
2190-
err = snd_hdac_display_power(bus, false);
2191-
if (err < 0) {
2192-
dev_err(dev, "Cannot turn on display power on i915\n");
2193-
return err;
2194-
}
21952190

21962191
hlink = snd_hdac_ext_bus_get_link(bus, dev_name(dev));
21972192
if (!hlink) {
@@ -2201,7 +2196,11 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
22012196

22022197
snd_hdac_ext_bus_link_put(bus, hlink);
22032198

2204-
return 0;
2199+
err = snd_hdac_display_power(bus, false);
2200+
if (err < 0)
2201+
dev_err(dev, "Cannot turn off display power on i915\n");
2202+
2203+
return err;
22052204
}
22062205

22072206
static int hdac_hdmi_runtime_resume(struct device *dev)

sound/soc/codecs/pcm186x.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ enum pcm186x_type {
139139
#define PCM186X_MAX_REGISTER PCM186X_CURR_TRIM_CTRL
140140

141141
/* PCM186X_PAGE */
142-
#define PCM186X_RESET 0xff
142+
#define PCM186X_RESET 0xfe
143143

144144
/* PCM186X_ADCX_INPUT_SEL_X */
145145
#define PCM186X_ADC_INPUT_SEL_POL BIT(7)

sound/soc/codecs/pcm3060.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,20 +198,16 @@ static const struct snd_kcontrol_new pcm3060_dapm_controls[] = {
198198
};
199199

200200
static const struct snd_soc_dapm_widget pcm3060_dapm_widgets[] = {
201-
SND_SOC_DAPM_OUTPUT("OUTL+"),
202-
SND_SOC_DAPM_OUTPUT("OUTR+"),
203-
SND_SOC_DAPM_OUTPUT("OUTL-"),
204-
SND_SOC_DAPM_OUTPUT("OUTR-"),
201+
SND_SOC_DAPM_OUTPUT("OUTL"),
202+
SND_SOC_DAPM_OUTPUT("OUTR"),
205203

206204
SND_SOC_DAPM_INPUT("INL"),
207205
SND_SOC_DAPM_INPUT("INR"),
208206
};
209207

210208
static const struct snd_soc_dapm_route pcm3060_dapm_map[] = {
211-
{ "OUTL+", NULL, "Playback" },
212-
{ "OUTR+", NULL, "Playback" },
213-
{ "OUTL-", NULL, "Playback" },
214-
{ "OUTR-", NULL, "Playback" },
209+
{ "OUTL", NULL, "Playback" },
210+
{ "OUTR", NULL, "Playback" },
215211

216212
{ "Capture", NULL, "INL" },
217213
{ "Capture", NULL, "INR" },

0 commit comments

Comments
 (0)