1 From 418ee9488ff74ab4ada3a539a2840dda9e56f847 Mon Sep 17 00:00:00 2001
2 From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 Date: Fri, 29 Mar 2024 12:55:18 +0200
4 Subject: [PATCH] pinctrl: aw9523: Make use of struct pinfunction and
7 Since pin control provides a generic data type and a macro for
8 the pin function definition, use them in the driver.
10 Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
11 Message-ID: <20240329105634.712457-5-andy.shevchenko@gmail.com>
12 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
14 drivers/pinctrl/pinctrl-aw9523.c | 32 ++++++--------------------------
15 1 file changed, 6 insertions(+), 26 deletions(-)
17 --- a/drivers/pinctrl/pinctrl-aw9523.c
18 +++ b/drivers/pinctrl/pinctrl-aw9523.c
19 @@ -67,18 +67,6 @@ struct aw9523_irq {
23 - * struct aw9523_pinmux - Pin mux params
24 - * @name: Name of the mux
25 - * @grps: Groups of the mux
26 - * @num_grps: Number of groups (sizeof array grps)
28 -struct aw9523_pinmux {
30 - const char * const *grps;
35 * struct aw9523 - Main driver structure
37 * @regmap: regmap handle for current device
38 @@ -158,17 +146,9 @@ static const char * const gpio_pwm_group
41 /* Warning: Do NOT reorder this array */
42 -static const struct aw9523_pinmux aw9523_pmx[] = {
45 - .grps = gpio_pwm_groups,
46 - .num_grps = ARRAY_SIZE(gpio_pwm_groups),
50 - .grps = gpio_pwm_groups,
51 - .num_grps = ARRAY_SIZE(gpio_pwm_groups),
53 +static const struct pinfunction aw9523_pmx[] = {
54 + PINCTRL_PINFUNCTION("pwm", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)),
55 + PINCTRL_PINFUNCTION("gpio", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)),
58 static int aw9523_pmx_get_funcs_count(struct pinctrl_dev *pctl)
59 @@ -184,10 +164,10 @@ static const char *aw9523_pmx_get_fname(
61 static int aw9523_pmx_get_groups(struct pinctrl_dev *pctl, unsigned int sel,
62 const char * const **groups,
63 - unsigned int * const num_groups)
64 + unsigned int * const ngroups)
66 - *groups = aw9523_pmx[sel].grps;
67 - *num_groups = aw9523_pmx[sel].num_grps;
68 + *groups = aw9523_pmx[sel].groups;
69 + *ngroups = aw9523_pmx[sel].ngroups;