drivers/pinctrl/actions/pinctrl-owl.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/actions/pinctrl-owl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/actions/pinctrl-owl.c- Extension
.c- Size
- 23946 bytes
- Lines
- 1013
- 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.
- 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/clk.hlinux/err.hlinux/gpio/driver.hlinux/io.hlinux/irq.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/seq_file.hlinux/slab.hlinux/spinlock.hlinux/pinctrl/machine.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.h../core.h../pinctrl-utils.hpinctrl-owl.h
Detected Declarations
struct owl_pinctrlfunction owl_update_bitsfunction owl_read_fieldfunction owl_write_fieldfunction owl_get_groups_countfunction owl_get_group_pinsfunction owl_pin_dbg_showfunction owl_get_funcs_countfunction owl_get_func_groupsfunction get_group_mfp_mask_valfunction owl_set_muxfunction owl_pad_pinconf_regfunction owl_pin_config_getfunction owl_pin_config_setfunction owl_group_pinconf_regfunction owl_group_pinconf_arg2valfunction owl_group_pinconf_val2argfunction owl_group_config_getfunction owl_group_config_setfunction owl_gpio_get_portfunction owl_gpio_update_regfunction owl_gpio_requestfunction owl_gpio_freefunction owl_gpio_getfunction owl_gpio_setfunction owl_gpio_direction_inputfunction owl_gpio_direction_outputfunction irq_set_typefunction owl_gpio_irq_maskfunction owl_gpio_irq_unmaskfunction owl_gpio_irq_ackfunction owl_gpio_irq_set_typefunction owl_gpio_irq_handlerfunction for_each_set_bitfunction owl_gpio_initfunction owl_pinctrl_probe
Annotated Snippet
struct owl_pinctrl {
struct device *dev;
struct pinctrl_dev *pctrldev;
struct gpio_chip chip;
raw_spinlock_t lock;
struct clk *clk;
const struct owl_pinctrl_soc_data *soc;
void __iomem *base;
unsigned int num_irq;
unsigned int *irq;
};
static void owl_update_bits(void __iomem *base, u32 mask, u32 val)
{
u32 reg_val;
reg_val = readl_relaxed(base);
reg_val = (reg_val & ~mask) | (val & mask);
writel_relaxed(reg_val, base);
}
static u32 owl_read_field(struct owl_pinctrl *pctrl, u32 reg,
u32 bit, u32 width)
{
u32 tmp, mask;
tmp = readl_relaxed(pctrl->base + reg);
mask = (1 << width) - 1;
return (tmp >> bit) & mask;
}
static void owl_write_field(struct owl_pinctrl *pctrl, u32 reg, u32 arg,
u32 bit, u32 width)
{
u32 mask;
mask = (1 << width) - 1;
mask = mask << bit;
owl_update_bits(pctrl->base + reg, mask, (arg << bit));
}
static int owl_get_groups_count(struct pinctrl_dev *pctrldev)
{
struct owl_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctrldev);
return pctrl->soc->ngroups;
}
static const char *owl_get_group_name(struct pinctrl_dev *pctrldev,
unsigned int group)
{
struct owl_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctrldev);
return pctrl->soc->groups[group].name;
}
static int owl_get_group_pins(struct pinctrl_dev *pctrldev,
unsigned int group,
const unsigned int **pins,
unsigned int *num_pins)
{
struct owl_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctrldev);
*pins = pctrl->soc->groups[group].pads;
*num_pins = pctrl->soc->groups[group].npads;
return 0;
}
static void owl_pin_dbg_show(struct pinctrl_dev *pctrldev,
struct seq_file *s,
unsigned int offset)
{
struct owl_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctrldev);
seq_printf(s, "%s", dev_name(pctrl->dev));
}
static const struct pinctrl_ops owl_pinctrl_ops = {
.get_groups_count = owl_get_groups_count,
.get_group_name = owl_get_group_name,
.get_group_pins = owl_get_group_pins,
.pin_dbg_show = owl_pin_dbg_show,
.dt_node_to_map = pinconf_generic_dt_node_to_map_all,
.dt_free_map = pinctrl_utils_free_map,
};
Annotation
- Immediate include surface: `linux/clk.h`, `linux/err.h`, `linux/gpio/driver.h`, `linux/io.h`, `linux/irq.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct owl_pinctrl`, `function owl_update_bits`, `function owl_read_field`, `function owl_write_field`, `function owl_get_groups_count`, `function owl_get_group_pins`, `function owl_pin_dbg_show`, `function owl_get_funcs_count`, `function owl_get_func_groups`, `function get_group_mfp_mask_val`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: source 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.