drivers/pinctrl/pinctrl-generic.c

Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-generic.c

File Facts

System
Linux kernel
Corpus path
drivers/pinctrl/pinctrl-generic.c
Extension
.c
Size
8061 bytes
Lines
283
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ret) {
			pinctrl_utils_free_map(pctldev, *maps, *num_maps);
			return dev_err_probe(dev, ret, "error figuring out mappings for %s\n",
					     np->name);
		}

		ngroups++;
	}

	ret = pinmux_generic_add_function(pctldev, np->name, group_names, ngroups, NULL);
	if (ret < 0) {
		pinctrl_utils_free_map(pctldev, *maps, *num_maps);
		return dev_err_probe(dev, ret, "error adding function %s\n", np->name);
	}

	return 0;
}

/*
 * For platforms that do not define groups or functions in the driver, but
 * instead use the devicetree to describe them. This function will, unlike
 * pinconf_generic_dt_node_to_map() etc which rely on driver defined groups
 * and functions, create them in addition to parsing pinconf properties and
 * adding mappings.
 */
int pinctrl_generic_pins_function_dt_node_to_map(struct pinctrl_dev *pctldev,
						 struct device_node *np,
						 struct pinctrl_map **maps,
						 unsigned int *num_maps)
{
	return pinctrl_generic_dt_node_to_map(pctldev, np, maps, num_maps,
					      &pinctrl_generic_pins_function_dt_subnode_to_map);
}
EXPORT_SYMBOL_GPL(pinctrl_generic_pins_function_dt_node_to_map);

/*
 * For platforms that do not define groups or functions in the driver, but
 * instead use the devicetree to describe them. This function will, unlike
 * pinconf_generic_dt_node_to_map() etc which rely on driver defined groups
 * and functions, create them in addition to parsing pinconf properties and
 * adding mappings.
 *
 * It assumes that the upper 16 bits of the pinmux items contain the pin
 * and the lower 16 the mux setting.
 */
int pinctrl_generic_pinmux_dt_node_to_map(struct pinctrl_dev *pctldev,
					  struct device_node *np,
					  struct pinctrl_map **maps,
					  unsigned int *num_maps)
{
	return pinctrl_generic_dt_node_to_map(pctldev, np, maps, num_maps,
					      &pinctrl_generic_pinmux_dt_subnode_to_map);
};
EXPORT_SYMBOL_GPL(pinctrl_generic_pinmux_dt_node_to_map);

Annotation

Implementation Notes