Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'sound-fix-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
"A collection of small fixes. Majority of changes are device-specific
fixes and quirks, while there are a few core fixes to address
regressions and corner cases spotted by fuzzers.

- Fix of spinlock range that wrongly covered kvfree() call in rawmidi

- Fix potential NULL dereference at PCM mmap

- Fix incorrectly advertised MIDI 2.0 UMP Function Block info

- Various ASoC AMD quirks and fixes

- ASoC SOF Intel, Mediatek, HDMI-codec fixes

- A few more quirks and TAS2781 codec fix for HD-audio

- A couple of fixes for USB-audio for malicious USB descriptors"

* tag 'sound-fix-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (30 commits)
ALSA: hda: improve bass speaker support for ASUS Zenbook UM5606WA
ALSA: hda/realtek: Apply quirk for Medion E15433
ASoC: amd: yc: Add a quirk for microfone on Lenovo ThinkPad P14s Gen 5 21MES00B00
ASoC: SOF: ipc3-topology: Convert the topology pin index to ALH dai index
ASoC: mediatek: Check num_codecs is not zero to avoid panic during probe
ASoC: amd: yc: Fix for enabling DMIC on acp6x via _DSD entry
ALSA: ump: Fix evaluation of MIDI 1.0 FB info
ALSA: core: Fix possible NULL dereference caused by kunit_kzalloc()
ALSA: hda: Show the codec quirk info at probing
ALSA: asihpi: Remove unused variable
ALSA: hda/realtek: Set PCBeep to default value for ALC274
ALSA: hda/tas2781: Add speaker id check for ASUS projects
ALSA: hda/realtek: Update ALC225 depop procedure
ALSA: hda/realtek: Enable speaker pins for Medion E15443 platform
ALSA: hda/realtek: fix mute/micmute LEDs don't work for EliteBook X G1i
ALSA: usb-audio: Fix out of bounds reads when finding clock sources
ALSA: rawmidi: Fix kvfree() call in spinlock
ALSA: hda/realtek: Fix Internal Speaker and Mic boost of Infinix Y4 Max
ASoC: amd: yc: Add quirk for microphone on Lenovo Thinkpad T14s Gen 6 21M1CTO1WW
ASoC: doc: dapm: Add location information for dapm-graph tool
...

