sound/soc/renesas/rcar/ssiu.c

Source file repositories/reference/linux-study-clean/sound/soc/renesas/rcar/ssiu.c

File Facts

System
Linux kernel
Corpus path
sound/soc/renesas/rcar/ssiu.c
Extension
.c
Size
14656 bytes
Lines
652
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 rsnd_ssiu {
	struct rsnd_mod mod;
	u32 busif_status[8]; /* for BUSIF0 - BUSIF7 */
	unsigned int usrcnt;
	int id;
	int id_sub;
};

/* SSI_MODE */
#define TDM_EXT		(1 << 0)
#define TDM_SPLIT	(1 << 8)

#define rsnd_ssiu_nr(priv) ((priv)->ssiu_nr)
#define rsnd_mod_to_ssiu(_mod) container_of((_mod), struct rsnd_ssiu, mod)
#define for_each_rsnd_ssiu(pos, priv, i)				\
	for (i = 0;							\
	     (i < rsnd_ssiu_nr(priv)) &&				\
		     ((pos) = ((struct rsnd_ssiu *)(priv)->ssiu + i));	\
	     i++)

/*
 *	SSI	Gen2		Gen3		Gen4		RZ/G3E
 *	0	BUSIF0-3	BUSIF0-7	BUSIF0-7	BUSIF0-3
 *	1	BUSIF0-3	BUSIF0-7			BUSIF0-3
 *	2	BUSIF0-3	BUSIF0-7			BUSIF0-3
 *	3	BUSIF0		BUSIF0-7			BUSIF0-3
 *	4	BUSIF0		BUSIF0-7			BUSIF0-3
 *	5	BUSIF0		BUSIF0				BUSIF0
 *	6	BUSIF0		BUSIF0				BUSIF0
 *	7	BUSIF0		BUSIF0				BUSIF0
 *	8	BUSIF0		BUSIF0				BUSIF0
 *	9	BUSIF0-3	BUSIF0-7			BUSIF0-3
 *	total	22		52		8		28
 */
static const int gen2_id[] = { 0, 4,  8, 12, 13, 14, 15, 16, 17, 18 };
static const int gen3_id[] = { 0, 8, 16, 24, 32, 40, 41, 42, 43, 44 };
static const int gen4_id[] = { 0 };
static const int rzg3e_id[] = { 0, 4, 8, 12, 16, 20, 21, 22, 23, 24 };

struct rsnd_ssiu_ctrl {
	unsigned int busif_status_count;
};

#define rsnd_priv_to_ssiu_ctrl(priv) \
	((struct rsnd_ssiu_ctrl *)(priv)->ssiu_ctrl)

/* enable busif buffer over/under run interrupt. */
#define rsnd_ssiu_busif_err_irq_enable(mod)  rsnd_ssiu_busif_err_irq_ctrl(mod, 1)
#define rsnd_ssiu_busif_err_irq_disable(mod) rsnd_ssiu_busif_err_irq_ctrl(mod, 0)
static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod *mod, int enable)
{
	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
	int id = rsnd_mod_id(mod);
	int shift, offset;

	switch (id) {
	case 0:
	case 1:
	case 2:
	case 3:
	case 4:
		shift  = id;
		offset = 0;
		break;
	case 9:
		shift  = 1;
		offset = 1;
		break;
	default:
		return;
	}

	for (unsigned int i = 0; i < rsnd_priv_to_ssiu_ctrl(priv)->busif_status_count; i++) {
		enum rsnd_reg reg = SSI_SYS_INT_ENABLE((i * 2) + offset);
		u32 val = 0xf << (shift * 4);
		u32 sys_int_enable = rsnd_mod_read(mod, reg);

		if (enable)
			sys_int_enable |= val;
		else
			sys_int_enable &= ~val;
		rsnd_mod_write(mod, reg, sys_int_enable);
	}
}

bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod)
{
	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
	bool error = false;
	int id = rsnd_mod_id(mod);

Annotation

Implementation Notes