summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/pinctrl-ingenic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/pinctrl-ingenic.c')
-rw-r--r--drivers/pinctrl/pinctrl-ingenic.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 3c660471ec69..c7f14546de05 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -96,11 +96,8 @@
.data = (void *)func, \
}
-#define INGENIC_PIN_FUNCTION(_name_, id) \
- { \
- .func = PINCTRL_PINFUNCTION(_name_, id##_groups, ARRAY_SIZE(id##_groups)), \
- .data = NULL, \
- }
+#define INGENIC_PIN_FUNCTION(_name_, id) \
+ PINCTRL_PINFUNCTION(_name_, id##_groups, ARRAY_SIZE(id##_groups))
enum jz_version {
ID_JZ4730,
@@ -128,7 +125,7 @@ struct ingenic_chip_info {
const struct group_desc *groups;
unsigned int num_groups;
- const struct function_desc *functions;
+ const struct pinfunction *functions;
unsigned int num_functions;
const u32 *pull_ups, *pull_downs;
@@ -263,7 +260,7 @@ static const char *jz4730_pwm1_groups[] = { "pwm1", };
static const char *jz4730_mii_groups[] = { "mii", };
static const char *jz4730_i2s_groups[] = { "i2s-data", "i2s-master", "i2s-slave", };
-static const struct function_desc jz4730_functions[] = {
+static const struct pinfunction jz4730_functions[] = {
INGENIC_PIN_FUNCTION("mmc", jz4730_mmc),
INGENIC_PIN_FUNCTION("uart0", jz4730_uart0),
INGENIC_PIN_FUNCTION("uart1", jz4730_uart1),
@@ -370,7 +367,7 @@ static const char *jz4740_pwm5_groups[] = { "pwm5", };
static const char *jz4740_pwm6_groups[] = { "pwm6", };
static const char *jz4740_pwm7_groups[] = { "pwm7", };
-static const struct function_desc jz4740_functions[] = {
+static const struct pinfunction jz4740_functions[] = {
INGENIC_PIN_FUNCTION("mmc", jz4740_mmc),
INGENIC_PIN_FUNCTION("uart0", jz4740_uart0),
INGENIC_PIN_FUNCTION("uart1", jz4740_uart1),
@@ -474,7 +471,7 @@ static const char *jz4725b_pwm3_groups[] = { "pwm3", };
static const char *jz4725b_pwm4_groups[] = { "pwm4", };
static const char *jz4725b_pwm5_groups[] = { "pwm5", };
-static const struct function_desc jz4725b_functions[] = {
+static const struct pinfunction jz4725b_functions[] = {
INGENIC_PIN_FUNCTION("mmc0", jz4725b_mmc0),
INGENIC_PIN_FUNCTION("mmc1", jz4725b_mmc1),
INGENIC_PIN_FUNCTION("uart", jz4725b_uart),
@@ -606,7 +603,7 @@ static const char *jz4750_pwm3_groups[] = { "pwm3", };
static const char *jz4750_pwm4_groups[] = { "pwm4", };
static const char *jz4750_pwm5_groups[] = { "pwm5", };
-static const struct function_desc jz4750_functions[] = {
+static const struct pinfunction jz4750_functions[] = {
INGENIC_PIN_FUNCTION("uart0", jz4750_uart0),
INGENIC_PIN_FUNCTION("uart1", jz4750_uart1),
INGENIC_PIN_FUNCTION("uart2", jz4750_uart2),
@@ -771,7 +768,7 @@ static const char *jz4755_pwm3_groups[] = { "pwm3", };
static const char *jz4755_pwm4_groups[] = { "pwm4", };
static const char *jz4755_pwm5_groups[] = { "pwm5", };
-static const struct function_desc jz4755_functions[] = {
+static const struct pinfunction jz4755_functions[] = {
INGENIC_PIN_FUNCTION("uart0", jz4755_uart0),
INGENIC_PIN_FUNCTION("uart1", jz4755_uart1),
INGENIC_PIN_FUNCTION("uart2", jz4755_uart2),
@@ -1106,7 +1103,7 @@ static const char *jz4760_pwm6_groups[] = { "pwm6", };
static const char *jz4760_pwm7_groups[] = { "pwm7", };
static const char *jz4760_otg_groups[] = { "otg-vbus", };
-static const struct function_desc jz4760_functions[] = {
+static const struct pinfunction jz4760_functions[] = {
INGENIC_PIN_FUNCTION("uart0", jz4760_uart0),
INGENIC_PIN_FUNCTION("uart1", jz4760_uart1),
INGENIC_PIN_FUNCTION("uart2", jz4760_uart2),
@@ -1444,7 +1441,7 @@ static const char *jz4770_pwm6_groups[] = { "pwm6", };
static const char *jz4770_pwm7_groups[] = { "pwm7", };
static const char *jz4770_mac_groups[] = { "mac-rmii", "mac-mii", };
-static const struct function_desc jz4770_functions[] = {
+static const struct pinfunction jz4770_functions[] = {
INGENIC_PIN_FUNCTION("uart0", jz4770_uart0),
INGENIC_PIN_FUNCTION("uart1", jz4770_uart1),
INGENIC_PIN_FUNCTION("uart2", jz4770_uart2),
@@ -1723,7 +1720,7 @@ static const char *jz4775_mac_groups[] = {
};
static const char *jz4775_otg_groups[] = { "otg-vbus", };
-static const struct function_desc jz4775_functions[] = {
+static const struct pinfunction jz4775_functions[] = {
INGENIC_PIN_FUNCTION("uart0", jz4775_uart0),
INGENIC_PIN_FUNCTION("uart1", jz4775_uart1),
INGENIC_PIN_FUNCTION("uart2", jz4775_uart2),
@@ -1976,7 +1973,7 @@ static const char *jz4780_dmic_groups[] = { "dmic", };
static const char *jz4780_cim_groups[] = { "cim-data", };
static const char *jz4780_hdmi_ddc_groups[] = { "hdmi-ddc", };
-static const struct function_desc jz4780_functions[] = {
+static const struct pinfunction jz4780_functions[] = {
INGENIC_PIN_FUNCTION("uart0", jz4770_uart0),
INGENIC_PIN_FUNCTION("uart1", jz4770_uart1),
INGENIC_PIN_FUNCTION("uart2", jz4780_uart2),
@@ -2211,7 +2208,7 @@ static const char *x1000_pwm3_groups[] = { "pwm3", };
static const char *x1000_pwm4_groups[] = { "pwm4", };
static const char *x1000_mac_groups[] = { "mac", };
-static const struct function_desc x1000_functions[] = {
+static const struct pinfunction x1000_functions[] = {
INGENIC_PIN_FUNCTION("uart0", x1000_uart0),
INGENIC_PIN_FUNCTION("uart1", x1000_uart1),
INGENIC_PIN_FUNCTION("uart2", x1000_uart2),
@@ -2341,7 +2338,7 @@ static const char *x1500_pwm2_groups[] = { "pwm2", };
static const char *x1500_pwm3_groups[] = { "pwm3", };
static const char *x1500_pwm4_groups[] = { "pwm4", };
-static const struct function_desc x1500_functions[] = {
+static const struct pinfunction x1500_functions[] = {
INGENIC_PIN_FUNCTION("uart0", x1500_uart0),
INGENIC_PIN_FUNCTION("uart1", x1500_uart1),
INGENIC_PIN_FUNCTION("uart2", x1500_uart2),
@@ -2562,7 +2559,7 @@ static const char * const x1600_pwm7_groups[] = { "pwm7-b10", "pwm7-b21", };
static const char * const x1600_mac_groups[] = { "mac", };
-static const struct function_desc x1600_functions[] = {
+static const struct pinfunction x1600_functions[] = {
INGENIC_PIN_FUNCTION("uart0", x1600_uart0),
INGENIC_PIN_FUNCTION("uart1", x1600_uart1),
INGENIC_PIN_FUNCTION("uart2", x1600_uart2),
@@ -2779,7 +2776,7 @@ static const char *x1830_pwm6_groups[] = { "pwm6-c-17", "pwm6-c-27", };
static const char *x1830_pwm7_groups[] = { "pwm7-c-18", "pwm7-c-28", };
static const char *x1830_mac_groups[] = { "mac", };
-static const struct function_desc x1830_functions[] = {
+static const struct pinfunction x1830_functions[] = {
INGENIC_PIN_FUNCTION("uart0", x1830_uart0),
INGENIC_PIN_FUNCTION("uart1", x1830_uart1),
INGENIC_PIN_FUNCTION("sfc", x1830_sfc),
@@ -3225,7 +3222,7 @@ static const char *x2000_mac0_groups[] = { "mac0-rmii", "mac0-rgmii", };
static const char *x2000_mac1_groups[] = { "mac1-rmii", "mac1-rgmii", };
static const char *x2000_otg_groups[] = { "otg-vbus", };
-static const struct function_desc x2000_functions[] = {
+static const struct pinfunction x2000_functions[] = {
INGENIC_PIN_FUNCTION("uart0", x2000_uart0),
INGENIC_PIN_FUNCTION("uart1", x2000_uart1),
INGENIC_PIN_FUNCTION("uart2", x2000_uart2),
@@ -3449,7 +3446,7 @@ static const struct group_desc x2100_groups[] = {
static const char *x2100_mac_groups[] = { "mac", };
-static const struct function_desc x2100_functions[] = {
+static const struct pinfunction x2100_functions[] = {
INGENIC_PIN_FUNCTION("uart0", x2000_uart0),
INGENIC_PIN_FUNCTION("uart1", x2000_uart1),
INGENIC_PIN_FUNCTION("uart2", x2000_uart2),
@@ -4003,7 +4000,7 @@ static int ingenic_pinmux_set_mux(struct pinctrl_dev *pctldev,
unsigned int selector, unsigned int group)
{
struct ingenic_pinctrl *jzpc = pinctrl_dev_get_drvdata(pctldev);
- struct function_desc *func;
+ const struct function_desc *func;
struct group_desc *grp;
unsigned int i;
uintptr_t mode;
@@ -4018,7 +4015,7 @@ static int ingenic_pinmux_set_mux(struct pinctrl_dev *pctldev,
return -EINVAL;
dev_dbg(pctldev->dev, "enable function %s group %s\n",
- func->func.name, grp->grp.name);
+ func->func->name, grp->grp.name);
mode = (uintptr_t)grp->data;
if (mode <= 3) {
@@ -4267,7 +4264,7 @@ static int ingenic_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
case PIN_CONFIG_BIAS_PULL_UP:
case PIN_CONFIG_BIAS_PULL_DOWN:
case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
- case PIN_CONFIG_OUTPUT:
+ case PIN_CONFIG_LEVEL:
case PIN_CONFIG_SLEW_RATE:
continue;
default:
@@ -4308,7 +4305,7 @@ static int ingenic_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
ingenic_set_schmitt_trigger(jzpc, pin, arg);
break;
- case PIN_CONFIG_OUTPUT:
+ case PIN_CONFIG_LEVEL:
ret = pinctrl_gpio_direction_output(jzpc->gc,
pin - jzpc->gc->base);
if (ret)
@@ -4451,7 +4448,7 @@ static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc,
jzgc->gc.fwnode = fwnode;
jzgc->gc.owner = THIS_MODULE;
- jzgc->gc.set_rv = ingenic_gpio_set;
+ jzgc->gc.set = ingenic_gpio_set;
jzgc->gc.get = ingenic_gpio_get;
jzgc->gc.direction_input = pinctrl_gpio_direction_input;
jzgc->gc.direction_output = ingenic_gpio_direction_output;
@@ -4571,12 +4568,9 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
}
for (i = 0; i < chip_info->num_functions; i++) {
- const struct function_desc *function = &chip_info->functions[i];
- const struct pinfunction *func = &function->func;
+ const struct pinfunction *func = &chip_info->functions[i];
- err = pinmux_generic_add_function(jzpc->pctl, func->name,
- func->groups, func->ngroups,
- function->data);
+ err = pinmux_generic_add_pinfunction(jzpc->pctl, func, NULL);
if (err < 0) {
dev_err(dev, "Failed to register function %s\n", func->name);
return err;