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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'sound-5.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
"A collection of small fixes.

The major changes are ASoC core fixes, addressing the DPCM locking
issue after the recent code changes and the potentially invalid
register accesses via control API. Also, HD-audio got a core fix for
Oops at dynamic unbinding.

The rest are device-specific small fixes, including the usual stuff
like HD-audio and USB-audio quirks"

* tag 'sound-5.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (31 commits)
ALSA: hda: Skip codec shutdown in case the codec is not registered
ALSA: usb-audio: Correct quirk for VF0770
ALSA: Replace acpi_bus_get_device()
Input: wm97xx: Simplify resource management
ALSA: hda/realtek: Add quirk for ASUS GU603
ALSA: hda/realtek: Fix silent output on Gigabyte X570 Aorus Xtreme after reboot from Windows
ALSA: hda/realtek: Fix silent output on Gigabyte X570S Aorus Master (newer chipset)
ALSA: hda/realtek: Add missing fixup-model entry for Gigabyte X570 ALC1220 quirks
ALSA: hda: realtek: Fix race at concurrent COEF updates
ASoC: ops: Check for negative values before reading them
ASoC: rt5682: Fix deadlock on resume
ASoC: hdmi-codec: Fix OOB memory accesses
ASoC: soc-pcm: Move debugfs removal out of spinlock
ASoC: soc-pcm: Fix DPCM lockdep warning due to nested stream locks
ASoC: fsl: Add missing error handling in pcm030_fabric_probe
ALSA: hda: Fix signedness of sscanf() arguments
ALSA: usb-audio: initialize variables that could ignore errors
ALSA: hda: Fix UAF of leds class devs at unbinding
ASoC: qdsp6: q6apm-dai: only stop graphs that are started
ASoC: codecs: wcd938x: fix return value of mixer put function
...

