Skip to content

Commit 5b46fb0

Browse files
committed
Merge tag 'sound-5.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "Another collection of small fixes. It's still not quite calm yet, but nothing looks scary. ALSA core got a few fixes for covering the issues detected by fuzzer and the 32bit compat problem of control API, while the rest are all device-specific small fixes, including the continued fixes for Tegra" * tag 'sound-5.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (23 commits) ALSA: hda/realtek - Add headset Mic support for Lenovo ALC897 platform ALSA: usb-audio: Reorder snd_djm_devices[] entries ALSA: hda/realtek: Fix quirk for TongFang PHxTxX1 ALSA: ctl: Fix copy of updated id with element read/write ALSA: pcm: oss: Handle missing errors in snd_pcm_oss_change_params*() ALSA: pcm: oss: Limit the period size to 16MB ALSA: pcm: oss: Fix negative period/buffer sizes ASoC: codecs: wsa881x: fix return values from kcontrol put ASoC: codecs: wcd934x: return correct value from mixer put ASoC: codecs: wcd934x: handle channel mappping list correctly ASoC: qdsp6: q6routing: Fix return value from msm_routing_put_audio_mixer ASoC: SOF: Intel: Retry codec probing if it fails ASoC: amd: fix uninitialized variable in snd_acp6x_probe() ASoC: rockchip: i2s_tdm: Dup static DAI template ASoC: rt5682s: Fix crash due to out of scope stack vars ASoC: rt5682: Fix crash due to out of scope stack vars ASoC: tegra: Use normal system sleep for ADX ASoC: tegra: Use normal system sleep for AMX ASoC: tegra: Use normal system sleep for Mixer ASoC: tegra: Use normal system sleep for MVC ...
2 parents 9b302ff + d7f3279 commit 5b46fb0

File tree

18 files changed

+274
-122
lines changed

18 files changed

+274
-122
lines changed

Documentation/devicetree/bindings/sound/wlf,wm8962.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ properties:
1919
clocks:
2020
maxItems: 1
2121

22+
interrupts:
23+
maxItems: 1
24+
2225
"#sound-dai-cells":
2326
const: 0
2427

