drivers/pinctrl/pinctrl-st.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-st.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-st.c- Extension
.c- Size
- 48975 bytes
- Lines
- 1728
- 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/err.hlinux/gpio/driver.hlinux/init.hlinux/io.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/platform_device.hlinux/regmap.hlinux/seq_file.hlinux/slab.hlinux/string_helpers.hlinux/pinctrl/consumer.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hcore.h
Detected Declarations
struct st_retime_dedicatedstruct st_retime_packedstruct st_pio_controlstruct st_pctl_datastruct st_pinconfstruct st_pmx_funcstruct st_pctl_groupstruct st_gpio_bankstruct st_pinctrlenum st_retime_stylefunction st_gpio_pinfunction st_pinconf_set_configfunction st_pctl_set_functionfunction st_pctl_get_pin_functionfunction st_pinconf_delay_to_bitfunction st_pinconf_bit_to_delayfunction st_regmap_field_bit_set_clear_pinfunction st_pinconf_set_retime_packedfunction st_pinconf_set_retime_dedicatedfunction st_pinconf_get_directionfunction st_pinconf_get_retime_packedfunction st_pinconf_get_retime_dedicatedfunction __st_gpio_setfunction st_gpio_directionfunction st_gpio_getfunction st_gpio_setfunction st_gpio_direction_outputfunction st_gpio_get_directionfunction st_pctl_get_groups_countfunction st_pctl_get_group_pinsfunction st_pctl_dt_node_to_mapfunction st_pctl_dt_free_mapfunction st_pmx_get_funcs_countfunction st_pmx_get_groupsfunction st_pmx_set_muxfunction st_pmx_set_gpio_directionfunction st_pinconf_get_retimefunction st_pinconf_set_retimefunction st_pinconf_setfunction st_pinconf_getfunction st_pinconf_dbg_showfunction st_pctl_dt_child_countfunction st_pctl_dt_setup_retime_packedfunction st_pctl_dt_setup_retime_dedicatedfunction st_pctl_dt_setup_retimefunction st_parse_syscfgsfunction st_pctl_dt_calculate_pinfunction st_pctl_dt_parse_groups
Annotated Snippet
struct st_retime_dedicated {
struct regmap_field *rt[ST_GPIO_PINS_PER_BANK];
};
struct st_retime_packed {
struct regmap_field *clk1notclk0;
struct regmap_field *delay_0;
struct regmap_field *delay_1;
struct regmap_field *invertclk;
struct regmap_field *retime;
struct regmap_field *clknotdata;
struct regmap_field *double_edge;
};
struct st_pio_control {
u32 rt_pin_mask;
struct regmap_field *alt, *oe, *pu, *od;
/* retiming */
union {
struct st_retime_packed rt_p;
struct st_retime_dedicated rt_d;
} rt;
};
struct st_pctl_data {
const enum st_retime_style rt_style;
const unsigned int *input_delays;
const int ninput_delays;
const unsigned int *output_delays;
const int noutput_delays;
/* register offset information */
const int alt, oe, pu, od, rt;
};
struct st_pinconf {
int pin;
const char *name;
unsigned long config;
int altfunc;
};
struct st_pmx_func {
const char *name;
const char **groups;
unsigned ngroups;
};
struct st_pctl_group {
const char *name;
unsigned int *pins;
unsigned npins;
struct st_pinconf *pin_conf;
};
/*
* Edge triggers are not supported at hardware level, it is supported by
* software by exploiting the level trigger support in hardware.
* Software uses a virtual register (EDGE_CONF) for edge trigger configuration
* of each gpio pin in a GPIO bank.
*
* Each bank has a 32 bit EDGE_CONF register which is divided in to 8 parts of
* 4-bits. Each 4-bit space is allocated for each pin in a gpio bank.
*
* bit allocation per pin is:
* Bits: [0 - 3] | [4 - 7] [8 - 11] ... ... ... ... [ 28 - 31]
* --------------------------------------------------------
* | pin-0 | pin-2 | pin-3 | ... ... ... ... | pin -7 |
* --------------------------------------------------------
*
* A pin can have one of following the values in its edge configuration field.
*
* ------- ----------------------------
* [0-3] - Description
* ------- ----------------------------
* 0000 - No edge IRQ.
* 0001 - Falling edge IRQ.
* 0010 - Rising edge IRQ.
* 0011 - Rising and Falling edge IRQ.
* ------- ----------------------------
*/
#define ST_IRQ_EDGE_CONF_BITS_PER_PIN 4
#define ST_IRQ_EDGE_MASK 0xf
#define ST_IRQ_EDGE_FALLING BIT(0)
#define ST_IRQ_EDGE_RISING BIT(1)
#define ST_IRQ_EDGE_BOTH (BIT(0) | BIT(1))
#define ST_IRQ_RISING_EDGE_CONF(pin) \
(ST_IRQ_EDGE_RISING << (pin * ST_IRQ_EDGE_CONF_BITS_PER_PIN))
Annotation
- Immediate include surface: `linux/err.h`, `linux/gpio/driver.h`, `linux/init.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`.
- Detected declarations: `struct st_retime_dedicated`, `struct st_retime_packed`, `struct st_pio_control`, `struct st_pctl_data`, `struct st_pinconf`, `struct st_pmx_func`, `struct st_pctl_group`, `struct st_gpio_bank`, `struct st_pinctrl`, `enum st_retime_style`.
- 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.