diff mbox series

[2/4] pinctrl: mediatek: add get_pin_muxing ops for mediatek pinctrl

Message ID f89c4d95b3db2438bf1f95425b3907448d24e6b0.1614909515.git.weijie.gao@mediatek.com
State Accepted
Commit e254d2c0a44183b9ec1da81578a7bb7d548bdf60
Delegated to: Tom Rini
Headers show
Series Minor fixes for MediaTek pinctrl driver | expand

Commit Message

Weijie Gao March 5, 2021, 2:22 a.m. UTC
From: Sam Shih <sam.shih@mediatek.com>

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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Tom Rini March 20, 2021, 11:36 p.m. UTC | #1
On Fri, Mar 05, 2021 at 10:22:19AM +0800, Weijie Gao wrote:

> From: Sam Shih <sam.shih@mediatek.com>
> 
> This patch add get_pin_muxing support for mediatek pinctrl drivers
> 
> Signed-off-by: Sam Shih <sam.shih@mediatek.com>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index b700dd98bf..b2212c2559 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -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,