Commit 5ff776889212c080e3d1a33634ac904405ed6845
Committed by
Philipp Tomsich
1 parent
4de2bbb39e
Exists in
smarc_8mq_lf_v2020.04
and in
12 other branches
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>
Showing 2 changed files with 34 additions and 0 deletions Side-by-side Diff
drivers/pinctrl/pinctrl-uclass.c
... | ... | @@ -27,6 +27,28 @@ |
27 | 27 | return flags; |
28 | 28 | } |
29 | 29 | |
30 | +/* | |
31 | + * TODO: this function is temporary for v2019.01. | |
32 | + * It should be renamed to pinctrl_decode_pin_config(), | |
33 | + * the original pinctrl_decode_pin_config() function should | |
34 | + * be removed and all callers of the original function should | |
35 | + * be migrated to use the new one. | |
36 | + */ | |
37 | +int pinctrl_decode_pin_config_dm(struct udevice *dev) | |
38 | +{ | |
39 | + int pinconfig = 0; | |
40 | + | |
41 | + if (dev->uclass->uc_drv->id != UCLASS_PINCONFIG) | |
42 | + return -EINVAL; | |
43 | + | |
44 | + if (dev_read_bool(dev, "bias-pull-up")) | |
45 | + pinconfig |= 1 << PIN_CONFIG_BIAS_PULL_UP; | |
46 | + else if (dev_read_bool(dev, "bias-pull-down")) | |
47 | + pinconfig |= 1 << PIN_CONFIG_BIAS_PULL_DOWN; | |
48 | + | |
49 | + return pinconfig; | |
50 | +} | |
51 | + | |
30 | 52 | #if CONFIG_IS_ENABLED(PINCTRL_FULL) |
31 | 53 | /** |
32 | 54 | * pinctrl_config_one() - apply pinctrl settings for a single node |
include/dm/pinctrl.h
... | ... | @@ -355,6 +355,18 @@ |
355 | 355 | int pinctrl_decode_pin_config(const void *blob, int node); |
356 | 356 | |
357 | 357 | /** |
358 | + * pinctrl_decode_pin_config_dm() - decode pin configuration flags | |
359 | + * | |
360 | + * This decodes some of the PIN_CONFIG values into flags, with each value | |
361 | + * being (1 << pin_cfg). This does not support things with values like the | |
362 | + * slew rate. | |
363 | + * | |
364 | + * @pinconfig: Pinconfig udevice | |
365 | + * @return decoded flag value, or -ve on error | |
366 | + */ | |
367 | +int pinctrl_decode_pin_config_dm(struct udevice *dev); | |
368 | + | |
369 | +/** | |
358 | 370 | * pinctrl_get_gpio_mux() - get the mux value for a particular GPIO |
359 | 371 | * |
360 | 372 | * This allows the raw mux value for a GPIO to be obtained. It is |
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538
-
mentioned in commit 174538