]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pinctrl: renesas: sh-pfc: Implement .pin_config_group_get() callback
authorGeert Uytterhoeven <geert+renesas@glider.be>
Thu, 30 Apr 2026 15:24:42 +0000 (17:24 +0200)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 15 May 2026 09:15:19 +0000 (11:15 +0200)
When reading /sys/kernel/debug/pinctrl/*.pinctrl-sh-pfc/pinconf-groups
while CONFIG_DEBUG_PINCTRL is enabled, the user is confronted with a
seemlingly endless stream of identical messages on the console:

    sh-pfc e6060000.pinctrl: cannot get configuration for pin group, missing group config get function in driver

Fix this by implementing the sh_pfc_pinconf_ops.pin_config_group_get()
callback.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/130ce567f23fd6eef8f5fa7273480a0e3ff2d1d9.1777562482.git.geert+renesas@glider.be
drivers/pinctrl/renesas/pinctrl.c

index 3a742f74ecd1dcdf6b7a286e8989b6b221860dbc..8585ed4bcfe0961d3b31b081b2e71f665f9ccd6e 100644 (file)
@@ -719,6 +719,30 @@ static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned _pin,
        return 0;
 }
 
+static int sh_pfc_pinconf_group_get(struct pinctrl_dev *pctldev,
+                                   unsigned int group, unsigned long *config)
+{
+       struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
+       const unsigned int *pins = pmx->pfc->info->groups[group].pins;
+       unsigned int num_pins = pmx->pfc->info->groups[group].nr_pins;
+       unsigned long prev_config = 0;
+       int ret;
+
+       for (unsigned int i = 0; i < num_pins; ++i) {
+               ret = sh_pfc_pinconf_get(pctldev, pins[i], config);
+               if (ret)
+                       return ret;
+
+               /* configs should match for all pins in the group */
+               if (i && prev_config != *config)
+                       return -ENOTSUPP;
+
+               prev_config = *config;
+       }
+
+       return 0;
+}
+
 static int sh_pfc_pinconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
                                    unsigned long *configs,
                                    unsigned num_configs)
@@ -745,6 +769,7 @@ static const struct pinconf_ops sh_pfc_pinconf_ops = {
        .is_generic                     = true,
        .pin_config_get                 = sh_pfc_pinconf_get,
        .pin_config_set                 = sh_pfc_pinconf_set,
+       .pin_config_group_get           = sh_pfc_pinconf_group_get,
        .pin_config_group_set           = sh_pfc_pinconf_group_set,
        .pin_config_config_dbg_show     = pinconf_generic_dump_config,
 };