drivers/pinctrl/renesas/pinctrl.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/renesas/pinctrl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/renesas/pinctrl.c- Extension
.c- Size
- 23493 bytes
- Lines
- 959
- 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/device.hlinux/err.hlinux/io.hlinux/module.hlinux/of.hlinux/seq_file.hlinux/slab.hlinux/spinlock.hlinux/pinctrl/consumer.hlinux/pinctrl/machine.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hcore.h../core.h../pinconf.h
Detected Declarations
struct sh_pfc_pin_configstruct sh_pfc_pinctrlfunction sh_pfc_get_groups_countfunction sh_pfc_get_group_pinsfunction sh_pfc_pin_dbg_showfunction sh_pfc_map_add_configfunction sh_pfc_dt_subnode_to_mapfunction of_property_for_each_stringfunction sh_pfc_dt_free_mapfunction sh_pfc_dt_node_to_mapfunction for_each_child_of_node_scopedfunction sh_pfc_get_functions_countfunction sh_pfc_get_function_groupsfunction sh_pfc_func_set_muxfunction sh_pfc_gpio_request_enablefunction sh_pfc_gpio_disable_freefunction sh_pfc_gpio_set_directionfunction sh_pfc_pinconf_find_drive_strength_regfunction sh_pfc_pinconf_get_drive_strengthfunction sh_pfc_pinconf_set_drive_strengthfunction sh_pfc_pinconf_validatefunction sh_pfc_pinconf_getfunction sh_pfc_pinconf_setfunction sh_pfc_pinconf_group_getfunction sh_pfc_pinconf_group_setfunction sh_pfc_map_pinsfunction sh_pfc_register_pinctrlfunction rcar_pin_to_bias_regfunction rcar_pinmux_get_biasfunction rcar_pinmux_set_biasfunction rmobile_pinmux_get_biasfunction rmobile_pinmux_set_bias
Annotated Snippet
struct sh_pfc_pin_config {
u16 gpio_enabled:1;
u16 mux_mark:15;
};
struct sh_pfc_pinctrl {
struct pinctrl_dev *pctl;
struct pinctrl_desc pctl_desc;
struct sh_pfc *pfc;
struct pinctrl_pin_desc *pins;
struct sh_pfc_pin_config *configs;
};
static int sh_pfc_get_groups_count(struct pinctrl_dev *pctldev)
{
struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
return pmx->pfc->info->nr_groups;
}
static const char *sh_pfc_get_group_name(struct pinctrl_dev *pctldev,
unsigned selector)
{
struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
return pmx->pfc->info->groups[selector].name;
}
static int sh_pfc_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
const unsigned **pins, unsigned *num_pins)
{
struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
*pins = pmx->pfc->info->groups[selector].pins;
*num_pins = pmx->pfc->info->groups[selector].nr_pins;
return 0;
}
static void sh_pfc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
unsigned offset)
{
seq_puts(s, DRV_NAME);
}
#ifdef CONFIG_OF
static int sh_pfc_map_add_config(struct pinctrl_map *map,
const char *group_or_pin,
enum pinctrl_map_type type,
unsigned long *configs,
unsigned int num_configs)
{
unsigned long *cfgs;
cfgs = kmemdup_array(configs, num_configs, sizeof(*cfgs), GFP_KERNEL);
if (cfgs == NULL)
return -ENOMEM;
map->type = type;
map->data.configs.group_or_pin = group_or_pin;
map->data.configs.configs = cfgs;
map->data.configs.num_configs = num_configs;
return 0;
}
static int sh_pfc_dt_subnode_to_map(struct pinctrl_dev *pctldev,
struct device_node *np,
struct pinctrl_map **map,
unsigned int *num_maps, unsigned int *index)
{
struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
struct device *dev = pmx->pfc->dev;
struct pinctrl_map *maps = *map;
unsigned int nmaps = *num_maps;
unsigned int idx = *index;
unsigned int num_configs;
const char *function = NULL;
unsigned long *configs;
struct property *prop;
unsigned int num_groups;
unsigned int num_pins;
const char *group;
const char *pin;
int ret;
/* Parse the function and configuration properties. At least a function
* or one configuration must be specified.
Annotation
- Immediate include surface: `linux/device.h`, `linux/err.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/seq_file.h`, `linux/slab.h`, `linux/spinlock.h`.
- Detected declarations: `struct sh_pfc_pin_config`, `struct sh_pfc_pinctrl`, `function sh_pfc_get_groups_count`, `function sh_pfc_get_group_pins`, `function sh_pfc_pin_dbg_show`, `function sh_pfc_map_add_config`, `function sh_pfc_dt_subnode_to_map`, `function of_property_for_each_string`, `function sh_pfc_dt_free_map`, `function sh_pfc_dt_node_to_map`.
- 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.