]> git.sur5r.net Git - u-boot/blobdiff - include/asm-generic/gpio.h
board/T1040qds: Add VSC9953 support for T1040qds board
[u-boot] / include / asm-generic / gpio.h
index 71044549ba44c06f5ccd1f4326906533739fb38f..36a36c64b8a6a19879e5236eb85af2fd5960a43d 100644 (file)
@@ -95,6 +95,24 @@ enum gpio_func_t {
 
 struct udevice;
 
+/**
+ * gpio_get_status() - get the current GPIO status as a string
+ *
+ * Obtain the current GPIO status as a string which can be presented to the
+ * user. A typical string is:
+ *
+ * "b4:  in: 1 [x] sdmmc_cd"
+ *
+ * which means this is GPIO bank b, offset 4, currently set to input, current
+ * value 1, [x] means that it is requested and the owner is 'sdmmc_cd'
+ *
+ * @dev:       Device to check
+ * @offset:    Offset of device GPIO to check
+ * @buf:       Place to put string
+ * @buffsize:  Size of string including \0
+ */
+int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize);
+
 /**
  * gpio_get_function() - get the current function for a GPIO pin
  *
@@ -127,6 +145,16 @@ int gpio_get_function(struct udevice *dev, int offset, const char **namep);
  */
 int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep);
 
+/**
+ * gpio_requestf() - request a GPIO using a format string for the owner
+ *
+ * This is a helper function for gpio_request(). It allows you to provide
+ * a printf()-format string for the GPIO owner. It calls gpio_request() with
+ * the string that is created
+ */
+int gpio_requestf(unsigned gpio, const char *fmt, ...)
+               __attribute__ ((format (__printf__, 2, 3)));
+
 /**
  * struct struct dm_gpio_ops - Driver model GPIO operations
  *
@@ -170,8 +198,6 @@ struct dm_gpio_ops {
         * @return current function - GPIOF_...
         */
        int (*get_function)(struct udevice *dev, unsigned offset);
-       int (*get_state)(struct udevice *dev, unsigned offset, char *state,
-                        int maxlen);
 };
 
 /**
@@ -231,4 +257,15 @@ const char *gpio_get_bank_info(struct udevice *dev, int *offset_count);
 int gpio_lookup_name(const char *name, struct udevice **devp,
                     unsigned int *offsetp, unsigned int *gpiop);
 
+/**
+ * get_gpios() - Turn the values of a list of GPIOs into an integer
+ *
+ * This puts the value of the first GPIO into bit 0, the second into bit 1,
+ * etc. then returns the resulting integer.
+ *
+ * @gpio_list: List of GPIOs to collect
+ * @return resulting integer value
+ */
+unsigned gpio_get_values_as_int(const int *gpio_list);
+
 #endif /* _ASM_GENERIC_GPIO_H_ */