aboutsummaryrefslogtreecommitdiff
path: root/drivers/pinctrl/pinctrl-uclass.c
diff options
context:
space:
mode:
authorChristoph Muellner2019-01-02 15:09:18 +0100
committerPhilipp Tomsich2019-01-02 22:38:44 +0100
commit5ff776889212c080e3d1a33634ac904405ed6845 (patch)
tree836c2cf8fece6fc3aed29e7c5fbbfc7a15cd676a /drivers/pinctrl/pinctrl-uclass.c
parent4de2bbb39ea71d28bc422b9405f199b3abe4b8fa (diff)
dm: pinctrl: Add pinctrl_decode_pin_config_dm().
pinctrl_decode_pin_config_dm() is basically a feature-equivalent implementation of pinctrl_decode_pin_config(), which operates on struct udevice devices and uses the dev_read_*() API. Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Diffstat (limited to 'drivers/pinctrl/pinctrl-uclass.c')
-rw-r--r--drivers/pinctrl/pinctrl-uclass.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 29c910c55f3..c8b38d78f6b 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -27,6 +27,28 @@ int pinctrl_decode_pin_config(const void *blob, int node)
return flags;
}
+/*
+ * TODO: this function is temporary for v2019.01.
+ * It should be renamed to pinctrl_decode_pin_config(),
+ * the original pinctrl_decode_pin_config() function should
+ * be removed and all callers of the original function should
+ * be migrated to use the new one.
+ */
+int pinctrl_decode_pin_config_dm(struct udevice *dev)
+{
+ int pinconfig = 0;
+
+ if (dev->uclass->uc_drv->id != UCLASS_PINCONFIG)
+ return -EINVAL;
+
+ if (dev_read_bool(dev, "bias-pull-up"))
+ pinconfig |= 1 << PIN_CONFIG_BIAS_PULL_UP;
+ else if (dev_read_bool(dev, "bias-pull-down"))
+ pinconfig |= 1 << PIN_CONFIG_BIAS_PULL_DOWN;
+
+ return pinconfig;
+}
+
#if CONFIG_IS_ENABLED(PINCTRL_FULL)
/**
* pinctrl_config_one() - apply pinctrl settings for a single node