}
static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
- unsigned number, const char *name)
+ const struct pinctrl_pin_desc *pin)
{
struct pin_desc *pindesc;
- pindesc = pin_desc_get(pctldev, number);
+ pindesc = pin_desc_get(pctldev, pin->number);
if (pindesc != NULL) {
- dev_err(pctldev->dev, "pin %d already registered\n", number);
+ dev_err(pctldev->dev, "pin %d already registered\n",
+ pin->number);
return -EINVAL;
}
pindesc->pctldev = pctldev;
/* Copy basic pin info */
- if (name) {
- pindesc->name = name;
+ if (pin->name) {
+ pindesc->name = pin->name;
} else {
- pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", number);
+ pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", pin->number);
if (pindesc->name == NULL) {
kfree(pindesc);
return -ENOMEM;
pindesc->dynamic_name = true;
}
- radix_tree_insert(&pctldev->pin_desc_tree, number, pindesc);
+ pindesc->drv_data = pin->drv_data;
+
+ radix_tree_insert(&pctldev->pin_desc_tree, pin->number, pindesc);
pr_debug("registered pin %d (%s) on %s\n",
- number, pindesc->name, pctldev->desc->name);
+ pin->number, pindesc->name, pctldev->desc->name);
return 0;
}
int ret = 0;
for (i = 0; i < num_descs; i++) {
- ret = pinctrl_register_one_pin(pctldev,
- pins[i].number, pins[i].name);
+ ret = pinctrl_register_one_pin(pctldev, &pins[i]);
if (ret)
return ret;
}
* @name: a name for the pin, e.g. the name of the pin/pad/finger on a
* datasheet or such
* @dynamic_name: if the name of this pin was dynamically allocated
+ * @drv_data: driver-defined per-pin data. pinctrl core does not touch this
* @mux_usecount: If zero, the pin is not claimed, and @owner should be NULL.
* If non-zero, this pin is claimed by @owner. This field is an integer
* rather than a boolean, since pinctrl_get() might process multiple
struct pinctrl_dev *pctldev;
const char *name;
bool dynamic_name;
+ void *drv_data;
/* These fields only added when supporting pinmux drivers */
#ifdef CONFIG_PINMUX
unsigned mux_usecount;