1. 29 Mar, 2023 3 commits
    • huangwenhui's avatar
      ALSA: hda/realtek: Add quirk for Lenovo ZhaoYang CF4620Z · 52aad393
      huangwenhui authored
      Fix headset microphone detection on Lenovo ZhaoYang CF4620Z.
      
      [ adjusted to be applicable to the latest tree -- tiwai ]
      Signed-off-by: default avatarhuangwenhui <huangwenhuia@uniontech.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20230328074644.30142-1-huangwenhuia@uniontech.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      52aad393
    • Tasos Sahanidis's avatar
      ALSA: ymfpci: Fix BUG_ON in probe function · 6be2e752
      Tasos Sahanidis authored
      The snd_dma_buffer.bytes field now contains the aligned size, which this
      snd_BUG_ON() did not account for, resulting in the following:
      
      [    9.625915] ------------[ cut here ]------------
      [    9.633440] WARNING: CPU: 0 PID: 126 at sound/pci/ymfpci/ymfpci_main.c:2168 snd_ymfpci_create+0x681/0x698 [snd_ymfpci]
      [    9.648926] Modules linked in: snd_ymfpci(+) snd_intel_dspcfg kvm(+) snd_intel_sdw_acpi snd_ac97_codec snd_mpu401_uart snd_opl3_lib irqbypass snd_hda_codec gameport snd_rawmidi crct10dif_pclmul crc32_pclmul cfg80211 snd_hda_core polyval_clmulni polyval_generic gf128mul snd_seq_device ghash_clmulni_intel snd_hwdep ac97_bus sha512_ssse3 rfkill snd_pcm aesni_intel tg3 snd_timer crypto_simd snd mxm_wmi libphy cryptd k10temp fam15h_power pcspkr soundcore sp5100_tco wmi acpi_cpufreq mac_hid dm_multipath sg loop fuse dm_mod bpf_preload ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 sr_mod cdrom ata_generic pata_acpi firewire_ohci crc32c_intel firewire_core xhci_pci crc_itu_t pata_via xhci_pci_renesas floppy
      [    9.711849] CPU: 0 PID: 126 Comm: kworker/0:2 Not tainted 6.1.21-1-lts #1 08d2e5ece03136efa7c6aeea9a9c40916b1bd8da
      [    9.722200] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./990FX Extreme4, BIOS P2.70 06/05/2014
      [    9.732204] Workqueue: events work_for_cpu_fn
      [    9.736580] RIP: 0010:snd_ymfpci_create+0x681/0x698 [snd_ymfpci]
      [    9.742594] Code: 8c c0 4c 89 e2 48 89 df 48 c7 c6 92 c6 8c c0 e8 15 d0 e9 ff 48 83 c4 08 44 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f e9 d3 7a 33 e3 <0f> 0b e9 cb fd ff ff 41 bd fb ff ff ff eb db 41 bd f4 ff ff ff eb
      [    9.761358] RSP: 0018:ffffab64804e7da0 EFLAGS: 00010287
      [    9.766594] RAX: ffff8fa2df06c400 RBX: ffff8fa3073a8000 RCX: ffff8fa303fbc4a8
      [    9.773734] RDX: ffff8fa2df06d000 RSI: 0000000000000010 RDI: 0000000000000020
      [    9.780876] RBP: ffff8fa300b5d0d0 R08: ffff8fa3073a8e50 R09: 00000000df06bf00
      [    9.788018] R10: ffff8fa2df06bf00 R11: 00000000df068200 R12: ffff8fa3073a8918
      [    9.795159] R13: 0000000000000000 R14: 0000000000000080 R15: ffff8fa2df068200
      [    9.802317] FS:  0000000000000000(0000) GS:ffff8fa9fec00000(0000) knlGS:0000000000000000
      [    9.810414] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [    9.816158] CR2: 000055febaf66500 CR3: 0000000101a2e000 CR4: 00000000000406f0
      [    9.823301] Call Trace:
      [    9.825747]  <TASK>
      [    9.827889]  snd_card_ymfpci_probe+0x194/0x950 [snd_ymfpci b78a5fe64b5663a6390a909c67808567e3e73615]
      [    9.837030]  ? finish_task_switch.isra.0+0x90/0x2d0
      [    9.841918]  local_pci_probe+0x45/0x80
      [    9.845680]  work_for_cpu_fn+0x1a/0x30
      [    9.849431]  process_one_work+0x1c7/0x380
      [    9.853464]  worker_thread+0x1af/0x390
      [    9.857225]  ? rescuer_thread+0x3b0/0x3b0
      [    9.861254]  kthread+0xde/0x110
      [    9.864414]  ? kthread_complete_and_exit+0x20/0x20
      [    9.869210]  ret_from_fork+0x22/0x30
      [    9.872792]  </TASK>
      [    9.874985] ---[ end trace 0000000000000000 ]---
      
      Fixes: 5c1733e3 ("ALSA: memalloc: Align buffer allocations in page size")
      Signed-off-by: default avatarTasos Sahanidis <tasos@tasossah.com>
      Link: https://lore.kernel.org/r/20230329032808.170403-1-tasos@tasossah.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6be2e752
    • Tasos Sahanidis's avatar
      ALSA: ymfpci: Create card with device-managed snd_devm_card_new() · f33fc157
      Tasos Sahanidis authored
      snd_card_ymfpci_remove() was removed in commit c6e6bb5e ("ALSA:
      ymfpci: Allocate resources with device-managed APIs"), but the call to
      snd_card_new() was not replaced with snd_devm_card_new().
      
      Since there was no longer a call to snd_card_free, unloading the module
      would eventually result in Oops:
      
      [697561.532887] BUG: unable to handle page fault for address: ffffffffc0924480
      [697561.532893] #PF: supervisor read access in kernel mode
      [697561.532896] #PF: error_code(0x0000) - not-present page
      [697561.532899] PGD ae1e15067 P4D ae1e15067 PUD ae1e17067 PMD 11a8f5067 PTE 0
      [697561.532905] Oops: 0000 [#1] PREEMPT SMP NOPTI
      [697561.532909] CPU: 21 PID: 5080 Comm: wireplumber Tainted: G        W  OE      6.2.7 #1
      [697561.532914] Hardware name: System manufacturer System Product Name/TUF GAMING X570-PLUS, BIOS 4408 10/28/2022
      [697561.532916] RIP: 0010:try_module_get.part.0+0x1a/0xe0
      [697561.532924] Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 55 41 54 49 89 fc bf 01 00 00 00 e8 56 3c f8 ff <41> 83 3c 24 02 0f 84 96 00 00 00 41 8b 84 24 30 03 00 00 85 c0 0f
      [697561.532927] RSP: 0018:ffffbe9b858c3bd8 EFLAGS: 00010246
      [697561.532930] RAX: ffff9815d14f1900 RBX: ffff9815c14e6000 RCX: 0000000000000000
      [697561.532933] RDX: 0000000000000000 RSI: ffffffffc055092c RDI: ffffffffb3778c1a
      [697561.532935] RBP: ffffbe9b858c3be8 R08: 0000000000000040 R09: ffff981a1a741380
      [697561.532937] R10: ffffbe9b858c3c80 R11: 00000009d56533a6 R12: ffffffffc0924480
      [697561.532939] R13: ffff9823439d8500 R14: 0000000000000025 R15: ffff9815cd109f80
      [697561.532942] FS:  00007f13084f1f80(0000) GS:ffff9824aef40000(0000) knlGS:0000000000000000
      [697561.532945] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [697561.532947] CR2: ffffffffc0924480 CR3: 0000000145344000 CR4: 0000000000350ee0
      [697561.532949] Call Trace:
      [697561.532951]  <TASK>
      [697561.532955]  try_module_get+0x13/0x30
      [697561.532960]  snd_ctl_open+0x61/0x1c0 [snd]
      [697561.532976]  snd_open+0xb4/0x1e0 [snd]
      [697561.532989]  chrdev_open+0xc7/0x240
      [697561.532995]  ? fsnotify_perm.part.0+0x6e/0x160
      [697561.533000]  ? __pfx_chrdev_open+0x10/0x10
      [697561.533005]  do_dentry_open+0x169/0x440
      [697561.533009]  vfs_open+0x2d/0x40
      [697561.533012]  path_openat+0xa9d/0x10d0
      [697561.533017]  ? debug_smp_processor_id+0x17/0x20
      [697561.533022]  ? trigger_load_balance+0x65/0x370
      [697561.533026]  do_filp_open+0xb2/0x160
      [697561.533032]  ? _raw_spin_unlock+0x19/0x40
      [697561.533036]  ? alloc_fd+0xa9/0x190
      [697561.533040]  do_sys_openat2+0x9f/0x160
      [697561.533044]  __x64_sys_openat+0x55/0x90
      [697561.533048]  do_syscall_64+0x3b/0x90
      [697561.533052]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
      [697561.533056] RIP: 0033:0x7f1308a40db4
      [697561.533059] Code: 24 20 eb 8f 66 90 44 89 54 24 0c e8 46 68 f8 ff 44 8b 54 24 0c 44 89 e2 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 32 44 89 c7 89 44 24 0c e8 78 68 f8 ff 8b 44
      [697561.533062] RSP: 002b:00007ffcce664450 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
      [697561.533066] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f1308a40db4
      [697561.533068] RDX: 0000000000080000 RSI: 00007ffcce664690 RDI: 00000000ffffff9c
      [697561.533070] RBP: 00007ffcce664690 R08: 0000000000000000 R09: 0000000000000012
      [697561.533072] R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000080000
      [697561.533074] R13: 00007f13054b069b R14: 0000565209f83200 R15: 0000000000000000
      [697561.533078]  </TASK>
      
      Fixes: c6e6bb5e ("ALSA: ymfpci: Allocate resources with device-managed APIs")
      Signed-off-by: default avatarTasos Sahanidis <tasos@tasossah.com>
      Link: https://lore.kernel.org/r/20230329032422.170024-1-tasos@tasossah.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f33fc157
  2. 24 Mar, 2023 1 commit
  3. 22 Mar, 2023 1 commit
  4. 21 Mar, 2023 2 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix recursive locking at XRUN during syncing · 8c721c53
      Takashi Iwai authored
      The recent support of low latency playback in USB-audio driver made
      the snd_usb_queue_pending_output_urbs() function to be called via PCM
      ack ops.  In the new code path, the function is performed already in
      the PCM stream lock.  The problem is that, when an XRUN is detected,
      the function calls snd_pcm_xrun() to notify, but snd_pcm_xrun() is
      supposed to be called only outside the stream lock.  As a result, it
      leads to a deadlock of PCM stream locking.
      
      For avoiding such a recursive locking, this patch adds an additional
      check to the code paths in PCM core that call the ack callback; now it
      checks the error code from the callback, and if it's -EPIPE, the XRUN
      is handled in the PCM core side gracefully.  Along with it, the
      USB-audio driver code is changed to follow that, i.e. -EPIPE is
      returned instead of the explicit snd_pcm_xrun() call when the function
      is performed already in the stream lock.
      
      Fixes: d5f871f8 ("ALSA: usb-audio: Improved lowlatency playback support")
      Reported-and-tested-by: default avatarJohn Keeping <john@metanate.com>
      Link: https://lore.kernel.org/r/20230317195128.3911155-1-john@metanate.comReviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Reviewed-by; Takashi Sakamoto <o-takashi@sakamocchi.jp>
      Link: https://lore.kernel.org/r/20230320142838.494-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      8c721c53
    • Takashi Iwai's avatar
      ALSA: hda/conexant: Partial revert of a quirk for Lenovo · b871cb97
      Takashi Iwai authored
      The recent commit f83bb259 ("ALSA: hda/conexant: Add quirk for
      LENOVO 20149 Notebook model") introduced a quirk for the device with
      17aa:3977, but this caused a regression on another model (Lenovo
      Ideadpad U31) with the very same PCI SSID.  And, through skimming over
      the net, it seems that this PCI SSID is used for multiple different
      models, so it's no good idea to apply the quirk with the SSID.
      
      Although we may take a different ID check (e.g. the codec SSID instead
      of the PCI SSID), unfortunately, the original patch author couldn't
      identify the hardware details any longer as the machine was returned,
      and we can't develop the further proper fix.
      
      In this patch, instead, we partially revert the change so that the
      quirk won't be applied as default for addressing the regression.
      Meanwhile, the quirk function itself is kept, and it's now made to be
      applicable via the explicit model=lenovo-20149 option.
      
      Fixes: f83bb259 ("ALSA: hda/conexant: Add quirk for LENOVO 20149 Notebook model")
      Reported-by: default avatarJetro Jormalainen <jje-lxkl@jetro.fi>
      Link: https://lore.kernel.org/r/20230308215009.4d3e58a6@mopti
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20230320140954.31154-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b871cb97
  5. 19 Mar, 2023 1 commit
  6. 14 Mar, 2023 2 commits
    • Kuninori Morimoto's avatar
      ALSA: hda/ca0132: fixup buffer overrun at tuning_ctl_set() · 98e5eb11
      Kuninori Morimoto authored
      tuning_ctl_set() might have buffer overrun at (X) if it didn't break
      from loop by matching (A).
      
      	static int tuning_ctl_set(...)
      	{
      		for (i = 0; i < TUNING_CTLS_COUNT; i++)
      (A)			if (nid == ca0132_tuning_ctls[i].nid)
      				break;
      
      		snd_hda_power_up(...);
      (X)		dspio_set_param(..., ca0132_tuning_ctls[i].mid, ...);
      		snd_hda_power_down(...);                ^
      
      		return 1;
      	}
      
      We will get below error by cppcheck
      
      	sound/pci/hda/patch_ca0132.c:4229:2: note: After for loop, i has value 12
      	 for (i = 0; i < TUNING_CTLS_COUNT; i++)
      	 ^
      	sound/pci/hda/patch_ca0132.c:4234:43: note: Array index out of bounds
      	 dspio_set_param(codec, ca0132_tuning_ctls[i].mid, 0x20,
      	                                           ^
      This patch cares non match case.
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87sfe9eap7.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      98e5eb11
    • Kuninori Morimoto's avatar
      ALSA: asihpi: check pao in control_message() · 9026c0bf
      Kuninori Morimoto authored
      control_message() might be called with pao = NULL.
      Here indicates control_message() as sample.
      
      (B)	static void control_message(struct hpi_adapter_obj *pao, ...)
      	{                                                   ^^^
      		struct hpi_hw_obj *phw = pao->priv;
      		...                      ^^^
      	}
      
      (A)	void _HPI_6205(struct hpi_adapter_obj *pao, ...)
      	{                                      ^^^
      		...
      		case HPI_OBJ_CONTROL:
      (B)			control_message(pao, phm, phr);
      			break;          ^^^
      		...
      	}
      
      	void HPI_6205(...)
      	{
      		...
      (A)		_HPI_6205(NULL, phm, phr);
      		...       ^^^^
      	}
      
      Therefore, We will get too many warning via cppcheck, like below
      
      	sound/pci/asihpi/hpi6205.c:238:27: warning: Possible null pointer dereference: pao [nullPointer]
      		 struct hpi_hw_obj *phw = pao->priv;
      		                          ^
      	sound/pci/asihpi/hpi6205.c:433:13: note: Calling function '_HPI_6205', 1st argument 'NULL' value is 0
      		  _HPI_6205(NULL, phm, phr);
      		            ^
      	sound/pci/asihpi/hpi6205.c:401:20: note: Calling function 'control_message', 1st argument 'pao' value is 0
      	   control_message(pao, phm, phr);
      	                   ^
      Set phr->error like many functions doing, and don't call _HPI_6205()
      with NULL.
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87ttypeaqz.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9026c0bf
  7. 10 Mar, 2023 1 commit
  8. 09 Mar, 2023 1 commit
  9. 08 Mar, 2023 5 commits
  10. 07 Mar, 2023 16 commits
  11. 06 Mar, 2023 6 commits
  12. 05 Mar, 2023 1 commit