drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/qcom/pinctrl-lpass-lpi.c- Extension
.c- Size
- 15144 bytes
- Lines
- 604
- Domain
- Driver Families
- Bucket
- drivers/pinctrl
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/bitfield.hlinux/clk.hlinux/gpio/driver.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/seq_file.hlinux/cleanup.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinmux.hlinux/pm_clock.hlinux/pm_runtime.h../pinctrl-utils.hpinctrl-lpass-lpi.h
Detected Declarations
struct lpi_pinctrlfunction lpi_gpio_read_regfunction lpi_gpio_write_regfunction lpi_gpio_readfunction lpi_gpio_get_functions_countfunction lpi_gpio_get_function_groupsfunction lpi_gpio_set_muxfunction lpi_config_getfunction lpi_config_set_slew_ratefunction lpi_config_setfunction lpi_gpio_get_directionfunction lpi_gpio_direction_inputfunction lpi_gpio_direction_outputfunction lpi_gpio_getfunction lpi_gpio_setfunction lpi_regval_to_drivefunction lpi_gpio_dbg_show_onefunction lpi_gpio_dbg_showfunction lpi_build_pin_desc_groupsfunction lpi_pinctrl_probefunction lpi_pinctrl_removeexport lpi_pinctrl_probeexport lpi_pinctrl_remove
Annotated Snippet
struct lpi_pinctrl {
struct device *dev;
struct pinctrl_dev *ctrl;
struct gpio_chip chip;
struct pinctrl_desc desc;
char __iomem *tlmm_base;
char __iomem *slew_base;
/* Protects from concurrent register updates */
struct mutex lock;
DECLARE_BITMAP(ever_gpio, MAX_NR_GPIO);
const struct lpi_pinctrl_variant_data *data;
};
static void __iomem *lpi_gpio_reg(struct lpi_pinctrl *state,
unsigned int pin, unsigned int addr)
{
u32 pin_offset;
if (state->data->flags & LPI_FLAG_USE_PREDEFINED_PIN_OFFSET)
pin_offset = state->data->groups[pin].pin_offset;
else
pin_offset = LPI_TLMM_REG_OFFSET * pin;
return state->tlmm_base + pin_offset + addr;
}
static void lpi_gpio_read_reg(struct lpi_pinctrl *state,
unsigned int pin, unsigned int addr, u32 *val)
{
*val = ioread32(lpi_gpio_reg(state, pin, addr));
}
static void lpi_gpio_write_reg(struct lpi_pinctrl *state,
unsigned int pin, unsigned int addr,
unsigned int val)
{
iowrite32(val, lpi_gpio_reg(state, pin, addr));
}
static int lpi_gpio_read(struct lpi_pinctrl *state, unsigned int pin,
unsigned int addr, u32 *val)
{
int ret;
ret = pm_runtime_resume_and_get(state->dev);
if (ret < 0)
return ret;
lpi_gpio_read_reg(state, pin, addr, val);
return pm_runtime_put_autosuspend(state->dev);
}
static const struct pinctrl_ops lpi_gpio_pinctrl_ops = {
.get_groups_count = pinctrl_generic_get_group_count,
.get_group_name = pinctrl_generic_get_group_name,
.get_group_pins = pinctrl_generic_get_group_pins,
.dt_node_to_map = pinconf_generic_dt_node_to_map_group,
.dt_free_map = pinctrl_utils_free_map,
};
static int lpi_gpio_get_functions_count(struct pinctrl_dev *pctldev)
{
struct lpi_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
return pctrl->data->nfunctions;
}
static const char *lpi_gpio_get_function_name(struct pinctrl_dev *pctldev,
unsigned int function)
{
struct lpi_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
return pctrl->data->functions[function].name;
}
static int lpi_gpio_get_function_groups(struct pinctrl_dev *pctldev,
unsigned int function,
const char *const **groups,
unsigned *const num_qgroups)
{
struct lpi_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
*groups = pctrl->data->functions[function].groups;
*num_qgroups = pctrl->data->functions[function].ngroups;
return 0;
}
static int lpi_gpio_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/gpio/driver.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/seq_file.h`, `linux/cleanup.h`.
- Detected declarations: `struct lpi_pinctrl`, `function lpi_gpio_read_reg`, `function lpi_gpio_write_reg`, `function lpi_gpio_read`, `function lpi_gpio_get_functions_count`, `function lpi_gpio_get_function_groups`, `function lpi_gpio_set_mux`, `function lpi_config_get`, `function lpi_config_set_slew_rate`, `function lpi_config_set`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.