89b51f7e819548d62ceacd41f07c92994326fde9
[openwrt/staging/wigyori.git] /
1 From ca73da39ff0c9f599f75d7ccac0196030aa946b9 Mon Sep 17 00:00:00 2001
2 From: Sam Shih <sam.shih@mediatek.com>
3 Date: Thu, 17 Dec 2020 19:32:48 +0800
4 Subject: [PATCH 04/21] pinctrl: mediatek: add get_pin_muxing ops for mediatek
5 pinctrl
6
7 This patch add get_pin_muxing support for mediatek pinctrl drivers
8
9 Signed-off-by: Sam Shih <sam.shih@mediatek.com>
10 ---
11 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 14 ++++++++++++++
12 1 file changed, 14 insertions(+)
13
14 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
15 +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
16 @@ -232,6 +232,19 @@ static int mtk_get_pins_count(struct ude
17 return priv->soc->npins;
18 }
19
20 +static int mtk_get_pin_muxing(struct udevice *dev,
21 + unsigned int selector,
22 + char *buf, int size)
23 +{
24 + int val, err;
25 + err = mtk_hw_get_value(dev, selector, PINCTRL_PIN_REG_MODE, &val);
26 + if (err)
27 + return err;
28 +
29 + snprintf(buf, size, "Aux Func.%d", val);
30 + return 0;
31 +}
32 +
33 static const char *mtk_get_group_name(struct udevice *dev,
34 unsigned int selector)
35 {
36 @@ -512,6 +525,7 @@ static int mtk_pinconf_group_set(struct
37 const struct pinctrl_ops mtk_pinctrl_ops = {
38 .get_pins_count = mtk_get_pins_count,
39 .get_pin_name = mtk_get_pin_name,
40 + .get_pin_muxing = mtk_get_pin_muxing,
41 .get_groups_count = mtk_get_groups_count,
42 .get_group_name = mtk_get_group_name,
43 .get_functions_count = mtk_get_functions_count,