drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/qcom/pinctrl-spmi-mpp.c- Extension
.c- Size
- 26309 bytes
- Lines
- 1014
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/gpio/driver.hlinux/module.hlinux/of.hlinux/of_irq.hlinux/platform_device.hlinux/regmap.hlinux/seq_file.hlinux/slab.hlinux/string_choices.hlinux/types.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinmux.hdt-bindings/pinctrl/qcom,pmic-mpp.h../core.h../pinctrl-utils.h
Detected Declarations
struct pmic_mpp_padstruct pmic_mpp_statefunction pmic_mpp_readfunction pmic_mpp_writefunction pmic_mpp_get_groups_countfunction pmic_mpp_get_group_pinsfunction pmic_mpp_get_functions_countfunction pmic_mpp_get_function_groupsfunction pmic_mpp_write_mode_ctlfunction pmic_mpp_set_muxfunction pmic_mpp_config_getfunction pmic_mpp_config_setfunction pmic_mpp_config_dbg_showfunction pmic_mpp_direction_inputfunction pmic_mpp_direction_outputfunction pmic_mpp_getfunction pmic_mpp_setfunction pmic_mpp_of_xlatefunction pmic_mpp_dbg_showfunction pmic_mpp_populatefunction pmic_mpp_domain_translatefunction pmic_mpp_child_offset_to_irqfunction pmic_mpp_child_to_parent_hwirqfunction pmic_mpp_irq_maskfunction pmic_mpp_irq_unmaskfunction pmic_mpp_probefunction pmic_mpp_remove
Annotated Snippet
struct pmic_mpp_pad {
u16 base;
bool is_enabled;
bool out_value;
bool output_enabled;
bool input_enabled;
bool paired;
bool has_pullup;
unsigned int num_sources;
unsigned int power_source;
unsigned int amux_input;
unsigned int aout_level;
unsigned int pullup;
unsigned int function;
unsigned int drive_strength;
unsigned int dtest;
};
struct pmic_mpp_state {
struct device *dev;
struct regmap *map;
struct pinctrl_dev *ctrl;
struct gpio_chip chip;
};
static const struct pinconf_generic_params pmic_mpp_bindings[] = {
{"qcom,amux-route", PMIC_MPP_CONF_AMUX_ROUTE, 0},
{"qcom,analog-level", PMIC_MPP_CONF_ANALOG_LEVEL, 0},
{"qcom,dtest", PMIC_MPP_CONF_DTEST_SELECTOR, 0},
{"qcom,paired", PMIC_MPP_CONF_PAIRED, 0},
};
#ifdef CONFIG_DEBUG_FS
static const struct pin_config_item pmic_conf_items[] = {
PCONFDUMP(PMIC_MPP_CONF_AMUX_ROUTE, "analog mux", NULL, true),
PCONFDUMP(PMIC_MPP_CONF_ANALOG_LEVEL, "analog level", NULL, true),
PCONFDUMP(PMIC_MPP_CONF_DTEST_SELECTOR, "dtest", NULL, true),
PCONFDUMP(PMIC_MPP_CONF_PAIRED, "paired", NULL, false),
};
#endif
static const char *const pmic_mpp_groups[] = {
"mpp1", "mpp2", "mpp3", "mpp4", "mpp5", "mpp6", "mpp7", "mpp8",
};
#define PMIC_MPP_DIGITAL 0
#define PMIC_MPP_ANALOG 1
#define PMIC_MPP_SINK 2
static const char *const pmic_mpp_functions[] = {
"digital", "analog", "sink"
};
static int pmic_mpp_read(struct pmic_mpp_state *state,
struct pmic_mpp_pad *pad, unsigned int addr)
{
unsigned int val;
int ret;
ret = regmap_read(state->map, pad->base + addr, &val);
if (ret < 0)
dev_err(state->dev, "read 0x%x failed\n", addr);
else
ret = val;
return ret;
}
static int pmic_mpp_write(struct pmic_mpp_state *state,
struct pmic_mpp_pad *pad, unsigned int addr,
unsigned int val)
{
int ret;
ret = regmap_write(state->map, pad->base + addr, val);
if (ret < 0)
dev_err(state->dev, "write 0x%x failed\n", addr);
return ret;
}
static int pmic_mpp_get_groups_count(struct pinctrl_dev *pctldev)
{
/* Every PIN is a group */
return pctldev->desc->npins;
}
static const char *pmic_mpp_get_group_name(struct pinctrl_dev *pctldev,
unsigned pin)
{
Annotation
- Immediate include surface: `linux/gpio/driver.h`, `linux/module.h`, `linux/of.h`, `linux/of_irq.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/seq_file.h`, `linux/slab.h`.
- Detected declarations: `struct pmic_mpp_pad`, `struct pmic_mpp_state`, `function pmic_mpp_read`, `function pmic_mpp_write`, `function pmic_mpp_get_groups_count`, `function pmic_mpp_get_group_pins`, `function pmic_mpp_get_functions_count`, `function pmic_mpp_get_function_groups`, `function pmic_mpp_write_mode_ctl`, `function pmic_mpp_set_mux`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.