diff options
author | Mengdong Lin <mengdong.lin@intel.com> | 2015-05-19 10:29:30 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-05-20 00:16:36 -0400 |
commit | 98d8fc6c5d3652e91c61d78941e0fa6f94771d67 (patch) | |
tree | 31f5d9ce478f828686fb848b66bebc664c51898f /include/sound | |
parent | 4214c5349c20005b7a83916801394eb7270896b2 (diff) |
ALSA: hda - Move hda_i915.c from sound/pci/hda to sound/hda
The file is moved to hda core and renamed to hdac_i915.c, so can be used
by both legacy HDA driver and new Skylake audio driver.
- Add snd_hdac_ prefix to the public APIs.
- The i915 audio component is moved to core bus and dynamically allocated.
- A static pointer hdac_acomp is used to help bind/unbind callbacks to get
this component, because the sound card's private_data is used by the azx
chip pointer, which is a legacy structure. It could be removed if private
_data changes to some core structure which can be extended to find the
bus.
- snd_hdac_get_display_clk() is added to get the display core clock for
HSW/BDW.
- haswell_set_bclk() is moved to hda_intel.c because it needs to write the
controller registers EM4/EM5, and only legacy HD-A needs it for HSW/BDW.
- Move definition of HSW/BDW-specific registers EM4/EM5 to hda_register.h
and rename them to HSW_EM4/HSW_EM5, because other HD-A controllers have
different layout for the extended mode registers.
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/hda_i915.h | 36 | ||||
-rw-r--r-- | include/sound/hda_register.h | 4 | ||||
-rw-r--r-- | include/sound/hdaudio.h | 5 |
3 files changed, 45 insertions, 0 deletions
diff --git a/include/sound/hda_i915.h b/include/sound/hda_i915.h new file mode 100644 index 000000000000..adb5ba5cbd9d --- /dev/null +++ b/include/sound/hda_i915.h | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * HD-Audio helpers to sync with i915 driver | ||
3 | */ | ||
4 | #ifndef __SOUND_HDA_I915_H | ||
5 | #define __SOUND_HDA_I915_H | ||
6 | |||
7 | #ifdef CONFIG_SND_HDA_I915 | ||
8 | int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); | ||
9 | int snd_hdac_display_power(struct hdac_bus *bus, bool enable); | ||
10 | int snd_hdac_get_display_clk(struct hdac_bus *bus); | ||
11 | int snd_hdac_i915_init(struct hdac_bus *bus); | ||
12 | int snd_hdac_i915_exit(struct hdac_bus *bus); | ||
13 | #else | ||
14 | static int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) | ||
15 | { | ||
16 | return 0; | ||
17 | } | ||
18 | static inline int snd_hdac_display_power(struct hdac_bus *bus, bool enable) | ||
19 | { | ||
20 | return 0; | ||
21 | } | ||
22 | static inline int snd_hdac_get_display_clk(struct hdac_bus *bus) | ||
23 | { | ||
24 | return 0; | ||
25 | } | ||
26 | static inline int snd_hdac_i915_init(struct hdac_bus *bus) | ||
27 | { | ||
28 | return -ENODEV; | ||
29 | } | ||
30 | static inline int snd_hdac_i915_exit(struct hdac_bus *bus) | ||
31 | { | ||
32 | return 0; | ||
33 | } | ||
34 | #endif | ||
35 | |||
36 | #endif /* __SOUND_HDA_I915_H */ | ||
diff --git a/include/sound/hda_register.h b/include/sound/hda_register.h index 4f6d3fce6ee6..0c7536e30fa4 100644 --- a/include/sound/hda_register.h +++ b/include/sound/hda_register.h | |||
@@ -84,6 +84,10 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
84 | #define AZX_REG_SD_BDLPL 0x18 | 84 | #define AZX_REG_SD_BDLPL 0x18 |
85 | #define AZX_REG_SD_BDLPU 0x1c | 85 | #define AZX_REG_SD_BDLPU 0x1c |
86 | 86 | ||
87 | /* Haswell/Broadwell display HD-A controller Extended Mode registers */ | ||
88 | #define AZX_REG_HSW_EM4 0x100c | ||
89 | #define AZX_REG_HSW_EM5 0x1010 | ||
90 | |||
87 | /* PCI space */ | 91 | /* PCI space */ |
88 | #define AZX_PCIREG_TCSEL 0x44 | 92 | #define AZX_PCIREG_TCSEL 0x44 |
89 | 93 | ||
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index b97c59eab7ab..64fff4db81bb 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <sound/core.h> | 11 | #include <sound/core.h> |
12 | #include <sound/memalloc.h> | 12 | #include <sound/memalloc.h> |
13 | #include <sound/hda_verbs.h> | 13 | #include <sound/hda_verbs.h> |
14 | #include <drm/i915_component.h> | ||
14 | 15 | ||
15 | /* codec node id */ | 16 | /* codec node id */ |
16 | typedef u16 hda_nid_t; | 17 | typedef u16 hda_nid_t; |
@@ -285,6 +286,10 @@ struct hdac_bus { | |||
285 | /* locks */ | 286 | /* locks */ |
286 | spinlock_t reg_lock; | 287 | spinlock_t reg_lock; |
287 | struct mutex cmd_mutex; | 288 | struct mutex cmd_mutex; |
289 | |||
290 | /* i915 component interface */ | ||
291 | struct i915_audio_component *audio_component; | ||
292 | int i915_power_refcount; | ||
288 | }; | 293 | }; |
289 | 294 | ||
290 | int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, | 295 | int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, |