sound/soc/renesas/siu.h

Source file repositories/reference/linux-study-clean/sound/soc/renesas/siu.h

File Facts

System
Linux kernel
Corpus path
sound/soc/renesas/siu.h
Extension
.h
Size
5062 bytes
Lines
181
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct siu_spb_param {
	__u32	ab1a;	/* input FIFO address */
	__u32	ab0a;	/* output FIFO address */
	__u32	dir;	/* 0=the ather except CPUOUTPUT, 1=CPUINPUT */
	__u32	event;	/* SPB program starting conditions */
	__u32	stfifo;	/* STFIFO register setting value */
	__u32	trdat;	/* TRDAT register setting value */
};

struct siu_firmware {
	__u32			yram_fir_coeff[YRAM_FIR_SIZE];
	__u32			pram0[PRAM0_SIZE];
	__u32			pram1[PRAM1_SIZE];
	__u32			yram0[YRAM0_SIZE];
	__u32			yram1[YRAM1_SIZE];
	__u32			yram2[YRAM2_SIZE];
	__u32			yram3[YRAM3_SIZE];
	__u32			yram4[YRAM4_SIZE];
	__u32			spbpar_num;
	struct siu_spb_param	spbpar[32];
};

#ifdef __KERNEL__

#include <linux/dmaengine.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/sh_dma.h>

#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>

#define SIU_PERIOD_BYTES_MAX	8192		/* DMA transfer/period size */
#define SIU_PERIOD_BYTES_MIN	256		/* DMA transfer/period size */
#define SIU_PERIODS_MAX		64		/* Max periods in buffer */
#define SIU_PERIODS_MIN		4		/* Min periods in buffer */
#define SIU_BUFFER_BYTES_MAX	(SIU_PERIOD_BYTES_MAX * SIU_PERIODS_MAX)

/* SIU ports: only one can be used at a time */
enum {
	SIU_PORT_A,
	SIU_PORT_B,
	SIU_PORT_NUM,
};

/* SIU clock configuration */
enum {
	SIU_CLKA_PLL,
	SIU_CLKA_EXT,
	SIU_CLKB_PLL,
	SIU_CLKB_EXT
};

struct device;
struct siu_info {
	struct device		*dev;
	int			port_id;
	u32 __iomem		*pram;
	u32 __iomem		*xram;
	u32 __iomem		*yram;
	u32 __iomem		*reg;
	struct siu_firmware	fw;
};

struct siu_stream {
	struct work_struct		work;
	struct snd_pcm_substream	*substream;
	snd_pcm_format_t		format;
	size_t				buf_bytes;
	size_t				period_bytes;
	int				cur_period;	/* Period currently in dma */
	u32				volume;
	snd_pcm_sframes_t		xfer_cnt;	/* Number of frames */
	u8				rw_flg;		/* transfer status */
	/* DMA status */
	struct dma_chan			*chan;		/* DMA channel */
	struct dma_async_tx_descriptor	*tx_desc;
	dma_cookie_t			cookie;
	struct sh_dmae_slave		param;
};

struct siu_port {
	unsigned long		play_cap;	/* Used to track full duplex */
	struct snd_pcm		*pcm;
	struct siu_stream	playback;
	struct siu_stream	capture;
	u32			stfifo;		/* STFIFO value from firmware */
	u32			trdat;		/* TRDAT value from firmware */
};

Annotation

Implementation Notes