]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pinctrl: mediatek: add get_pin_muxing ops for mediatek pinctrl
authorSam Shih <sam.shih@mediatek.com>
Fri, 5 Mar 2021 02:22:19 +0000 (10:22 +0800)
committerTom Rini <trini@konsulko.com>
Sat, 20 Mar 2021 20:24:27 +0000 (16:24 -0400)
This patch add get_pin_muxing support for mediatek pinctrl drivers

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
drivers/pinctrl/mediatek/pinctrl-mtk-common.c

index b700dd98bf61f87e47c0d55ddc8dec8a0c634104..83c2104a7f0fac0674067ea16ab3696cb95caf9a 100644 (file)
@@ -232,6 +232,19 @@ static int mtk_get_pins_count(struct udevice *dev)
        return priv->soc->npins;
 }
 
+static int mtk_get_pin_muxing(struct udevice *dev, unsigned int selector,
+                             char *buf, int size)
+{
+       int val, err;
+
+       err = mtk_hw_get_value(dev, selector, PINCTRL_PIN_REG_MODE, &val);
+       if (err)
+               return err;
+
+       snprintf(buf, size, "Aux Func.%d", val);
+       return 0;
+}
+
 static const char *mtk_get_group_name(struct udevice *dev,
                                      unsigned int selector)
 {
@@ -512,6 +525,7 @@ static int mtk_pinconf_group_set(struct udevice *dev,
 const struct pinctrl_ops mtk_pinctrl_ops = {
        .get_pins_count = mtk_get_pins_count,
        .get_pin_name = mtk_get_pin_name,
+       .get_pin_muxing = mtk_get_pin_muxing,
        .get_groups_count = mtk_get_groups_count,
        .get_group_name = mtk_get_group_name,
        .get_functions_count = mtk_get_functions_count,