This patch addresses a potential state inconsistency bug and optimizes
runtime performance:
1. Fix error handling in set_beep_amp():
Previously, beep_nid was assigned before adding kcontrols. If
kcontrol creation failed, the function returned error but left
beep_nid set, causing inconsistent driver state. Moved the
assignment to the end of the function.
2. Optimize senary_auto_turn_eapd():
Removed the redundant snd_hda_query_pin_caps() check inside the
loop. The target pins are sourced from spec->eapds, which is
strictly filtered during the initial parse phase. Checking
capabilities again during every mute/unmute hook is unnecessary
overhead.
Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
Link: https://patch.msgid.link/20260310023649.155858-1-wangdich9700@163.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Port the essential hardware initialization logic from the vendor driver
and introduce the standard HDA fixup framework to handle different
machine configurations.
Key changes:
1. Add hardware init verbs:
- Implement `senary_init_verb` to send the vendor-specific
initialization sequence required by the SN6186 chip.
- Override pin capabilities for Node 0x19 to ensure proper headset
microphone support.
2. Introduce fixup framework:
- Define a default pin configuration table (`senary_pincfg_default`)
to provide a fallback for devices with invalid BIOS configurations.
- Establish a quirk table structure for future machine-specific
fixes.
- Since the standard quirk matching relies on Subsystem IDs, we
manually apply the default fixup if `snd_hda_pick_fixup` does not
find a specific match.
This ensures the chip is correctly initialized during probe and resume,
and provides a scalable mechanism for supporting specific hardware
quirks.
Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
Link: https://patch.msgid.link/20260304070219.450083-1-wangdich9700@163.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The driver sets spec->gen.own_eapd_ctl to take manual control of the
EAPD (External Amplifier). However, senary_init does not turn on the
EAPD, while senary_shutdown turns it off.
Since the generic driver skips EAPD handling when own_eapd_ctl is set,
the EAPD remains off after initialization (e.g., after resume), leaving
the codec in a non-functional state.
Explicitly call senary_auto_turn_eapd in senary_init to ensure the EAPD
is enabled and the codec is functional.
Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
Link: https://patch.msgid.link/20260303081516.583438-1-wangdich9700@163.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Replace the hardcoded GPIO node ID (0x01) with codec->core.afg.
This follows the standard HDA driver practice and makes the driver
more robust against different hardware configurations.
Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
Link: https://patch.msgid.link/20260303054242.318062-1-wangdich9700@163.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This was done entirely with mindless brute force, using
git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'
to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.
Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.
For the same reason the 'flex' versions will be done as a separate
conversion.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:
Single allocations: kmalloc(sizeof(TYPE), ...)
are replaced with: kmalloc_obj(TYPE, ...)
Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with: kmalloc_objs(TYPE, COUNT, ...)
Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...)
(where TYPE may also be *VAR)
The resulting allocations no longer return "void *", instead returning
"TYPE *".
Signed-off-by: Kees Cook <kees@kernel.org>
Replace hardcoded GPIO node value with a defined constant for better
code readability and maintainability.
Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
Link: https://patch.msgid.link/20251107024030.36712-1-wangdich9700@163.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now move the all remaining codec drivers from sound/pci/hda to
sound/hda/codecs subdirectory. Some drivers are put under the further
vendor subdirectory, and the vendor helper code (*_helper.c) are put
under helpers subdirectory. Also the sub-codec drivers are moved under
a different subdirectory, sound/hda/codecs/sub-codecs, for
distinguishing from the main HD-audio codec drivers.
The prefix patch_ and hda_ as well as the suffix _helper are dropped
from file names as they are mostly superfluous.
No functional changes but just file path shuffling.
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250709160434.1859-7-tiwai@suse.de