+266 -108
+3 -9
drivers/input/touchscreen/wm97xx-core.c
··· 615 615 * extensions) 616 616 */ 617 617 wm->touch_dev = platform_device_alloc("wm97xx-touch", -1); 618 - if (!wm->touch_dev) { 619 - ret = -ENOMEM; 620 - goto touch_err; 621 - } 618 + if (!wm->touch_dev) 619 + return -ENOMEM; 620 + 622 621 platform_set_drvdata(wm->touch_dev, wm); 623 622 wm->touch_dev->dev.parent = wm->dev; 624 623 wm->touch_dev->dev.platform_data = pdata; ··· 628 629 return 0; 629 630 touch_reg_err: 630 631 platform_device_put(wm->touch_dev); 631 - touch_err: 632 - input_unregister_device(wm->input_dev); 633 - wm->input_dev = NULL; 634 632 635 633 return ret; 636 634 } ··· 635 639 static void wm97xx_unregister_touch(struct wm97xx *wm) 636 640 { 637 641 platform_device_unregister(wm->touch_dev); 638 - input_unregister_device(wm->input_dev); 639 - wm->input_dev = NULL; 640 642 } 641 643 642 644 static int _wm97xx_probe(struct wm97xx *wm)
+15
include/sound/pcm.h
··· 617 617 void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream); 618 618 void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream); 619 619 unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); 620 + unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream); 620 621 621 622 /** 622 623 * snd_pcm_stream_lock_irqsave - Lock the PCM stream ··· 635 634 } while (0) 636 635 void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, 637 636 unsigned long flags); 637 + 638 + /** 639 + * snd_pcm_stream_lock_irqsave_nested - Single-nested PCM stream locking 640 + * @substream: PCM substream 641 + * @flags: irq flags 642 + * 643 + * This locks the PCM stream like snd_pcm_stream_lock_irqsave() but with 644 + * the single-depth lockdep subclass. 645 + */ 646 + #define snd_pcm_stream_lock_irqsave_nested(substream, flags) \ 647 + do { \ 648 + typecheck(unsigned long, flags); \ 649 + flags = _snd_pcm_stream_lock_irqsave_nested(substream); \ 650 + } while (0) 638 651 639 652 /** 640 653 * snd_pcm_group_for_each_entry - iterate over the linked substreams
+3 -1
include/uapi/sound/asound.h
··· 56 56 * * 57 57 ****************************************************************************/ 58 58 59 + #define AES_IEC958_STATUS_SIZE 24 60 + 59 61 struct snd_aes_iec958 { 60 - unsigned char status[24]; /* AES/IEC958 channel status bits */ 62 + unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */ 61 63 unsigned char subcode[147]; /* AES/IEC958 subcode bits */ 62 64 unsigned char pad; /* nothing */ 63 65 unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
+13
sound/core/pcm_native.c
··· 172 172 } 173 173 EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave); 174 174 175 + unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream) 176 + { 177 + unsigned long flags = 0; 178 + if (substream->pcm->nonatomic) 179 + mutex_lock_nested(&substream->self_group.mutex, 180 + SINGLE_DEPTH_NESTING); 181 + else 182 + spin_lock_irqsave_nested(&substream->self_group.lock, flags, 183 + SINGLE_DEPTH_NESTING); 184 + return flags; 185 + } 186 + EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave_nested); 187 + 175 188 /** 176 189 * snd_pcm_stream_unlock_irqrestore - Unlock the PCM stream 177 190 * @substream: PCM substream
+3 -4
sound/hda/intel-sdw-acpi.c
··· 50 50 static int 51 51 sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) 52 52 { 53 - struct acpi_device *adev; 53 + struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle); 54 54 int ret, i; 55 55 u8 count; 56 56 57 - if (acpi_bus_get_device(info->handle, &adev)) 57 + if (!adev) 58 58 return -EINVAL; 59 59 60 60 /* Found controller, find links supported */ ··· 119 119 void *cdata, void **return_value) 120 120 { 121 121 struct sdw_intel_acpi_info *info = cdata; 122 - struct acpi_device *adev; 123 122 acpi_status status; 124 123 u64 adr; 125 124 ··· 126 127 if (ACPI_FAILURE(status)) 127 128 return AE_OK; /* keep going */ 128 129 129 - if (acpi_bus_get_device(handle, &adev)) { 130 + if (!acpi_fetch_acpi_dev(handle)) { 130 131 pr_err("%s: Couldn't find ACPI handle\n", __func__); 131 132 return AE_NOT_FOUND; 132 133 }
+1 -1
sound/pci/hda/hda_auto_parser.c
··· 981 981 int id = HDA_FIXUP_ID_NOT_SET; 982 982 const char *name = NULL; 983 983 const char *type = NULL; 984 - int vendor, device; 984 + unsigned int vendor, device; 985 985 986 986 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) 987 987 return;
+4
sound/pci/hda/hda_codec.c
··· 3000 3000 { 3001 3001 struct hda_pcm *cpcm; 3002 3002 3003 + /* Skip the shutdown if codec is not registered */ 3004 + if (!codec->registered) 3005 + return; 3006 + 3003 3007 list_for_each_entry(cpcm, &codec->pcm_list_head, list) 3004 3008 snd_pcm_suspend_all(cpcm->pcm); 3005 3009
+15 -2
sound/pci/hda/hda_generic.c
··· 91 91 free_kctls(spec); 92 92 snd_array_free(&spec->paths); 93 93 snd_array_free(&spec->loopback_list); 94 + #ifdef CONFIG_SND_HDA_GENERIC_LEDS 95 + if (spec->led_cdevs[LED_AUDIO_MUTE]) 96 + led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MUTE]); 97 + if (spec->led_cdevs[LED_AUDIO_MICMUTE]) 98 + led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MICMUTE]); 99 + #endif 94 100 } 95 101 96 102 /* ··· 3928 3922 enum led_brightness), 3929 3923 bool micmute) 3930 3924 { 3925 + struct hda_gen_spec *spec = codec->spec; 3931 3926 struct led_classdev *cdev; 3927 + int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE; 3928 + int err; 3932 3929 3933 3930 cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL); 3934 3931 if (!cdev) ··· 3941 3932 cdev->max_brightness = 1; 3942 3933 cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute"; 3943 3934 cdev->brightness_set_blocking = callback; 3944 - cdev->brightness = ledtrig_audio_get(micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE); 3935 + cdev->brightness = ledtrig_audio_get(idx); 3945 3936 cdev->flags = LED_CORE_SUSPENDRESUME; 3946 3937 3947 - return devm_led_classdev_register(&codec->core.dev, cdev); 3938 + err = led_classdev_register(&codec->core.dev, cdev); 3939 + if (err < 0) 3940 + return err; 3941 + spec->led_cdevs[idx] = cdev; 3942 + return 0; 3948 3943 } 3949 3944 3950 3945 /**
+3
sound/pci/hda/hda_generic.h
··· 294 294 struct hda_jack_callback *cb); 295 295 void (*mic_autoswitch_hook)(struct hda_codec *codec, 296 296 struct hda_jack_callback *cb); 297 + 298 + /* leds */ 299 + struct led_classdev *led_cdevs[NUM_AUDIO_LEDS]; 297 300 }; 298 301 299 302 /* values for add_stereo_mix_input flag */
+55 -12
sound/pci/hda/patch_realtek.c
··· 98 98 unsigned int gpio_mic_led_mask; 99 99 struct alc_coef_led mute_led_coef; 100 100 struct alc_coef_led mic_led_coef; 101 + struct mutex coef_mutex; 101 102 102 103 hda_nid_t headset_mic_pin; 103 104 hda_nid_t headphone_mic_pin; ··· 138 137 * COEF access helper functions 139 138 */ 140 139 141 - static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 142 - unsigned int coef_idx) 140 + static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 141 + unsigned int coef_idx) 143 142 { 144 143 unsigned int val; 145 144 ··· 148 147 return val; 149 148 } 150 149 150 + static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 151 + unsigned int coef_idx) 152 + { 153 + struct alc_spec *spec = codec->spec; 154 + unsigned int val; 155 + 156 + mutex_lock(&spec->coef_mutex); 157 + val = __alc_read_coefex_idx(codec, nid, coef_idx); 158 + mutex_unlock(&spec->coef_mutex); 159 + return val; 160 + } 161 + 151 162 #define alc_read_coef_idx(codec, coef_idx) \ 152 163 alc_read_coefex_idx(codec, 0x20, coef_idx) 153 164 154 - static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 155 - unsigned int coef_idx, unsigned int coef_val) 165 + static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 166 + unsigned int coef_idx, unsigned int coef_val) 156 167 { 157 168 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); 158 169 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); 159 170 } 160 171 172 + static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 173 + unsigned int coef_idx, unsigned int coef_val) 174 + { 175 + struct alc_spec *spec = codec->spec; 176 + 177 + mutex_lock(&spec->coef_mutex); 178 + __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); 179 + mutex_unlock(&spec->coef_mutex); 180 + } 181 + 161 182 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ 162 183 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val) 184 + 185 + static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 186 + unsigned int coef_idx, unsigned int mask, 187 + unsigned int bits_set) 188 + { 189 + unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); 190 + 191 + if (val != -1) 192 + __alc_write_coefex_idx(codec, nid, coef_idx, 193 + (val & ~mask) | bits_set); 194 + } 163 195 164 196 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 165 197 unsigned int coef_idx, unsigned int mask, 166 198 unsigned int bits_set) 167 199 { 168 - unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); 200 + struct alc_spec *spec = codec->spec; 169 201 170 - if (val != -1) 171 - alc_write_coefex_idx(codec, nid, coef_idx, 172 - (val & ~mask) | bits_set); 202 + mutex_lock(&spec->coef_mutex); 203 + __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); 204 + mutex_unlock(&spec->coef_mutex); 173 205 } 174 206 175 207 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ ··· 235 201 static void alc_process_coef_fw(struct hda_codec *codec, 236 202 const struct coef_fw *fw) 237 203 { 204 + struct alc_spec *spec = codec->spec; 205 + 206 + mutex_lock(&spec->coef_mutex); 238 207 for (; fw->nid; fw++) { 239 208 if (fw->mask == (unsigned short)-1) 240 - alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); 209 + __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); 241 210 else 242 - alc_update_coefex_idx(codec, fw->nid, fw->idx, 243 - fw->mask, fw->val); 211 + __alc_update_coefex_idx(codec, fw->nid, fw->idx, 212 + fw->mask, fw->val); 244 213 } 214 + mutex_unlock(&spec->coef_mutex); 245 215 } 246 216 247 217 /* ··· 1191 1153 codec->spdif_status_reset = 1; 1192 1154 codec->forced_resume = 1; 1193 1155 codec->patch_ops = alc_patch_ops; 1156 + mutex_init(&spec->coef_mutex); 1194 1157 1195 1158 err = alc_codec_rename_from_preset(codec); 1196 1159 if (err < 0) { ··· 2164 2125 { 2165 2126 static const hda_nid_t conn1[] = { 0x0c }; 2166 2127 static const struct coef_fw gb_x570_coefs[] = { 2128 + WRITE_COEF(0x07, 0x03c0), 2167 2129 WRITE_COEF(0x1a, 0x01c1), 2168 2130 WRITE_COEF(0x1b, 0x0202), 2169 2131 WRITE_COEF(0x43, 0x3005), ··· 2591 2551 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), 2592 2552 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), 2593 2553 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570), 2594 - SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950), 2554 + SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570), 2555 + SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570), 2595 2556 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950), 2596 2557 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950), 2597 2558 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950), ··· 2667 2626 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"}, 2668 2627 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"}, 2669 2628 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"}, 2629 + {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"}, 2670 2630 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"}, 2671 2631 {} 2672 2632 }; ··· 9011 8969 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), 9012 8970 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), 9013 8971 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), 8972 + SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), 9014 8973 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), 9015 8974 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), 9016 8975 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
+2 -2
sound/soc/amd/acp/acp-mach-common.c
··· 303 303 304 304 static struct snd_soc_codec_conf rt1019_conf[] = { 305 305 { 306 - .dlc = COMP_CODEC_CONF("i2c-10EC1019:00"), 306 + .dlc = COMP_CODEC_CONF("i2c-10EC1019:01"), 307 307 .name_prefix = "Left", 308 308 }, 309 309 { 310 - .dlc = COMP_CODEC_CONF("i2c-10EC1019:01"), 310 + .dlc = COMP_CODEC_CONF("i2c-10EC1019:00"), 311 311 .name_prefix = "Right", 312 312 }, 313 313 };
+2
sound/soc/codecs/cpcap.c
··· 1667 1667 { 1668 1668 struct device_node *codec_node = 1669 1669 of_get_child_by_name(pdev->dev.parent->of_node, "audio-codec"); 1670 + if (!codec_node) 1671 + return -ENODEV; 1670 1672 1671 1673 pdev->dev.of_node = codec_node; 1672 1674
+1 -1
sound/soc/codecs/hdmi-codec.c
··· 277 277 bool busy; 278 278 struct snd_soc_jack *jack; 279 279 unsigned int jack_status; 280 - u8 iec_status[5]; 280 + u8 iec_status[AES_IEC958_STATUS_SIZE]; 281 281 }; 282 282 283 283 static const struct snd_soc_dapm_widget hdmi_widgets[] = {
+4 -4
sound/soc/codecs/lpass-rx-macro.c
··· 2688 2688 int reg, b2_reg; 2689 2689 2690 2690 /* Address does not automatically update if reading */ 2691 - reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx; 2692 - b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx; 2691 + reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx; 2692 + b2_reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx; 2693 2693 2694 2694 snd_soc_component_write(component, reg, 2695 2695 ((band_idx * BAND_MAX + coeff_idx) * ··· 2718 2718 static void set_iir_band_coeff(struct snd_soc_component *component, 2719 2719 int iir_idx, int band_idx, uint32_t value) 2720 2720 { 2721 - int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 16 * iir_idx; 2721 + int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B2_CTL + 0x80 * iir_idx; 2722 2722 2723 2723 snd_soc_component_write(component, reg, (value & 0xFF)); 2724 2724 snd_soc_component_write(component, reg, (value >> 8) & 0xFF); ··· 2739 2739 int iir_idx = ctl->iir_idx; 2740 2740 int band_idx = ctl->band_idx; 2741 2741 u32 coeff[BAND_MAX]; 2742 - int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 16 * iir_idx; 2742 + int reg = CDC_RX_SIDETONE_IIR0_IIR_COEF_B1_CTL + 0x80 * iir_idx; 2743 2743 2744 2744 memcpy(&coeff[0], ucontrol->value.bytes.data, params->max); 2745 2745
+2 -1
sound/soc/codecs/max9759.c
··· 64 64 struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); 65 65 struct max9759 *priv = snd_soc_component_get_drvdata(c); 66 66 67 - if (ucontrol->value.integer.value[0] > 3) 67 + if (ucontrol->value.integer.value[0] < 0 || 68 + ucontrol->value.integer.value[0] > 3) 68 69 return -EINVAL; 69 70 70 71 priv->gain = ucontrol->value.integer.value[0];
+4 -11
sound/soc/codecs/rt5682-i2c.c
··· 59 59 struct rt5682_priv *rt5682 = container_of(work, struct rt5682_priv, 60 60 jd_check_work.work); 61 61 62 - if (snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL) 63 - & RT5682_JDH_RS_MASK) { 62 + if (snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL) & RT5682_JDH_RS_MASK) 64 63 /* jack out */ 65 - rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0); 66 - 67 - snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type, 68 - SND_JACK_HEADSET | 69 - SND_JACK_BTN_0 | SND_JACK_BTN_1 | 70 - SND_JACK_BTN_2 | SND_JACK_BTN_3); 71 - } else { 64 + mod_delayed_work(system_power_efficient_wq, 65 + &rt5682->jack_detect_work, 0); 66 + else 72 67 schedule_delayed_work(&rt5682->jd_check_work, 500); 73 - } 74 68 } 75 69 76 70 static irqreturn_t rt5682_irq(int irq, void *data) ··· 192 198 } 193 199 194 200 mutex_init(&rt5682->calibrate_mutex); 195 - mutex_init(&rt5682->jdet_mutex); 196 201 rt5682_calibrate(rt5682); 197 202 198 203 rt5682_apply_patch_list(rt5682, &i2c->dev);
+8 -16
sound/soc/codecs/rt5682.c
··· 922 922 * 923 923 * Returns detect status. 924 924 */ 925 - int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert) 925 + static int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert) 926 926 { 927 927 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); 928 928 struct snd_soc_dapm_context *dapm = &component->dapm; 929 929 unsigned int val, count; 930 930 931 931 if (jack_insert) { 932 - snd_soc_dapm_mutex_lock(dapm); 933 - 934 932 snd_soc_component_update_bits(component, RT5682_PWR_ANLG_1, 935 933 RT5682_PWR_VREF2 | RT5682_PWR_MB, 936 934 RT5682_PWR_VREF2 | RT5682_PWR_MB); ··· 979 981 snd_soc_component_update_bits(component, RT5682_MICBIAS_2, 980 982 RT5682_PWR_CLK25M_MASK | RT5682_PWR_CLK1M_MASK, 981 983 RT5682_PWR_CLK25M_PU | RT5682_PWR_CLK1M_PU); 982 - 983 - snd_soc_dapm_mutex_unlock(dapm); 984 984 } else { 985 985 rt5682_enable_push_button_irq(component, false); 986 986 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1, ··· 1007 1011 dev_dbg(component->dev, "jack_type = %d\n", rt5682->jack_type); 1008 1012 return rt5682->jack_type; 1009 1013 } 1010 - EXPORT_SYMBOL_GPL(rt5682_headset_detect); 1011 1014 1012 1015 static int rt5682_set_jack_detect(struct snd_soc_component *component, 1013 1016 struct snd_soc_jack *hs_jack, void *data) ··· 1089 1094 { 1090 1095 struct rt5682_priv *rt5682 = 1091 1096 container_of(work, struct rt5682_priv, jack_detect_work.work); 1097 + struct snd_soc_dapm_context *dapm; 1092 1098 int val, btn_type; 1093 1099 1094 1100 while (!rt5682->component) ··· 1098 1102 while (!rt5682->component->card->instantiated) 1099 1103 usleep_range(10000, 15000); 1100 1104 1101 - mutex_lock(&rt5682->jdet_mutex); 1105 + dapm = snd_soc_component_get_dapm(rt5682->component); 1106 + 1107 + snd_soc_dapm_mutex_lock(dapm); 1102 1108 mutex_lock(&rt5682->calibrate_mutex); 1103 1109 1104 1110 val = snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL) ··· 1160 1162 rt5682->irq_work_delay_time = 50; 1161 1163 } 1162 1164 1165 + mutex_unlock(&rt5682->calibrate_mutex); 1166 + snd_soc_dapm_mutex_unlock(dapm); 1167 + 1163 1168 snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type, 1164 1169 SND_JACK_HEADSET | 1165 1170 SND_JACK_BTN_0 | SND_JACK_BTN_1 | ··· 1175 1174 else 1176 1175 cancel_delayed_work_sync(&rt5682->jd_check_work); 1177 1176 } 1178 - 1179 - mutex_unlock(&rt5682->calibrate_mutex); 1180 - mutex_unlock(&rt5682->jdet_mutex); 1181 1177 } 1182 1178 EXPORT_SYMBOL_GPL(rt5682_jack_detect_handler); 1183 1179 ··· 1524 1526 { 1525 1527 struct snd_soc_component *component = 1526 1528 snd_soc_dapm_to_component(w->dapm); 1527 - struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); 1528 1529 1529 1530 switch (event) { 1530 1531 case SND_SOC_DAPM_PRE_PMU: ··· 1535 1538 RT5682_DEPOP_1, 0x60, 0x60); 1536 1539 snd_soc_component_update_bits(component, 1537 1540 RT5682_DAC_ADC_DIG_VOL1, 0x00c0, 0x0080); 1538 - 1539 - mutex_lock(&rt5682->jdet_mutex); 1540 - 1541 1541 snd_soc_component_update_bits(component, RT5682_HP_CTRL_2, 1542 1542 RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN, 1543 1543 RT5682_HP_C2_DAC_L_EN | RT5682_HP_C2_DAC_R_EN); 1544 1544 usleep_range(5000, 10000); 1545 1545 snd_soc_component_update_bits(component, RT5682_CHARGE_PUMP_1, 1546 1546 RT5682_CP_SW_SIZE_MASK, RT5682_CP_SW_SIZE_L); 1547 - 1548 - mutex_unlock(&rt5682->jdet_mutex); 1549 1547 break; 1550 1548 1551 1549 case SND_SOC_DAPM_POST_PMD:
-2
sound/soc/codecs/rt5682.h
··· 1463 1463 1464 1464 int jack_type; 1465 1465 int irq_work_delay_time; 1466 - struct mutex jdet_mutex; 1467 1466 }; 1468 1467 1469 1468 extern const char *rt5682_supply_names[RT5682_NUM_SUPPLIES]; ··· 1472 1473 1473 1474 void rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev); 1474 1475 1475 - int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert); 1476 1476 void rt5682_jack_detect_handler(struct work_struct *work); 1477 1477 1478 1478 bool rt5682_volatile_register(struct device *dev, unsigned int reg);
+19 -16
sound/soc/codecs/wcd938x.c
··· 1432 1432 return 0; 1433 1433 } 1434 1434 1435 - static int wcd938x_connect_port(struct wcd938x_sdw_priv *wcd, u8 ch_id, u8 enable) 1435 + static int wcd938x_connect_port(struct wcd938x_sdw_priv *wcd, u8 port_num, u8 ch_id, u8 enable) 1436 1436 { 1437 - u8 port_num; 1438 - 1439 - port_num = wcd->ch_info[ch_id].port_num; 1440 - 1441 1437 return wcd938x_sdw_connect_port(&wcd->ch_info[ch_id], 1442 - &wcd->port_config[port_num], 1438 + &wcd->port_config[port_num - 1], 1443 1439 enable); 1444 1440 } 1445 1441 ··· 2559 2563 WCD938X_EAR_GAIN_MASK, 2560 2564 ucontrol->value.integer.value[0]); 2561 2565 2562 - return 0; 2566 + return 1; 2563 2567 } 2564 2568 2565 2569 static int wcd938x_get_compander(struct snd_kcontrol *kcontrol, ··· 2589 2593 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); 2590 2594 struct wcd938x_sdw_priv *wcd; 2591 2595 int value = ucontrol->value.integer.value[0]; 2596 + int portidx; 2592 2597 struct soc_mixer_control *mc; 2593 2598 bool hphr; 2594 2599 ··· 2603 2606 else 2604 2607 wcd938x->comp1_enable = value; 2605 2608 2606 - if (value) 2607 - wcd938x_connect_port(wcd, mc->reg, true); 2608 - else 2609 - wcd938x_connect_port(wcd, mc->reg, false); 2609 + portidx = wcd->ch_info[mc->reg].port_num; 2610 2610 2611 - return 0; 2611 + if (value) 2612 + wcd938x_connect_port(wcd, portidx, mc->reg, true); 2613 + else 2614 + wcd938x_connect_port(wcd, portidx, mc->reg, false); 2615 + 2616 + return 1; 2612 2617 } 2613 2618 2614 2619 static int wcd938x_ldoh_get(struct snd_kcontrol *kcontrol, ··· 2881 2882 struct wcd938x_sdw_priv *wcd; 2882 2883 struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; 2883 2884 int dai_id = mixer->shift; 2884 - int portidx = mixer->reg; 2885 + int portidx, ch_idx = mixer->reg; 2886 + 2885 2887 2886 2888 wcd = wcd938x->sdw_priv[dai_id]; 2889 + portidx = wcd->ch_info[ch_idx].port_num; 2887 2890 2888 2891 ucontrol->value.integer.value[0] = wcd->port_enable[portidx]; 2889 2892 ··· 2900 2899 struct wcd938x_sdw_priv *wcd; 2901 2900 struct soc_mixer_control *mixer = 2902 2901 (struct soc_mixer_control *)kcontrol->private_value; 2903 - int portidx = mixer->reg; 2902 + int ch_idx = mixer->reg; 2903 + int portidx; 2904 2904 int dai_id = mixer->shift; 2905 2905 bool enable; 2906 2906 2907 2907 wcd = wcd938x->sdw_priv[dai_id]; 2908 2908 2909 + portidx = wcd->ch_info[ch_idx].port_num; 2909 2910 if (ucontrol->value.integer.value[0]) 2910 2911 enable = true; 2911 2912 else ··· 2915 2912 2916 2913 wcd->port_enable[portidx] = enable; 2917 2914 2918 - wcd938x_connect_port(wcd, portidx, enable); 2915 + wcd938x_connect_port(wcd, portidx, ch_idx, enable); 2919 2916 2920 - return 0; 2917 + return 1; 2921 2918 2922 2919 } 2923 2920
+8 -3
sound/soc/fsl/pcm030-audio-fabric.c
··· 93 93 dev_err(&op->dev, "platform_device_alloc() failed\n"); 94 94 95 95 ret = platform_device_add(pdata->codec_device); 96 - if (ret) 96 + if (ret) { 97 97 dev_err(&op->dev, "platform_device_add() failed: %d\n", ret); 98 + platform_device_put(pdata->codec_device); 99 + } 98 100 99 101 ret = snd_soc_register_card(card); 100 - if (ret) 102 + if (ret) { 101 103 dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret); 104 + platform_device_del(pdata->codec_device); 105 + platform_device_put(pdata->codec_device); 106 + } 102 107 103 108 platform_set_drvdata(op, pdata); 104 - 105 109 return ret; 110 + 106 111 } 107 112 108 113 static int pcm030_fabric_remove(struct platform_device *op)
+25 -1
sound/soc/generic/simple-card.c
··· 28 28 .hw_params = asoc_simple_hw_params, 29 29 }; 30 30 31 + static int asoc_simple_parse_platform(struct device_node *node, 32 + struct snd_soc_dai_link_component *dlc) 33 + { 34 + struct of_phandle_args args; 35 + int ret; 36 + 37 + if (!node) 38 + return 0; 39 + 40 + /* 41 + * Get node via "sound-dai = <&phandle port>" 42 + * it will be used as xxx_of_node on soc_bind_dai_link() 43 + */ 44 + ret = of_parse_phandle_with_args(node, DAI, CELL, 0, &args); 45 + if (ret) 46 + return ret; 47 + 48 + /* dai_name is not required and may not exist for plat component */ 49 + 50 + dlc->of_node = args.np; 51 + 52 + return 0; 53 + } 54 + 31 55 static int asoc_simple_parse_dai(struct device_node *node, 32 56 struct snd_soc_dai_link_component *dlc, 33 57 int *is_single_link) ··· 313 289 if (ret < 0) 314 290 goto dai_link_of_err; 315 291 316 - ret = asoc_simple_parse_dai(plat, platforms, NULL); 292 + ret = asoc_simple_parse_platform(plat, platforms); 317 293 if (ret < 0) 318 294 goto dai_link_of_err; 319 295
+1 -1
sound/soc/mediatek/Kconfig
··· 216 216 217 217 config SND_SOC_MT8195_MT6359_RT1011_RT5682 218 218 tristate "ASoC Audio driver for MT8195 with MT6359 RT1011 RT5682 codec" 219 - depends on I2C 219 + depends on I2C && GPIOLIB 220 220 depends on SND_SOC_MT8195 && MTK_PMIC_WRAP 221 221 select SND_SOC_MT6359 222 222 select SND_SOC_RT1011
+5 -2
sound/soc/qcom/qdsp6/q6apm-dai.c
··· 308 308 struct snd_pcm_runtime *runtime = substream->runtime; 309 309 struct q6apm_dai_rtd *prtd = runtime->private_data; 310 310 311 - q6apm_graph_stop(prtd->graph); 312 - q6apm_unmap_memory_regions(prtd->graph, substream->stream); 311 + if (prtd->state) { /* only stop graph that is started */ 312 + q6apm_graph_stop(prtd->graph); 313 + q6apm_unmap_memory_regions(prtd->graph, substream->stream); 314 + } 315 + 313 316 q6apm_graph_close(prtd->graph); 314 317 prtd->graph = NULL; 315 318 kfree(prtd);
+2 -5
sound/soc/soc-acpi.c
··· 55 55 static acpi_status snd_soc_acpi_find_package(acpi_handle handle, u32 level, 56 56 void *context, void **ret) 57 57 { 58 - struct acpi_device *adev; 58 + struct acpi_device *adev = acpi_fetch_acpi_dev(handle); 59 59 acpi_status status; 60 60 struct snd_soc_acpi_package_context *pkg_ctx = context; 61 61 62 62 pkg_ctx->data_valid = false; 63 63 64 - if (acpi_bus_get_device(handle, &adev)) 65 - return AE_OK; 66 - 67 - if (adev->status.present && adev->status.functional) { 64 + if (adev && adev->status.present && adev->status.functional) { 68 65 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 69 66 union acpi_object *myobj = NULL; 70 67
+26 -3
sound/soc/soc-ops.c
··· 316 316 if (sign_bit) 317 317 mask = BIT(sign_bit + 1) - 1; 318 318 319 - val = ((ucontrol->value.integer.value[0] + min) & mask); 319 + if (ucontrol->value.integer.value[0] < 0) 320 + return -EINVAL; 321 + val = ucontrol->value.integer.value[0]; 322 + if (mc->platform_max && val > mc->platform_max) 323 + return -EINVAL; 324 + if (val > max - min) 325 + return -EINVAL; 326 + val = (val + min) & mask; 320 327 if (invert) 321 328 val = max - val; 322 329 val_mask = mask << shift; 323 330 val = val << shift; 324 331 if (snd_soc_volsw_is_stereo(mc)) { 325 - val2 = ((ucontrol->value.integer.value[1] + min) & mask); 332 + if (ucontrol->value.integer.value[1] < 0) 333 + return -EINVAL; 334 + val2 = ucontrol->value.integer.value[1]; 335 + if (mc->platform_max && val2 > mc->platform_max) 336 + return -EINVAL; 337 + if (val2 > max - min) 338 + return -EINVAL; 339 + val2 = (val2 + min) & mask; 326 340 if (invert) 327 341 val2 = max - val2; 328 342 if (reg == reg2) { ··· 423 409 int err = 0; 424 410 unsigned int val, val_mask; 425 411 412 + if (ucontrol->value.integer.value[0] < 0) 413 + return -EINVAL; 414 + val = ucontrol->value.integer.value[0]; 415 + if (mc->platform_max && val > mc->platform_max) 416 + return -EINVAL; 417 + if (val > max - min) 418 + return -EINVAL; 426 419 val_mask = mask << shift; 427 - val = (ucontrol->value.integer.value[0] + min) & mask; 420 + val = (val + min) & mask; 428 421 val = val << shift; 429 422 430 423 err = snd_soc_component_update_bits(component, reg, val_mask, val); ··· 879 858 long val = ucontrol->value.integer.value[0]; 880 859 unsigned int i; 881 860 861 + if (val < mc->min || val > mc->max) 862 + return -EINVAL; 882 863 if (invert) 883 864 val = max - val; 884 865 val &= mask;
+13 -7
sound/soc/soc-pcm.c
··· 46 46 snd_pcm_stream_lock_irq(snd_soc_dpcm_get_substream(rtd, stream)); 47 47 } 48 48 49 - #define snd_soc_dpcm_stream_lock_irqsave(rtd, stream, flags) \ 50 - snd_pcm_stream_lock_irqsave(snd_soc_dpcm_get_substream(rtd, stream), flags) 49 + #define snd_soc_dpcm_stream_lock_irqsave_nested(rtd, stream, flags) \ 50 + snd_pcm_stream_lock_irqsave_nested(snd_soc_dpcm_get_substream(rtd, stream), flags) 51 51 52 52 static inline void snd_soc_dpcm_stream_unlock_irq(struct snd_soc_pcm_runtime *rtd, 53 53 int stream) ··· 1268 1268 void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream) 1269 1269 { 1270 1270 struct snd_soc_dpcm *dpcm, *d; 1271 + LIST_HEAD(deleted_dpcms); 1271 1272 1272 1273 snd_soc_dpcm_mutex_assert_held(fe); 1273 1274 ··· 1288 1287 /* BEs still alive need new FE */ 1289 1288 dpcm_be_reparent(fe, dpcm->be, stream); 1290 1289 1291 - dpcm_remove_debugfs_state(dpcm); 1292 - 1293 1290 list_del(&dpcm->list_be); 1294 - list_del(&dpcm->list_fe); 1295 - kfree(dpcm); 1291 + list_move(&dpcm->list_fe, &deleted_dpcms); 1296 1292 } 1297 1293 snd_soc_dpcm_stream_unlock_irq(fe, stream); 1294 + 1295 + while (!list_empty(&deleted_dpcms)) { 1296 + dpcm = list_first_entry(&deleted_dpcms, struct snd_soc_dpcm, 1297 + list_fe); 1298 + list_del(&dpcm->list_fe); 1299 + dpcm_remove_debugfs_state(dpcm); 1300 + kfree(dpcm); 1301 + } 1298 1302 } 1299 1303 1300 1304 /* get BE for DAI widget and stream */ ··· 2100 2094 be = dpcm->be; 2101 2095 be_substream = snd_soc_dpcm_get_substream(be, stream); 2102 2096 2103 - snd_soc_dpcm_stream_lock_irqsave(be, stream, flags); 2097 + snd_soc_dpcm_stream_lock_irqsave_nested(be, stream, flags); 2104 2098 2105 2099 /* is this op for this BE ? */ 2106 2100 if (!snd_soc_dpcm_be_can_update(fe, be, stream))
+24 -3
sound/soc/xilinx/xlnx_formatter_pcm.c
··· 37 37 #define XLNX_AUD_XFER_COUNT 0x28 38 38 #define XLNX_AUD_CH_STS_START 0x2C 39 39 #define XLNX_BYTES_PER_CH 0x44 40 + #define XLNX_AUD_ALIGN_BYTES 64 40 41 41 42 #define AUD_STS_IOC_IRQ_MASK BIT(31) 42 43 #define AUD_STS_CH_STS_MASK BIT(29) ··· 369 368 snd_soc_set_runtime_hwparams(substream, &xlnx_pcm_hardware); 370 369 runtime->private_data = stream_data; 371 370 372 - /* Resize the period size divisible by 64 */ 371 + /* Resize the period bytes as divisible by 64 */ 373 372 err = snd_pcm_hw_constraint_step(runtime, 0, 374 - SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64); 373 + SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 374 + XLNX_AUD_ALIGN_BYTES); 375 375 if (err) { 376 376 dev_err(component->dev, 377 - "unable to set constraint on period bytes\n"); 377 + "Unable to set constraint on period bytes\n"); 378 + return err; 379 + } 380 + 381 + /* Resize the buffer bytes as divisible by 64 */ 382 + err = snd_pcm_hw_constraint_step(runtime, 0, 383 + SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 384 + XLNX_AUD_ALIGN_BYTES); 385 + if (err) { 386 + dev_err(component->dev, 387 + "Unable to set constraint on buffer bytes\n"); 388 + return err; 389 + } 390 + 391 + /* Set periods as integer multiple */ 392 + err = snd_pcm_hw_constraint_integer(runtime, 393 + SNDRV_PCM_HW_PARAM_PERIODS); 394 + if (err < 0) { 395 + dev_err(component->dev, 396 + "Unable to set constraint on periods to be integer\n"); 378 397 return err; 379 398 } 380 399
+4
sound/usb/mixer.c
··· 1527 1527 usb_audio_err(chip, 1528 1528 "cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", 1529 1529 UAC_GET_CUR, validx, idx, cval->val_type); 1530 + 1531 + if (val) 1532 + *val = 0; 1533 + 1530 1534 return filter_error(cval, ret); 1531 1535 } 1532 1536
+1 -1
sound/usb/quirks-table.h
··· 84 84 * combination. 85 85 */ 86 86 { 87 - USB_DEVICE(0x041e, 0x4095), 87 + USB_AUDIO_DEVICE(0x041e, 0x4095), 88 88 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 89 89 .ifnum = QUIRK_ANY_INTERFACE, 90 90 .type = QUIRK_COMPOSITE,