drivers/pinctrl/renesas/core.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/renesas/core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/renesas/core.c- Extension
.c- Size
- 35826 bytes
- Lines
- 1437
- 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.
- 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/bitops.hlinux/err.hlinux/errno.hlinux/init.hlinux/io.hlinux/ioport.hlinux/kernel.hlinux/math.hlinux/of.hlinux/pinctrl/machine.hlinux/platform_device.hlinux/psci.hlinux/slab.hlinux/sys_soc.hcore.h
Detected Declarations
function Copyrightfunction sh_pfc_get_pin_indexfunction sh_pfc_enum_in_rangefunction sh_pfc_read_raw_regfunction sh_pfc_write_raw_regfunction sh_pfc_readfunction sh_pfc_unlock_regfunction sh_pfc_writefunction sh_pfc_config_reg_helperfunction sh_pfc_write_config_regfunction sh_pfc_get_config_regfunction sh_pfc_mark_to_enumfunction sh_pfc_config_muxfunction sh_pfc_init_rangesfunction sh_pfc_nop_regfunction sh_pfc_restore_regfunction sh_pfc_walk_regsfunction sh_pfc_suspend_initfunction sh_pfc_suspend_noirqfunction sh_pfc_resume_noirqfunction sh_pfc_suspend_initfunction sh_pfc_suspend_noirqfunction sh_pfc_resume_noirqfunction is0sfunction same_namefunction sh_pfc_check_regfunction sh_pfc_check_enumfunction sh_pfc_check_reg_enumsfunction sh_pfc_check_cfg_regfunction sh_pfc_check_drive_regfunction sh_pfc_check_bias_regfunction sh_pfc_compare_groupsfunction sh_pfc_check_infofunction sh_pfc_check_driverfunction sh_pfc_check_driverfunction sh_pfc_init
Annotated Snippet
if (f_width) {
curr_width = f_width;
} else {
curr_width = abs(config_reg->var_field_width[m]);
if (config_reg->var_field_width[m] < 0)
continue;
}
ncomb = 1 << curr_width;
for (n = 0; n < ncomb; n++) {
if (config_reg->enum_ids[pos + n] == enum_id) {
*crp = config_reg;
*fieldp = m;
*valuep = n;
return 0;
}
}
pos += ncomb;
}
k++;
}
return -EINVAL;
}
static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, u16 mark, int pos,
u16 *enum_idp)
{
const u16 *data = pfc->info->pinmux_data;
unsigned int k;
if (pos) {
*enum_idp = data[pos + 1];
return pos + 1;
}
for (k = 0; k < pfc->info->pinmux_data_size; k++) {
if (data[k] == mark) {
*enum_idp = data[k + 1];
return k + 1;
}
}
dev_err(pfc->dev, "cannot locate data/mark enum_id for mark %d\n",
mark);
return -EINVAL;
}
int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type)
{
const struct pinmux_range *range;
int pos = 0;
switch (pinmux_type) {
case PINMUX_TYPE_GPIO:
case PINMUX_TYPE_FUNCTION:
range = NULL;
break;
#ifdef CONFIG_PINCTRL_SH_PFC_GPIO
case PINMUX_TYPE_OUTPUT:
range = &pfc->info->output;
break;
case PINMUX_TYPE_INPUT:
range = &pfc->info->input;
break;
#endif /* CONFIG_PINCTRL_SH_PFC_GPIO */
default:
return -EINVAL;
}
/* Iterate over all the configuration fields we need to update. */
while (1) {
const struct pinmux_cfg_reg *cr;
unsigned int field;
u16 enum_id;
u32 value;
int in_range;
int ret;
pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id);
if (pos < 0)
return pos;
if (!enum_id)
break;
/* Check if the configuration field selects a function. If it
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/err.h`, `linux/errno.h`, `linux/init.h`, `linux/io.h`, `linux/ioport.h`, `linux/kernel.h`, `linux/math.h`.
- Detected declarations: `function Copyright`, `function sh_pfc_get_pin_index`, `function sh_pfc_enum_in_range`, `function sh_pfc_read_raw_reg`, `function sh_pfc_write_raw_reg`, `function sh_pfc_read`, `function sh_pfc_unlock_reg`, `function sh_pfc_write`, `function sh_pfc_config_reg_helper`, `function sh_pfc_write_config_reg`.
- 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.
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.