Skip to contentSkip to conversation

ALSA: hda - add hda controller to hda core

PATCH Superseded Vinod Koul 1 participant 6 messages Apr 1, 2015 Sound

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

v3 cover ALSA: hda - add hda controller to hda core

This incorporates the comments from Takashi on 1st patch and uses the change from Takashi's unstable tree for controller and then adds the DSP loader code on top.
This is based on sound/topic/hda-core

Comments welcome

Jeeja KP (1):
ALSA: hda: move common hda controller register defines up

Vinod Koul (4):
ALSA: hda: add HDA_MAX_CODECS
ALSA: hda - Add the controller helper codes to hda-core module
ALSA: hda - move dsp lock to hdac
ALSA: hda - add the DSP loader code

 include/sound/hda_registers.h  |  177 +++++++++++++
 include/sound/hdaudio.h        |  185 ++++++++++++-
 sound/hda/Makefile             |    3 +-
 sound/hda/hdac_bus.c           |   13 +-
 sound/hda/hdac_controller.c    |  401 ++++++++++++++++++++++++++++
 sound/hda/hdac_stream.c        |  565 ++++++++++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_controller.c |   17 +-
 sound/pci/hda/hda_controller.h |  171 +-----------
 8 files changed, 1347 insertions(+), 185 deletions(-)
 create mode 100644 include/sound/hda_registers.h
 create mode 100644 sound/hda/hdac_controller.c
 create mode 100644 sound/hda/hdac_stream.c
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v3 1/5 ALSA: hda: add HDA_MAX_CODECS

This moves AZX_MAX_CODECS define to HDA_MAX_CODECS so that common code can use this as well

---
 include/sound/hdaudio.h        |    2 ++
 sound/pci/hda/hda_controller.c |    4 ++--
 sound/pci/hda/hda_controller.h |    9 ++++-----
 3 files changed, 8 insertions(+), 7 deletions(-)
include/sound/hdaudio.h +2 -0
index 675614dc2b88..c67dbd3d8afa 100644
@@ -8,6 +8,8 @@
 #include <linux/device.h>
 #include <sound/hda_verbs.h>
 
+#define HDA_MAX_CODECS		8
+
 /* codec node id */
 typedef u16 hda_nid_t;
 
