drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c- Extension
.c- Size
- 18258 bytes
- Lines
- 738
- 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/bitfield.hlinux/module.hlinux/mfd/syscon.hlinux/mod_devicetable.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/seq_file.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.h../core.h../pinctrl-utils.h../pinconf.h../pinmux.h
Detected Declarations
struct mpfs_pinctrl_mux_configstruct mpfs_pinctrlstruct mpfs_pinctrl_drive_strengthstruct mpfs_pinctrl_bank_voltagefunction mpfs_pinctrl_get_drive_strength_mafunction mpfs_pinctrl_get_drive_strength_valfunction mpfs_pinctrl_get_bank_voltage_uvfunction mpfs_pinctrl_get_bank_voltage_valfunction mpfs_pinctrl_pin_to_bank_voltagefunction mpfs_pinctrl_set_bank_voltagefunction mpfs_pinctrl_function_mapfunction mpfs_pinctrl_pin_to_iomux_offsetfunction mpfs_pinctrl_pin_to_iomux_regfunction mpfs_pinctrl_pin_to_iocfg_regfunction mpfs_pinctrl_pin_to_iocfg_offsetfunction mpfs_pinctrl_dbg_showfunction mpfs_pinctrl_set_pin_funcfunction mpfs_pinctrl_set_muxfunction mpfs_pinctrl_pinconf_getfunction mpfs_pinctrl_pinconf_generate_configfunction mpfs_pinctrl_pin_set_configfunction mpfs_pinctrl_pinconf_setfunction mpfs_pinctrl_pinconf_group_setfunction mpfs_pinctrl_pinconf_dbg_showfunction mpfs_pinctrl_probe
Annotated Snippet
struct mpfs_pinctrl_mux_config {
u8 pin;
u8 function;
};
struct mpfs_pinctrl {
struct pinctrl_dev *pctrl;
struct device *dev;
struct regmap *regmap;
struct regmap *sysreg_regmap;
struct mutex mutex;
struct pinctrl_desc desc;
};
struct mpfs_pinctrl_drive_strength {
u8 ma;
u8 val;
};
struct mpfs_pinctrl_bank_voltage {
u32 uv;
u8 val;
};
static struct mpfs_pinctrl_drive_strength mpfs_pinctrl_drive_strengths[8] = {
{ .ma = 2, .val = 2 },
{ .ma = 4, .val = 3 },
{ .ma = 6, .val = 4 },
{ .ma = 8, .val = 5 },
{ .ma = 10, .val = 6 },
{ .ma = 12, .val = 7 },
{ .ma = 16, .val = 10 },
{ .ma = 20, .val = 12 },
};
static struct mpfs_pinctrl_bank_voltage mpfs_pinctrl_bank_voltages[8] = {
{ .uv = 1200000, .val = 0 },
{ .uv = 1500000, .val = 2 },
{ .uv = 1800000, .val = 4 },
{ .uv = 2500000, .val = 6 },
{ .uv = 3300000, .val = 8 },
{ .uv = 0, .val = 0x3f }, // pin unused
};
static int mpfs_pinctrl_get_drive_strength_ma(u32 drive_strength)
{
size_t num = ARRAY_SIZE(mpfs_pinctrl_drive_strengths);
for (int i = 0; i < num; i++)
if (drive_strength == mpfs_pinctrl_drive_strengths[i].val)
return mpfs_pinctrl_drive_strengths[i].ma;
return -EINVAL;
}
static int mpfs_pinctrl_get_drive_strength_val(u32 drive_strength_ma)
{
size_t num = ARRAY_SIZE(mpfs_pinctrl_drive_strengths);
if (!drive_strength_ma)
return -EINVAL;
for (int i = 0; i < num; i++)
if (drive_strength_ma <= mpfs_pinctrl_drive_strengths[i].ma)
return mpfs_pinctrl_drive_strengths[i].val;
return mpfs_pinctrl_drive_strengths[num - 1].val;
}
static int mpfs_pinctrl_get_bank_voltage_uv(u32 bank_voltage)
{
size_t num = ARRAY_SIZE(mpfs_pinctrl_bank_voltages);
for (int i = 0; i < num; i++)
if (bank_voltage == mpfs_pinctrl_bank_voltages[i].val)
return mpfs_pinctrl_bank_voltages[i].uv;
return -EINVAL;
}
static int mpfs_pinctrl_get_bank_voltage_val(u32 bank_voltage_uv)
{
size_t num = ARRAY_SIZE(mpfs_pinctrl_bank_voltages);
for (int i = 0; i < num; i++)
if (bank_voltage_uv <= mpfs_pinctrl_bank_voltages[i].uv)
return mpfs_pinctrl_bank_voltages[i].val;
return -EINVAL;
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/module.h`, `linux/mfd/syscon.h`, `linux/mod_devicetable.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/seq_file.h`.
- Detected declarations: `struct mpfs_pinctrl_mux_config`, `struct mpfs_pinctrl`, `struct mpfs_pinctrl_drive_strength`, `struct mpfs_pinctrl_bank_voltage`, `function mpfs_pinctrl_get_drive_strength_ma`, `function mpfs_pinctrl_get_drive_strength_val`, `function mpfs_pinctrl_get_bank_voltage_uv`, `function mpfs_pinctrl_get_bank_voltage_val`, `function mpfs_pinctrl_pin_to_bank_voltage`, `function mpfs_pinctrl_set_bank_voltage`.
- 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.