drivers/pinctrl/intel/pinctrl-intel-platform.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/intel/pinctrl-intel-platform.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/intel/pinctrl-intel-platform.c- Extension
.c- Size
- 5395 bytes
- Lines
- 225
- 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.
- 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/mod_devicetable.hlinux/module.hlinux/platform_device.hlinux/pm.hlinux/property.hlinux/string_helpers.hlinux/pinctrl/pinctrl.hpinctrl-intel.h
Detected Declarations
struct intel_platform_pinsfunction intel_platform_pinctrl_prepare_pinsfunction intel_platform_pinctrl_prepare_groupfunction intel_platform_pinctrl_prepare_communityfunction intel_platform_pinctrl_prepare_soc_datafunction intel_platform_pinctrl_probe
Annotated Snippet
struct intel_platform_pins {
struct pinctrl_pin_desc *pins;
size_t npins;
};
static int intel_platform_pinctrl_prepare_pins(struct device *dev, size_t base,
const char *name, u32 size,
struct intel_platform_pins *pins)
{
struct pinctrl_pin_desc *descs;
char **pin_names;
unsigned int i;
pin_names = devm_kasprintf_strarray(dev, name, size);
if (IS_ERR(pin_names))
return PTR_ERR(pin_names);
descs = devm_krealloc_array(dev, pins->pins, base + size, sizeof(*descs), GFP_KERNEL);
if (!descs)
return -ENOMEM;
for (i = 0; i < size; i++) {
unsigned int pin_number = base + i;
char *pin_name = pin_names[i];
struct pinctrl_pin_desc *desc;
/* Unify delimiter for pin name */
strreplace(pin_name, '-', '_');
desc = &descs[pin_number];
desc->number = pin_number;
desc->name = pin_name;
}
pins->pins = descs;
pins->npins = base + size;
return 0;
}
static int intel_platform_pinctrl_prepare_group(struct device *dev,
struct fwnode_handle *child,
struct intel_padgroup *gpp,
struct intel_platform_pins *pins)
{
size_t base = pins->npins;
const char *name;
u32 size;
int ret;
ret = fwnode_property_read_string(child, "intc-gpio-group-name", &name);
if (ret)
return ret;
ret = fwnode_property_read_u32(child, "intc-gpio-pad-count", &size);
if (ret)
return ret;
ret = intel_platform_pinctrl_prepare_pins(dev, base, name, size, pins);
if (ret)
return ret;
gpp->base = base;
gpp->size = size;
gpp->gpio_base = INTEL_GPIO_BASE_MATCH;
return 0;
}
static int intel_platform_pinctrl_prepare_community(struct device *dev,
struct intel_community *community,
struct intel_platform_pins *pins)
{
struct intel_padgroup *gpps;
unsigned int group;
size_t ngpps;
u32 offset;
int ret;
ret = device_property_read_u32(dev, "intc-gpio-pad-ownership-offset", &offset);
if (ret)
return ret;
community->padown_offset = offset;
ret = device_property_read_u32(dev, "intc-gpio-pad-configuration-lock-offset", &offset);
if (ret)
return ret;
community->padcfglock_offset = offset;
ret = device_property_read_u32(dev, "intc-gpio-host-software-pad-ownership-offset", &offset);
Annotation
- Immediate include surface: `linux/mod_devicetable.h`, `linux/module.h`, `linux/platform_device.h`, `linux/pm.h`, `linux/property.h`, `linux/string_helpers.h`, `linux/pinctrl/pinctrl.h`, `pinctrl-intel.h`.
- Detected declarations: `struct intel_platform_pins`, `function intel_platform_pinctrl_prepare_pins`, `function intel_platform_pinctrl_prepare_group`, `function intel_platform_pinctrl_prepare_community`, `function intel_platform_pinctrl_prepare_soc_data`, `function intel_platform_pinctrl_probe`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: source implementation candidate.
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.