+328 -109
+1 -1
Documentation/sound/hd-audio/notes.rst
··· 42 42 HD-audio specification at first. The specification is found on 43 43 Intel's web page, for example: 44 44 45 - * https://www.intel.com/standards/hdaudio/ 45 + * https://www.intel.com/content/www/us/en/standards/high-definition-audio-specification.html 46 46 47 47 48 48 HD-Audio Controller
+3
Documentation/sound/soc/dapm.rst
··· 35 35 :alt: Example DAPM graph 36 36 :align: center 37 37 38 + You can also generate compatible graph for your sound card using 39 + `tools/sound/dapm-graph` utility. 40 + 38 41 DAPM power domains 39 42 ================== 40 43
+1
include/sound/tas2781.h
··· 156 156 struct tasdevice_rca rcabin; 157 157 struct calidata cali_data; 158 158 struct tasdevice_fw *fmw; 159 + struct gpio_desc *speaker_id; 159 160 struct gpio_desc *reset; 160 161 struct mutex codec_lock; 161 162 struct regmap *regmap;
+3 -2
sound/ac97/bus.c
··· 180 180 181 181 /** 182 182 * snd_ac97_codec_driver_register - register an AC97 codec driver 183 - * @dev: AC97 driver codec to register 183 + * @drv: AC97 driver codec to register 184 184 * 185 185 * Register an AC97 codec driver to the ac97 bus driver, aka. the AC97 digital 186 186 * controller. ··· 196 196 197 197 /** 198 198 * snd_ac97_codec_driver_unregister - unregister an AC97 codec driver 199 - * @dev: AC97 codec driver to unregister 199 + * @drv: AC97 codec driver to unregister 200 200 * 201 201 * Unregister a previously registered ac97 codec driver. 202 202 */ ··· 338 338 * @dev: the device providing the ac97 DC function 339 339 * @slots_available: mask of the ac97 codecs that can be scanned and probed 340 340 * bit0 => codec 0, bit1 => codec 1 ... bit 3 => codec 3 341 + * @codecs_pdata: codec platform data 341 342 * 342 343 * Register a digital controller which can control up to 4 ac97 codecs. This is 343 344 * the controller side of the AC97 AC-link, while the slave side are the codecs.
+4 -2
sound/core/pcm_native.c
··· 3813 3813 return VM_FAULT_SIGBUS; 3814 3814 if (substream->ops->page) 3815 3815 page = substream->ops->page(substream, offset); 3816 - else if (!snd_pcm_get_dma_buf(substream)) 3816 + else if (!snd_pcm_get_dma_buf(substream)) { 3817 + if (WARN_ON_ONCE(!runtime->dma_area)) 3818 + return VM_FAULT_SIGBUS; 3817 3819 page = virt_to_page(runtime->dma_area + offset); 3818 - else 3820 + } else 3819 3821 page = snd_sgbuf_get_page(snd_pcm_get_dma_buf(substream), offset); 3820 3822 if (!page) 3821 3823 return VM_FAULT_SIGBUS;
+3 -1
sound/core/rawmidi.c
··· 724 724 newbuf = kvzalloc(params->buffer_size, GFP_KERNEL); 725 725 if (!newbuf) 726 726 return -ENOMEM; 727 - guard(spinlock_irq)(&substream->lock); 727 + spin_lock_irq(&substream->lock); 728 728 if (runtime->buffer_ref) { 729 + spin_unlock_irq(&substream->lock); 729 730 kvfree(newbuf); 730 731 return -EBUSY; 731 732 } ··· 734 733 runtime->buffer = newbuf; 735 734 runtime->buffer_size = params->buffer_size; 736 735 __reset_runtime_ptrs(runtime, is_input); 736 + spin_unlock_irq(&substream->lock); 737 737 kvfree(oldbuf); 738 738 } 739 739 runtime->avail_min = params->avail_min;
+11
sound/core/sound_kunit.c
··· 172 172 u32 i, j; 173 173 174 174 buffer = kunit_kzalloc(test, SILENCE_BUFFER_SIZE, GFP_KERNEL); 175 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buffer); 175 176 176 177 for (i = 0; i < ARRAY_SIZE(buf_samples); i++) { 177 178 for (j = 0; j < ARRAY_SIZE(valid_fmt); j++) ··· 209 208 struct snd_pcm_runtime *r = kunit_kzalloc(test, sizeof(*r), GFP_KERNEL); 210 209 u32 i; 211 210 211 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, r); 212 + 212 213 r->status = kunit_kzalloc(test, sizeof(*r->status), GFP_KERNEL); 213 214 r->control = kunit_kzalloc(test, sizeof(*r->control), GFP_KERNEL); 215 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, r->status); 216 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, r->control); 214 217 215 218 for (i = 0; i < ARRAY_SIZE(p_avail_data); i++) { 216 219 r->buffer_size = p_avail_data[i].buffer_size; ··· 237 232 struct snd_pcm_runtime *r = kunit_kzalloc(test, sizeof(*r), GFP_KERNEL); 238 233 u32 i; 239 234 235 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, r); 236 + 240 237 r->status = kunit_kzalloc(test, sizeof(*r->status), GFP_KERNEL); 241 238 r->control = kunit_kzalloc(test, sizeof(*r->control), GFP_KERNEL); 239 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, r->status); 240 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, r->control); 242 241 243 242 for (i = 0; i < ARRAY_SIZE(c_avail_data); i++) { 244 243 r->buffer_size = c_avail_data[i].buffer_size; ··· 256 247 static void test_card_set_id(struct kunit *test) 257 248 { 258 249 struct snd_card *card = kunit_kzalloc(test, sizeof(*card), GFP_KERNEL); 250 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, card); 259 251 260 252 snd_card_set_id(card, VALID_NAME); 261 253 KUNIT_EXPECT_STREQ(test, card->id, VALID_NAME); ··· 290 280 static void test_card_add_component(struct kunit *test) 291 281 { 292 282 struct snd_card *card = kunit_kzalloc(test, sizeof(*card), GFP_KERNEL); 283 + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, card); 293 284 294 285 snd_component_add(card, TEST_FIRST_COMPONENT); 295 286 KUNIT_ASSERT_STREQ(test, card->components, TEST_FIRST_COMPONENT);
+4 -1
sound/core/ump.c
··· 788 788 info->ui_hint = buf->fb_info.ui_hint; 789 789 info->first_group = buf->fb_info.first_group; 790 790 info->num_groups = buf->fb_info.num_groups; 791 - info->flags = buf->fb_info.midi_10; 791 + if (buf->fb_info.midi_10 < 2) 792 + info->flags = buf->fb_info.midi_10; 793 + else 794 + info->flags = SNDRV_UMP_BLOCK_IS_MIDI1 | SNDRV_UMP_BLOCK_IS_LOWSPEED; 792 795 info->active = buf->fb_info.active; 793 796 info->midi_ci_version = buf->fb_info.midi_ci_version; 794 797 info->sysex8_streams = buf->fb_info.sysex8_streams;
+1 -1
sound/pci/asihpi/asihpi.c
··· 464 464 return -ENOMEM; 465 465 } 466 466 467 - err = hpi_stream_get_info_ex(dpcm->h_stream, NULL, 467 + hpi_stream_get_info_ex(dpcm->h_stream, NULL, 468 468 &dpcm->hpi_buffer_attached, NULL, NULL, NULL); 469 469 } 470 470 bytes_per_sec = params_rate(params) * params_channels(params);
+11 -9
sound/pci/hda/hda_auto_parser.c
··· 933 933 bool match_all_pins) 934 934 { 935 935 const struct snd_hda_pin_quirk *pq; 936 + const char *name = NULL; 936 937 937 938 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) 938 939 return; ··· 947 946 codec->fixup_id = pq->value; 948 947 #ifdef CONFIG_SND_DEBUG_VERBOSE 949 948 codec->fixup_name = pq->name; 950 - codec_dbg(codec, "%s: picked fixup %s (pin match)\n", 951 - codec->core.chip_name, codec->fixup_name); 949 + name = pq->name; 952 950 #endif 951 + codec_info(codec, "%s: picked fixup %s (pin match)\n", 952 + codec->core.chip_name, name ? name : ""); 953 953 codec->fixup_list = fixlist; 954 954 return; 955 955 } ··· 1017 1015 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) { 1018 1016 id = HDA_FIXUP_ID_NO_FIXUP; 1019 1017 fixlist = NULL; 1020 - codec_dbg(codec, "%s: picked no fixup (nofixup specified)\n", 1021 - codec->core.chip_name); 1018 + codec_info(codec, "%s: picked no fixup (nofixup specified)\n", 1019 + codec->core.chip_name); 1022 1020 goto found; 1023 1021 } 1024 1022 ··· 1028 1026 if (!strcmp(codec->modelname, models->name)) { 1029 1027 id = models->id; 1030 1028 name = models->name; 1031 - codec_dbg(codec, "%s: picked fixup %s (model specified)\n", 1032 - codec->core.chip_name, codec->fixup_name); 1029 + codec_info(codec, "%s: picked fixup %s (model specified)\n", 1030 + codec->core.chip_name, name); 1033 1031 goto found; 1034 1032 } 1035 1033 models++; ··· 1087 1085 #ifdef CONFIG_SND_DEBUG_VERBOSE 1088 1086 name = q->name; 1089 1087 #endif 1090 - codec_dbg(codec, "%s: picked fixup %s for %s %04x:%04x\n", 1091 - codec->core.chip_name, name ? name : "", 1092 - type, q->subvendor, q->subdevice); 1088 + codec_info(codec, "%s: picked fixup %s for %s %04x:%04x\n", 1089 + codec->core.chip_name, name ? name : "", 1090 + type, q->subvendor, q->subdevice); 1093 1091 found: 1094 1092 codec->fixup_id = id; 1095 1093 codec->fixup_list = fixlist;
+98 -71
sound/pci/hda/patch_realtek.c
··· 473 473 break; 474 474 case 0x10ec0234: 475 475 case 0x10ec0274: 476 + alc_write_coef_idx(codec, 0x6e, 0x0c25); 477 + fallthrough; 476 478 case 0x10ec0294: 477 479 case 0x10ec0700: 478 480 case 0x10ec0701: ··· 3615 3613 3616 3614 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); 3617 3615 3618 - if (hp_pin_sense) 3616 + if (hp_pin_sense) { 3619 3617 msleep(2); 3618 + alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ 3620 3619 3621 - alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ 3622 - 3623 - snd_hda_codec_write(codec, hp_pin, 0, 3624 - AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3625 - 3626 - if (hp_pin_sense || spec->ultra_low_power) 3627 - msleep(85); 3628 - 3629 - snd_hda_codec_write(codec, hp_pin, 0, 3620 + snd_hda_codec_write(codec, hp_pin, 0, 3630 3621 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); 3631 3622 3632 - if (hp_pin_sense || spec->ultra_low_power) 3633 - msleep(100); 3623 + msleep(75); 3634 3624 3625 + snd_hda_codec_write(codec, hp_pin, 0, 3626 + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 3627 + 3628 + msleep(75); 3629 + alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ 3630 + } 3635 3631 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); 3636 - alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ 3637 3632 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ 3638 3633 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); 3639 3634 /* ··· 3654 3655 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ 3655 3656 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); 3656 3657 3657 - if (hp_pin_sense) 3658 + if (hp_pin_sense) { 3658 3659 msleep(2); 3659 3660 3660 - snd_hda_codec_write(codec, hp_pin, 0, 3661 + snd_hda_codec_write(codec, hp_pin, 0, 3661 3662 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3662 3663 3663 - if (hp_pin_sense || spec->ultra_low_power) 3664 - msleep(85); 3664 + msleep(75); 3665 3665 3666 3666 /* 3k pull low control for Headset jack. */ 3667 3667 /* NOTE: call this before clearing the pin, otherwise codec stalls */ 3668 3668 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly 3669 3669 * when booting with headset plugged. So skip setting it for the codec alc257 3670 3670 */ 3671 - if (spec->en_3kpull_low) 3672 - alc_update_coef_idx(codec, 0x46, 0, 3 << 12); 3671 + if (spec->en_3kpull_low) 3672 + alc_update_coef_idx(codec, 0x46, 0, 3 << 12); 3673 3673 3674 - if (!spec->no_shutup_pins) 3675 - snd_hda_codec_write(codec, hp_pin, 0, 3674 + if (!spec->no_shutup_pins) 3675 + snd_hda_codec_write(codec, hp_pin, 0, 3676 3676 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); 3677 3677 3678 - if (hp_pin_sense || spec->ultra_low_power) 3679 - msleep(100); 3678 + msleep(75); 3679 + } 3680 3680 3681 3681 alc_auto_setup_eapd(codec, false); 3682 3682 alc_shutup_pins(codec); ··· 3770 3772 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); 3771 3773 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); 3772 3774 3773 - if (hp1_pin_sense || hp2_pin_sense) 3775 + if (hp1_pin_sense || hp2_pin_sense) { 3774 3776 msleep(2); 3777 + alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ 3775 3778 3776 - alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ 3779 + if (hp1_pin_sense) 3780 + snd_hda_codec_write(codec, hp_pin, 0, 3781 + AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); 3782 + if (hp2_pin_sense) 3783 + snd_hda_codec_write(codec, 0x16, 0, 3784 + AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); 3785 + msleep(75); 3777 3786 3778 - if (hp1_pin_sense || spec->ultra_low_power) 3779 - snd_hda_codec_write(codec, hp_pin, 0, 3780 - AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3781 - if (hp2_pin_sense) 3782 - snd_hda_codec_write(codec, 0x16, 0, 3783 - AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3787 + if (hp1_pin_sense) 3788 + snd_hda_codec_write(codec, hp_pin, 0, 3789 + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 3790 + if (hp2_pin_sense) 3791 + snd_hda_codec_write(codec, 0x16, 0, 3792 + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 3784 3793 3785 - if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) 3786 - msleep(85); 3787 - 3788 - if (hp1_pin_sense || spec->ultra_low_power) 3789 - snd_hda_codec_write(codec, hp_pin, 0, 3790 - AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); 3791 - if (hp2_pin_sense) 3792 - snd_hda_codec_write(codec, 0x16, 0, 3793 - AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); 3794 - 3795 - if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) 3796 - msleep(100); 3797 - 3798 - alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); 3799 - alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ 3794 + msleep(75); 3795 + alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ 3796 + } 3800 3797 } 3801 3798 3802 3799 static void alc225_shutup(struct hda_codec *codec) ··· 3803 3810 if (!hp_pin) 3804 3811 hp_pin = 0x21; 3805 3812 3806 - alc_disable_headset_jack_key(codec); 3807 - /* 3k pull low control for Headset jack. */ 3808 - alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); 3809 - 3810 3813 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); 3811 3814 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); 3812 3815 3813 - if (hp1_pin_sense || hp2_pin_sense) 3816 + if (hp1_pin_sense || hp2_pin_sense) { 3817 + alc_disable_headset_jack_key(codec); 3818 + /* 3k pull low control for Headset jack. */ 3819 + alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); 3814 3820 msleep(2); 3815 3821 3816 - if (hp1_pin_sense || spec->ultra_low_power) 3817 - snd_hda_codec_write(codec, hp_pin, 0, 3818 - AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3819 - if (hp2_pin_sense) 3820 - snd_hda_codec_write(codec, 0x16, 0, 3821 - AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3822 + if (hp1_pin_sense) 3823 + snd_hda_codec_write(codec, hp_pin, 0, 3824 + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3825 + if (hp2_pin_sense) 3826 + snd_hda_codec_write(codec, 0x16, 0, 3827 + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3822 3828 3823 - if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) 3824 - msleep(85); 3829 + msleep(75); 3825 3830 3826 - if (hp1_pin_sense || spec->ultra_low_power) 3827 - snd_hda_codec_write(codec, hp_pin, 0, 3828 - AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); 3829 - if (hp2_pin_sense) 3830 - snd_hda_codec_write(codec, 0x16, 0, 3831 - AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); 3831 + if (hp1_pin_sense) 3832 + snd_hda_codec_write(codec, hp_pin, 0, 3833 + AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); 3834 + if (hp2_pin_sense) 3835 + snd_hda_codec_write(codec, 0x16, 0, 3836 + AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); 3832 3837 3833 - if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) 3834 - msleep(100); 3835 - 3838 + msleep(75); 3839 + alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); 3840 + alc_enable_headset_jack_key(codec); 3841 + } 3836 3842 alc_auto_setup_eapd(codec, false); 3837 3843 alc_shutup_pins(codec); 3838 3844 if (spec->ultra_low_power) { ··· 3842 3850 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); 3843 3851 msleep(30); 3844 3852 } 3845 - 3846 - alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); 3847 - alc_enable_headset_jack_key(codec); 3848 3853 } 3849 3854 3850 3855 static void alc_default_init(struct hda_codec *codec) ··· 6491 6502 } 6492 6503 } 6493 6504 6505 + /* disable DAC3 (0x06) selection on NID 0x15 - share Speaker/Bass Speaker DAC 0x03 */ 6506 + static void alc294_fixup_bass_speaker_15(struct hda_codec *codec, 6507 + const struct hda_fixup *fix, int action) 6508 + { 6509 + if (action == HDA_FIXUP_ACT_PRE_PROBE) { 6510 + static const hda_nid_t conn[] = { 0x02, 0x03 }; 6511 + snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); 6512 + } 6513 + } 6514 + 6494 6515 /* Hook to update amp GPIO4 for automute */ 6495 6516 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, 6496 6517 struct hda_jack_callback *jack) ··· 7558 7559 ALC269_FIXUP_THINKPAD_ACPI, 7559 7560 ALC269_FIXUP_DMIC_THINKPAD_ACPI, 7560 7561 ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13, 7562 + ALC269VC_FIXUP_INFINIX_Y4_MAX, 7561 7563 ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO, 7562 7564 ALC255_FIXUP_ACER_MIC_NO_PRESENCE, 7563 7565 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, ··· 7782 7782 ALC256_FIXUP_CHROME_BOOK, 7783 7783 ALC245_FIXUP_CLEVO_NOISY_MIC, 7784 7784 ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE, 7785 + ALC233_FIXUP_MEDION_MTL_SPK, 7786 + ALC294_FIXUP_BASS_SPEAKER_15, 7785 7787 }; 7786 7788 7787 7789 /* A special fixup for Lenovo C940 and Yoga Duet 7; ··· 7942 7940 .v.pins = (const struct hda_pintbl[]) { 7943 7941 { 0x14, 0x90170151 }, /* use as internal speaker (LFE) */ 7944 7942 { 0x1b, 0x90170152 }, /* use as internal speaker (back) */ 7943 + { } 7944 + }, 7945 + .chained = true, 7946 + .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST 7947 + }, 7948 + [ALC269VC_FIXUP_INFINIX_Y4_MAX] = { 7949 + .type = HDA_FIXUP_PINS, 7950 + .v.pins = (const struct hda_pintbl[]) { 7951 + { 0x1b, 0x90170150 }, /* use as internal speaker */ 7945 7952 { } 7946 7953 }, 7947 7954 .chained = true, ··· 10085 10074 .chained = true, 10086 10075 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST 10087 10076 }, 10077 + [ALC233_FIXUP_MEDION_MTL_SPK] = { 10078 + .type = HDA_FIXUP_PINS, 10079 + .v.pins = (const struct hda_pintbl[]) { 10080 + { 0x1b, 0x90170110 }, 10081 + { } 10082 + }, 10083 + }, 10084 + [ALC294_FIXUP_BASS_SPEAKER_15] = { 10085 + .type = HDA_FIXUP_FUNC, 10086 + .v.func = alc294_fixup_bass_speaker_15, 10087 + }, 10088 10088 }; 10089 10089 10090 10090 static const struct hda_quirk alc269_fixup_tbl[] = { ··· 10521 10499 SND_PCI_QUIRK(0x103c, 0x8cdf, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED), 10522 10500 SND_PCI_QUIRK(0x103c, 0x8ce0, "HP SnowWhite", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED), 10523 10501 SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED), 10502 + SND_PCI_QUIRK(0x103c, 0x8d84, "HP EliteBook X G1i", ALC285_FIXUP_HP_GPIO_LED), 10524 10503 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), 10525 10504 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), 10526 10505 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), ··· 10605 10582 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401), 10606 10583 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), 10607 10584 SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2), 10585 + SND_PCI_QUIRK(0x1043, 0x1df3, "ASUS UM5606WA", ALC294_FIXUP_BASS_SPEAKER_15), 10608 10586 SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2), 10609 10587 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), 10610 10588 SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2), ··· 10967 10943 SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 10968 10944 SND_PCI_QUIRK(0x2782, 0x0228, "Infinix ZERO BOOK 13", ALC269VB_FIXUP_INFINIX_ZERO_BOOK_13), 10969 10945 SND_PCI_QUIRK(0x2782, 0x0232, "CHUWI CoreBook XPro", ALC269VB_FIXUP_CHUWI_COREBOOK_XPRO), 10946 + SND_PCI_QUIRK(0x2782, 0x1701, "Infinix Y4 Max", ALC269VC_FIXUP_INFINIX_Y4_MAX), 10947 + SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_MAX), 10970 10948 SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME), 10949 + SND_PCI_QUIRK(0x2782, 0x4900, "MEDION E15443", ALC233_FIXUP_MEDION_MTL_SPK), 10971 10950 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC), 10972 10951 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED), 10973 10952 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
+59 -4
sound/pci/hda/tas2781_hda_i2c.c
··· 16 16 #include <linux/i2c.h> 17 17 #include <linux/mod_devicetable.h> 18 18 #include <linux/module.h> 19 + #include <linux/pci_ids.h> 19 20 #include <linux/pm_runtime.h> 20 21 #include <linux/regmap.h> 21 22 #include <sound/hda_codec.h> ··· 111 110 return 1; 112 111 } 113 112 113 + static const struct acpi_gpio_params speakerid_gpios = { 0, 0, false }; 114 + 115 + static const struct acpi_gpio_mapping tas2781_speaker_id_gpios[] = { 116 + { "speakerid-gpios", &speakerid_gpios, 1 }, 117 + { } 118 + }; 119 + 114 120 static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid) 115 121 { 116 122 struct acpi_device *adev; 123 + struct device *physdev; 117 124 LIST_HEAD(resources); 125 + const char *sub; 126 + uint32_t subid; 118 127 int ret; 119 128 120 129 adev = acpi_dev_get_first_match_dev(hid, NULL, -1); ··· 134 123 return -ENODEV; 135 124 } 136 125 126 + physdev = get_device(acpi_get_first_physical_node(adev)); 137 127 ret = acpi_dev_get_resources(adev, &resources, tas2781_get_i2c_res, p); 138 - if (ret < 0) 128 + if (ret < 0) { 129 + dev_err(p->dev, "Failed to get ACPI resource.\n"); 139 130 goto err; 131 + } 132 + sub = acpi_get_subsystem_id(ACPI_HANDLE(physdev)); 133 + if (IS_ERR(sub)) { 134 + dev_err(p->dev, "Failed to get SUBSYS ID.\n"); 135 + goto err; 136 + } 137 + /* Speaker id was needed for ASUS projects. */ 138 + ret = kstrtou32(sub, 16, &subid); 139 + if (!ret && upper_16_bits(subid) == PCI_VENDOR_ID_ASUSTEK) { 140 + ret = devm_acpi_dev_add_driver_gpios(p->dev, 141 + tas2781_speaker_id_gpios); 142 + if (ret < 0) 143 + dev_err(p->dev, "Failed to add driver gpio %d.\n", 144 + ret); 145 + p->speaker_id = devm_gpiod_get(p->dev, "speakerid", GPIOD_IN); 146 + if (IS_ERR(p->speaker_id)) { 147 + dev_err(p->dev, "Failed to get Speaker id.\n"); 148 + ret = PTR_ERR(p->speaker_id); 149 + goto err; 150 + } 151 + } else { 152 + p->speaker_id = NULL; 153 + } 140 154 141 155 acpi_dev_free_resource_list(&resources); 142 156 strscpy(p->dev_name, hid, sizeof(p->dev_name)); 157 + put_device(physdev); 143 158 acpi_dev_put(adev); 144 159 145 160 return 0; 146 161 147 162 err: 148 163 dev_err(p->dev, "read acpi error, ret: %d\n", ret); 164 + put_device(physdev); 149 165 acpi_dev_put(adev); 150 166 151 167 return ret; ··· 653 615 struct tasdevice_priv *tas_priv = context; 654 616 struct tas2781_hda *tas_hda = dev_get_drvdata(tas_priv->dev); 655 617 struct hda_codec *codec = tas_priv->codec; 656 - int i, ret; 618 + int i, ret, spk_id; 657 619 658 620 pm_runtime_get_sync(tas_priv->dev); 659 621 mutex_lock(&tas_priv->codec_lock); ··· 686 648 tasdevice_dsp_remove(tas_priv); 687 649 688 650 tas_priv->fw_state = TASDEVICE_DSP_FW_PENDING; 689 - scnprintf(tas_priv->coef_binaryname, 64, "TAS2XXX%04X.bin", 690 - codec->core.subsystem_id & 0xffff); 651 + if (tas_priv->speaker_id != NULL) { 652 + // Speaker id need to be checked for ASUS only. 653 + spk_id = gpiod_get_value(tas_priv->speaker_id); 654 + if (spk_id < 0) { 655 + // Speaker id is not valid, use default. 656 + dev_dbg(tas_priv->dev, "Wrong spk_id = %d\n", spk_id); 657 + spk_id = 0; 658 + } 659 + snprintf(tas_priv->coef_binaryname, 660 + sizeof(tas_priv->coef_binaryname), 661 + "TAS2XXX%04X%d.bin", 662 + lower_16_bits(codec->core.subsystem_id), 663 + spk_id); 664 + } else { 665 + snprintf(tas_priv->coef_binaryname, 666 + sizeof(tas_priv->coef_binaryname), 667 + "TAS2XXX%04X.bin", 668 + lower_16_bits(codec->core.subsystem_id)); 669 + } 691 670 ret = tasdevice_dsp_parser(tas_priv); 692 671 if (ret) { 693 672 dev_err(tas_priv->dev, "dspfw load %s error\n",
+1
sound/soc/amd/Kconfig
··· 163 163 config SND_SOC_AMD_PS 164 164 tristate "AMD Audio Coprocessor-v6.3 Pink Sardine support" 165 165 select SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE 166 + select SND_SOC_ACPI_AMD_MATCH 166 167 depends on X86 && PCI && ACPI 167 168 help 168 169 This option enables Audio Coprocessor i.e ACP v6.3 support on
+38 -1
sound/soc/amd/yc/acp6x-mach.c
··· 224 224 .driver_data = &acp6x_card, 225 225 .matches = { 226 226 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 227 + DMI_MATCH(DMI_PRODUCT_NAME, "21M1"), 228 + } 229 + }, 230 + { 231 + .driver_data = &acp6x_card, 232 + .matches = { 233 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 227 234 DMI_MATCH(DMI_PRODUCT_NAME, "21M3"), 228 235 } 229 236 }, ··· 246 239 .matches = { 247 240 DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 248 241 DMI_MATCH(DMI_PRODUCT_NAME, "21M5"), 242 + } 243 + }, 244 + { 245 + .driver_data = &acp6x_card, 246 + .matches = { 247 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 248 + DMI_MATCH(DMI_PRODUCT_NAME, "21ME"), 249 249 } 250 250 }, 251 251 { ··· 426 412 { 427 413 .driver_data = &acp6x_card, 428 414 .matches = { 415 + DMI_MATCH(DMI_BOARD_VENDOR, "TIMI"), 416 + DMI_MATCH(DMI_PRODUCT_NAME, "Redmi G 2022"), 417 + } 418 + }, 419 + { 420 + .driver_data = &acp6x_card, 421 + .matches = { 429 422 DMI_MATCH(DMI_BOARD_VENDOR, "Razer"), 430 423 DMI_MATCH(DMI_PRODUCT_NAME, "Blade 14 (2022) - RZ09-0427"), 431 424 } ··· 558 537 struct acp6x_pdm *machine = NULL; 559 538 struct snd_soc_card *card; 560 539 struct acpi_device *adev; 540 + acpi_handle handle; 541 + acpi_integer dmic_status; 561 542 int ret; 543 + bool is_dmic_enable, wov_en; 562 544 545 + /* IF WOV entry not found, enable dmic based on AcpDmicConnected entry*/ 546 + is_dmic_enable = false; 547 + wov_en = true; 563 548 /* check the parent device's firmware node has _DSD or not */ 564 549 adev = ACPI_COMPANION(pdev->dev.parent); 565 550 if (adev) { ··· 573 546 574 547 if (!acpi_dev_get_property(adev, "AcpDmicConnected", ACPI_TYPE_INTEGER, &obj) && 575 548 obj->integer.value == 1) 576 - platform_set_drvdata(pdev, &acp6x_card); 549 + is_dmic_enable = true; 577 550 } 551 + 552 + handle = ACPI_HANDLE(pdev->dev.parent); 553 + ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status); 554 + if (!ACPI_FAILURE(ret)) 555 + wov_en = dmic_status; 556 + 557 + if (is_dmic_enable && wov_en) 558 + platform_set_drvdata(pdev, &acp6x_card); 559 + else 560 + return 0; 578 561 579 562 /* check for any DMI overrides */ 580 563 dmi_id = dmi_first_match(yc_acp_quirk_table);
+1 -1
sound/soc/apple/mca.c
··· 616 616 tdm_slot_width = 32; 617 617 618 618 if (tdm_slot_width < params_width(params)) { 619 - dev_err(dev, "TDM slots too narrow (tdm=%d params=%d)\n", 619 + dev_err(dev, "TDM slots too narrow (tdm=%u params=%d)\n", 620 620 tdm_slot_width, params_width(params)); 621 621 return -EINVAL; 622 622 }
+3
sound/soc/fsl/imx-audmix.c
··· 274 274 /* Add AUDMIX Backend */ 275 275 be_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, 276 276 "audmix-%d", i); 277 + if (!be_name) 278 + return -ENOMEM; 279 + 277 280 priv->dai[num_dai + i].cpus = &dlc[1]; 278 281 priv->dai[num_dai + i].codecs = &snd_soc_dummy_dlc; 279 282
+7 -2
sound/soc/mediatek/mt8188/mt8188-mt6359.c
··· 1277 1277 1278 1278 for_each_card_prelinks(card, i, dai_link) { 1279 1279 if (strcmp(dai_link->name, "DPTX_BE") == 0) { 1280 - if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) 1280 + if (dai_link->num_codecs && 1281 + strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) 1281 1282 dai_link->init = mt8188_dptx_codec_init; 1282 1283 } else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) { 1283 - if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) 1284 + if (dai_link->num_codecs && 1285 + strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) 1284 1286 dai_link->init = mt8188_hdmi_codec_init; 1285 1287 } else if (strcmp(dai_link->name, "DL_SRC_BE") == 0 || 1286 1288 strcmp(dai_link->name, "UL_SRC_BE") == 0) { ··· 1294 1292 strcmp(dai_link->name, "ETDM2_OUT_BE") == 0 || 1295 1293 strcmp(dai_link->name, "ETDM1_IN_BE") == 0 || 1296 1294 strcmp(dai_link->name, "ETDM2_IN_BE") == 0) { 1295 + if (!dai_link->num_codecs) 1296 + continue; 1297 + 1297 1298 if (!strcmp(dai_link->codecs->dai_name, MAX98390_CODEC_DAI)) { 1298 1299 /* 1299 1300 * The TDM protocol settings with fixed 4 slots are defined in
+2 -2
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
··· 1091 1091 dai_link->ignore = 0; 1092 1092 } 1093 1093 1094 - if (dai_link->num_codecs && dai_link->codecs[0].dai_name && 1094 + if (dai_link->num_codecs && 1095 1095 strcmp(dai_link->codecs[0].dai_name, RT1015_CODEC_DAI) == 0) 1096 1096 dai_link->ops = &mt8192_rt1015_i2s_ops; 1097 1097 } ··· 1119 1119 int i; 1120 1120 1121 1121 for_each_card_prelinks(card, i, dai_link) 1122 - if (dai_link->num_codecs && dai_link->codecs[0].dai_name && 1122 + if (dai_link->num_codecs && 1123 1123 strcmp(dai_link->codecs[0].dai_name, RT1015_CODEC_DAI) == 0) 1124 1124 dai_link->ops = &mt8192_rt1015_i2s_ops; 1125 1125 }
+7 -2
sound/soc/mediatek/mt8195/mt8195-mt6359.c
··· 1378 1378 1379 1379 for_each_card_prelinks(card, i, dai_link) { 1380 1380 if (strcmp(dai_link->name, "DPTX_BE") == 0) { 1381 - if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) 1381 + if (dai_link->num_codecs && 1382 + strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) 1382 1383 dai_link->init = mt8195_dptx_codec_init; 1383 1384 } else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) { 1384 - if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) 1385 + if (dai_link->num_codecs && 1386 + strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) 1385 1387 dai_link->init = mt8195_hdmi_codec_init; 1386 1388 } else if (strcmp(dai_link->name, "DL_SRC_BE") == 0 || 1387 1389 strcmp(dai_link->name, "UL_SRC1_BE") == 0 || ··· 1396 1394 strcmp(dai_link->name, "ETDM2_OUT_BE") == 0 || 1397 1395 strcmp(dai_link->name, "ETDM1_IN_BE") == 0 || 1398 1396 strcmp(dai_link->name, "ETDM2_IN_BE") == 0) { 1397 + if (!dai_link->num_codecs) 1398 + continue; 1399 + 1399 1400 if (!strcmp(dai_link->codecs->dai_name, MAX98390_CODEC_DAI)) { 1400 1401 if (!(codec_init & MAX98390_CODEC_INIT)) { 1401 1402 dai_link->init = mt8195_max98390_init;
+24 -2
sound/soc/sof/ipc3-topology.c
··· 20 20 /* size of tplg ABI in bytes */ 21 21 #define SOF_IPC3_TPLG_ABI_SIZE 3 22 22 23 + /* Base of SOF_DAI_INTEL_ALH, this should be aligned with SOC_SDW_INTEL_BIDIR_PDI_BASE */ 24 + #define INTEL_ALH_DAI_INDEX_BASE 2 25 + 23 26 struct sof_widget_data { 24 27 int ctrl_type; 25 28 int ipc_cmd; ··· 1597 1594 if (ret < 0) 1598 1595 goto free; 1599 1596 1597 + /* Subtract the base to match the FW dai index. */ 1598 + if (comp_dai->type == SOF_DAI_INTEL_ALH) { 1599 + if (comp_dai->dai_index < INTEL_ALH_DAI_INDEX_BASE) { 1600 + dev_err(sdev->dev, 1601 + "Invalid ALH dai index %d, only Pin numbers >= %d can be used\n", 1602 + comp_dai->dai_index, INTEL_ALH_DAI_INDEX_BASE); 1603 + return -EINVAL; 1604 + } 1605 + comp_dai->dai_index -= INTEL_ALH_DAI_INDEX_BASE; 1606 + } 1607 + 1600 1608 dev_dbg(scomp->dev, "dai %s: type %d index %d\n", 1601 1609 swidget->widget->name, comp_dai->type, comp_dai->dai_index); 1602 1610 sof_dbg_comp_config(scomp, &comp_dai->config); ··· 2181 2167 case SOF_DAI_INTEL_ALH: 2182 2168 if (data) { 2183 2169 /* save the dai_index during hw_params and reuse it for hw_free */ 2184 - if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS) 2185 - config->dai_index = data->dai_index; 2170 + if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS) { 2171 + /* Subtract the base to match the FW dai index. */ 2172 + if (data->dai_index < INTEL_ALH_DAI_INDEX_BASE) { 2173 + dev_err(sdev->dev, 2174 + "Invalid ALH dai index %d, only Pin numbers >= %d can be used\n", 2175 + config->dai_index, INTEL_ALH_DAI_INDEX_BASE); 2176 + return -EINVAL; 2177 + } 2178 + config->dai_index = data->dai_index - INTEL_ALH_DAI_INDEX_BASE; 2179 + } 2186 2180 config->alh.stream_id = data->dai_data; 2187 2181 } 2188 2182 break;
+23 -1
sound/usb/clock.c
··· 36 36 struct uac_clock_multiplier_descriptor v3; 37 37 }; 38 38 39 + /* check whether the descriptor bLength has the minimal length */ 40 + #define DESC_LENGTH_CHECK(p, proto) \ 41 + ((proto) == UAC_VERSION_3 ? \ 42 + ((p)->v3.bLength >= sizeof((p)->v3)) : \ 43 + ((p)->v2.bLength >= sizeof((p)->v2))) 44 + 39 45 #define GET_VAL(p, proto, field) \ 40 46 ((proto) == UAC_VERSION_3 ? (p)->v3.field : (p)->v2.field) 41 47 ··· 64 58 { 65 59 union uac23_clock_source_desc *cs = p; 66 60 61 + if (!DESC_LENGTH_CHECK(cs, proto)) 62 + return false; 67 63 return GET_VAL(cs, proto, bClockID) == id; 68 64 } 69 65 ··· 73 65 { 74 66 union uac23_clock_selector_desc *cs = p; 75 67 76 - return GET_VAL(cs, proto, bClockID) == id; 68 + if (!DESC_LENGTH_CHECK(cs, proto)) 69 + return false; 70 + if (GET_VAL(cs, proto, bClockID) != id) 71 + return false; 72 + /* additional length check for baCSourceID array (in bNrInPins size) 73 + * and two more fields (which sizes depend on the protocol) 74 + */ 75 + if (proto == UAC_VERSION_3) 76 + return cs->v3.bLength >= sizeof(cs->v3) + cs->v3.bNrInPins + 77 + 4 /* bmControls */ + 2 /* wCSelectorDescrStr */; 78 + else 79 + return cs->v2.bLength >= sizeof(cs->v2) + cs->v2.bNrInPins + 80 + 1 /* bmControls */ + 1 /* iClockSelector */; 77 81 } 78 82 79 83 static bool validate_clock_multiplier(void *p, int id, int proto) 80 84 { 81 85 union uac23_clock_multiplier_desc *cs = p; 82 86 87 + if (!DESC_LENGTH_CHECK(cs, proto)) 88 + return false; 83 89 return GET_VAL(cs, proto, bClockID) == id; 84 90 } 85 91
+21 -6
sound/usb/quirks.c
··· 555 555 static int snd_usb_extigy_boot_quirk(struct usb_device *dev, struct usb_interface *intf) 556 556 { 557 557 struct usb_host_config *config = dev->actconfig; 558 + struct usb_device_descriptor new_device_descriptor; 558 559 int err; 559 560 560 561 if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD || ··· 567 566 if (err < 0) 568 567 dev_dbg(&dev->dev, "error sending boot message: %d\n", err); 569 568 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, 570 - &dev->descriptor, sizeof(dev->descriptor)); 571 - config = dev->actconfig; 569 + &new_device_descriptor, sizeof(new_device_descriptor)); 572 570 if (err < 0) 573 571 dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err); 572 + if (new_device_descriptor.bNumConfigurations > dev->descriptor.bNumConfigurations) 573 + dev_dbg(&dev->dev, "error too large bNumConfigurations: %d\n", 574 + new_device_descriptor.bNumConfigurations); 575 + else 576 + memcpy(&dev->descriptor, &new_device_descriptor, sizeof(dev->descriptor)); 574 577 err = usb_reset_configuration(dev); 575 578 if (err < 0) 576 579 dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err); ··· 906 901 static int snd_usb_mbox2_boot_quirk(struct usb_device *dev) 907 902 { 908 903 struct usb_host_config *config = dev->actconfig; 904 + struct usb_device_descriptor new_device_descriptor; 909 905 int err; 910 906 u8 bootresponse[0x12]; 911 907 int fwsize; ··· 942 936 dev_dbg(&dev->dev, "device initialised!\n"); 943 937 944 938 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, 945 - &dev->descriptor, sizeof(dev->descriptor)); 946 - config = dev->actconfig; 939 + &new_device_descriptor, sizeof(new_device_descriptor)); 947 940 if (err < 0) 948 941 dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err); 942 + if (new_device_descriptor.bNumConfigurations > dev->descriptor.bNumConfigurations) 943 + dev_dbg(&dev->dev, "error too large bNumConfigurations: %d\n", 944 + new_device_descriptor.bNumConfigurations); 945 + else 946 + memcpy(&dev->descriptor, &new_device_descriptor, sizeof(dev->descriptor)); 949 947 950 948 err = usb_reset_configuration(dev); 951 949 if (err < 0) ··· 1259 1249 static int snd_usb_mbox3_boot_quirk(struct usb_device *dev) 1260 1250 { 1261 1251 struct usb_host_config *config = dev->actconfig; 1252 + struct usb_device_descriptor new_device_descriptor; 1262 1253 int err; 1263 1254 int descriptor_size; 1264 1255 ··· 1273 1262 dev_dbg(&dev->dev, "MBOX3: device initialised!\n"); 1274 1263 1275 1264 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, 1276 - &dev->descriptor, sizeof(dev->descriptor)); 1277 - config = dev->actconfig; 1265 + &new_device_descriptor, sizeof(new_device_descriptor)); 1278 1266 if (err < 0) 1279 1267 dev_dbg(&dev->dev, "MBOX3: error usb_get_descriptor: %d\n", err); 1268 + if (new_device_descriptor.bNumConfigurations > dev->descriptor.bNumConfigurations) 1269 + dev_dbg(&dev->dev, "MBOX3: error too large bNumConfigurations: %d\n", 1270 + new_device_descriptor.bNumConfigurations); 1271 + else 1272 + memcpy(&dev->descriptor, &new_device_descriptor, sizeof(dev->descriptor)); 1280 1273 1281 1274 err = usb_reset_configuration(dev); 1282 1275 if (err < 0)
+2
tools/testing/selftests/alsa/.gitignore
··· 1 + global-timer 1 2 mixer-test 2 3 pcm-test 3 4 test-pcmtest-driver 5 + utimer-test