drivers/pinctrl/pinctrl-keembay.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-keembay.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-keembay.c- Extension
.c- Size
- 51834 bytes
- Lines
- 1720
- 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/bitfield.hlinux/bitops.hlinux/gpio/driver.hlinux/interrupt.hlinux/io.hlinux/module.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hlinux/platform_device.hcore.hpinmux.h
Detected Declarations
struct keembay_mux_descstruct keembay_gpio_irqstruct keembay_pinctrlstruct keembay_pin_socstruct keembay_pinfunctionfunction keembay_read_regfunction keembay_read_gpio_regfunction keembay_read_pinfunction keembay_write_regfunction keembay_write_gpio_regfunction keembay_gpio_invertfunction keembay_gpio_restore_defaultfunction keembay_request_gpiofunction keembay_set_muxfunction keembay_pinconf_get_pullfunction keembay_pinconf_set_pullfunction keembay_pinconf_get_drivefunction keembay_pinconf_set_drivefunction keembay_pinconf_get_slew_ratefunction keembay_pinconf_set_slew_ratefunction keembay_pinconf_get_schmittfunction keembay_pinconf_set_schmittfunction keembay_pinconf_getfunction keembay_pinconf_setfunction keembay_gpio_getfunction keembay_gpio_setfunction keembay_gpio_get_directionfunction keembay_gpio_set_direction_infunction keembay_gpio_set_direction_outfunction keembay_gpio_irq_handlerfunction keembay_gpio_clear_irqfunction keembay_find_free_slotfunction keembay_find_free_srcfunction keembay_gpio_set_irqfunction keembay_gpio_irq_enablefunction keembay_gpio_irq_ackfunction for_each_set_clump8function keembay_gpio_irq_set_typefunction keembay_gpio_add_pin_rangesfunction keembay_gpiochip_probefunction keembay_build_groupsfunction keembay_pinctrl_regfunction keembay_add_functionsfunction keembay_build_functionsfunction keembay_pinctrl_probe
Annotated Snippet
struct keembay_mux_desc {
u8 mode;
const char *name;
};
#define KEEMBAY_PIN_DESC(pin_number, pin_name, ...) { \
.number = pin_number, \
.name = pin_name, \
.drv_data = &(struct keembay_mux_desc[]) { \
__VA_ARGS__, { } }, \
} \
#define KEEMBAY_MUX(pin_mode, pin_function) { \
.mode = pin_mode, \
.name = pin_function, \
} \
/**
* struct keembay_gpio_irq - Config of each GPIO Interrupt sources
* @source: Interrupt source number (0 - 7)
* @line: Actual Interrupt line number
* @pins: Array of GPIO pins using this Interrupt line
* @trigger: Interrupt trigger type for this line
* @num_share: Number of pins currently using this Interrupt line
*/
struct keembay_gpio_irq {
unsigned int source;
unsigned int line;
unsigned int pins[KEEMBAY_GPIO_MAX_PER_IRQ];
unsigned int trigger;
unsigned int num_share;
};
/**
* struct keembay_pinctrl - Intel Keembay pinctrl structure
* @pctrl: Pointer to the pin controller device
* @base0: First register base address
* @base1: Second register base address
* @dev: Pointer to the device structure
* @chip: GPIO chip used by this pin controller
* @soc: Pin control configuration data based on SoC
* @lock: Spinlock to protect various gpio config register access
* @ngroups: Number of pin groups available
* @nfuncs: Number of pin functions available
* @npins: Number of GPIO pins available
* @irq: Store Interrupt source
* @max_gpios_level_type: Store max level trigger type
* @max_gpios_edge_type: Store max edge trigger type
*/
struct keembay_pinctrl {
struct pinctrl_dev *pctrl;
void __iomem *base0;
void __iomem *base1;
struct device *dev;
struct gpio_chip chip;
const struct keembay_pin_soc *soc;
raw_spinlock_t lock;
unsigned int ngroups;
unsigned int nfuncs;
unsigned int npins;
struct keembay_gpio_irq irq[KEEMBAY_GPIO_NUM_IRQ];
int max_gpios_level_type;
int max_gpios_edge_type;
};
/**
* struct keembay_pin_soc - Pin control config data based on SoC
* @pins: Pin description structure
*/
struct keembay_pin_soc {
const struct pinctrl_pin_desc *pins;
};
struct keembay_pinfunction {
struct pinfunction func;
u8 mux_mode;
};
static const struct pinctrl_pin_desc keembay_pins[] = {
KEEMBAY_PIN_DESC(0, "GPIO0",
KEEMBAY_MUX(0x0, "I2S0_M0"),
KEEMBAY_MUX(0x1, "SD0_M1"),
KEEMBAY_MUX(0x2, "SLVDS0_M2"),
KEEMBAY_MUX(0x3, "I2C0_M3"),
KEEMBAY_MUX(0x4, "CAM_M4"),
KEEMBAY_MUX(0x5, "ETH_M5"),
KEEMBAY_MUX(0x6, "LCD_M6"),
KEEMBAY_MUX(0x7, "GPIO_M7")),
KEEMBAY_PIN_DESC(1, "GPIO1",
KEEMBAY_MUX(0x0, "I2S0_M0"),
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/gpio/driver.h`, `linux/interrupt.h`, `linux/io.h`, `linux/module.h`, `linux/pinctrl/pinconf.h`, `linux/pinctrl/pinconf-generic.h`.
- Detected declarations: `struct keembay_mux_desc`, `struct keembay_gpio_irq`, `struct keembay_pinctrl`, `struct keembay_pin_soc`, `struct keembay_pinfunction`, `function keembay_read_reg`, `function keembay_read_gpio_reg`, `function keembay_read_pin`, `function keembay_write_reg`, `function keembay_write_gpio_reg`.
- 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.