sound/pci/hda/hda_controller.c +2 -2
index 26ce990592a0..abb3822f5488 100644
@@ -1066,7 +1066,7 @@ static unsigned int azx_command_addr(u32 cmd)
 {
 	unsigned int addr = cmd >> 28;
 
-	if (addr >= AZX_MAX_CODECS) {
+	if (addr >= HDA_MAX_CODECS) {
 		snd_BUG();
 		addr = 0;
 	}
@@ -1136,7 +1136,7 @@ static void azx_update_rirb(struct azx *chip)
 		res_ex = le32_to_cpu(chip->rirb.buf[rp + 1]);
 		res = le32_to_cpu(chip->rirb.buf[rp]);
 		addr = res_ex & 0xf;
-		if ((addr >= AZX_MAX_CODECS) || !(chip->codec_mask & (1 << addr))) {
+		if ((addr >= HDA_MAX_CODECS) || !(chip->codec_mask & (1 << addr))) {
 			dev_err(chip->card->dev, "spurious response %#x:%#x, rp = %d, wp = %d",
 				res, res_ex,
 				chip->rirb.rp, wp);
sound/pci/hda/hda_controller.h +4 -5
index be1b7ded8d82..2aa75e34a718 100644
@@ -119,9 +119,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define RIRB_INT_MASK		0x05
 
 /* STATESTS int mask: S3,SD2,SD1,SD0 */
-#define AZX_MAX_CODECS		8
 #define AZX_DEFAULT_CODECS	4
-#define STATESTS_INT_MASK	((1 << AZX_MAX_CODECS) - 1)
+#define STATESTS_INT_MASK	((1 << HDA_MAX_CODECS) - 1)
 
 /* SD_CTL bits */
 #define SD_CTL_STREAM_RESET	0x01	/* stream reset bit */
@@ -245,8 +244,8 @@ struct azx_rb {
 	dma_addr_t addr;	/* physical address of CORB/RIRB buffer */
 	/* for RIRB */
 	unsigned short rp, wp;	/* read/write pointers */
-	int cmds[AZX_MAX_CODECS];	/* number of pending requests */
-	u32 res[AZX_MAX_CODECS];	/* last read value */
+	int cmds[HDA_MAX_CODECS];	/* number of pending requests */
+	u32 res[HDA_MAX_CODECS];	/* last read value */
 };
 
 struct azx;
@@ -360,7 +359,7 @@ struct azx {
 	unsigned int disabled:1; /* disabled by VGA-switcher */
 
 	/* for debugging */
-	unsigned int last_cmd[AZX_MAX_CODECS];
+	unsigned int last_cmd[HDA_MAX_CODECS];
 
 #ifdef CONFIG_SND_HDA_DSP_LOADER
 	struct azx_dev saved_azx_dev;
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v3 2/5 ALSA: hda: move common hda controller register defines up

In reply to Vinod Koul

From: Jeeja KP <[email protected]>

The HDA register defines would be accessed by both existing codes as well as new code, so move it up to include/sound
No code change, fixed few alignment though

---
 include/sound/hda_registers.h  |  168 ++++++++++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_controller.h |  164 +--------------------------------------
 2 files changed, 169 insertions(+), 163 deletions(-)
 create mode 100644 include/sound/hda_registers.h
include/sound/hda_registers.h new file +168 -0
new file mode 100644
index 000000000000..6afb26191f4d
@@ -0,0 +1,168 @@
+#ifndef __SOUND_HDA_REGISTERS_H
+#define __SOUND_HDA_REGISTERS_H
+
+/*
+ * registers
+ */
+#define AZX_REG_GCAP			0x00
+#define AZX_GCAP_64OK			(1 << 0)   /* 64bit address support */
+#define AZX_GCAP_NSDO			(3 << 1)   /* # of serial data out signals */
+#define AZX_GCAP_BSS			(31 << 3)  /* # of bidirectional streams */
+#define AZX_GCAP_ISS			(15 << 8)  /* # of input streams */
+#define AZX_GCAP_OSS			(15 << 12) /* # of output streams */
+#define AZX_REG_VMIN			0x02
+#define AZX_REG_VMAJ			0x03
+#define AZX_REG_OUTPAY			0x04
+#define AZX_REG_INPAY			0x06
+#define AZX_REG_GCTL			0x08
+#define AZX_GCTL_RESET			(1 << 0)   /* controller reset */
+#define AZX_GCTL_FCNTRL			(1 << 1)   /* flush control */
+#define AZX_GCTL_UNSOL			(1 << 8)   /* accept unsol. response enable */
+#define AZX_REG_WAKEEN			0x0c
+#define AZX_REG_STATESTS		0x0e
+#define AZX_REG_GSTS			0x10
+#define AZX_GSTS_FSTS			(1 << 1)   /* flush status */
+#define AZX_REG_INTCTL			0x20
+#define AZX_REG_INTSTS			0x24
+#define AZX_REG_WALLCLK			0x30	/* 24Mhz source */
+#define AZX_REG_OLD_SSYNC		0x34	/* SSYNC for old ICH */
+#define AZX_REG_SSYNC			0x38
+#define AZX_REG_CORBLBASE		0x40
+#define AZX_REG_CORBUBASE		0x44
+#define AZX_REG_CORBWP			0x48
+#define AZX_REG_CORBRP			0x4a
+#define AZX_CORBRP_RST			(1 << 15)  /* read pointer reset */
+#define AZX_REG_CORBCTL			0x4c
+#define AZX_CORBCTL_RUN			(1 << 1)   /* enable DMA */
+#define AZX_CORBCTL_CMEIE		(1 << 0)   /* enable memory error irq */
+#define AZX_REG_CORBSTS			0x4d
+#define AZX_CORBSTS_CMEI		(1 << 0)   /* memory error indication */
+#define AZX_REG_CORBSIZE		0x4e
+
+#define AZX_REG_RIRBLBASE		0x50
+#define AZX_REG_RIRBUBASE		0x54
+#define AZX_REG_RIRBWP			0x58
+#define AZX_RIRBWP_RST			(1 << 15)  /* write pointer reset */
+#define AZX_REG_RINTCNT			0x5a
+#define AZX_REG_RIRBCTL			0x5c
+#define AZX_RBCTL_IRQ_EN		(1 << 0)   /* enable IRQ */
+#define AZX_RBCTL_DMA_EN		(1 << 1)   /* enable DMA */
+#define AZX_RBCTL_OVERRUN_EN		(1 << 2)   /* enable overrun irq */
+#define AZX_REG_RIRBSTS			0x5d
+#define AZX_RBSTS_IRQ			(1 << 0)   /* response irq */
+#define AZX_RBSTS_OVERRUN		(1 << 2)   /* overrun irq */
+#define AZX_REG_RIRBSIZE		0x5e
+
+#define AZX_REG_IC			0x60
+#define AZX_REG_IR			0x64
+#define AZX_REG_IRS			0x68
+#define AZX_IRS_VALID			(1<<1)
+#define AZX_IRS_BUSY			(1<<0)
+
+#define AZX_REG_DPLBASE			0x70
+#define AZX_REG_DPUBASE			0x74
+#define AZX_DPLBASE_ENABLE		0x1	/* Enable position buffer */
+
+/* SD offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */
+enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
+
+/* stream register offsets from stream base */
+#define AZX_REG_SD_CTL			0x00
+#define AZX_REG_SD_STS			0x03
+#define AZX_REG_SD_LPIB			0x04
+#define AZX_REG_SD_CBL			0x08
+#define AZX_REG_SD_LVI			0x0c
+#define AZX_REG_SD_FIFOW		0x0e
+#define AZX_REG_SD_FIFOSIZE		0x10
+#define AZX_REG_SD_FORMAT		0x12
+#define AZX_REG_SD_BDLPL		0x18
+#define AZX_REG_SD_BDLPU		0x1c
+
+/* PCI space */
+#define AZX_PCIREG_TCSEL		0x44
+
+/*
+ * other constants
+ */
+
+/* max number of fragments - we may use more if allocating more pages for BDL */
+#define BDL_SIZE		4096
+#define AZX_MAX_BDL_ENTRIES	(BDL_SIZE / 16)
+#define AZX_MAX_FRAG		32
+/* max buffer size - no h/w limit, you can increase as you like */
+#define AZX_MAX_BUF_SIZE	(1024*1024*1024)
+
+/* RIRB int mask: overrun[2], response[0] */
+#define RIRB_INT_RESPONSE	0x01
+#define RIRB_INT_OVERRUN	0x04
+#define RIRB_INT_MASK		0x05
+
+/* STATESTS int mask: S3,SD2,SD1,SD0 */
+#define AZX_DEFAULT_CODECS	4
+#define STATESTS_INT_MASK	((1 << HDA_MAX_CODECS) - 1)
+
+/* SD_CTL bits */
+#define SD_CTL_STREAM_RESET	0x01	/* stream reset bit */
+#define SD_CTL_DMA_START	0x02	/* stream DMA start bit */
+#define SD_CTL_STRIPE		(3 << 16)	/* stripe control */
+#define SD_CTL_TRAFFIC_PRIO	(1 << 18)	/* traffic priority */
+#define SD_CTL_DIR		(1 << 19)	/* bi-directional stream */
+#define SD_CTL_STREAM_TAG_MASK	(0xf << 20)
+#define SD_CTL_STREAM_TAG_SHIFT	20
+
+/* SD_CTL and SD_STS */
+#define SD_INT_DESC_ERR		0x10	/* descriptor error interrupt */
+#define SD_INT_FIFO_ERR		0x08	/* FIFO error interrupt */
+#define SD_INT_COMPLETE		0x04	/* completion interrupt */
+#define SD_INT_MASK		(SD_INT_DESC_ERR|SD_INT_FIFO_ERR|\
+				 SD_INT_COMPLETE)
+
+/* SD_STS */
+#define SD_STS_FIFO_READY	0x20	/* FIFO ready */
+
+/* INTCTL and INTSTS */
+#define AZX_INT_ALL_STREAM	0xff	   /* all stream interrupts */
+#define AZX_INT_CTRL_EN		0x40000000 /* controller interrupt enable bit */
+#define AZX_INT_GLOBAL_EN	0x80000000 /* global interrupt enable bit */
+
+/* below are so far hardcoded - should read registers in future */
+#define AZX_MAX_CORB_ENTRIES	256
+#define AZX_MAX_RIRB_ENTRIES	256
+
+/* HD Audio class code */
+#define PCI_CLASS_MULTIMEDIA_HD_AUDIO	0x0403
+
+/*
+ * macros for easy use
+ */
+
+#define azx_writel(chip, reg, value) \
+	((chip)->ops->reg_writel(value, (chip)->remap_addr + AZX_REG_##reg))
+#define azx_readl(chip, reg) \
+	((chip)->ops->reg_readl((chip)->remap_addr + AZX_REG_##reg))
+#define azx_writew(chip, reg, value) \
+	((chip)->ops->reg_writew(value, (chip)->remap_addr + AZX_REG_##reg))
+#define azx_readw(chip, reg) \
+	((chip)->ops->reg_readw((chip)->remap_addr + AZX_REG_##reg))
+#define azx_writeb(chip, reg, value) \
+	((chip)->ops->reg_writeb(value, (chip)->remap_addr + AZX_REG_##reg))
+#define azx_readb(chip, reg) \
+	((chip)->ops->reg_readb((chip)->remap_addr + AZX_REG_##reg))
+
+#define azx_sd_writel(chip, dev, reg, value) \
+	((chip)->ops->reg_writel(value, (dev)->sd_addr + AZX_REG_##reg))
+#define azx_sd_readl(chip, dev, reg) \
+	((chip)->ops->reg_readl((dev)->sd_addr + AZX_REG_##reg))
+#define azx_sd_writew(chip, dev, reg, value) \
+	((chip)->ops->reg_writew(value, (dev)->sd_addr + AZX_REG_##reg))
+#define azx_sd_readw(chip, dev, reg) \
+	((chip)->ops->reg_readw((dev)->sd_addr + AZX_REG_##reg))
+#define azx_sd_writeb(chip, dev, reg, value) \
+	((chip)->ops->reg_writeb(value, (dev)->sd_addr + AZX_REG_##reg))
+#define azx_sd_readb(chip, dev, reg) \
+	((chip)->ops->reg_readb((dev)->sd_addr + AZX_REG_##reg))
+
+#define azx_has_pm_runtime(chip) \
+	(!AZX_DCAPS_PM_RUNTIME || ((chip)->driver_caps & AZX_DCAPS_PM_RUNTIME))
+
+#endif
sound/pci/hda/hda_controller.h +1 -163

184 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v3 3/5 ALSA: hda - Add the controller helper codes to

In reply to Vinod Koul

From: Takashi Iwai <[email protected]>

This is picked from Takashi's unstable tree and rebased on top of other changes done

---
 include/sound/hda_registers.h |   41 ++--
 include/sound/hdaudio.h       |  151 ++++++++++++-
 sound/hda/Makefile            |    3 +-
 sound/hda/hdac_bus.c          |   13 +-
 sound/hda/hdac_controller.c   |  401 ++++++++++++++++++++++++++++++++++
 sound/hda/hdac_stream.c       |  473 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 1063 insertions(+), 19 deletions(-)
 create mode 100644 sound/hda/hdac_controller.c
 create mode 100644 sound/hda/hdac_stream.c
include/sound/hda_registers.h +25 -16
index 6afb26191f4d..9852a8c562b4 100644
@@ -135,32 +135,41 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 /*
  * macros for easy use
  */
+#define _azx_write(type, chip, reg, value)				\
+	((chip)->ops->reg_write ## type(value, (chip)->remap_addr + (reg)))
+#define _azx_read(type, chip, reg)					\
+	((chip)->ops->reg_read ## type((chip)->remap_addr + (reg)))
 
 #define azx_writel(chip, reg, value) \
-	((chip)->ops->reg_writel(value, (chip)->remap_addr + AZX_REG_##reg))
-#define azx_readl(chip, reg) \
-	((chip)->ops->reg_readl((chip)->remap_addr + AZX_REG_##reg))
+	_azx_write(l, chip, AZX_REG_ ## reg, value)
 #define azx_writew(chip, reg, value) \
-	((chip)->ops->reg_writew(value, (chip)->remap_addr + AZX_REG_##reg))
-#define azx_readw(chip, reg) \
-	((chip)->ops->reg_readw((chip)->remap_addr + AZX_REG_##reg))
+	_azx_write(w, chip, AZX_REG_ ## reg, value)
 #define azx_writeb(chip, reg, value) \
-	((chip)->ops->reg_writeb(value, (chip)->remap_addr + AZX_REG_##reg))
+	_azx_write(b, chip, AZX_REG_ ## reg, value)
+#define azx_readl(chip, reg) \
+	_azx_read(l, chip, AZX_REG_ ## reg)
+#define azx_readw(chip, reg) \
+	_azx_read(w, chip, AZX_REG_ ## reg)
 #define azx_readb(chip, reg) \
-	((chip)->ops->reg_readb((chip)->remap_addr + AZX_REG_##reg))
+	_azx_read(b, chip, AZX_REG_ ## reg)
+
+#define _azx_sd_write(type, chip, dev, reg, value)			\
+	((chip)->ops->reg_write ## type(value, (dev)->sd_addr + (reg)))
+#define _azx_sd_read(type, chip, dev, reg)				\
+	((chip)->ops->reg_read ## type((dev)->sd_addr + (reg)))
 
 #define azx_sd_writel(chip, dev, reg, value) \
-	((chip)->ops->reg_writel(value, (dev)->sd_addr + AZX_REG_##reg))
-#define azx_sd_readl(chip, dev, reg) \
-	((chip)->ops->reg_readl((dev)->sd_addr + AZX_REG_##reg))
+	_azx_sd_write(l, chip, dev, AZX_REG_ ## reg, value)
 #define azx_sd_writew(chip, dev, reg, value) \
-	((chip)->ops->reg_writew(value, (dev)->sd_addr + AZX_REG_##reg))
-#define azx_sd_readw(chip, dev, reg) \
-	((chip)->ops->reg_readw((dev)->sd_addr + AZX_REG_##reg))
+	_azx_sd_write(w, chip, dev, AZX_REG_ ## reg, value)
 #define azx_sd_writeb(chip, dev, reg, value) \
-	((chip)->ops->reg_writeb(value, (dev)->sd_addr + AZX_REG_##reg))
+	_azx_sd_write(b, chip, dev, AZX_REG_ ## reg, value)
+#define azx_sd_readl(chip, dev, reg) \
+	_azx_sd_read(l, chip, dev, AZX_REG_ ## reg)
+#define azx_sd_readw(chip, dev, reg) \
+	_azx_sd_read(w, chip, dev, AZX_REG_ ## reg)
 #define azx_sd_readb(chip, dev, reg) \
-	((chip)->ops->reg_readb((dev)->sd_addr + AZX_REG_##reg))
+	_azx_sd_read(b, chip, dev, AZX_REG_ ## reg)
 
 #define azx_has_pm_runtime(chip) \
 	(!AZX_DCAPS_PM_RUNTIME || ((chip)->driver_caps & AZX_DCAPS_PM_RUNTIME))
include/sound/hdaudio.h +150 -1

194 lines not on this page · raw message

sound/hda/Makefile +2 -1
index eec5da03b41f..25af39f330ef 100644
@@ -1,4 +1,5 @@
-snd-hda-core-objs := hda_bus_type.o hdac_bus.o hdac_device.o hdac_sysfs.o
+snd-hda-core-objs := hda_bus_type.o hdac_bus.o hdac_device.o hdac_sysfs.o \
+	hdac_controller.o hdac_stream.o
 
 snd-hda-core-objs += trace.o
 CFLAGS_trace.o := -I$(src)
sound/hda/hdac_bus.c +12 -1
index 8e262da74f6a..3294fd465ca2 100644
@@ -11,6 +11,11 @@
 
 static void process_unsol_events(struct work_struct *work);
 
+static const struct hdac_bus_ops default_ops = {
+	.command = snd_hdac_bus_send_cmd,
+	.get_response = snd_hdac_bus_get_response,
+};
+
 /**
  * snd_hdac_bus_init - initialize a HD-audio bas bus
  * @bus: the pointer to bus object
@@ -22,9 +27,14 @@ int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
 {
 	memset(bus, 0, sizeof(*bus));
 	bus->dev = dev;
-	bus->ops = ops;
+	if (ops)
+		bus->ops = ops;
+	else
+		bus->ops = &default_ops;
+	INIT_LIST_HEAD(&bus->stream_list);
 	INIT_LIST_HEAD(&bus->codec_list);
 	INIT_WORK(&bus->unsol_work, process_unsol_events);
+	spin_lock_init(&bus->reg_lock);
 	mutex_init(&bus->cmd_mutex);
 	return 0;
 }
@@ -36,6 +46,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_init);
  */
 void snd_hdac_bus_exit(struct hdac_bus *bus)
 {
+	WARN_ON(!list_empty(&bus->stream_list));
 	WARN_ON(!list_empty(&bus->codec_list));
 	cancel_work_sync(&bus->unsol_work);
 }
sound/hda/hdac_controller.c new file +401 -0

401 lines not on this page · raw message

sound/hda/hdac_stream.c new file +473 -0

473 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH v3 4/5 ALSA: hda - move dsp lock to hdac

In reply to Vinod Koul

DSP lock will be used by DSP code loader in hdac as well

---
 include/sound/hdaudio.h        |   17 +++++++++++++++++
 sound/pci/hda/hda_controller.c |   13 -------------
 2 files changed, 17 insertions(+), 13 deletions(-)
include/sound/hdaudio.h +17 -0
index 647d5ef44222..df4033fc864d 100644
@@ -15,6 +15,19 @@
 
 #define HDA_MAX_CODECS		8
 
+/* DSP lock helpers */
+#ifdef CONFIG_SND_HDA_DSP_LOADER
+#define dsp_lock_init(dev)	mutex_init(&(dev)->dsp_mutex)
+#define dsp_lock(dev)		mutex_lock(&(dev)->dsp_mutex)
+#define dsp_unlock(dev)		mutex_unlock(&(dev)->dsp_mutex)
+#define dsp_is_locked(dev)	((dev)->locked)
+#else
+#define dsp_lock_init(dev)	do {} while (0)
+#define dsp_lock(dev)		do {} while (0)
+#define dsp_unlock(dev)		do {} while (0)
+#define dsp_is_locked(dev)	0
+#endif
+
 /* codec node id */
 typedef u16 hda_nid_t;
 
@@ -283,6 +296,7 @@ struct hdac_stream {
 	unsigned int opened:1;
 	unsigned int running:1;
 	unsigned int no_period_wakeup:1;
+	unsigned int locked:1;
 
 	/* timestamp */
 	unsigned long start_wallclk;	/* start + minimum wallclk */
@@ -292,6 +306,9 @@ struct hdac_stream {
 	int delay_negative_threshold;
 
 	struct list_head list;
+
+	/* DSP mutex */
+	struct mutex dsp_mutex;
 };
 
 void snd_hdac_bus_stream_init(struct hdac_bus *bus, struct hdac_stream *azx_dev,
sound/pci/hda/hda_controller.c +0 -13
index abb3822f5488..318635184edd 100644
@@ -34,19 +34,6 @@
 #define CREATE_TRACE_POINTS
 #include "hda_intel_trace.h"
 
-/* DSP lock helpers */
-#ifdef CONFIG_SND_HDA_DSP_LOADER
-#define dsp_lock_init(dev)	mutex_init(&(dev)->dsp_mutex)
-#define dsp_lock(dev)		mutex_lock(&(dev)->dsp_mutex)
-#define dsp_unlock(dev)		mutex_unlock(&(dev)->dsp_mutex)
-#define dsp_is_locked(dev)	((dev)->locked)
-#else
-#define dsp_lock_init(dev)	do {} while (0)
-#define dsp_lock(dev)		do {} while (0)
-#define dsp_unlock(dev)		do {} while (0)
-#define dsp_is_locked(dev)	0
-#endif
-
 /*
  * AZX stream operations.
  */
Signature · 1 line
1.7.9.5
author
#5 lore raw

PATCH v3 5/5 ALSA: hda - add the DSP loader code

In reply to Vinod Koul

This will be used by SKL controller

---
 include/sound/hdaudio.h |   15 ++++++++
 sound/hda/hdac_stream.c |   92 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+)
include/sound/hdaudio.h +15 -0
index df4033fc864d..9aeede3c8ea1 100644
@@ -153,6 +153,13 @@ struct hdac_bus_ops {
 	u16 (*reg_readw)(u16 __iomem *addr);
 	void (*reg_writeb)(u8 value, u8 __iomem *addr);
 	u8 (*reg_readb)(u8 __iomem *addr);
+
+	/* Allocation ops */
+	int (*dma_alloc_pages)(struct hdac_bus *bus,
+			       int type,
+			       size_t size,
+			       struct snd_dma_buffer *buf);
+	void (*dma_free_pages)(struct hdac_bus *bus, struct snd_dma_buffer *buf);
 };
 
 #define HDA_UNSOL_QUEUE_SIZE	64
@@ -330,6 +337,14 @@ void snd_hdac_stream_sync(struct hdac_stream *azx_dev, bool start,
 			  unsigned int streams);
 void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev,
 				      unsigned int streams);
+/*DSP loader functions */
+int snd_hdac_load_dsp_prepare(struct hdac_stream *azx_dev, unsigned int format,
+				unsigned int byte_size,
+				struct snd_dma_buffer *bufp);
+
+void snd_hdac_load_dsp_trigger(struct hdac_stream *azx_dev, bool start);
+void snd_hdac_load_dsp_cleanup(struct hdac_stream *azx_dev,
+				 struct snd_dma_buffer *dmab);
 
 /*
  * helpers to read the stream position
sound/hda/hdac_stream.c +92 -0

95 lines not on this page · raw message

Signature · 1 line
1.7.9.5