aboutsummaryrefslogtreecommitdiff
path: root/include/asm-generic
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-04 21:22:04 -0700
committerTom Rini <trini@konsulko.com>2021-03-03 15:40:11 -0500
commitca1e1f57beb29fbaf48f9488ada1b008dace8314 (patch)
treede13345480cbd7411c78cdf97856a3fbc88adb3b /include/asm-generic
parent7e0a96d559da493812220731535f5ba6351bcea1 (diff)
downloadu-boot-ca1e1f57beb29fbaf48f9488ada1b008dace8314.zip
u-boot-ca1e1f57beb29fbaf48f9488ada1b008dace8314.tar.gz
u-boot-ca1e1f57beb29fbaf48f9488ada1b008dace8314.tar.bz2
gpio: Replace direction_input() and direction_output()
The new update_flags() method is more flexible since it allows the driver to see the full flags all at once. Use that in preference to these two functions. Add comments to that effect. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/gpio.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 7d1e19a..f0c835e 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -260,10 +260,32 @@ int gpio_xlate_offs_flags(struct udevice *dev, struct gpio_desc *desc,
struct dm_gpio_ops {
int (*request)(struct udevice *dev, unsigned offset, const char *label);
int (*rfree)(struct udevice *dev, unsigned int offset);
+
+ /**
+ * direction_input() - deprecated
+ *
+ * Equivalent to set_flags(...GPIOD_IS_IN)
+ */
int (*direction_input)(struct udevice *dev, unsigned offset);
+
+ /**
+ * direction_output() - deprecated
+ *
+ * Equivalent to set_flags(...GPIOD_IS_OUT) with GPIOD_IS_OUT_ACTIVE
+ * also set if @value
+ */
int (*direction_output)(struct udevice *dev, unsigned offset,
int value);
+
int (*get_value)(struct udevice *dev, unsigned offset);
+
+ /**
+ * set_value() - Sets the GPIO value of an output
+ *
+ * If the driver provides an @set_flags() method then that is used
+ * in preference to this, with GPIOD_IS_OUT_ACTIVE set according to
+ * @value.
+ */
int (*set_value)(struct udevice *dev, unsigned offset, int value);
/**
* get_function() Get the GPIO function
@@ -320,7 +342,9 @@ struct dm_gpio_ops {
* uclass, so the driver always sees the value that should be set at the
* pin (1=high, 0=low).
*
- * This method is optional.
+ * This method is required and should be implemented by new drivers. At
+ * some point, it will supersede direction_input() and
+ * direction_output(), which wil be removed.
*
* @dev: GPIO device
* @offset: GPIO offset within that device