drivers/pinctrl/spear/pinctrl-spear.h

Source file repositories/reference/linux-study-clean/drivers/pinctrl/spear/pinctrl-spear.h

File Facts

System
Linux kernel
Corpus path
drivers/pinctrl/spear/pinctrl-spear.h
Extension
.h
Size
13689 bytes
Lines
456
Domain
Driver Families
Bucket
drivers/pinctrl
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 spear_pmx_mode {
	const char *const name;
	u16 mode;
	u16 reg;
	u16 mask;
	u32 val;
};

/**
 * struct spear_muxreg - SPEAr mux reg configuration
 * @reg: register offset
 * @mask: mask bits
 * @val: val to be written on mask bits
 */
struct spear_muxreg {
	u16 reg;
	u32 mask;
	u32 val;
};

struct spear_gpio_pingroup {
	const unsigned *pins;
	unsigned npins;
	struct spear_muxreg *muxregs;
	u8 nmuxregs;
};

/* ste: set to enable */
#define DEFINE_MUXREG(__pins, __muxreg, __mask, __ste)		\
static struct spear_muxreg __pins##_muxregs[] = {		\
	{							\
		.reg = __muxreg,				\
		.mask = __mask,					\
		.val = __ste ? __mask : 0,			\
	},							\
}

#define DEFINE_2_MUXREG(__pins, __muxreg1, __muxreg2, __mask, __ste1, __ste2) \
static struct spear_muxreg __pins##_muxregs[] = {		\
	{							\
		.reg = __muxreg1,				\
		.mask = __mask,					\
		.val = __ste1 ? __mask : 0,			\
	}, {							\
		.reg = __muxreg2,				\
		.mask = __mask,					\
		.val = __ste2 ? __mask : 0,			\
	},							\
}

#define GPIO_PINGROUP(__pins)					\
	{							\
		.pins = __pins,					\
		.npins = ARRAY_SIZE(__pins),			\
		.muxregs = __pins##_muxregs,			\
		.nmuxregs = ARRAY_SIZE(__pins##_muxregs),	\
	}

/**
 * struct spear_modemux - SPEAr mode mux configuration
 * @modes: mode ids supported by this group of muxregs
 * @nmuxregs: number of muxreg configurations to be done for modes
 * @muxregs: array of muxreg configurations to be done for modes
 */
struct spear_modemux {
	u16 modes;
	u8 nmuxregs;
	struct spear_muxreg *muxregs;
};

/**
 * struct spear_pingroup - SPEAr pin group configurations
 * @name: name of pin group
 * @pins: array containing pin numbers
 * @npins: size of pins array
 * @modemuxs: array of modemux configurations for this pin group
 * @nmodemuxs: size of array modemuxs
 *
 * A representation of a group of pins in the SPEAr pin controller. Each group
 * allows some parameter or parameters to be configured.
 */
struct spear_pingroup {
	const char *name;
	const unsigned *pins;
	unsigned npins;
	struct spear_modemux *modemuxs;
	unsigned nmodemuxs;
};

/**

Annotation

Implementation Notes