drivers/pinctrl/vt8500/pinctrl-wmt.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/vt8500/pinctrl-wmt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/vt8500/pinctrl-wmt.c- Extension
.c- Size
- 14831 bytes
- Lines
- 600
- 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/err.hlinux/gpio/driver.hlinux/interrupt.hlinux/io.hlinux/irq.hlinux/of.hlinux/of_irq.hlinux/pinctrl/consumer.hlinux/pinctrl/machine.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hlinux/platform_device.hlinux/slab.hpinctrl-wmt.h
Detected Declarations
enum wmt_func_selfunction Copyrightfunction wmt_clearbitsfunction wmt_pmx_get_functions_countfunction wmt_pmx_get_function_groupsfunction wmt_set_pinmuxfunction disabledfunction wmt_pmx_set_muxfunction wmt_pmx_gpio_disable_freefunction wmt_pmx_gpio_set_directionfunction wmt_get_groups_countfunction wmt_get_group_pinsfunction wmt_pctl_find_group_by_pinfunction wmt_pctl_dt_node_to_map_funcfunction wmt_pctl_dt_node_to_map_pullfunction wmt_pctl_dt_free_mapfunction wmt_pctl_dt_node_to_mapfunction wmt_pinconf_getfunction wmt_pinconf_setfunction wmt_gpio_get_directionfunction wmt_gpio_get_valuefunction wmt_gpio_set_valuefunction wmt_gpio_direction_outputfunction wmt_pinctrl_probe
Annotated Snippet
if (reg_en == NO_REG) {
dev_err(data->dev, "pin:%d no alt function available\n",
pin);
return -EINVAL;
}
wmt_clearbits(data, reg_en, BIT(bit));
}
return 0;
}
static int wmt_pmx_set_mux(struct pinctrl_dev *pctldev,
unsigned func_selector,
unsigned group_selector)
{
struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
u32 pinnum = data->pins[group_selector].number;
return wmt_set_pinmux(data, func_selector, pinnum);
}
static void wmt_pmx_gpio_disable_free(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned offset)
{
struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
/* disable by setting GPIO_IN */
wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, offset);
}
static int wmt_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range,
unsigned offset,
bool input)
{
struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
wmt_set_pinmux(data, (input ? WMT_FSEL_GPIO_IN : WMT_FSEL_GPIO_OUT),
offset);
return 0;
}
static const struct pinmux_ops wmt_pinmux_ops = {
.get_functions_count = wmt_pmx_get_functions_count,
.get_function_name = wmt_pmx_get_function_name,
.get_function_groups = wmt_pmx_get_function_groups,
.set_mux = wmt_pmx_set_mux,
.gpio_disable_free = wmt_pmx_gpio_disable_free,
.gpio_set_direction = wmt_pmx_gpio_set_direction,
};
static int wmt_get_groups_count(struct pinctrl_dev *pctldev)
{
struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
return data->ngroups;
}
static const char *wmt_get_group_name(struct pinctrl_dev *pctldev,
unsigned selector)
{
struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
return data->groups[selector];
}
static int wmt_get_group_pins(struct pinctrl_dev *pctldev,
unsigned selector,
const unsigned **pins,
unsigned *num_pins)
{
struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev);
*pins = &data->pins[selector].number;
*num_pins = 1;
return 0;
}
static int wmt_pctl_find_group_by_pin(struct wmt_pinctrl_data *data, u32 pin)
{
int i;
for (i = 0; i < data->npins; i++) {
if (data->pins[i].number == pin)
return i;
}
Annotation
- Immediate include surface: `linux/err.h`, `linux/gpio/driver.h`, `linux/interrupt.h`, `linux/io.h`, `linux/irq.h`, `linux/of.h`, `linux/of_irq.h`, `linux/pinctrl/consumer.h`.
- Detected declarations: `enum wmt_func_sel`, `function Copyright`, `function wmt_clearbits`, `function wmt_pmx_get_functions_count`, `function wmt_pmx_get_function_groups`, `function wmt_set_pinmux`, `function disabled`, `function wmt_pmx_set_mux`, `function wmt_pmx_gpio_disable_free`, `function wmt_pmx_gpio_set_direction`.
- 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.