Create hdalib for common hda code
cover 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%)Signature · 1 line
1.7.9.5
RFC 1/5 ALSA: hda: move hdaudio header files to global include
From: Jeeja KP <[email protected]>
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
---
{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%)include/sound/hda_auto_parser.h renamed from sound/pci/hda/hda_auto_parser.h +0 -0
include/sound/hda_beep.h renamed from sound/pci/hda/hda_beep.h +0 -0
include/sound/hda_codec.h renamed from sound/pci/hda/hda_codec.h +0 -0
include/sound/hda_controller.h renamed from sound/pci/hda/hda_controller.h +0 -0
include/sound/hda_generic.h renamed from sound/pci/hda/hda_generic.h +0 -0
include/sound/hda_jack.h renamed from sound/pci/hda/hda_jack.h +0 -0
include/sound/hda_local.h renamed from sound/pci/hda/hda_local.h +0 -0
include/sound/hda_priv.h renamed from sound/pci/hda/hda_priv.h +0 -0
sound/pci/hda/hda_auto_parser.c +3 -3
@@ -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
sound/pci/hda/hda_beep.c +2 -2
@@ -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 */
sound/pci/hda/hda_codec.c +4 -4
@@ -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
sound/pci/hda/hda_controller.c +2 -2
@@ -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"
sound/pci/hda/hda_eld.c +2 -2
@@ -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 ,
sound/pci/hda/hda_generic.c +6 -6
@@ -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> /**
sound/pci/hda/hda_hwdep.c +2 -2
@@ -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>
sound/pci/hda/hda_i915.c +1 -1
@@ -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.
sound/pci/hda/hda_intel.c +3 -3
@@ -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 */
sound/pci/hda/hda_jack.c +4 -4
@@ -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
sound/pci/hda/hda_proc.c +2 -2
@@ -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 );
sound/pci/hda/hda_sysfs.c +2 -2
@@ -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>
Signature · 1 line
1.7.9.5
RFC 2/5 ALSA: HDA: create HDA common lib
In reply to Vinod KoulFrom: Jeeja KP <[email protected]>
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
---
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%)sound/Kconfig +2 -0
@@ -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"
sound/Makefile +1 -1
@@ -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/
sound/hda/Kconfig new file +85 -0
85 lines not on this page · raw message
sound/hda/Makefile new file +20 -0
@@ -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
sound/hda/hda_auto_parser.c renamed from sound/pci/hda/hda_auto_parser.c +0 -0
sound/hda/hda_beep.c renamed from sound/pci/hda/hda_beep.c +0 -0
sound/hda/hda_codec.c renamed from sound/pci/hda/hda_codec.c +0 -0
sound/hda/hda_controller.c renamed from sound/pci/hda/hda_controller.c +0 -0
sound/hda/hda_eld.c renamed from sound/pci/hda/hda_eld.c +0 -0
sound/hda/hda_generic.c renamed from sound/pci/hda/hda_generic.c +0 -0
sound/hda/hda_hwdep.c renamed from sound/pci/hda/hda_hwdep.c +0 -0
sound/hda/hda_intel_trace.h renamed from sound/pci/hda/hda_intel_trace.h +0 -0
sound/hda/hda_jack.c renamed from sound/pci/hda/hda_jack.c +0 -0
sound/hda/hda_proc.c renamed from sound/pci/hda/hda_proc.c +0 -0
sound/hda/hda_sysfs.c renamed from sound/pci/hda/hda_sysfs.c +0 -0
sound/hda/hda_trace.h renamed from sound/pci/hda/hda_trace.h +0 -0
sound/pci/hda/Kconfig +0 -44
62 lines not on this page · raw message
sound/pci/hda/Makefile +2 -12
@@ -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
Signature · 1 line
1.7.9.5
RFC 3/5 ALSA: hdalib - fix existing checkpatch issues
In reply to Vinod KoulFrom: Jeeja KP <[email protected]>
The existing code seems to have a bit of checkpatch errors creeped in, so take this opportinuty to fix them as well
--- 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(-)
include/sound/hda_codec.h +5 -5
@@ -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 */
include/sound/hda_local.h +7 -7
@@ -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);
sound/hda/hda_beep.c +1 -1
@@ -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,
sound/hda/hda_codec.c +2 -2
@@ -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;
sound/hda/hda_proc.c +4 -4
@@ -1,6 +1,6 @@/* * Universal Interface for Intel High Definition Audio Codec -* +* * Generic proc interface * * Copyright (c) 2004 Takashi Iwai <[email protected]>
@@ -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 ;
Signature · 1 line
1.7.9.5
RFC 4/5 ALSA: hda: rename sound/hda/hda* as sound/hda/hdalib
In reply to Vinod KoulFrom: Jeeja KP <[email protected]>
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_*
---
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%)sound/hda/Makefile +14 -13
@@ -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
sound/hda/hdalib_auto_parser.c renamed from sound/hda/hda_auto_parser.c +0 -0
sound/hda/hdalib_beep.c renamed from sound/hda/hda_beep.c +0 -0
sound/hda/hdalib_codec.c renamed from sound/hda/hda_codec.c +0 -0
sound/hda/hdalib_controller.c renamed from sound/hda/hda_controller.c +0 -0
sound/hda/hdalib_eld.c renamed from sound/hda/hda_eld.c +0 -0
sound/hda/hdalib_generic.c renamed from sound/hda/hda_generic.c +0 -0
sound/hda/hdalib_hwdep.c renamed from sound/hda/hda_hwdep.c +0 -0
sound/hda/hdalib_jack.c renamed from sound/hda/hda_jack.c +0 -0
sound/hda/hdalib_proc.c renamed from sound/hda/hda_proc.c +0 -0
sound/hda/hdalib_sysfs.c renamed from sound/hda/hda_sysfs.c +0 -0
Signature · 1 line
1.7.9.5
RFC 5/5 ALSA: hdalib: rename common header files as hdalib_*
In reply to Vinod KoulFrom: Jeeja KP <[email protected]>
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
---
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%)include/sound/hda_register.h renamed from include/sound/hda_priv.h +3 -7
@@ -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 */
include/sound/hdalib_auto_parser.h renamed from include/sound/hda_auto_parser.h +3 -3
@@ -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 */
include/sound/hdalib_beep.h renamed from include/sound/hda_beep.h +3 -3
@@ -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
include/sound/hdalib_codec.h renamed from include/sound/hda_codec.h +6 -7
@@ -1,8 +1,11 @@/* * Universal Interface for Intel High Definition Audio Codec * +* Copyright (c) 2014 Intel Corporation * Copyright (c) 2004 Takashi Iwai <[email protected]> * +* Modified by: Lakshmi Vinnakota <[email protected]> +* * 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 */
include/sound/hdalib_controller.h renamed from include/sound/hda_controller.h +6 -5
@@ -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 */
include/sound/hdalib_controls.h renamed from include/sound/hda_local.h +3 -3
@@ -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 */
include/sound/hdalib_generic.h renamed from include/sound/hda_generic.h +3 -3
@@ -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 */
include/sound/hdalib_hwdep.h renamed from include/sound/hda_hwdep.h +2 -2
@@ -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 */
include/sound/hdalib_jack.h renamed from include/sound/hda_jack.h +3 -3
@@ -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 */
sound/hda/hdalib_auto_parser.c +4 -3
@@ -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
sound/hda/hdalib_beep.c +4 -2
@@ -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 */
sound/hda/hdalib_codec.c +8 -9
@@ -1,8 +1,10 @@/* * Universal Interface for Intel High Definition Audio Codec * +* Copyright (c) 2014 Intel Corporation * Copyright (c) 2004 Takashi Iwai <[email protected]> * +* Modified by: Lakshmi Vinnakota <[email protected]> * * 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"
sound/hda/hdalib_controller.c +7 -3
@@ -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 <[email protected]> * PeiSen Hou <[email protected]> * +* Modified by: KP Jeeja <[email protected]> +* * 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"
sound/hda/hdalib_eld.c +2 -2
@@ -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 ,
sound/hda/hdalib_generic.c +7 -6
@@ -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> /**
sound/hda/hdalib_hwdep.c +3 -3
@@ -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> /*
sound/hda/hdalib_jack.c +4 -4
@@ -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
sound/hda/hdalib_proc.c +3 -2
@@ -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 );
sound/hda/hdalib_sysfs.c +3 -3
@@ -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 {
sound/pci/hda/hda_i915.c +2 -1
@@ -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.
sound/pci/hda/hda_intel.c +4 -3
@@ -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 */
sound/pci/hda/patch_hdmi.c +9 -1
@@ -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 );
sound/pci/hda/patch_realtek.c +7 -3
@@ -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
Signature · 1 line
1.7.9.5
At Sun, 8 Mar 2015 20:07:54 +0530,
Quoted 8 lines · Vinod Koul
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.
Quoted 5 lines
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 recentlyComments 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 */
Quoted 16 lines · Takashi Iwai
At Sun, 8 Mar 2015 20:07:54 +0530,
Quoted 8 lines · Vinod Koul
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.
Quoted 5 lines
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 recentlyComments welcome...
Quoted 9 lines
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/hdacore 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.
Quoted 4 lines
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... :)
Signature · 1 line
~Vinod
Quoted 250 lines
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 u16hda_nid_t;struct
hdac_bus;
structhdac_device;
structhdac_driver;
structhdac_widget_tree;/*
* exported bus type
*/
extern structbus_typesnd_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, structhdac_bus*bus,const char *name, unsigned int addr);void
snd_hdac_device_exit(struct hdac_device *dev); intsnd_hdac_device_register(struct hdac_device *codec); voidsnd_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_tnid,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(structhdac_device*codec,hda_nid_tnid,
int parm){ unsigned int val; return _snd_hdac_read_parm(codec, nid, parm, &val) < 0 ? -1 : val; }#ifdef
CONFIG_PM
voidsnd_hdac_power_up(struct hdac_device *codec);
voidsnd_hdac_power_down(struct hdac_device *codec); #else
static inline voidsnd_hdac_power_up(struct hdac_device *codec){} static inline voidsnd_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_SIZE64struct 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(structhdac_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(structsnd_array*array);
voidsnd_array_free(struct snd_array *array);
static inline void snd_array_init(structsnd_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*/
At Sun, 8 Mar 2015 22:25:36 +0530,
Quoted 27 lines · Vinod Koul
Quoted 16 lines · Takashi Iwai
At Sun, 8 Mar 2015 20:07:54 +0530,
Quoted 8 lines · Vinod Koul
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.
Quoted 5 lines
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 recentlyComments welcome...
Quoted 9 lines
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/hdacore 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.)
Quoted 4 lines
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.
Quoted 7 lines
Quoted 2 lines
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