drivers/pinctrl/pinctrl-tps6594.c

Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-tps6594.c

File Facts

System
Linux kernel
Corpus path
drivers/pinctrl/pinctrl-tps6594.c
Extension
.c
Size
18030 bytes
Lines
583
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 tps6594_pinctrl_function {
	struct pinfunction pinfunction;
	u8 muxval;
};

struct muxval_remap {
	unsigned int group;
	u8 muxval;
	u8 remap;
};

static struct muxval_remap tps65224_muxval_remap[] = {
	{5, TPS6594_PINCTRL_DISABLE_WDOG_FUNCTION, TPS65224_PINCTRL_WKUP_FUNCTION_GPIO5},
	{5, TPS65224_PINCTRL_SYNCCLKIN_FUNCTION, TPS65224_PINCTRL_SYNCCLKIN_FUNCTION_GPIO5},
	{5, TPS65224_PINCTRL_NSLEEP2_FUNCTION, TPS65224_PINCTRL_NSLEEP2_FUNCTION_GPIO5},
};

static struct muxval_remap tps6594_muxval_remap[] = {
	{8, TPS6594_PINCTRL_DISABLE_WDOG_FUNCTION, TPS6594_PINCTRL_DISABLE_WDOG_FUNCTION_GPIO8},
	{8, TPS6594_PINCTRL_SYNCCLKOUT_FUNCTION, TPS6594_PINCTRL_SYNCCLKOUT_FUNCTION_GPIO8},
	{9, TPS6594_PINCTRL_CLK32KOUT_FUNCTION, TPS6594_PINCTRL_CLK32KOUT_FUNCTION_GPIO9},
};

static const struct tps6594_pinctrl_function pinctrl_functions[] = {
	FUNCTION(tps6594, gpio, TPS6594_PINCTRL_GPIO_FUNCTION),
	FUNCTION(tps6594, nsleep1, TPS6594_PINCTRL_NSLEEP1_FUNCTION),
	FUNCTION(tps6594, nsleep2, TPS6594_PINCTRL_NSLEEP2_FUNCTION),
	FUNCTION(tps6594, wkup1, TPS6594_PINCTRL_WKUP1_FUNCTION),
	FUNCTION(tps6594, wkup2, TPS6594_PINCTRL_WKUP2_FUNCTION),
	FUNCTION(tps6594, scl_i2c2_cs_spi, TPS6594_PINCTRL_SCL_I2C2_CS_SPI_FUNCTION),
	FUNCTION(tps6594, nrstout_soc, TPS6594_PINCTRL_NRSTOUT_SOC_FUNCTION),
	FUNCTION(tps6594, trig_wdog, TPS6594_PINCTRL_TRIG_WDOG_FUNCTION),
	FUNCTION(tps6594, sda_i2c2_sdo_spi, TPS6594_PINCTRL_SDA_I2C2_SDO_SPI_FUNCTION),
	FUNCTION(tps6594, clk32kout, TPS6594_PINCTRL_CLK32KOUT_FUNCTION),
	FUNCTION(tps6594, nerr_soc, TPS6594_PINCTRL_NERR_SOC_FUNCTION),
	FUNCTION(tps6594, sclk_spmi, TPS6594_PINCTRL_SCLK_SPMI_FUNCTION),
	FUNCTION(tps6594, sdata_spmi, TPS6594_PINCTRL_SDATA_SPMI_FUNCTION),
	FUNCTION(tps6594, nerr_mcu, TPS6594_PINCTRL_NERR_MCU_FUNCTION),
	FUNCTION(tps6594, syncclkout, TPS6594_PINCTRL_SYNCCLKOUT_FUNCTION),
	FUNCTION(tps6594, disable_wdog, TPS6594_PINCTRL_DISABLE_WDOG_FUNCTION),
	FUNCTION(tps6594, pdog, TPS6594_PINCTRL_PDOG_FUNCTION),
	FUNCTION(tps6594, syncclkin, TPS6594_PINCTRL_SYNCCLKIN_FUNCTION),
};

static const struct tps6594_pinctrl_function tps65224_pinctrl_functions[] = {
	FUNCTION(tps65224, gpio, TPS6594_PINCTRL_GPIO_FUNCTION),
	FUNCTION(tps65224, sda_i2c2_sdo_spi, TPS65224_PINCTRL_SDA_I2C2_SDO_SPI_FUNCTION),
	FUNCTION(tps65224, nsleep2, TPS65224_PINCTRL_NSLEEP2_FUNCTION),
	FUNCTION(tps65224, nint, TPS65224_PINCTRL_NINT_FUNCTION),
	FUNCTION(tps65224, scl_i2c2_cs_spi, TPS65224_PINCTRL_SCL_I2C2_CS_SPI_FUNCTION),
	FUNCTION(tps65224, nsleep1, TPS65224_PINCTRL_NSLEEP1_FUNCTION),
	FUNCTION(tps65224, trig_wdog, TPS65224_PINCTRL_TRIG_WDOG_FUNCTION),
	FUNCTION(tps65224, vmon1, TPS65224_PINCTRL_VMON1_FUNCTION),
	FUNCTION(tps65224, pb, TPS65224_PINCTRL_PB_FUNCTION),
	FUNCTION(tps65224, vmon2, TPS65224_PINCTRL_VMON2_FUNCTION),
	FUNCTION(tps65224, adc_in, TPS65224_PINCTRL_ADC_IN_FUNCTION),
	FUNCTION(tps65224, wkup, TPS65224_PINCTRL_WKUP_FUNCTION),
	FUNCTION(tps65224, syncclkin, TPS65224_PINCTRL_SYNCCLKIN_FUNCTION),
	FUNCTION(tps65224, nerr_mcu, TPS65224_PINCTRL_NERR_MCU_FUNCTION),
};

static const struct tps6594_pinctrl_function tps652g1_pinctrl_functions[] = {
	FUNCTION(tps65224, gpio, TPS6594_PINCTRL_GPIO_FUNCTION),
	FUNCTION(tps65224, sda_i2c2_sdo_spi, TPS65224_PINCTRL_SDA_I2C2_SDO_SPI_FUNCTION),
	FUNCTION(tps65224, nsleep2, TPS65224_PINCTRL_NSLEEP2_FUNCTION),
	FUNCTION(tps65224, nint, TPS65224_PINCTRL_NINT_FUNCTION),
	FUNCTION(tps652g1, cs_spi, TPS65224_PINCTRL_SCL_I2C2_CS_SPI_FUNCTION),
	FUNCTION(tps65224, nsleep1, TPS65224_PINCTRL_NSLEEP1_FUNCTION),
	FUNCTION(tps65224, pb, TPS65224_PINCTRL_PB_FUNCTION),
	FUNCTION(tps65224, wkup, TPS65224_PINCTRL_WKUP_FUNCTION),
	FUNCTION(tps65224, syncclkin, TPS65224_PINCTRL_SYNCCLKIN_FUNCTION),
};

struct tps6594_pinctrl {
	struct tps6594 *tps;
	struct gpio_regmap *gpio_regmap;
	struct pinctrl_dev *pctl_dev;
	const struct tps6594_pinctrl_function *funcs;
	const struct pinctrl_pin_desc *pins;
	int func_cnt;
	int num_pins;
	u8 mux_sel_mask;
	unsigned int remap_cnt;
	struct muxval_remap *remap;
};

static struct tps6594_pinctrl tps652g1_template_pinctrl = {
	.funcs = tps652g1_pinctrl_functions,
	.func_cnt = ARRAY_SIZE(tps652g1_pinctrl_functions),
	.pins = tps65224_pins,

Annotation

Implementation Notes