sound/core/control_compat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ static int copy_ctl_value_to_user(void __user *userdata,
264264
struct snd_ctl_elem_value *data,
265265
int type, int count)
266266
{
267+
struct snd_ctl_elem_value32 __user *data32 = userdata;
267268
int i, size;
268269

269270
if (type == SNDRV_CTL_ELEM_TYPE_BOOLEAN ||
@@ -280,6 +281,8 @@ static int copy_ctl_value_to_user(void __user *userdata,
280281
if (copy_to_user(valuep, data->value.bytes.data, size))
281282
return -EFAULT;
282283
}
284+
if (copy_to_user(&data32->id, &data->id, sizeof(data32->id)))
285+
return -EFAULT;
283286
return 0;
284287
}
285288

sound/core/oss/pcm_oss.c

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params,
147147
*
148148
* Return the maximum value for field PAR.
149149
*/
150-
static unsigned int
150+
static int
151151
snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params,
152152
snd_pcm_hw_param_t var, int *dir)
153153
{
@@ -682,18 +682,24 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
682682
struct snd_pcm_hw_params *oss_params,
683683
struct snd_pcm_hw_params *slave_params)
684684
{
685-
size_t s;
686-
size_t oss_buffer_size, oss_period_size, oss_periods;
687-
size_t min_period_size, max_period_size;
685+
ssize_t s;
686+
ssize_t oss_buffer_size;
687+
ssize_t oss_period_size, oss_periods;
688+
ssize_t min_period_size, max_period_size;
688689
struct snd_pcm_runtime *runtime = substream->runtime;
689690
size_t oss_frame_size;
690691

691692
oss_frame_size = snd_pcm_format_physical_width(params_format(oss_params)) *
692693
params_channels(oss_params) / 8;
693694

695+
oss_buffer_size = snd_pcm_hw_param_value_max(slave_params,
696+
SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
697+
NULL);
698+
if (oss_buffer_size <= 0)
699+
return -EINVAL;
694700
oss_buffer_size = snd_pcm_plug_client_size(substream,
695-
snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size;
696-
if (!oss_buffer_size)
701+
oss_buffer_size * oss_frame_size);
702+
if (oss_buffer_size <= 0)
697703
return -EINVAL;
698704
oss_buffer_size = rounddown_pow_of_two(oss_buffer_size);
699705
if (atomic_read(&substream->mmap_count)) {
@@ -730,7 +736,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
730736

731737
min_period_size = snd_pcm_plug_client_size(substream,
732738
snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
733-
if (min_period_size) {
739+
if (min_period_size > 0) {
734740
min_period_size *= oss_frame_size;
735741
min_period_size = roundup_pow_of_two(min_period_size);
736742
if (oss_period_size < min_period_size)
@@ -739,7 +745,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
739745

740746
max_period_size = snd_pcm_plug_client_size(substream,
741747
snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
742-
if (max_period_size) {
748+
if (max_period_size > 0) {
743749
max_period_size *= oss_frame_size;
744750
max_period_size = rounddown_pow_of_two(max_period_size);
745751
if (oss_period_size > max_period_size)
@@ -752,7 +758,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream,
752758
oss_periods = substream->oss.setup.periods;
753759

754760
s = snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIODS, NULL);
755-
if (runtime->oss.maxfrags && s > runtime->oss.maxfrags)
761+
if (s > 0 && runtime->oss.maxfrags && s > runtime->oss.maxfrags)
756762
s = runtime->oss.maxfrags;
757763
if (oss_periods > s)
758764
oss_periods = s;
@@ -878,8 +884,15 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
878884
err = -EINVAL;
879885
goto failure;
880886
}
881-
choose_rate(substream, sparams, runtime->oss.rate);
882-
snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL);
887+
888+
err = choose_rate(substream, sparams, runtime->oss.rate);
889+
if (err < 0)
890+
goto failure;
891+
err = snd_pcm_hw_param_near(substream, sparams,
892+
SNDRV_PCM_HW_PARAM_CHANNELS,
893+
runtime->oss.channels, NULL);
894+
if (err < 0)
895+
goto failure;
883896

884897
format = snd_pcm_oss_format_from(runtime->oss.format);
885898

@@ -1956,7 +1969,7 @@ static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsign
19561969
if (runtime->oss.subdivision || runtime->oss.fragshift)
19571970
return -EINVAL;
19581971
fragshift = val & 0xffff;
1959-
if (fragshift >= 31)
1972+
if (fragshift >= 25) /* should be large enough */
19601973
return -EINVAL;
19611974
runtime->oss.fragshift = fragshift;
19621975
runtime->oss.maxfrags = (val >> 16) & 0xffff;

sound/pci/hda/patch_realtek.c

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6503,22 +6503,26 @@ static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
65036503
/* for alc285_fixup_ideapad_s740_coef() */
65046504
#include "ideapad_s740_helper.c"
65056505

6506-
static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec,
6507-
const struct hda_fixup *fix,
6508-
int action)
6506+
static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6507+
WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6508+
WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6509+
WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6510+
{}
6511+
};
6512+
6513+
static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6514+
const struct hda_fixup *fix,
6515+
int action)
65096516
{
65106517
/*
6511-
* A certain other OS sets these coeffs to different values. On at least one TongFang
6512-
* barebone these settings might survive even a cold reboot. So to restore a clean slate the
6513-
* values are explicitly reset to default here. Without this, the external microphone is
6514-
* always in a plugged-in state, while the internal microphone is always in an unplugged
6515-
* state, breaking the ability to use the internal microphone.
6516-
*/
6517-
alc_write_coef_idx(codec, 0x24, 0x0000);
6518-
alc_write_coef_idx(codec, 0x26, 0x0000);
6519-
alc_write_coef_idx(codec, 0x29, 0x3000);
6520-
alc_write_coef_idx(codec, 0x37, 0xfe05);
6521-
alc_write_coef_idx(codec, 0x45, 0x5089);
6518+
* A certain other OS sets these coeffs to different values. On at least
6519+
* one TongFang barebone these settings might survive even a cold
6520+
* reboot. So to restore a clean slate the values are explicitly reset
6521+
* to default here. Without this, the external microphone is always in a
6522+
* plugged-in state, while the internal microphone is always in an
6523+
* unplugged state, breaking the ability to use the internal microphone.
6524+
*/
6525+
alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
65226526
}
65236527

65246528
static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
@@ -6759,7 +6763,7 @@ enum {
67596763
ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
67606764
ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
67616765
ALC287_FIXUP_13S_GEN2_SPEAKERS,
6762-
ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS,
6766+
ALC256_FIXUP_SET_COEF_DEFAULTS,
67636767
ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
67646768
ALC233_FIXUP_NO_AUDIO_JACK,
67656769
};
@@ -8465,9 +8469,9 @@ static const struct hda_fixup alc269_fixups[] = {
84658469
.chained = true,
84668470
.chain_id = ALC269_FIXUP_HEADSET_MODE,
84678471
},
8468-
[ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = {
8472+
[ALC256_FIXUP_SET_COEF_DEFAULTS] = {
84698473
.type = HDA_FIXUP_FUNC,
8470-
.v.func = alc256_fixup_tongfang_reset_persistent_settings,
8474+
.v.func = alc256_fixup_set_coef_defaults,
84718475
},
84728476
[ALC245_FIXUP_HP_GPIO_LED] = {
84738477
.type = HDA_FIXUP_FUNC,
@@ -8929,7 +8933,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
89298933
SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
89308934
SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
89318935
SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
8932-
SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS),
8936+
SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
89338937
SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
89348938
SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
89358939
SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
@@ -10231,6 +10235,27 @@ static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
1023110235
}
1023210236
}
1023310237

10238+
static void alc897_hp_automute_hook(struct hda_codec *codec,
10239+
struct hda_jack_callback *jack)
10240+
{
10241+
struct alc_spec *spec = codec->spec;
10242+
int vref;
10243+
10244+
snd_hda_gen_hp_automute(codec, jack);
10245+
vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10246+
snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10247+
vref);
10248+
}
10249+
10250+
static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10251+
const struct hda_fixup *fix, int action)
10252+
{
10253+
struct alc_spec *spec = codec->spec;
10254+
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10255+
spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10256+
}
10257+
}
10258+
1023410259
static const struct coef_fw alc668_coefs[] = {
1023510260
WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
1023610261
WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
@@ -10311,6 +10336,8 @@ enum {
1031110336
ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
1031210337
ALC668_FIXUP_HEADSET_MIC,
1031310338
ALC668_FIXUP_MIC_DET_COEF,
10339+
ALC897_FIXUP_LENOVO_HEADSET_MIC,
10340+
ALC897_FIXUP_HEADSET_MIC_PIN,
1031410341
};
1031510342

1031610343
static const struct hda_fixup alc662_fixups[] = {
@@ -10717,6 +10744,19 @@ static const struct hda_fixup alc662_fixups[] = {
1071710744
{}
1071810745
},
1071910746
},
10747+
[ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
10748+
.type = HDA_FIXUP_FUNC,
10749+
.v.func = alc897_fixup_lenovo_headset_mic,
10750+
},
10751+
[ALC897_FIXUP_HEADSET_MIC_PIN] = {
10752+
.type = HDA_FIXUP_PINS,
10753+
.v.pins = (const struct hda_pintbl[]) {
10754+
{ 0x1a, 0x03a11050 },
10755+
{ }
10756+
},
10757+
.chained = true,
10758+
.chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
10759+
},
1072010760
};
1072110761

