Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98d8fc6c authored by Mengdong Lin's avatar Mengdong Lin Committed by Takashi Iwai
Browse files

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: default avatarMengdong Lin <mengdong.lin@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 4214c534
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
/*
 * HD-Audio helpers to sync with i915 driver
 */
#ifndef __SOUND_HDA_I915_H
#define __SOUND_HDA_I915_H

#ifdef CONFIG_SND_HDA_I915
int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable);
int snd_hdac_display_power(struct hdac_bus *bus, bool enable);
int snd_hdac_get_display_clk(struct hdac_bus *bus);
int snd_hdac_i915_init(struct hdac_bus *bus);
int snd_hdac_i915_exit(struct hdac_bus *bus);
#else
static int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable)
{
	return 0;
}
static inline int snd_hdac_display_power(struct hdac_bus *bus, bool enable)
{
	return 0;
}
static inline int snd_hdac_get_display_clk(struct hdac_bus *bus)
{
	return 0;
}
static inline int snd_hdac_i915_init(struct hdac_bus *bus)
{
	return -ENODEV;
}
static inline int snd_hdac_i915_exit(struct hdac_bus *bus)
{
	return 0;
}
#endif

#endif /* __SOUND_HDA_I915_H */
+4 −0
Original line number Diff line number Diff line
@@ -84,6 +84,10 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
#define AZX_REG_SD_BDLPL		0x18
#define AZX_REG_SD_BDLPU		0x1c

/* Haswell/Broadwell display HD-A controller Extended Mode registers */
#define AZX_REG_HSW_EM4			0x100c
#define AZX_REG_HSW_EM5			0x1010

/* PCI space */
#define AZX_PCIREG_TCSEL		0x44

+5 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <sound/core.h>
#include <sound/memalloc.h>
#include <sound/hda_verbs.h>
#include <drm/i915_component.h>

/* codec node id */
typedef u16 hda_nid_t;
@@ -285,6 +286,10 @@ struct hdac_bus {
	/* locks */
	spinlock_t reg_lock;
	struct mutex cmd_mutex;

	/* i915 component interface */
	struct i915_audio_component *audio_component;
	int i915_power_refcount;
};

int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
+6 −0
Original line number Diff line number Diff line
@@ -4,3 +4,9 @@ config SND_HDA_CORE

config SND_HDA_DSP_LOADER
	bool

config SND_HDA_I915
	bool
	default y
	depends on DRM_I915
	depends on SND_HDA_CORE
+3 −0
Original line number Diff line number Diff line
@@ -4,4 +4,7 @@ snd-hda-core-objs := hda_bus_type.o hdac_bus.o hdac_device.o hdac_sysfs.o \
snd-hda-core-objs += trace.o
CFLAGS_trace.o := -I$(src)

# for sync with i915 gfx driver
snd-hda-core-$(CONFIG_SND_HDA_I915) += hdac_i915.o

obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o
Loading