summaryrefslogtreecommitdiff
path: root/sound/hda/common/codec.c
AgeCommit message (Collapse)Author
2025-07-11ALSA: hda: Use safer strscpy() instead of strcpy()Takashi Iwai
Use a safer function strscpy() instead of strcpy() for copying to arrays. Only idiomatic code replacement, and no functional changes. Link: https://patch.msgid.link/20250711083051.18759-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-07-11ALSA: hda: Return the codec init error properly at ↵Takashi Iwai
snd_hda_codec_build_controls() The error from snd_hda_codec_init() was ignored in snd_hda_codec_build_controls(), which should have been taken account and abort the flow. Fix it now. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250709160434.1859-28-tiwai@suse.de
2025-07-11ALSA: hda: Drop superfluous driver->ops NULL checksTakashi Iwai
After all conversions, driver->ops became a must in most places (except for the codec power setup which might be called before binding to the codec driver), hence we can get rid of the superfluous driver->ops NULL checks, too. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250709160434.1859-26-tiwai@suse.de
2025-07-11ALSA: hda: Drop old codec binding methodTakashi Iwai
Now that all patch_ops usage have been converted to the new hda_codec_ops probe, we can drop patch_ops from the hda_codec, together with the calls of patch_ops callbacks. The hda_codec_ops.free callback is removed as all have been replaced with the new remove callback. Also, correct comments mentioning "patch"; it's replaced with "codec driver". Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250709160434.1859-25-tiwai@suse.de
2025-07-11ALSA: hda: Introduce hda_codec_driver opsTakashi Iwai
Until now, we use "patch_ops" embedded in hda_codec object for defining the callbacks that are used in various places to manage HD-audio codec. But from the device driver POV, this should have been rather the driver ops, instead of the callbacks in the codec object. This patch defines the driver ops for HD-audio codec driver as the replacement. We reuse the same struct hda_codec_ops, and this is put as hda_codec_driver.ops. When the driver->ops callbacks are defined, they are called primarily instead of codec->patch_ops callbacks. With converting to the driver ops, there is no need to pass the ugly patch_ops handling in hda_device_id tables. That is, driver_data field of hda_device_id becomes really optional and it can be used for passing the codec-specific data (e.g. specifying a model). The codec entries after the conversion should be with HDA_CODEC_ID() and co, instead of the former HDA_CODEC_ENTRY(). Once after converting all codec drivers to use driver ops, we can get rid of codec patch_ops. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250709160434.1859-10-tiwai@suse.de
2025-07-11ALSA: hda: Move common codec driver into sound/hda/common directoryTakashi Iwai
The snd-hda-codec module contains the most of common code used by both HD-audio controller and codec drivers, and it's basically independent from PCI. Let's move the code to sound/hda/common directory as a part of code reorganization. The hda_ prefix is dropped from the most of file names as it's rather superfluous. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250709160434.1859-4-tiwai@suse.de