drivers/pinctrl/intel/pinctrl-intel.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/intel/pinctrl-intel.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/intel/pinctrl-intel.c- Extension
.c- Size
- 51462 bytes
- Lines
- 1969
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/acpi.hlinux/cleanup.hlinux/export.hlinux/gpio/driver.hlinux/interrupt.hlinux/log2.hlinux/module.hlinux/platform_device.hlinux/property.hlinux/seq_file.hlinux/string_helpers.hlinux/time.hlinux/pinctrl/consumer.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hlinux/platform_data/x86/pwm-lpss.h../core.hpinctrl-intel.h
Detected Declarations
struct intel_pad_contextstruct intel_community_contextfunction for_each_intel_community_pad_groupfunction for_each_intel_pin_communityfunction intel_community_get_padgroupfunction for_each_intel_community_pad_groupfunction intel_pad_owned_by_hostfunction intel_pad_acpi_modefunction intel_pad_lockedfunction intel_pad_is_unlockedfunction intel_pad_usablefunction intel_get_groups_countfunction intel_get_group_pinsfunction intel_pin_dbg_showfunction intel_get_functions_countfunction intel_get_function_groupsfunction intel_pinmux_set_muxfunction __intel_gpio_get_directionfunction __intel_gpio_set_directionfunction __intel_gpio_get_gpio_modefunction intel_gpio_get_gpio_modefunction intel_gpio_set_gpio_modefunction intel_gpio_request_enablefunction intel_gpio_set_directionfunction intel_config_get_pullfunction intel_config_get_high_impedancefunction intel_config_get_debouncefunction intel_config_getfunction intel_config_set_pullfunction intel_gpio_set_high_impedancefunction intel_config_set_debouncefunction intel_config_setfunction intel_gpio_to_pinfunction for_each_intel_gpio_groupfunction intel_pin_to_gpiofunction intel_gpio_getfunction intel_gpio_setfunction intel_gpio_get_directionfunction intel_gpio_direction_inputfunction intel_gpio_direction_outputfunction intel_gpio_irq_ackfunction intel_gpio_irq_mask_unmaskfunction intel_gpio_irq_maskfunction intel_gpio_irq_unmaskfunction intel_gpio_irq_typefunction intel_gpio_irq_wakefunction intel_gpio_irqfunction scoped_guard
Annotated Snippet
struct intel_pad_context {
u32 padcfg0;
u32 padcfg1;
u32 padcfg2;
};
struct intel_community_context {
u32 *intmask;
u32 *hostown;
};
#define pin_to_padno(c, p) ((p) - (c)->pin_base)
#define padgroup_offset(g, p) ((p) - (g)->base)
#define for_each_intel_pin_community(pctrl, community) \
for (unsigned int __ci = 0; \
__ci < pctrl->ncommunities && (community = &pctrl->communities[__ci]); \
__ci++) \
#define for_each_intel_community_pad_group(community, grp) \
for (unsigned int __gi = 0; \
__gi < community->ngpps && (grp = &community->gpps[__gi]); \
__gi++) \
#define for_each_intel_pad_group(pctrl, community, grp) \
for_each_intel_pin_community(pctrl, community) \
for_each_intel_community_pad_group(community, grp)
#define for_each_intel_gpio_group(pctrl, community, grp) \
for_each_intel_pad_group(pctrl, community, grp) \
if (grp->gpio_base == INTEL_GPIO_BASE_NOMAP) {} else
const struct intel_community *intel_get_community(const struct intel_pinctrl *pctrl,
unsigned int pin)
{
const struct intel_community *community;
for_each_intel_pin_community(pctrl, community) {
if (pin >= community->pin_base &&
pin < community->pin_base + community->npins)
return community;
}
dev_warn(pctrl->dev, "failed to find community for pin %u\n", pin);
return NULL;
}
EXPORT_SYMBOL_NS_GPL(intel_get_community, "PINCTRL_INTEL");
static const struct intel_padgroup *
intel_community_get_padgroup(const struct intel_community *community,
unsigned int pin)
{
const struct intel_padgroup *padgrp;
for_each_intel_community_pad_group(community, padgrp) {
if (pin >= padgrp->base && pin < padgrp->base + padgrp->size)
return padgrp;
}
return NULL;
}
static void __iomem *intel_get_padcfg(struct intel_pinctrl *pctrl,
unsigned int pin, unsigned int reg)
{
const struct intel_community *community;
unsigned int padno;
size_t nregs;
community = intel_get_community(pctrl, pin);
if (!community)
return NULL;
padno = pin_to_padno(community, pin);
nregs = (community->features & PINCTRL_FEATURE_DEBOUNCE) ? 4 : 2;
if (reg >= nregs * 4)
return NULL;
return community->pad_regs + reg + padno * nregs * 4;
}
static bool intel_pad_owned_by_host(const struct intel_pinctrl *pctrl, unsigned int pin)
{
const struct intel_community *community;
const struct intel_padgroup *padgrp;
unsigned int gpp, offset, gpp_offset;
void __iomem *padown;
community = intel_get_community(pctrl, pin);
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/cleanup.h`, `linux/export.h`, `linux/gpio/driver.h`, `linux/interrupt.h`, `linux/log2.h`, `linux/module.h`, `linux/platform_device.h`.
- Detected declarations: `struct intel_pad_context`, `struct intel_community_context`, `function for_each_intel_community_pad_group`, `function for_each_intel_pin_community`, `function intel_community_get_padgroup`, `function for_each_intel_community_pad_group`, `function intel_pad_owned_by_host`, `function intel_pad_acpi_mode`, `function intel_pad_locked`, `function intel_pad_is_unlocked`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.