]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: hda: Move common codec driver into sound/hda/common directory
authorTakashi Iwai <tiwai@suse.de>
Wed, 9 Jul 2025 16:04:06 +0000 (18:04 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 11 Jul 2025 07:55:37 +0000 (09:55 +0200)
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
21 files changed:
sound/hda/Kconfig
sound/hda/Makefile
sound/hda/common/Kconfig [new file with mode: 0644]
sound/hda/common/Makefile [new file with mode: 0644]
sound/hda/common/auto_parser.c [moved from sound/pci/hda/hda_auto_parser.c with 100% similarity]
sound/hda/common/beep.c [moved from sound/pci/hda/hda_beep.c with 100% similarity]
sound/hda/common/bind.c [moved from sound/pci/hda/hda_bind.c with 100% similarity]
sound/hda/common/codec.c [moved from sound/pci/hda/hda_codec.c with 100% similarity]
sound/hda/common/controller.c [moved from sound/pci/hda/hda_controller.c with 99% similarity]
sound/hda/common/controller_trace.h [moved from sound/pci/hda/hda_controller_trace.h with 97% similarity]
sound/hda/common/hda_auto_parser.h [moved from sound/pci/hda/hda_auto_parser.h with 100% similarity]
sound/hda/common/hda_beep.h [moved from sound/pci/hda/hda_beep.h with 100% similarity]
sound/hda/common/hda_controller.h [moved from sound/pci/hda/hda_controller.h with 100% similarity]
sound/hda/common/hda_jack.h [moved from sound/pci/hda/hda_jack.h with 100% similarity]
sound/hda/common/hda_local.h [moved from sound/pci/hda/hda_local.h with 100% similarity]
sound/hda/common/hwdep.c [moved from sound/pci/hda/hda_hwdep.c with 100% similarity]
sound/hda/common/jack.c [moved from sound/pci/hda/hda_jack.c with 100% similarity]
sound/hda/common/proc.c [moved from sound/pci/hda/hda_proc.c with 100% similarity]
sound/hda/common/sysfs.c [moved from sound/pci/hda/hda_sysfs.c with 100% similarity]
sound/pci/hda/Kconfig
sound/pci/hda/Makefile

index e380146560772f0db18cb1a3c9812b4b275a4548..2928cb570ec635f1da3cfddd33a880e77ae0c715 100644 (file)
@@ -1,2 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
+menu "HD-Audio"
+
+source "sound/hda/common/Kconfig"
 source "sound/hda/core/Kconfig"
+
+endmenu
index 3fdbc22b153041bd514a9651d81312dc9f03dff1..e7596bf736a467f821bc7b604b5627c8c33eae65 100644 (file)
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-y += core/
+obj-$(CONFIG_SND_HDA) += common/
diff --git a/sound/hda/common/Kconfig b/sound/hda/common/Kconfig
new file mode 100644 (file)
index 0000000..d1e2bfd
--- /dev/null
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+config SND_HDA
+       tristate
+       select SND_PCM
+       select SND_VMASTER
+       select SND_JACK
+       select SND_HDA_CORE
+
+if SND_HDA
+
+config SND_HDA_HWDEP
+       bool "Build hwdep interface for HD-audio driver"
+       select SND_HWDEP
+       help
+         Say Y here to build a hwdep interface for HD-audio driver.
+         This interface can be used for out-of-band communication
+         with codecs for debugging purposes.
+
+config SND_HDA_RECONFIG
+       bool "Allow dynamic codec reconfiguration"
+       help
+         Say Y here to enable the HD-audio codec re-configuration feature.
+         It allows user to clear the whole codec configuration, change the
+         codec setup, add extra verbs, and re-configure the codec dynamically.
+
+         Note that this item alone doesn't provide the sysfs interface, but
+         enables the feature just for the patch loader below.
+         If you need the traditional sysfs entries for the manual interaction,
+         turn on CONFIG_SND_HDA_HWDEP as well.
+
+config SND_HDA_INPUT_BEEP
+       bool "Support digital beep via input layer"
+       depends on INPUT=y || INPUT=SND_HDA
+       help
+         Say Y here to build a digital beep interface for HD-audio
+         driver. This interface is used to generate digital beeps.
+
+config SND_HDA_INPUT_BEEP_MODE
+       int "Digital beep registration mode (0=off, 1=on)"
+       depends on SND_HDA_INPUT_BEEP=y
+       default "1"
+       range 0 1
+       help
+         Set 0 to disable the digital beep interface for HD-audio by default.
+         Set 1 to always enable the digital beep interface for HD-audio by
+         default.
+
+config SND_HDA_PATCH_LOADER
+       bool "Support initialization patch loading for HD-audio"
+       select FW_LOADER
+       select SND_HDA_RECONFIG
+       help
+         Say Y here to allow the HD-audio driver to load a pseudo
+         firmware file ("patch") for overriding the BIOS setup at
+         start up.  The "patch" file can be specified via patch module
+         option, such as patch=hda-init.
+
+config SND_HDA_POWER_SAVE_DEFAULT
+       int "Default time-out for HD-audio power-save mode"
+       depends on PM
+       default 0
+       help
+         The default time-out value in seconds for HD-audio automatic
+         power-save mode.  0 means to disable the power-save mode.
+
+config SND_HDA_CTL_DEV_ID
+       bool "Use the device identifier field for controls"
+       depends on SND_HDA_INTEL
+       help
+         Say Y to use the device identifier field for (mixer)
+         controls (old behaviour until this option is available).
+
+         When enabled, the multiple HDA codecs may set the device
+         field in control (mixer) element identifiers. The use
+         of this field is not recommended and defined for mixer controls.
+
+         The old behaviour (Y) is obsolete and will be removed. Consider
+         to not enable this option.
+endif
diff --git a/sound/hda/common/Makefile b/sound/hda/common/Makefile
new file mode 100644 (file)
index 0000000..3344fa0
--- /dev/null
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0
+snd-hda-codec-y := bind.o codec.o jack.o auto_parser.o sysfs.o
+snd-hda-codec-y += controller.o
+snd-hda-codec-$(CONFIG_SND_PROC_FS) += proc.o
+
+snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hwdep.o
+snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += beep.o
+
+# for trace-points
+CFLAGS_controller.o := -I$(src)
+
+# common driver
+obj-$(CONFIG_SND_HDA) := snd-hda-codec.o
similarity index 99%
rename from sound/pci/hda/hda_controller.c
rename to sound/hda/common/controller.c
index f3330b7e0fcfc97eb452d1429631444a6a35a18a..84387ed761be9721a6de3e0ffbb82eeaba10c384 100644 (file)
@@ -29,7 +29,7 @@
 #include "hda_local.h"
 
 #define CREATE_TRACE_POINTS
-#include "hda_controller_trace.h"
+#include "controller_trace.h"
 
 /* DSP lock helpers */
 #define dsp_lock(dev)          snd_hdac_dsp_lock(azx_stream(dev))
similarity index 97%
rename from sound/pci/hda/hda_controller_trace.h
rename to sound/hda/common/controller_trace.h
index bf48304e230aa90df0386f0d065033bf926b47e8..7f5841f8919ec2d3c78e57912ce407b7a61d997f 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM hda_controller
-#define TRACE_INCLUDE_FILE hda_controller_trace
+#define TRACE_INCLUDE_FILE controller_trace
 
 #if !defined(_TRACE_HDA_CONTROLLER_H) || defined(TRACE_HEADER_MULTI_READ)
 #define _TRACE_HDA_CONTROLLER_H
index 745f120a5cee2f418a11d375aa8a2c6bac8694b1..1dfd56493d3997ef52318537ad39b870b27a4a1e 100644 (file)
@@ -1,13 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 menu "HD-Audio"
 
-config SND_HDA
-       tristate
-       select SND_PCM
-       select SND_VMASTER
-       select SND_JACK
-       select SND_HDA_CORE
-
 config SND_HDA_GENERIC_LEDS
        bool
 
@@ -55,53 +48,6 @@ config SND_HDA_ACPI
 
 if SND_HDA
 
-config SND_HDA_HWDEP
-       bool "Build hwdep interface for HD-audio driver"
-       select SND_HWDEP
-       help
-         Say Y here to build a hwdep interface for HD-audio driver.
-         This interface can be used for out-of-band communication
-         with codecs for debugging purposes.
-
-config SND_HDA_RECONFIG
-       bool "Allow dynamic codec reconfiguration"
-       help
-         Say Y here to enable the HD-audio codec re-configuration feature.
-         It allows user to clear the whole codec configuration, change the
-         codec setup, add extra verbs, and re-configure the codec dynamically.
-
-         Note that this item alone doesn't provide the sysfs interface, but
-         enables the feature just for the patch loader below.
-         If you need the traditional sysfs entries for the manual interaction,
-         turn on CONFIG_SND_HDA_HWDEP as well.
-
-config SND_HDA_INPUT_BEEP
-       bool "Support digital beep via input layer"
-       depends on INPUT=y || INPUT=SND_HDA
-       help
-         Say Y here to build a digital beep interface for HD-audio
-         driver. This interface is used to generate digital beeps.
-
-config SND_HDA_INPUT_BEEP_MODE
-       int "Digital beep registration mode (0=off, 1=on)"
-       depends on SND_HDA_INPUT_BEEP=y
-       default "1"
-       range 0 1
-       help
-         Set 0 to disable the digital beep interface for HD-audio by default.
-         Set 1 to always enable the digital beep interface for HD-audio by
-         default.
-
-config SND_HDA_PATCH_LOADER
-       bool "Support initialization patch loading for HD-audio"
-       select FW_LOADER
-       select SND_HDA_RECONFIG
-       help
-         Say Y here to allow the HD-audio driver to load a pseudo
-         firmware file ("patch") for overriding the BIOS setup at
-         start up.  The "patch" file can be specified via patch module
-         option, such as patch=hda-init.
-
 config SND_HDA_CIRRUS_SCODEC
        tristate
 
@@ -394,14 +340,6 @@ config SND_HDA_GENERIC
 comment "Set to Y if you want auto-loading the codec driver"
        depends on SND_HDA=y && SND_HDA_GENERIC=m
 
-config SND_HDA_POWER_SAVE_DEFAULT
-       int "Default time-out for HD-audio power-save mode"
-       depends on PM
-       default 0
-       help
-         The default time-out value in seconds for HD-audio automatic
-         power-save mode.  0 means to disable the power-save mode.
-
 config SND_HDA_INTEL_HDMI_SILENT_STREAM
        bool "Enable Silent Stream always for HDMI"
        depends on SND_HDA_INTEL
@@ -417,20 +355,6 @@ config SND_HDA_INTEL_HDMI_SILENT_STREAM
          This feature can impact power consumption as resources
          are kept reserved both at transmitter and receiver.
 
-config SND_HDA_CTL_DEV_ID
-       bool "Use the device identifier field for controls"
-       depends on SND_HDA_INTEL
-       help
-         Say Y to use the device identifier field for (mixer)
-         controls (old behaviour until this option is available).
-
-         When enabled, the multiple HDA codecs may set the device
-         field in control (mixer) element identifiers. The use
-         of this field is not recommended and defined for mixer controls.
-
-         The old behaviour (Y) is obsolete and will be removed. Consider
-         to not enable this option.
-
 endif
 
 endmenu
index a5ab8ee2d7f941bc600a8893ca8739a294999ad0..920011bb1b06c01b15ee36dcbd04510a0eb443a0 100644 (file)
@@ -3,17 +3,11 @@ snd-hda-intel-y := hda_intel.o
 snd-hda-tegra-y := hda_tegra.o
 snd-hda-acpi-y := hda_acpi.o
 
-snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o
-snd-hda-codec-y += hda_controller.o
-snd-hda-codec-$(CONFIG_SND_PROC_FS) += hda_proc.o
-
-snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
-snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
-
 # for trace-points
-CFLAGS_hda_controller.o := -I$(src)
 CFLAGS_hda_intel.o := -I$(src)
 
+subdir-ccflags-y += -I$(src)/../../hda/common
+
 snd-hda-codec-generic-y :=     hda_generic.o
 snd-hda-codec-realtek-y :=     patch_realtek.o
 snd-hda-codec-cmedia-y :=      patch_cmedia.o
@@ -43,9 +37,6 @@ snd-hda-scodec-tas2781-y :=   tas2781_hda.o
 snd-hda-scodec-tas2781-i2c-y :=        tas2781_hda_i2c.o
 snd-hda-scodec-tas2781-spi-y :=        tas2781_hda_spi.o
 
-# common driver
-obj-$(CONFIG_SND_HDA) := snd-hda-codec.o
-
 # codec drivers
 obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o
 obj-$(CONFIG_SND_HDA_CODEC_REALTEK) += snd-hda-codec-realtek.o