drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c

Source file repositories/reference/linux-study-clean/drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c

File Facts

System
Linux kernel
Corpus path
drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c
Extension
.c
Size
23967 bytes
Lines
959
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 pm8xxx_pin_data {
	unsigned reg;

	u8 mode;

	bool input;
	bool output;
	bool high_z;
	bool paired;
	bool output_value;

	u8 power_source;
	u8 dtest;
	u8 amux;
	u8 aout_level;
	u8 drive_strength;
	unsigned pullup;
};

struct pm8xxx_mpp {
	struct device *dev;
	struct regmap *regmap;
	struct pinctrl_dev *pctrl;
	struct gpio_chip chip;

	struct pinctrl_desc desc;
	unsigned npins;
};

static const struct pinconf_generic_params pm8xxx_mpp_bindings[] = {
	{"qcom,amux-route",	PM8XXX_CONFIG_AMUX,		0},
	{"qcom,analog-level",	PM8XXX_CONFIG_ALEVEL,		0},
	{"qcom,dtest",		PM8XXX_CONFIG_DTEST_SELECTOR,	0},
	{"qcom,paired",		PM8XXX_CONFIG_PAIRED,		0},
};

#ifdef CONFIG_DEBUG_FS
static const struct pin_config_item pm8xxx_conf_items[] = {
	PCONFDUMP(PM8XXX_CONFIG_AMUX, "analog mux", NULL, true),
	PCONFDUMP(PM8XXX_CONFIG_ALEVEL, "analog level", NULL, true),
	PCONFDUMP(PM8XXX_CONFIG_DTEST_SELECTOR, "dtest", NULL, true),
	PCONFDUMP(PM8XXX_CONFIG_PAIRED, "paired", NULL, false),
};
#endif

#define PM8XXX_MAX_MPPS	12
#define PM8XXX_MPP_PHYSICAL_OFFSET    1

static const char * const pm8xxx_groups[PM8XXX_MAX_MPPS] = {
	"mpp1", "mpp2", "mpp3", "mpp4", "mpp5", "mpp6", "mpp7", "mpp8",
	"mpp9", "mpp10", "mpp11", "mpp12",
};

#define PM8XXX_MPP_DIGITAL	0
#define PM8XXX_MPP_ANALOG	1
#define PM8XXX_MPP_SINK		2

static const char * const pm8xxx_mpp_functions[] = {
	"digital", "analog", "sink",
};

static int pm8xxx_mpp_update(struct pm8xxx_mpp *pctrl,
			     struct pm8xxx_pin_data *pin)
{
	unsigned level;
	unsigned ctrl;
	unsigned type;
	int ret;
	u8 val;

	switch (pin->mode) {
	case PM8XXX_MPP_DIGITAL:
		if (pin->dtest) {
			type = PM8XXX_MPP_TYPE_DTEST_OUTPUT;
			ctrl = pin->dtest - 1;
		} else if (pin->input && pin->output) {
			type = PM8XXX_MPP_TYPE_D_BI_DIR;
			if (pin->high_z)
				ctrl = PM8XXX_MPP_BI_PULLUP_OPEN;
			else if (pin->pullup == 600)
				ctrl = PM8XXX_MPP_BI_PULLUP_1KOHM;
			else if (pin->pullup == 10000)
				ctrl = PM8XXX_MPP_BI_PULLUP_10KOHM;
			else
				ctrl = PM8XXX_MPP_BI_PULLUP_30KOHM;
		} else if (pin->input) {
			type = PM8XXX_MPP_TYPE_D_INPUT;
			if (pin->dtest)
				ctrl = pin->dtest;
			else

Annotation

Implementation Notes