/*
* ZynqMP pin controller
*
- * Copyright (C) 2020 Xilinx, Inc.
+ * Copyright (C) 2020, 2021 Xilinx, Inc.
*
* Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
* Rajan Vaja <rajan.vaja@xilinx.com>
unsigned int arg, param = pinconf_to_config_param(*config);
int ret;
- if (pin >= zynqmp_desc.npins)
- return -EOPNOTSUPP;
-
switch (param) {
case PIN_CONFIG_SLEW_RATE:
param = PM_PINCTRL_CONFIG_SLEW_RATE;
}
break;
default:
- ret = -EOPNOTSUPP;
+ ret = -ENOTSUPP;
break;
}
{
int i, ret;
- if (pin >= zynqmp_desc.npins)
- return -EOPNOTSUPP;
-
for (i = 0; i < num_configs; i++) {
unsigned int param = pinconf_to_config_param(configs[i]);
unsigned int arg = pinconf_to_config_argument(configs[i]);
dev_warn(pctldev->dev,
"unsupported configuration parameter '%u'\n",
param);
- ret = -EOPNOTSUPP;
+ ret = -ENOTSUPP;
break;
}
memcpy(groups, &payload[1], PINCTRL_GET_FUNC_GROUPS_RESP_LEN);
- return ret;
+ return 0;
}
static int zynqmp_pinctrl_get_func_num_groups(u32 fid, unsigned int *ngroups)
*ngroups = payload[1];
- return ret;
+ return 0;
}
/**
* @groups: Groups data.
*
* Query firmware to get group IDs for each function. Firmware returns
- * group IDs. Based on group index for the function, group names in
+ * group IDs. Based on the group index for the function, group names in
* the function are stored. For example, the first group in "eth0" function
- * is named as "eth0_0" and second group as "eth0_1" and so on.
+ * is named as "eth0_0" and the second group as "eth0_1" and so on.
*
* Based on the group ID received from the firmware, function stores name of
* the group for that group ID. For example, if "eth0" first group ID
* is x, groups[x] name will be stored as "eth0_0".
*
* Once done for each function, each function would have its group names
- * and each groups would also have their names.
+ * and each group would also have their names.
*
* Return: 0 on success else error code.
*/
{
u16 resp[NUM_GROUPS_PER_RESP] = {0};
const char **fgroups;
- int ret = 0, index, i;
+ int ret, index, i;
fgroups = devm_kzalloc(dev, sizeof(*fgroups) * func->ngroups, GFP_KERNEL);
if (!fgroups)
done:
func->groups = fgroups;
- return ret;
+ return 0;
}
static void zynqmp_pinctrl_get_function_name(u32 fid, char *name)
*nfuncs = payload[1];
- return ret;
+ return 0;
}
static int zynqmp_pinctrl_get_pin_groups(u32 pin, u32 index, u16 *groups)
memcpy(groups, &payload[1], PINCTRL_GET_PIN_GROUPS_RESP_LEN);
- return ret;
+ return 0;
}
static void zynqmp_pinctrl_group_add_pin(struct zynqmp_pctrl_group *group,
* Based on the firmware response(group IDs for the pin), add
* pin number to the respective group's pin array.
*
- * Once all pins are queries, each groups would have its number
+ * Once all pins are queries, each group would have its number
* of pins and pin numbers data.
*
* Return: 0 on success else error code.
index += NUM_GROUPS_PER_RESP;
} while (index <= MAX_PIN_GROUPS);
- return ret;
+ return 0;
}
/**
* prepare pin control driver data.
*
* Query number of functions and number of function groups (number
- * of groups in given function) to allocate required memory buffers
+ * of groups in the given function) to allocate required memory buffers
* for functions and groups. Once buffers are allocated to store
* functions and groups data, query and store required information
* (number of groups and group names for each function, number of
pctrl->funcs = funcs;
pctrl->groups = groups;
- return ret;
+ return 0;
}
static int zynqmp_pinctrl_get_num_pins(unsigned int *npins)
*npins = payload[1];
- return ret;
+ return 0;
}
/**
&zynqmp_desc.pins,
&zynqmp_desc.npins);
if (ret) {
- dev_err(&pdev->dev, "pin desc prepare fail with %d\n",
- ret);
+ dev_err(&pdev->dev, "pin desc prepare fail with %d\n", ret);
return ret;
}
ret = zynqmp_pinctrl_prepare_function_info(&pdev->dev, pctrl);
if (ret) {
- dev_err(&pdev->dev, "function info prepare fail with %d\n",
- ret);
+ dev_err(&pdev->dev, "function info prepare fail with %d\n", ret);
return ret;
}
- pctrl->pctrl = pinctrl_register(&zynqmp_desc, &pdev->dev, pctrl);
+ pctrl->pctrl = devm_pinctrl_register(&pdev->dev, &zynqmp_desc, pctrl);
if (IS_ERR(pctrl->pctrl))
return PTR_ERR(pctrl->pctrl);
{ .compatible = "xlnx,zynqmp-pinctrl" },
{ }
};
-
MODULE_DEVICE_TABLE(of, zynqmp_pinctrl_of_match);
static struct platform_driver zynqmp_pinctrl_driver = {
.probe = zynqmp_pinctrl_probe,
.remove = zynqmp_pinctrl_remove,
};
-
module_platform_driver(zynqmp_pinctrl_driver);
MODULE_AUTHOR("Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>");