[alsa-devel] [RFC 0/5] Create hdalib for common hda code
This patch series attempts to split existing HDA code to create common hda library. This is done in order to make HDA code available to other users like upcoming Intel platforms which sport a HDA controller along with an I2S link. This series is 1st patch series which will try to refactor HDA by splitting it up and then adding ASoC HDA controller driver for these platforms.
This series moves code to sound/hda, renames the files mostly. The second series will do API changes and subsequent ones will be using HDA bus patches which Takashi posted recently
Comments welcome...
~Vinod
Jeeja KP (5): ALSA: hda: move hdaudio header files to global include ALSA: HDA: create HDA common lib ALSA: hdalib - fix existing checkpatch issues ALSA: hda: rename sound/hda/hda* as sound/hda/hdalib ALSA: hdalib: rename common header files as hdalib_*
.../hda/hda_priv.h => include/sound/hda_register.h | 10 +-- .../sound/hdalib_auto_parser.h | 6 +- .../hda/hda_beep.h => include/sound/hdalib_beep.h | 6 +- .../hda_codec.h => include/sound/hdalib_codec.h | 23 +++--- .../sound/hdalib_controller.h | 11 +-- .../hda_local.h => include/sound/hdalib_controls.h | 20 ++--- .../sound/hdalib_generic.h | 6 +- include/sound/{hda_hwdep.h => hdalib_hwdep.h} | 4 +- .../hda/hda_jack.h => include/sound/hdalib_jack.h | 6 +- sound/Kconfig | 2 + sound/Makefile | 2 +- sound/hda/Kconfig | 85 ++++++++++++++++++++ sound/hda/Makefile | 21 +++++ sound/{pci => }/hda/hda_intel_trace.h | 0 sound/{pci => }/hda/hda_trace.h | 0 .../hda_auto_parser.c => hda/hdalib_auto_parser.c} | 7 +- sound/{pci/hda/hda_beep.c => hda/hdalib_beep.c} | 8 +- sound/{pci/hda/hda_codec.c => hda/hdalib_codec.c} | 21 +++-- .../hda_controller.c => hda/hdalib_controller.c} | 10 ++- sound/{pci/hda/hda_eld.c => hda/hdalib_eld.c} | 4 +- .../hda/hda_generic.c => hda/hdalib_generic.c} | 13 +-- sound/{pci/hda/hda_hwdep.c => hda/hdalib_hwdep.c} | 6 +- sound/{pci/hda/hda_jack.c => hda/hdalib_jack.c} | 8 +- sound/{pci/hda/hda_proc.c => hda/hdalib_proc.c} | 13 +-- sound/{pci/hda/hda_sysfs.c => hda/hdalib_sysfs.c} | 6 +- sound/pci/hda/Kconfig | 44 ---------- sound/pci/hda/Makefile | 14 +--- sound/pci/hda/hda_i915.c | 3 +- sound/pci/hda/hda_intel.c | 7 +- sound/pci/hda/patch_hdmi.c | 10 ++- sound/pci/hda/patch_realtek.c | 10 ++- 31 files changed, 229 insertions(+), 157 deletions(-) rename sound/pci/hda/hda_priv.h => include/sound/hda_register.h (98%) rename sound/pci/hda/hda_auto_parser.h => include/sound/hdalib_auto_parser.h (96%) rename sound/pci/hda/hda_beep.h => include/sound/hdalib_beep.h (95%) rename sound/pci/hda/hda_codec.h => include/sound/hdalib_codec.h (97%) rename sound/pci/hda/hda_controller.h => include/sound/hdalib_controller.h (90%) rename sound/pci/hda/hda_local.h => include/sound/hdalib_controls.h (98%) rename sound/pci/hda/hda_generic.h => include/sound/hdalib_generic.h (99%) rename include/sound/{hda_hwdep.h => hdalib_hwdep.h} (95%) rename sound/pci/hda/hda_jack.h => include/sound/hdalib_jack.h (96%) create mode 100644 sound/hda/Kconfig create mode 100644 sound/hda/Makefile rename sound/{pci => }/hda/hda_intel_trace.h (100%) rename sound/{pci => }/hda/hda_trace.h (100%) rename sound/{pci/hda/hda_auto_parser.c => hda/hdalib_auto_parser.c} (99%) rename sound/{pci/hda/hda_beep.c => hda/hdalib_beep.c} (98%) rename sound/{pci/hda/hda_codec.c => hda/hdalib_codec.c} (99%) rename sound/{pci/hda/hda_controller.c => hda/hdalib_controller.c} (99%) rename sound/{pci/hda/hda_eld.c => hda/hdalib_eld.c} (99%) rename sound/{pci/hda/hda_generic.c => hda/hdalib_generic.c} (99%) rename sound/{pci/hda/hda_hwdep.c => hda/hdalib_hwdep.c} (96%) rename sound/{pci/hda/hda_jack.c => hda/hdalib_jack.c} (99%) rename sound/{pci/hda/hda_proc.c => hda/hdalib_proc.c} (99%) rename sound/{pci/hda/hda_sysfs.c => hda/hdalib_sysfs.c} (99%)
From: Jeeja KP jeeja.kp@intel.com
The hd-audio headers are local to sound/pci/hda. Moving them out helps to use these headers in other places like the upcoming ASoC HDA code
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- {sound/pci/hda => include/sound}/hda_auto_parser.h | 0 {sound/pci/hda => include/sound}/hda_beep.h | 0 {sound/pci/hda => include/sound}/hda_codec.h | 0 {sound/pci/hda => include/sound}/hda_controller.h | 0 {sound/pci/hda => include/sound}/hda_generic.h | 0 {sound/pci/hda => include/sound}/hda_jack.h | 0 {sound/pci/hda => include/sound}/hda_local.h | 0 {sound/pci/hda => include/sound}/hda_priv.h | 0 sound/pci/hda/hda_auto_parser.c | 6 +++--- sound/pci/hda/hda_beep.c | 4 ++-- sound/pci/hda/hda_codec.c | 8 ++++---- sound/pci/hda/hda_controller.c | 4 ++-- sound/pci/hda/hda_eld.c | 4 ++-- sound/pci/hda/hda_generic.c | 12 ++++++------ sound/pci/hda/hda_hwdep.c | 4 ++-- sound/pci/hda/hda_i915.c | 2 +- sound/pci/hda/hda_intel.c | 6 +++--- sound/pci/hda/hda_jack.c | 8 ++++---- sound/pci/hda/hda_proc.c | 4 ++-- sound/pci/hda/hda_sysfs.c | 4 ++-- 20 files changed, 33 insertions(+), 33 deletions(-) rename {sound/pci/hda => include/sound}/hda_auto_parser.h (100%) rename {sound/pci/hda => include/sound}/hda_beep.h (100%) rename {sound/pci/hda => include/sound}/hda_codec.h (100%) rename {sound/pci/hda => include/sound}/hda_controller.h (100%) rename {sound/pci/hda => include/sound}/hda_generic.h (100%) rename {sound/pci/hda => include/sound}/hda_jack.h (100%) rename {sound/pci/hda => include/sound}/hda_local.h (100%) rename {sound/pci/hda => include/sound}/hda_priv.h (100%)
diff --git a/sound/pci/hda/hda_auto_parser.h b/include/sound/hda_auto_parser.h similarity index 100% rename from sound/pci/hda/hda_auto_parser.h rename to include/sound/hda_auto_parser.h diff --git a/sound/pci/hda/hda_beep.h b/include/sound/hda_beep.h similarity index 100% rename from sound/pci/hda/hda_beep.h rename to include/sound/hda_beep.h diff --git a/sound/pci/hda/hda_codec.h b/include/sound/hda_codec.h similarity index 100% rename from sound/pci/hda/hda_codec.h rename to include/sound/hda_codec.h diff --git a/sound/pci/hda/hda_controller.h b/include/sound/hda_controller.h similarity index 100% rename from sound/pci/hda/hda_controller.h rename to include/sound/hda_controller.h diff --git a/sound/pci/hda/hda_generic.h b/include/sound/hda_generic.h similarity index 100% rename from sound/pci/hda/hda_generic.h rename to include/sound/hda_generic.h diff --git a/sound/pci/hda/hda_jack.h b/include/sound/hda_jack.h similarity index 100% rename from sound/pci/hda/hda_jack.h rename to include/sound/hda_jack.h diff --git a/sound/pci/hda/hda_local.h b/include/sound/hda_local.h similarity index 100% rename from sound/pci/hda/hda_local.h rename to include/sound/hda_local.h diff --git a/sound/pci/hda/hda_priv.h b/include/sound/hda_priv.h similarity index 100% rename from sound/pci/hda/hda_priv.h rename to include/sound/hda_priv.h diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c index 1ede82200ee5..e518a74b3d66 100644 --- a/sound/pci/hda/hda_auto_parser.c +++ b/sound/pci/hda/hda_auto_parser.c @@ -13,9 +13,9 @@ #include <linux/export.h> #include <linux/sort.h> #include <sound/core.h> -#include "hda_codec.h" -#include "hda_local.h" -#include "hda_auto_parser.h" +#include <sound/hda_codec.h> +#include <sound/hda_local.h> +#include <sound/hda_auto_parser.h>
/* * Helper for automatic pin configuration diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 1e7de08e77cb..3ce849899bb5 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c @@ -24,8 +24,8 @@ #include <linux/workqueue.h> #include <linux/export.h> #include <sound/core.h> -#include "hda_beep.h" -#include "hda_local.h" +#include <sound/hda_beep.h> +#include <sound/hda_local.h>
enum { DIGBEEP_HZ_STEP = 46875, /* 46.875 Hz */ diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 2fe86d2e1b09..5eb244a02b59 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -27,14 +27,14 @@ #include <linux/module.h> #include <linux/async.h> #include <sound/core.h> -#include "hda_codec.h" +#include <sound/hda_codec.h> #include <sound/asoundef.h> #include <sound/tlv.h> #include <sound/initval.h> #include <sound/jack.h> -#include "hda_local.h" -#include "hda_beep.h" -#include "hda_jack.h" +#include <sound/hda_local.h> +#include <sound/hda_beep.h> +#include <sound/hda_jack.h> #include <sound/hda_hwdep.h>
#define CREATE_TRACE_POINTS diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 0cfc9c8c4b4e..5ae5fcb9b8a9 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -30,8 +30,8 @@ #include <linux/reboot.h> #include <sound/core.h> #include <sound/initval.h> -#include "hda_priv.h" -#include "hda_controller.h" +#include <sound/hda_priv.h> +#include <sound/hda_controller.h>
#define CREATE_TRACE_POINTS #include "hda_intel_trace.h" diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 0e6d7534f491..f1b6493c65d9 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c @@ -26,8 +26,8 @@ #include <linux/slab.h> #include <sound/core.h> #include <asm/unaligned.h> -#include "hda_codec.h" -#include "hda_local.h" +#include <sound/hda_codec.h> +#include <sound/hda_local.h>
enum eld_versions { ELD_VER_CEA_861D = 2, diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index b680b4ec6331..bac07550f7be 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -32,12 +32,12 @@ #include <sound/core.h> #include <sound/jack.h> #include <sound/tlv.h> -#include "hda_codec.h" -#include "hda_local.h" -#include "hda_auto_parser.h" -#include "hda_jack.h" -#include "hda_beep.h" -#include "hda_generic.h" +#include <sound/hda_codec.h> +#include <sound/hda_local.h> +#include <sound/hda_auto_parser.h> +#include <sound/hda_jack.h> +#include <sound/hda_beep.h> +#include <sound/hda_generic.h>
/** diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 014a7849e8fd..8b17ad1cbb1b 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c @@ -22,8 +22,8 @@ #include <linux/slab.h> #include <linux/compat.h> #include <sound/core.h> -#include "hda_codec.h" -#include "hda_local.h" +#include <sound/hda_codec.h> +#include <sound/hda_local.h> #include <sound/hda_hwdep.h> #include <sound/minors.h>
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c index d4d0375ac181..ca15d465c8b0 100644 --- a/sound/pci/hda/hda_i915.c +++ b/sound/pci/hda/hda_i915.c @@ -20,7 +20,7 @@ #include <linux/module.h> #include <sound/core.h> #include <drm/i915_powerwell.h> -#include "hda_priv.h" +#include <sound/hda_priv.h> #include "hda_i915.h"
/* Intel HSW/BDW display HDA controller Extended Mode registers. diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index d426a0bd6a5f..70606016843b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -60,9 +60,9 @@ #include <linux/vgaarb.h> #include <linux/vga_switcheroo.h> #include <linux/firmware.h> -#include "hda_codec.h" -#include "hda_controller.h" -#include "hda_priv.h" +#include <sound/hda_codec.h> +#include <sound/hda_controller.h> +#include <sound/hda_priv.h> #include "hda_i915.h"
/* position fix mode */ diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index e664307617bd..bcaee91e655e 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -15,10 +15,10 @@ #include <sound/core.h> #include <sound/control.h> #include <sound/jack.h> -#include "hda_codec.h" -#include "hda_local.h" -#include "hda_auto_parser.h" -#include "hda_jack.h" +#include <sound/hda_codec.h> +#include <sound/hda_local.h> +#include <sound/hda_auto_parser.h> +#include <sound/hda_jack.h>
/** * is_jack_detectable - Check whether the given pin is jack-detectable diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index ce5a6da83419..9c60c8cbe89d 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -25,8 +25,8 @@ #include <linux/slab.h> #include <sound/core.h> #include <linux/module.h> -#include "hda_codec.h" -#include "hda_local.h" +#include <sound/hda_codec.h> +#include <sound/hda_local.h>
static int dump_coef = -1; module_param(dump_coef, int, 0644); diff --git a/sound/pci/hda/hda_sysfs.c b/sound/pci/hda/hda_sysfs.c index ccc962a1699f..b25001cc3f83 100644 --- a/sound/pci/hda/hda_sysfs.c +++ b/sound/pci/hda/hda_sysfs.c @@ -14,8 +14,8 @@ #include <linux/string.h> #include <linux/export.h> #include <sound/core.h> -#include "hda_codec.h" -#include "hda_local.h" +#include <sound/hda_codec.h> +#include <sound/hda_local.h> #include <sound/hda_hwdep.h> #include <sound/minors.h>
From: Jeeja KP jeeja.kp@intel.com
Move the common hda controller and hda codec code from sound/pci/hda/ to sound/hda. This new location will serve as common HDA lib uses by current code as well as upcoming ASoC HDA implementations
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/Kconfig | 2 + sound/Makefile | 2 +- sound/hda/Kconfig | 85 +++++++++++++++++++++++++++++++++ sound/hda/Makefile | 20 ++++++++ sound/{pci => }/hda/hda_auto_parser.c | 0 sound/{pci => }/hda/hda_beep.c | 0 sound/{pci => }/hda/hda_codec.c | 0 sound/{pci => }/hda/hda_controller.c | 0 sound/{pci => }/hda/hda_eld.c | 0 sound/{pci => }/hda/hda_generic.c | 0 sound/{pci => }/hda/hda_hwdep.c | 0 sound/{pci => }/hda/hda_intel_trace.h | 0 sound/{pci => }/hda/hda_jack.c | 0 sound/{pci => }/hda/hda_proc.c | 0 sound/{pci => }/hda/hda_sysfs.c | 0 sound/{pci => }/hda/hda_trace.h | 0 sound/pci/hda/Kconfig | 44 ----------------- sound/pci/hda/Makefile | 14 +----- 18 files changed, 110 insertions(+), 57 deletions(-) create mode 100644 sound/hda/Kconfig create mode 100644 sound/hda/Makefile rename sound/{pci => }/hda/hda_auto_parser.c (100%) rename sound/{pci => }/hda/hda_beep.c (100%) rename sound/{pci => }/hda/hda_codec.c (100%) rename sound/{pci => }/hda/hda_controller.c (100%) rename sound/{pci => }/hda/hda_eld.c (100%) rename sound/{pci => }/hda/hda_generic.c (100%) rename sound/{pci => }/hda/hda_hwdep.c (100%) rename sound/{pci => }/hda/hda_intel_trace.h (100%) rename sound/{pci => }/hda/hda_jack.c (100%) rename sound/{pci => }/hda/hda_proc.c (100%) rename sound/{pci => }/hda/hda_sysfs.c (100%) rename sound/{pci => }/hda/hda_trace.h (100%)
diff --git a/sound/Kconfig b/sound/Kconfig index c710ce2c5c37..63233752ee01 100644 --- a/sound/Kconfig +++ b/sound/Kconfig @@ -90,6 +90,8 @@ source "sound/mips/Kconfig"
source "sound/sh/Kconfig"
+source "sound/hda/Kconfig" + # the following will depend on the order of config. # here assuming USB is defined before ALSA source "sound/usb/Kconfig" diff --git a/sound/Makefile b/sound/Makefile index ce9132b1c395..0e5c4283f4a4 100644 --- a/sound/Makefile +++ b/sound/Makefile @@ -5,7 +5,7 @@ obj-$(CONFIG_SOUND) += soundcore.o obj-$(CONFIG_SOUND_PRIME) += sound_firmware.o obj-$(CONFIG_SOUND_PRIME) += oss/ obj-$(CONFIG_DMASOUND) += oss/ -obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \ +obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ hda/ synth/ usb/ \ firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ obj-$(CONFIG_SND_AOA) += aoa/
diff --git a/sound/hda/Kconfig b/sound/hda/Kconfig new file mode 100644 index 000000000000..7e1f1a07cb6e --- /dev/null +++ b/sound/hda/Kconfig @@ -0,0 +1,85 @@ +menu "HD-Audio Common Library" + +config SND_CORE_HDA + tristate "Enable HD Audio Common Library" + default n + select SND_VMASTER + select SND_KCTL_JACK + help + Say Y here to enable the HD-audio codec common library. + +if SND_CORE_HDA + +config SND_HDA_PREALLOC_SIZE + int "Pre-allocated buffer size for HD-audio driver" + range 0 32768 + default 64 + help + Specifies the default pre-allocated buffer-size in kB for the + HD-audio driver. A larger buffer (e.g. 2048) is preferred for systems + using PulseAudio. The default 64 is chosen just + for compatibility reasons. + + Note that the pre-allocation size can be changed dynamically + via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too. + +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_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_RECONFIG + bool "Allow dynamic codec reconfiguration" + help + Say Y here to enable the HD-audio codec re-configuration feature. + This adds the sysfs interfaces to allow user to clear the whole + codec configuration, change the codec setup, add extra verbs, + and re-configure the codec dynamically. + +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_INPUT_JACK + bool "Support jack plugging notification via input layer" + depends on INPUT=y || INPUT=SND + select SND_JACK + help + Say Y here to enable the jack plugging notification via + input layer. + +config SND_CORE_HDA_GENERIC + tristate "Enable generic HD-audio codec parser" + help + Say Y or M here to enable the generic HD-audio codec parser + in HDA library. + +endif + +endmenu diff --git a/sound/hda/Makefile b/sound/hda/Makefile new file mode 100644 index 000000000000..6862de9bcbb6 --- /dev/null +++ b/sound/hda/Makefile @@ -0,0 +1,20 @@ +snd-hda-controller-objs := hda_controller.o +snd-hda-codec-y := hda_codec.o hda_jack.o hda_auto_parser.o \ + hda_eld.o hda_sysfs.o + +snd-hda-codec-$(CONFIG_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_codec.o := -I$(src) + +snd-hda-codec-generic-objs := hda_generic.o + +# common driver +obj-$(CONFIG_SND_CORE_HDA) += snd-hda-codec.o +obj-$(CONFIG_SND_CORE_HDA) += snd-hda-controller.o + +# codec drivers +obj-$(CONFIG_SND_CORE_HDA_GENERIC) += snd-hda-codec-generic.o diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/hda/hda_auto_parser.c similarity index 100% rename from sound/pci/hda/hda_auto_parser.c rename to sound/hda/hda_auto_parser.c diff --git a/sound/pci/hda/hda_beep.c b/sound/hda/hda_beep.c similarity index 100% rename from sound/pci/hda/hda_beep.c rename to sound/hda/hda_beep.c diff --git a/sound/pci/hda/hda_codec.c b/sound/hda/hda_codec.c similarity index 100% rename from sound/pci/hda/hda_codec.c rename to sound/hda/hda_codec.c diff --git a/sound/pci/hda/hda_controller.c b/sound/hda/hda_controller.c similarity index 100% rename from sound/pci/hda/hda_controller.c rename to sound/hda/hda_controller.c diff --git a/sound/pci/hda/hda_eld.c b/sound/hda/hda_eld.c similarity index 100% rename from sound/pci/hda/hda_eld.c rename to sound/hda/hda_eld.c diff --git a/sound/pci/hda/hda_generic.c b/sound/hda/hda_generic.c similarity index 100% rename from sound/pci/hda/hda_generic.c rename to sound/hda/hda_generic.c diff --git a/sound/pci/hda/hda_hwdep.c b/sound/hda/hda_hwdep.c similarity index 100% rename from sound/pci/hda/hda_hwdep.c rename to sound/hda/hda_hwdep.c diff --git a/sound/pci/hda/hda_intel_trace.h b/sound/hda/hda_intel_trace.h similarity index 100% rename from sound/pci/hda/hda_intel_trace.h rename to sound/hda/hda_intel_trace.h diff --git a/sound/pci/hda/hda_jack.c b/sound/hda/hda_jack.c similarity index 100% rename from sound/pci/hda/hda_jack.c rename to sound/hda/hda_jack.c diff --git a/sound/pci/hda/hda_proc.c b/sound/hda/hda_proc.c similarity index 100% rename from sound/pci/hda/hda_proc.c rename to sound/hda/hda_proc.c diff --git a/sound/pci/hda/hda_sysfs.c b/sound/hda/hda_sysfs.c similarity index 100% rename from sound/pci/hda/hda_sysfs.c rename to sound/hda/hda_sysfs.c diff --git a/sound/pci/hda/hda_trace.h b/sound/hda/hda_trace.h similarity index 100% rename from sound/pci/hda/hda_trace.h rename to sound/hda/hda_trace.h diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index ebf4c2fb99df..7a821ebb3bc2 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig @@ -3,8 +3,6 @@ menu "HD-Audio" config SND_HDA tristate select SND_PCM - select SND_VMASTER - select SND_KCTL_JACK
config SND_HDA_INTEL tristate "HD Audio PCI" @@ -61,39 +59,6 @@ config SND_HDA_HWDEP 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. - This adds the sysfs interfaces to allow user to clear the whole - codec configuration, change the codec setup, add extra verbs, - and re-configure the codec dynamically. - -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_INPUT_JACK - bool "Support jack plugging notification via input layer" - depends on INPUT=y || INPUT=SND - select SND_JACK - help - Say Y here to enable the jack plugging notification via - input layer. - config SND_HDA_PATCH_LOADER bool "Support initialization patch loading for HD-audio" select FW_LOADER @@ -229,15 +194,6 @@ config SND_HDA_CODEC_SI3054 comment "Set to Y if you want auto-loading the codec driver" depends on SND_HDA=y && SND_HDA_CODEC_SI3054=m
-config SND_HDA_GENERIC - tristate "Enable generic HD-audio codec parser" - help - Say Y or M here to enable the generic HD-audio codec parser - in snd-hda-intel driver. - -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 diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index 194f30935e77..62c0f3f3424f 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile @@ -1,19 +1,11 @@ snd-hda-intel-objs := hda_intel.o -snd-hda-controller-objs := hda_controller.o snd-hda-tegra-objs := hda_tegra.o # for haswell power well snd-hda-intel-$(CONFIG_SND_HDA_I915) += hda_i915.o
-snd-hda-codec-y := hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o -snd-hda-codec-$(CONFIG_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_codec.o := -I$(src) -CFLAGS_hda_controller.o := -I$(src) +#CFLAGS_hda_controller.o := -I$(src)
-snd-hda-codec-generic-objs := hda_generic.o snd-hda-codec-realtek-objs := patch_realtek.o snd-hda-codec-cmedia-objs := patch_cmedia.o snd-hda-codec-analog-objs := patch_analog.o @@ -27,11 +19,9 @@ snd-hda-codec-via-objs := patch_via.o snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o
# common driver -obj-$(CONFIG_SND_HDA) := snd-hda-codec.o -obj-$(CONFIG_SND_HDA) += snd-hda-controller.o +#obj-$(CONFIG_SND_HDA) += snd-hda-controller.o
# codec drivers -obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o obj-$(CONFIG_SND_HDA_CODEC_REALTEK) += snd-hda-codec-realtek.o obj-$(CONFIG_SND_HDA_CODEC_CMEDIA) += snd-hda-codec-cmedia.o obj-$(CONFIG_SND_HDA_CODEC_ANALOG) += snd-hda-codec-analog.o
From: Jeeja KP jeeja.kp@intel.com
The existing code seems to have a bit of checkpatch errors creeped in, so take this opportinuty to fix them as well
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- include/sound/hda_codec.h | 10 +++++----- include/sound/hda_local.h | 14 +++++++------- sound/hda/hda_beep.c | 2 +- sound/hda/hda_codec.c | 4 ++-- sound/hda/hda_proc.c | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h index 9c8820f21f94..f5d7717dfca6 100644 --- a/include/sound/hda_codec.h +++ b/include/sound/hda_codec.h @@ -144,11 +144,11 @@ struct hda_bus { DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES);
/* misc op flags */ - unsigned int needs_damn_long_delay :1; + unsigned int needs_damn_long_delay:1; unsigned int allow_bus_reset:1; /* allow bus reset at fatal error */ unsigned int sync_write:1; /* sync after verb write */ /* status for codec/controller */ - unsigned int shutdown :1; /* being unloaded */ + unsigned int shutdown:1; /* being unloaded */ unsigned int rirb_error:1; /* error in codec communication */ unsigned int response_reset:1; /* controller was reset */ unsigned int in_reset:1; /* during reset operation */ @@ -174,7 +174,7 @@ struct hda_codec_preset { const char *name; int (*patch)(struct hda_codec *codec); }; - + struct hda_codec_preset_list { const struct hda_codec_preset *preset; struct module *owner; @@ -345,7 +345,7 @@ struct hda_codec { #endif
/* misc flags */ - unsigned int spdif_status_reset :1; /* needs to toggle SPDIF for each + unsigned int spdif_status_reset:1; /* needs to toggle SPDIF for each * status change * (e.g. Realtek codecs) */ @@ -367,7 +367,7 @@ struct hda_codec { unsigned int dp_mst:1; /* support DP1.2 Multi-stream transport */ unsigned int dump_coef:1; /* dump processing coefs in codec proc file */ #ifdef CONFIG_PM - unsigned int power_on :1; /* current (global) power-state */ + unsigned int power_on:1; /* current (global) power-state */ unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */ unsigned int pm_up_notified:1; /* PM notified to controller */ unsigned int in_pm:1; /* suspend/resume being performed */ diff --git a/include/sound/hda_local.h b/include/sound/hda_local.h index 62658f2f8c9f..d5aedd811806 100644 --- a/include/sound/hda_local.h +++ b/include/sound/hda_local.h @@ -26,7 +26,7 @@ /* We abuse kcontrol_new.subdev field to pass the NID corresponding to * the given new control. If id.subdev has a bit flag HDA_SUBDEV_NID_FLAG, * snd_hda_ctl_add() takes the lower-bit subdev value as a valid NID. - * + * * Note that the subdevice field is cleared again before the real registration * in snd_hda_ctl_add(), so that this value won't appear in the outside. */ @@ -36,18 +36,18 @@ /* * for mixer controls */ -#define HDA_COMPOSE_AMP_VAL_OFS(nid,chs,idx,dir,ofs) \ +#define HDA_COMPOSE_AMP_VAL_OFS(nid, chs, idx, dir, ofs) \ ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19) | ((ofs)<<23)) #define HDA_AMP_VAL_MIN_MUTE (1<<29) -#define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) \ +#define HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ HDA_COMPOSE_AMP_VAL_OFS(nid, chs, idx, dir, 0) /* mono volume with index (index=0,1,...) (channel=1,2) */ #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, dir, flags) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ .subdevice = HDA_SUBDEV_AMP_FLAG, \ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ - SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ - SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ + SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ + SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ .info = snd_hda_mixer_amp_volume_info, \ .get = snd_hda_mixer_amp_volume_get, \ .put = snd_hda_mixer_amp_volume_put, \ @@ -187,8 +187,8 @@ void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook); .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, indices, direction) }
/* stereo switch binding multiple inputs */ -#define HDA_BIND_MUTE(xname,nid,indices,dir) \ - HDA_BIND_MUTE_MONO(xname,nid,3,indices,dir) +#define HDA_BIND_MUTE(xname, nid, indices, dir) \ + HDA_BIND_MUTE_MONO(xname, nid, 3, indices, dir)
int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); diff --git a/sound/hda/hda_beep.c b/sound/hda/hda_beep.c index 3ce849899bb5..dda5b1b6ee1a 100644 --- a/sound/hda/hda_beep.c +++ b/sound/hda/hda_beep.c @@ -57,7 +57,7 @@ static void snd_hda_generate_beep(struct work_struct *work) } }
-/* (non-standard) Linear beep tone calculation for IDT/STAC codecs +/* (non-standard) Linear beep tone calculation for IDT/STAC codecs * * The tone frequency of beep generator on IDT/STAC codecs is * defined from the 8bit tone parameter, in Hz, diff --git a/sound/hda/hda_codec.c b/sound/hda/hda_codec.c index 5eb244a02b59..46eb8e14c884 100644 --- a/sound/hda/hda_codec.c +++ b/sound/hda/hda_codec.c @@ -2817,7 +2817,7 @@ typedef int (*map_slave_func_t)(struct hda_codec *, void *, struct snd_kcontrol
/* apply the function to all matching slave ctls in the mixer list */ static int map_slaves(struct hda_codec *codec, const char * const *slaves, - const char *suffix, map_slave_func_t func, void *data) + const char *suffix, map_slave_func_t func, void *data) { struct hda_nid_item *items; const char * const *s; @@ -2877,7 +2877,7 @@ static int get_kctl_0dB_offset(struct hda_codec *codec, return -1; if (*step_to_check && *step_to_check != step) { codec_err(codec, "Mismatching dB step for vmaster slave (%d!=%d)\n", -- *step_to_check, step); + *step_to_check, step); return -1; } *step_to_check = step; diff --git a/sound/hda/hda_proc.c b/sound/hda/hda_proc.c index 9c60c8cbe89d..0f4992f93bf8 100644 --- a/sound/hda/hda_proc.c +++ b/sound/hda/hda_proc.c @@ -1,6 +1,6 @@ /* * Universal Interface for Intel High Definition Audio Codec - * + * * Generic proc interface * * Copyright (c) 2004 Takashi Iwai tiwai@suse.de @@ -215,7 +215,7 @@ static const char *get_jack_connection(u32 cfg) { static char *names[16] = { "Unknown", "1/8", "1/4", "ATAPI", - "RCA", "Optical","Digital", "Analog", + "RCA", "Optical", "Digital", "Analog", "DIN", "XLR", "RJ11", "Comb", NULL, NULL, NULL, "Other" }; @@ -671,7 +671,7 @@ static void print_codec_info(struct snd_info_entry *entry, else snd_iprintf(buffer, "No Modem Function Group found\n");
- if (! codec->afg) + if (!codec->afg) return; snd_hda_power_up(codec); snd_iprintf(buffer, "Default PCM:\n"); @@ -684,7 +684,7 @@ static void print_codec_info(struct snd_info_entry *entry, print_power_state(buffer, codec, codec->afg);
nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); - if (! nid || nodes < 0) { + if (!nid || nodes < 0) { snd_iprintf(buffer, "Invalid AFG subtree\n"); snd_hda_power_down(codec); return;
From: Jeeja KP jeeja.kp@intel.com
The hda common library will eventually have name space conflicts with other code, so start moving the common code to use hdalib names, so we willr eplace all common code from snd_hda_* to snd_hdalib_*
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Hardik T Shah hardik.t.shah@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/hda/Makefile | 27 ++++++++++---------- .../{hda_auto_parser.c => hdalib_auto_parser.c} | 0 sound/hda/{hda_beep.c => hdalib_beep.c} | 0 sound/hda/{hda_codec.c => hdalib_codec.c} | 0 .../hda/{hda_controller.c => hdalib_controller.c} | 0 sound/hda/{hda_eld.c => hdalib_eld.c} | 0 sound/hda/{hda_generic.c => hdalib_generic.c} | 0 sound/hda/{hda_hwdep.c => hdalib_hwdep.c} | 0 sound/hda/{hda_jack.c => hdalib_jack.c} | 0 sound/hda/{hda_proc.c => hdalib_proc.c} | 0 sound/hda/{hda_sysfs.c => hdalib_sysfs.c} | 0 11 files changed, 14 insertions(+), 13 deletions(-) rename sound/hda/{hda_auto_parser.c => hdalib_auto_parser.c} (100%) rename sound/hda/{hda_beep.c => hdalib_beep.c} (100%) rename sound/hda/{hda_codec.c => hdalib_codec.c} (100%) rename sound/hda/{hda_controller.c => hdalib_controller.c} (100%) rename sound/hda/{hda_eld.c => hdalib_eld.c} (100%) rename sound/hda/{hda_generic.c => hdalib_generic.c} (100%) rename sound/hda/{hda_hwdep.c => hdalib_hwdep.c} (100%) rename sound/hda/{hda_jack.c => hdalib_jack.c} (100%) rename sound/hda/{hda_proc.c => hdalib_proc.c} (100%) rename sound/hda/{hda_sysfs.c => hdalib_sysfs.c} (100%)
diff --git a/sound/hda/Makefile b/sound/hda/Makefile index 6862de9bcbb6..ae57a6a6c40d 100644 --- a/sound/hda/Makefile +++ b/sound/hda/Makefile @@ -1,20 +1,21 @@ -snd-hda-controller-objs := hda_controller.o -snd-hda-codec-y := hda_codec.o hda_jack.o hda_auto_parser.o \ - hda_eld.o hda_sysfs.o - -snd-hda-codec-$(CONFIG_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 +ccflags-y += -Werror +ccflags-y += -DDEBUG +snd-hdalib-controller-objs := hdalib_controller.o +snd-hdalib-codec-y := hdalib_codec.o hdalib_jack.o hdalib_auto_parser.o \ +hdalib_eld.o hdalib_sysfs.o +snd-hdalib-codec-$(CONFIG_PROC_FS) += hdalib_proc.o +snd-hdalib-codec-$(CONFIG_SND_HDA_HWDEP) += hdalib_hwdep.o +snd-hdalib-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hdalib_beep.o
# for trace-points -CFLAGS_hda_controller.o := -I$(src) -CFLAGS_hda_codec.o := -I$(src) +CFLAGS_hdalib_controller.o := -I$(src) +CFLAGS_hdalib_codec.o := -I$(src)
-snd-hda-codec-generic-objs := hda_generic.o +snd-hdalib-codec-generic-objs := hdalib_generic.o
# common driver -obj-$(CONFIG_SND_CORE_HDA) += snd-hda-codec.o -obj-$(CONFIG_SND_CORE_HDA) += snd-hda-controller.o +obj-$(CONFIG_SND_CORE_HDA) += snd-hdalib-codec.o +obj-$(CONFIG_SND_CORE_HDA) += snd-hdalib-controller.o
# codec drivers -obj-$(CONFIG_SND_CORE_HDA_GENERIC) += snd-hda-codec-generic.o +obj-$(CONFIG_SND_CORE_HDA_GENERIC) += snd-hdalib-codec-generic.o diff --git a/sound/hda/hda_auto_parser.c b/sound/hda/hdalib_auto_parser.c similarity index 100% rename from sound/hda/hda_auto_parser.c rename to sound/hda/hdalib_auto_parser.c diff --git a/sound/hda/hda_beep.c b/sound/hda/hdalib_beep.c similarity index 100% rename from sound/hda/hda_beep.c rename to sound/hda/hdalib_beep.c diff --git a/sound/hda/hda_codec.c b/sound/hda/hdalib_codec.c similarity index 100% rename from sound/hda/hda_codec.c rename to sound/hda/hdalib_codec.c diff --git a/sound/hda/hda_controller.c b/sound/hda/hdalib_controller.c similarity index 100% rename from sound/hda/hda_controller.c rename to sound/hda/hdalib_controller.c diff --git a/sound/hda/hda_eld.c b/sound/hda/hdalib_eld.c similarity index 100% rename from sound/hda/hda_eld.c rename to sound/hda/hdalib_eld.c diff --git a/sound/hda/hda_generic.c b/sound/hda/hdalib_generic.c similarity index 100% rename from sound/hda/hda_generic.c rename to sound/hda/hdalib_generic.c diff --git a/sound/hda/hda_hwdep.c b/sound/hda/hdalib_hwdep.c similarity index 100% rename from sound/hda/hda_hwdep.c rename to sound/hda/hdalib_hwdep.c diff --git a/sound/hda/hda_jack.c b/sound/hda/hdalib_jack.c similarity index 100% rename from sound/hda/hda_jack.c rename to sound/hda/hdalib_jack.c diff --git a/sound/hda/hda_proc.c b/sound/hda/hdalib_proc.c similarity index 100% rename from sound/hda/hda_proc.c rename to sound/hda/hdalib_proc.c diff --git a/sound/hda/hda_sysfs.c b/sound/hda/hdalib_sysfs.c similarity index 100% rename from sound/hda/hda_sysfs.c rename to sound/hda/hdalib_sysfs.c
From: Jeeja KP jeeja.kp@intel.com
Here we rename the common header files to hdalib. This is last big file move patch. Here the files in sound/hda/ and sound/pci/hda are modified to use new headers
TODO: fix other patch files and other code in sound/pci/hda
Signed-off-by: Jeeja KP jeeja.kp@intel.com Signed-off-by: Hardik T Shah hardik.t.shah@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- include/sound/{hda_priv.h => hda_register.h} | 10 +++------- .../{hda_auto_parser.h => hdalib_auto_parser.h} | 6 +++--- include/sound/{hda_beep.h => hdalib_beep.h} | 6 +++--- include/sound/{hda_codec.h => hdalib_codec.h} | 13 ++++++------- .../{hda_controller.h => hdalib_controller.h} | 11 ++++++----- include/sound/{hda_local.h => hdalib_controls.h} | 6 +++--- include/sound/{hda_generic.h => hdalib_generic.h} | 6 +++--- include/sound/{hda_hwdep.h => hdalib_hwdep.h} | 4 ++-- include/sound/{hda_jack.h => hdalib_jack.h} | 6 +++--- sound/hda/hdalib_auto_parser.c | 7 ++++--- sound/hda/hdalib_beep.c | 6 ++++-- sound/hda/hdalib_codec.c | 17 ++++++++--------- sound/hda/hdalib_controller.c | 10 +++++++--- sound/hda/hdalib_eld.c | 4 ++-- sound/hda/hdalib_generic.c | 13 +++++++------ sound/hda/hdalib_hwdep.c | 6 +++--- sound/hda/hdalib_jack.c | 8 ++++---- sound/hda/hdalib_proc.c | 5 +++-- sound/hda/hdalib_sysfs.c | 6 +++--- sound/pci/hda/hda_i915.c | 3 ++- sound/pci/hda/hda_intel.c | 7 ++++--- sound/pci/hda/patch_hdmi.c | 10 +++++++++- sound/pci/hda/patch_realtek.c | 10 +++++++--- 23 files changed, 99 insertions(+), 81 deletions(-) rename include/sound/{hda_priv.h => hda_register.h} (98%) rename include/sound/{hda_auto_parser.h => hdalib_auto_parser.h} (96%) rename include/sound/{hda_beep.h => hdalib_beep.h} (95%) rename include/sound/{hda_codec.h => hdalib_codec.h} (98%) rename include/sound/{hda_controller.h => hdalib_controller.h} (90%) rename include/sound/{hda_local.h => hdalib_controls.h} (99%) rename include/sound/{hda_generic.h => hdalib_generic.h} (99%) rename include/sound/{hda_hwdep.h => hdalib_hwdep.h} (95%) rename include/sound/{hda_jack.h => hdalib_jack.h} (96%)
diff --git a/include/sound/hda_priv.h b/include/sound/hda_register.h similarity index 98% rename from include/sound/hda_priv.h rename to include/sound/hda_register.h index 166e3e84b963..9f8a37b19de7 100644 --- a/include/sound/hda_priv.h +++ b/include/sound/hda_register.h @@ -12,12 +12,8 @@ * more details. */
-#ifndef __SOUND_HDA_PRIV_H -#define __SOUND_HDA_PRIV_H - -#include <linux/clocksource.h> -#include <sound/core.h> -#include <sound/pcm.h> +#ifndef __SOUND_HDA_REGISTER_H +#define __SOUND_HDA_REGISTER_H
/* * registers @@ -403,4 +399,4 @@ struct azx { #define azx_sd_readb(chip, dev, reg) \ ((chip)->ops->reg_readb((dev)->sd_addr + AZX_REG_##reg))
-#endif /* __SOUND_HDA_PRIV_H */ +#endif /* __SOUND_HDA_REGISTER_H */ diff --git a/include/sound/hda_auto_parser.h b/include/sound/hdalib_auto_parser.h similarity index 96% rename from include/sound/hda_auto_parser.h rename to include/sound/hdalib_auto_parser.h index 2b8e29fd73e7..c011cbf50196 100644 --- a/include/sound/hda_auto_parser.h +++ b/include/sound/hdalib_auto_parser.h @@ -9,8 +9,8 @@ * (at your option) any later version. */
-#ifndef __SOUND_HDA_AUTO_PARSER_H -#define __SOUND_HDA_AUTO_PARSER_H +#ifndef __SOUND_HDALIB_AUTO_PARSER_H +#define __SOUND_HDALIB_AUTO_PARSER_H
/* * Helper for automatic pin configuration @@ -116,4 +116,4 @@ static inline const hda_nid_t *auto_cfg_speaker_pins(const struct auto_pin_cfg * cfg->line_out_pins : cfg->speaker_pins; }
-#endif /* __SOUND_HDA_AUTO_PARSER_H */ +#endif /* __SOUND_HDALIB_AUTO_PARSER_H */ diff --git a/include/sound/hda_beep.h b/include/sound/hdalib_beep.h similarity index 95% rename from include/sound/hda_beep.h rename to include/sound/hdalib_beep.h index a63b5e077332..cb3ff5cab495 100644 --- a/include/sound/hda_beep.h +++ b/include/sound/hdalib_beep.h @@ -19,10 +19,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifndef __SOUND_HDA_BEEP_H -#define __SOUND_HDA_BEEP_H +#ifndef __SOUND_HDALIB_BEEP_H +#define __SOUND_HDALIB_BEEP_H
-#include "hda_codec.h" +#include "hdalib_codec.h"
#define HDA_BEEP_MODE_OFF 0 #define HDA_BEEP_MODE_ON 1 diff --git a/include/sound/hda_codec.h b/include/sound/hdalib_codec.h similarity index 98% rename from include/sound/hda_codec.h rename to include/sound/hdalib_codec.h index f5d7717dfca6..459ba6a182ef 100644 --- a/include/sound/hda_codec.h +++ b/include/sound/hdalib_codec.h @@ -1,8 +1,11 @@ /* * Universal Interface for Intel High Definition Audio Codec * + * Copyright (c) 2014 Intel Corporation * Copyright (c) 2004 Takashi Iwai tiwai@suse.de * + * Modified by: Lakshmi Vinnakota lakshmi.n.vinnakota@intel.com + * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) @@ -12,14 +15,10 @@ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ifndef __SOUND_HDA_CODEC_H -#define __SOUND_HDA_CODEC_H +#ifndef __SOUND_HDALIB_CODEC_H +#define __SOUND_HDALIB_CODEC_H
#include <sound/info.h> #include <sound/control.h> @@ -687,4 +686,4 @@ snd_hda_codec_load_dsp_cleanup(struct hda_codec *codec, struct snd_dma_buffer *dmab) {} #endif
-#endif /* __SOUND_HDA_CODEC_H */ +#endif /* __SOUND_HDALIB_CODEC_H */ diff --git a/include/sound/hda_controller.h b/include/sound/hdalib_controller.h similarity index 90% rename from include/sound/hda_controller.h rename to include/sound/hdalib_controller.h index c90d10fd4d8f..d3e70f5d1a08 100644 --- a/include/sound/hda_controller.h +++ b/include/sound/hdalib_controller.h @@ -12,13 +12,14 @@ * more details. */
-#ifndef __SOUND_HDA_CONTROLLER_H -#define __SOUND_HDA_CONTROLLER_H +#ifndef __SOUND_HDALIB_CONTROLLER_H +#define __SOUND_HDALIB_CONTROLLER_H
#include <sound/core.h> #include <sound/initval.h> -#include "hda_codec.h" -#include "hda_priv.h" +#include "hdalib_codec.h" +#include "hdalib_controls.h" +#include "hda_register.h"
/* PCM setup */ static inline struct azx_dev *get_azx_dev(struct snd_pcm_substream *substream) @@ -53,4 +54,4 @@ int azx_init_stream(struct azx *chip); void azx_notifier_register(struct azx *chip); void azx_notifier_unregister(struct azx *chip);
-#endif /* __SOUND_HDA_CONTROLLER_H */ +#endif /* __SOUND_HDALIB_CONTROLLER_H */ diff --git a/include/sound/hda_local.h b/include/sound/hdalib_controls.h similarity index 99% rename from include/sound/hda_local.h rename to include/sound/hdalib_controls.h index d5aedd811806..9b3b35462884 100644 --- a/include/sound/hda_local.h +++ b/include/sound/hdalib_controls.h @@ -20,8 +20,8 @@ * Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#ifndef __SOUND_HDA_LOCAL_H -#define __SOUND_HDA_LOCAL_H +#ifndef __SOUND_HDALIB_CONTROLS_H +#define __SOUND_HDALIB_CONTROLS_H
/* We abuse kcontrol_new.subdev field to pass the NID corresponding to * the given new control. If id.subdev has a bit flag HDA_SUBDEV_NID_FLAG, @@ -805,4 +805,4 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen); #define codec_info(codec, fmt, args...) dev_info(&(codec)->dev, fmt, ##args) #define codec_dbg(codec, fmt, args...) dev_dbg(&(codec)->dev, fmt, ##args)
-#endif /* __SOUND_HDA_LOCAL_H */ +#endif /* __SOUND_HDALIB_CONTROLS_H */ diff --git a/include/sound/hda_generic.h b/include/sound/hdalib_generic.h similarity index 99% rename from include/sound/hda_generic.h rename to include/sound/hdalib_generic.h index 3d852660443a..4e4b455924b8 100644 --- a/include/sound/hda_generic.h +++ b/include/sound/hdalib_generic.h @@ -9,8 +9,8 @@ * (at your option) any later version. */
-#ifndef __SOUND_HDA_GENERIC_H -#define __SOUND_HDA_GENERIC_H +#ifndef __SOUND_HDALIB_GENERIC_H +#define __SOUND_HDALIB_GENERIC_H
/* table entry for multi-io paths */ struct hda_multi_io { @@ -341,4 +341,4 @@ unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec, hda_nid_t nid, unsigned int power_state);
-#endif /* __SOUND_HDA_GENERIC_H */ +#endif /* __SOUND_HDALIB_GENERIC_H */ diff --git a/include/sound/hda_hwdep.h b/include/sound/hdalib_hwdep.h similarity index 95% rename from include/sound/hda_hwdep.h rename to include/sound/hdalib_hwdep.h index 1c0034e87f22..e54af1d24b5b 100644 --- a/include/sound/hda_hwdep.h +++ b/include/sound/hdalib_hwdep.h @@ -18,8 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifndef __SOUND_HDA_HWDEP_H -#define __SOUND_HDA_HWDEP_H +#ifndef __SOUND_HDALIB_HWDEP_H +#define __SOUND_HDALIB_HWDEP_H
#define HDA_HWDEP_VERSION ((1 << 16) | (0 << 8) | (0 << 0)) /* 1.0.0 */
diff --git a/include/sound/hda_jack.h b/include/sound/hdalib_jack.h similarity index 96% rename from include/sound/hda_jack.h rename to include/sound/hdalib_jack.h index b279e327a23b..b9f874493343 100644 --- a/include/sound/hda_jack.h +++ b/include/sound/hdalib_jack.h @@ -9,8 +9,8 @@ * (at your option) any later version. */
-#ifndef __SOUND_HDA_JACK_H -#define __SOUND_HDA_JACK_H +#ifndef __SOUND_HDALIB_JACK_H +#define __SOUND_HDALIB_JACK_H
#include <linux/err.h>
@@ -95,4 +95,4 @@ void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res);
void snd_hda_jack_poll_all(struct hda_codec *codec);
-#endif /* __SOUND_HDA_JACK_H */ +#endif /* __SOUND_HDALIB_JACK_H */ diff --git a/sound/hda/hdalib_auto_parser.c b/sound/hda/hdalib_auto_parser.c index e518a74b3d66..e2d11d374040 100644 --- a/sound/hda/hdalib_auto_parser.c +++ b/sound/hda/hdalib_auto_parser.c @@ -9,13 +9,14 @@ * (at your option) any later version. */
+#include <linux/module.h> #include <linux/slab.h> #include <linux/export.h> #include <linux/sort.h> #include <sound/core.h> -#include <sound/hda_codec.h> -#include <sound/hda_local.h> -#include <sound/hda_auto_parser.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_auto_parser.h>
/* * Helper for automatic pin configuration diff --git a/sound/hda/hdalib_beep.c b/sound/hda/hdalib_beep.c index dda5b1b6ee1a..0fe9c224f90a 100644 --- a/sound/hda/hdalib_beep.c +++ b/sound/hda/hdalib_beep.c @@ -24,8 +24,10 @@ #include <linux/workqueue.h> #include <linux/export.h> #include <sound/core.h> -#include <sound/hda_beep.h> -#include <sound/hda_local.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_auto_parser.h> +#include <sound/hdalib_beep.h>
enum { DIGBEEP_HZ_STEP = 46875, /* 46.875 Hz */ diff --git a/sound/hda/hdalib_codec.c b/sound/hda/hdalib_codec.c index 46eb8e14c884..df2cd7f00213 100644 --- a/sound/hda/hdalib_codec.c +++ b/sound/hda/hdalib_codec.c @@ -1,8 +1,10 @@ /* * Universal Interface for Intel High Definition Audio Codec * + * Copyright (c) 2014 Intel Corporation * Copyright (c) 2004 Takashi Iwai tiwai@suse.de * + * Modified by: Lakshmi Vinnakota lakshmi.n.vinnakota@intel.com * * This driver is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -13,10 +15,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <linux/mm.h> @@ -27,15 +25,16 @@ #include <linux/module.h> #include <linux/async.h> #include <sound/core.h> -#include <sound/hda_codec.h> #include <sound/asoundef.h> #include <sound/tlv.h> #include <sound/initval.h> #include <sound/jack.h> -#include <sound/hda_local.h> -#include <sound/hda_beep.h> -#include <sound/hda_jack.h> -#include <sound/hda_hwdep.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_auto_parser.h> +#include <sound/hdalib_beep.h> +#include <sound/hdalib_jack.h> +#include <sound/hdalib_hwdep.h>
#define CREATE_TRACE_POINTS #include "hda_trace.h" diff --git a/sound/hda/hdalib_controller.c b/sound/hda/hdalib_controller.c index 5ae5fcb9b8a9..b4fc5423925c 100644 --- a/sound/hda/hdalib_controller.c +++ b/sound/hda/hdalib_controller.c @@ -1,12 +1,15 @@ /* * - * Implementation of primary alsa driver code base for Intel HD Audio. + * Implementation of Common HDA driver funcitons for Intel HD Audio. * + * Copyright (c) 2014 Intel Corporation * Copyright(c) 2004 Intel Corporation. All rights reserved. * * Copyright (c) 2004 Takashi Iwai tiwai@suse.de * PeiSen Hou pshou@realtek.com.tw * + * Modified by: KP Jeeja jeeja.kp@intel.com + * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) @@ -30,8 +33,9 @@ #include <linux/reboot.h> #include <sound/core.h> #include <sound/initval.h> -#include <sound/hda_priv.h> -#include <sound/hda_controller.h> +#include <sound/hdalib_controller.h> +#include <sound/hda_register.h> +
#define CREATE_TRACE_POINTS #include "hda_intel_trace.h" diff --git a/sound/hda/hdalib_eld.c b/sound/hda/hdalib_eld.c index f1b6493c65d9..f5622c8a5286 100644 --- a/sound/hda/hdalib_eld.c +++ b/sound/hda/hdalib_eld.c @@ -26,8 +26,8 @@ #include <linux/slab.h> #include <sound/core.h> #include <asm/unaligned.h> -#include <sound/hda_codec.h> -#include <sound/hda_local.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_controls.h>
enum eld_versions { ELD_VER_CEA_861D = 2, diff --git a/sound/hda/hdalib_generic.c b/sound/hda/hdalib_generic.c index bac07550f7be..a2c0fccc0cc9 100644 --- a/sound/hda/hdalib_generic.c +++ b/sound/hda/hdalib_generic.c @@ -32,12 +32,13 @@ #include <sound/core.h> #include <sound/jack.h> #include <sound/tlv.h> -#include <sound/hda_codec.h> -#include <sound/hda_local.h> -#include <sound/hda_auto_parser.h> -#include <sound/hda_jack.h> -#include <sound/hda_beep.h> -#include <sound/hda_generic.h> +#include <sound/control.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_auto_parser.h> +#include <sound/hdalib_beep.h> +#include <sound/hdalib_jack.h> +#include <sound/hdalib_generic.h>
/** diff --git a/sound/hda/hdalib_hwdep.c b/sound/hda/hdalib_hwdep.c index 8b17ad1cbb1b..4afa6f803cb9 100644 --- a/sound/hda/hdalib_hwdep.c +++ b/sound/hda/hdalib_hwdep.c @@ -22,9 +22,9 @@ #include <linux/slab.h> #include <linux/compat.h> #include <sound/core.h> -#include <sound/hda_codec.h> -#include <sound/hda_local.h> -#include <sound/hda_hwdep.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_hwdep.h> #include <sound/minors.h>
/* diff --git a/sound/hda/hdalib_jack.c b/sound/hda/hdalib_jack.c index bcaee91e655e..7c061f18c373 100644 --- a/sound/hda/hdalib_jack.c +++ b/sound/hda/hdalib_jack.c @@ -15,10 +15,10 @@ #include <sound/core.h> #include <sound/control.h> #include <sound/jack.h> -#include <sound/hda_codec.h> -#include <sound/hda_local.h> -#include <sound/hda_auto_parser.h> -#include <sound/hda_jack.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_auto_parser.h> +#include <sound/hdalib_jack.h>
/** * is_jack_detectable - Check whether the given pin is jack-detectable diff --git a/sound/hda/hdalib_proc.c b/sound/hda/hdalib_proc.c index 0f4992f93bf8..5bf040d38ffe 100644 --- a/sound/hda/hdalib_proc.c +++ b/sound/hda/hdalib_proc.c @@ -25,8 +25,9 @@ #include <linux/slab.h> #include <sound/core.h> #include <linux/module.h> -#include <sound/hda_codec.h> -#include <sound/hda_local.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_auto_parser.h>
static int dump_coef = -1; module_param(dump_coef, int, 0644); diff --git a/sound/hda/hdalib_sysfs.c b/sound/hda/hdalib_sysfs.c index b25001cc3f83..07d24cad0c3d 100644 --- a/sound/hda/hdalib_sysfs.c +++ b/sound/hda/hdalib_sysfs.c @@ -14,10 +14,10 @@ #include <linux/string.h> #include <linux/export.h> #include <sound/core.h> -#include <sound/hda_codec.h> -#include <sound/hda_local.h> -#include <sound/hda_hwdep.h> #include <sound/minors.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_hwdep.h> +#include <sound/hdalib_controls.h>
/* hint string pair */ struct hda_hint { diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c index ca15d465c8b0..4e614490bdd8 100644 --- a/sound/pci/hda/hda_i915.c +++ b/sound/pci/hda/hda_i915.c @@ -20,7 +20,8 @@ #include <linux/module.h> #include <sound/core.h> #include <drm/i915_powerwell.h> -#include <sound/hda_priv.h> +#include <sound/hdalib_codec.h> +#include <sound/hda_register.h> #include "hda_i915.h"
/* Intel HSW/BDW display HDA controller Extended Mode registers. diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 70606016843b..89f3a7654170 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -60,9 +60,10 @@ #include <linux/vgaarb.h> #include <linux/vga_switcheroo.h> #include <linux/firmware.h> -#include <sound/hda_codec.h> -#include <sound/hda_controller.h> -#include <sound/hda_priv.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_controller.h> +#include <sound/hda_register.h> #include "hda_i915.h"
/* position fix mode */ diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index b422e406a9cb..99efc88f3d36 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -37,9 +37,17 @@ #include <sound/jack.h> #include <sound/asoundef.h> #include <sound/tlv.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_bus.h> +#include <sound/hdalib_auto_parser.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_jack.h> +#include <sound/hdalib_generic.h> +#include <sound/hdalib_hdmi.h> #include "hda_codec.h" +#include "hda_generic.h" +#include "hda_bus.h" #include "hda_local.h" -#include "hda_jack.h"
static bool static_hdmi_pcm; module_param(static_hdmi_pcm, bool, 0644); diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 65f1f4e18ea5..9058d206dd58 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -31,11 +31,15 @@ #include <linux/module.h> #include <sound/core.h> #include <sound/jack.h> +#include <sound/hdalib_codec.h> +#include <sound/hdalib_bus.h> +#include <sound/hdalib_auto_parser.h> +#include <sound/hdalib_controls.h> +#include <sound/hdalib_jack.h> +#include <sound/hdalib_generic.h> #include "hda_codec.h" -#include "hda_local.h" -#include "hda_auto_parser.h" -#include "hda_jack.h" #include "hda_generic.h" +#include "hda_bus.h"
/* keep halting ALC5505 DSP, for power saving */ #define HALT_REALTEK_ALC5505
At Sun, 8 Mar 2015 20:07:54 +0530, Vinod Koul wrote:
This patch series attempts to split existing HDA code to create common hda library. This is done in order to make HDA code available to other users like upcoming Intel platforms which sport a HDA controller along with an I2S link. This series is 1st patch series which will try to refactor HDA by splitting it up and then adding ASoC HDA controller driver for these platforms.
This series moves code to sound/hda, renames the files mostly. The second series will do API changes and subsequent ones will be using HDA bus patches which Takashi posted recently
Comments welcome...
I have a working tree that already contains some HD-audio core stuff changes (I think I formed it in private mail threads), too. They are found in topic/hda-core branch. This will be rather picking up only the necessary pieces into sound/hda core directory instead of copying the whole fat ones, targeted to build up a minimalistic HD-audio codec driver. So, it's a bit different strategy. You can find the header file (include/sound/hdaudio.h) below and understand what I meant. (BTW, it contains the regmap support, found in topic/hda-regmap branch.)
I don't mind to abandon my patches, but before that, we should define the global goal and discuss how to achieve in a better form.
thanks,
Takashi
===
/* * HD-audio core stuff */
#ifndef __SOUND_HDAUDIO_H #define __SOUND_HDAUDIO_H
#include <linux/device.h> #include <sound/hda_verbs.h>
/* codec node id */ typedef u16 hda_nid_t;
struct hdac_bus; struct hdac_device; struct hdac_driver; struct hdac_widget_tree;
/* * exported bus type */ extern struct bus_type snd_hda_bus_type;
/* * generic arrays */ struct snd_array { unsigned int used; unsigned int alloced; unsigned int elem_size; unsigned int alloc_align; void *list; };
/* * HD-audio codec base device */ struct hdac_device { struct device dev; int type; struct hdac_bus *bus; unsigned int addr; /* codec address */ struct list_head list; /* list point for bus codec_list */
hda_nid_t afg; /* AFG node id */ hda_nid_t mfg; /* MFG node id */
/* ids */ unsigned int vendor_id; unsigned int subsystem_id; unsigned int revision_id; unsigned int afg_function_id; unsigned int mfg_function_id; unsigned int afg_unsol:1; unsigned int mfg_unsol:1;
unsigned int power_caps; /* FG power caps */
const char *vendor_name; /* codec vendor name */ const char *chip_name; /* codec chip name */
/* verb exec op override */ int (*exec_verb)(struct hdac_device *dev, unsigned int cmd, unsigned int flags, unsigned int *res);
/* widgets */ unsigned int num_nodes; hda_nid_t start_nid, end_nid;
/* misc flags */ atomic_t in_pm; /* suspend/resume being performed */
/* sysfs */ struct hdac_widget_tree *widgets;
/* regmap */ struct regmap *regmap; struct snd_array vendor_verbs; bool lazy_cache:1; /* don't wake up for writes */ bool caps_overwriting:1; /* caps overwrite being in process */ };
/* device/driver type used for matching */ enum { HDA_DEV_CORE, HDA_DEV_LEGACY, };
/* direction */ enum { HDA_INPUT, HDA_OUTPUT };
#define dev_to_hdac_dev(_dev) container_of(_dev, struct hdac_device, dev)
int snd_hdac_device_init(struct hdac_device *dev, struct hdac_bus *bus, const char *name, unsigned int addr); void snd_hdac_device_exit(struct hdac_device *dev); int snd_hdac_device_register(struct hdac_device *codec); void snd_hdac_device_unregister(struct hdac_device *codec);
int snd_hdac_refresh_widgets(struct hdac_device *codec);
unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid, unsigned int verb, unsigned int parm); int snd_hdac_exec_verb(struct hdac_device *codec, unsigned int cmd, unsigned int flags, unsigned int *res); int snd_hdac_read(struct hdac_device *codec, hda_nid_t nid, unsigned int verb, unsigned int parm, unsigned int *res); int _snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm, unsigned int *res); int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid, int parm); int snd_hdac_override_parm(struct hdac_device *codec, hda_nid_t nid, unsigned int parm, unsigned int val); int snd_hdac_get_connections(struct hdac_device *codec, hda_nid_t nid, hda_nid_t *conn_list, int max_conns); int snd_hdac_get_sub_nodes(struct hdac_device *codec, hda_nid_t nid, hda_nid_t *start_id);
/** * snd_hdac_read_parm - read a codec parameter * @codec: the codec object * @nid: NID to read a parameter * @parm: parameter to read * * Returns -1 for error. If you need to distinguish the error more * strictly, use _snd_hdac_read_parm() directly. */ static inline int snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm) { unsigned int val;
return _snd_hdac_read_parm(codec, nid, parm, &val) < 0 ? -1 : val; }
#ifdef CONFIG_PM void snd_hdac_power_up(struct hdac_device *codec); void snd_hdac_power_down(struct hdac_device *codec); #else static inline void snd_hdac_power_up(struct hdac_device *codec) {} static inline void snd_hdac_power_down(struct hdac_device *codec) {} #endif
/* * HD-audio codec base driver */ struct hdac_driver { struct device_driver driver; int type; int (*match)(struct hdac_device *dev, struct hdac_driver *drv); void (*unsol_event)(struct hdac_device *dev, unsigned int event); };
#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
/* * HD-audio bus base driver */ struct hdac_bus_ops { /* send a single command */ int (*command)(struct hdac_bus *bus, unsigned int cmd); /* get a response from the last command */ int (*get_response)(struct hdac_bus *bus, unsigned int addr, unsigned int *res); };
#define HDA_UNSOL_QUEUE_SIZE 64
struct hdac_bus { struct device *dev; const struct hdac_bus_ops *ops;
/* codec linked list */ struct list_head codec_list; unsigned int num_codecs;
/* link caddr -> codec */ struct hdac_device *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1];
/* unsolicited event queue */ u32 unsol_queue[HDA_UNSOL_QUEUE_SIZE * 2]; /* ring buffer */ unsigned int unsol_rp, unsol_wp; struct work_struct unsol_work;
/* bit flags of powered codecs */ unsigned long codec_powered;
/* flags */ bool sync_write:1; /* sync after verb write */
/* locks */ struct mutex cmd_mutex; };
int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, const struct hdac_bus_ops *ops); void snd_hdac_bus_exit(struct hdac_bus *bus); int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr, unsigned int cmd, unsigned int *res); int snd_hdac_bus_exec_verb_unlocked(struct hdac_bus *bus, unsigned int addr, unsigned int cmd, unsigned int *res); void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex);
int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec); void snd_hdac_bus_remove_device(struct hdac_bus *bus, struct hdac_device *codec);
static inline void snd_hdac_codec_link_up(struct hdac_device *codec) { set_bit(codec->addr, &codec->bus->codec_powered); }
static inline void snd_hdac_codec_link_down(struct hdac_device *codec) { clear_bit(codec->addr, &codec->bus->codec_powered); }
/* * generic array helpers */ void *snd_array_new(struct snd_array *array); void snd_array_free(struct snd_array *array); static inline void snd_array_init(struct snd_array *array, unsigned int size, unsigned int align) { array->elem_size = size; array->alloc_align = align; }
static inline void *snd_array_elem(struct snd_array *array, unsigned int idx) { return array->list + idx * array->elem_size; }
static inline unsigned int snd_array_index(struct snd_array *array, void *ptr) { return (unsigned long)(ptr - array->list) / array->elem_size; }
#endif /* __SOUND_HDAUDIO_H */
On Sun, Mar 08, 2015 at 04:50:52PM +0100, Takashi Iwai wrote:
At Sun, 8 Mar 2015 20:07:54 +0530, Vinod Koul wrote:
This patch series attempts to split existing HDA code to create common hda library. This is done in order to make HDA code available to other users like upcoming Intel platforms which sport a HDA controller along with an I2S link. This series is 1st patch series which will try to refactor HDA by splitting it up and then adding ASoC HDA controller driver for these platforms.
This series moves code to sound/hda, renames the files mostly. The second series will do API changes and subsequent ones will be using HDA bus patches which Takashi posted recently
Comments welcome...
I have a working tree that already contains some HD-audio core stuff changes (I think I formed it in private mail threads), too. They are found in topic/hda-core branch. This will be rather picking up only the necessary pieces into sound/hda core directory instead of copying the whole fat ones, targeted to build up a minimalistic HD-audio codec driver. So, it's a bit different strategy. You can find the header file (include/sound/hdaudio.h) below and understand what I meant. (BTW, it contains the regmap support, found in topic/hda-regmap branch.)
I don't mind using this statergy if you recommend that :)
In that case let me post incremental patches moving code on top of topic/hda-core picking changes one by one.
I don't mind to abandon my patches, but before that, we should define the global goal and discuss how to achieve in a better form. From our side the goal is to split the current HDA code and move the common
bits into sound/hda/ That way both existing code and new ASoC HDA code can use the existing interfaces. We didn't do much changes on existing HDA since we were concerned about possible regressions on existing HDA, but I think you want to improve HDA, so we can do both bits togther... :)
At Sun, 8 Mar 2015 22:25:36 +0530, Vinod Koul wrote:
On Sun, Mar 08, 2015 at 04:50:52PM +0100, Takashi Iwai wrote:
At Sun, 8 Mar 2015 20:07:54 +0530, Vinod Koul wrote:
This patch series attempts to split existing HDA code to create common hda library. This is done in order to make HDA code available to other users like upcoming Intel platforms which sport a HDA controller along with an I2S link. This series is 1st patch series which will try to refactor HDA by splitting it up and then adding ASoC HDA controller driver for these platforms.
This series moves code to sound/hda, renames the files mostly. The second series will do API changes and subsequent ones will be using HDA bus patches which Takashi posted recently
Comments welcome...
I have a working tree that already contains some HD-audio core stuff changes (I think I formed it in private mail threads), too. They are found in topic/hda-core branch. This will be rather picking up only the necessary pieces into sound/hda core directory instead of copying the whole fat ones, targeted to build up a minimalistic HD-audio codec driver. So, it's a bit different strategy. You can find the header file (include/sound/hdaudio.h) below and understand what I meant. (BTW, it contains the regmap support, found in topic/hda-regmap branch.)
I don't mind using this statergy if you recommend that :)
In that case let me post incremental patches moving code on top of topic/hda-core picking changes one by one.
I'm open for any options at this point. I think it'd be cleaner to have a small subset (so I've started like that), but of course it would need more works than using the full set. Note that currently I've done only for a smaller codec driver, and the split / porting of the controller driver is still on the way.
If ASoC driver might be used alone without the legacy mode, it might be worth to think of the slim version by a smaller core. OTOH, if both modes are more or less tagged, splitting to the smaller core wouldn't be a big win any longer because the both objects are loaded in anyway.
I don't mind to abandon my patches, but before that, we should define the global goal and discuss how to achieve in a better form.
From our side the goal is to split the current HDA code and move the common bits into sound/hda/ That way both existing code and new ASoC HDA code can use the existing interfaces. We didn't do much changes on existing HDA since we were concerned about possible regressions on existing HDA, but I think you want to improve HDA, so we can do both bits togther... :)
Right, a regression is a bigger risk of such code splits. We'll be able to catch most of regressions in the codec driver side by hda-emu, I suppose, but a regression in the controller side is a bit more difficult to catch. So this has to be done carefully.
So, the question remains how large we'd take a common part wrt the controller driver code.
thanks,
Takashi
participants (2)
-
Takashi Iwai
-
Vinod Koul