1072210762
static const struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -10761,6 +10801,10 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
1076110801
SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
1076210802
SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
1076310803
SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
10804+
SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
10805+
SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
10806+
SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
10807+
SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
1076410808
SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
1076510809
SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1076610810
SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),

sound/soc/amd/yc/pci-acp6x.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,11 @@ static int snd_acp6x_probe(struct pci_dev *pci,
146146
{
147147
struct acp6x_dev_data *adata;
148148
struct platform_device_info pdevinfo[ACP6x_DEVS];
149-
int ret, index;
149+
int index = 0;
150150
int val = 0x00;
151151
u32 addr;
152152
unsigned int irqflags;
153+
int ret;
153154

154155
irqflags = IRQF_SHARED;
155156
/* Yellow Carp device check */

sound/soc/codecs/rt5682.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,24 +2858,26 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682)
28582858

28592859
for (i = 0; i < RT5682_DAI_NUM_CLKS; ++i) {
28602860
struct clk_init_data init = { };
2861+
struct clk_parent_data parent_data;
2862+
const struct clk_hw *parent;
28612863

28622864
dai_clk_hw = &rt5682->dai_clks_hw[i];
28632865

28642866
switch (i) {
28652867
case RT5682_DAI_WCLK_IDX:
28662868
/* Make MCLK the parent of WCLK */
28672869
if (rt5682->mclk) {
2868-
init.parent_data = &(struct clk_parent_data){
2870+
parent_data = (struct clk_parent_data){
28692871
.fw_name = "mclk",
28702872
};
2873+
init.parent_data = &parent_data;
28712874
init.num_parents = 1;
28722875
}
28732876
break;
28742877
case RT5682_DAI_BCLK_IDX:
28752878
/* Make WCLK the parent of BCLK */
2876-
init.parent_hws = &(const struct clk_hw *){
2877-
&rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX]
2878-
};
2879+
parent = &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX];
2880+
init.parent_hws = &parent;
28792881
init.num_parents = 1;
28802882
break;
28812883
default:

sound/soc/codecs/rt5682s.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,24 +2693,26 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component)
26932693

26942694
for (i = 0; i < RT5682S_DAI_NUM_CLKS; ++i) {
26952695
struct clk_init_data init = { };
2696+
struct clk_parent_data parent_data;
2697+
const struct clk_hw *parent;
26962698

26972699
dai_clk_hw = &rt5682s->dai_clks_hw[i];
26982700

26992701
switch (i) {
27002702
case RT5682S_DAI_WCLK_IDX:
27012703
/* Make MCLK the parent of WCLK */
27022704
if (rt5682s->mclk) {
2703-
init.parent_data = &(struct clk_parent_data){
2705+
parent_data = (struct clk_parent_data){
27042706
.fw_name = "mclk",
27052707
};
2708+
init.parent_data = &parent_data;
27062709
init.num_parents = 1;
27072710
}
27082711
break;
27092712
case RT5682S_DAI_BCLK_IDX:
27102713
/* Make WCLK the parent of BCLK */
2711-
init.parent_hws = &(const struct clk_hw *){
2712-
&rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX]
2713-
};
2714+
parent = &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX];
2715+
init.parent_hws = &parent;
27142716
init.num_parents = 1;
27152717
break;
27162718
default:

0 commit comments

Comments
 (0)