Merge tag 'usb-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[cascardo/linux.git] / drivers / gpio / gpiolib.h
index c5a5b57..e30e5fd 100644 (file)
@@ -32,6 +32,14 @@ struct acpi_device;
  * @owner: helps prevent removal of modules exporting active GPIOs
  * @chip: pointer to the corresponding gpiochip, holding static
  * data for this device
+ * @descs: array of ngpio descriptors.
+ * @ngpio: the number of GPIO lines on this GPIO device, equal to the size
+ * of the @descs array.
+ * @base: GPIO base in the DEPRECATED global Linux GPIO numberspace, assigned
+ * at device creation time.
+ * @label: a descriptive name for the GPIO device, such as the part number
+ * or name of the IP component in a System on Chip.
+ * @data: per-instance data assigned by the driver
  * @list: links gpio_device:s together for traversal
  *
  * This state container holds most of the runtime variable data
@@ -46,7 +54,22 @@ struct gpio_device {
        struct device           *mockdev;
        struct module           *owner;
        struct gpio_chip        *chip;
+       struct gpio_desc        *descs;
+       int                     base;
+       u16                     ngpio;
+       char                    *label;
+       void                    *data;
        struct list_head        list;
+
+#ifdef CONFIG_PINCTRL
+       /*
+        * If CONFIG_PINCTRL is enabled, then gpio controllers can optionally
+        * describe the actual pin range which they serve in an SoC. This
+        * information would be used by pinctrl subsystem to configure
+        * corresponding pins for gpio usage.
+        */
+       struct list_head pin_ranges;
+#endif
 };
 
 /**
@@ -123,7 +146,7 @@ extern struct spinlock gpio_lock;
 extern struct list_head gpio_devices;
 
 struct gpio_desc {
-       struct gpio_chip        *chip;
+       struct gpio_device      *gdev;
        unsigned long           flags;
 /* flag symbols are bit numbers */
 #define FLAG_REQUESTED 0
@@ -152,7 +175,7 @@ int gpiod_hog(struct gpio_desc *desc, const char *name,
  */
 static int __maybe_unused gpio_chip_hwgpio(const struct gpio_desc *desc)
 {
-       return desc - &desc->chip->desc[0];
+       return desc - &desc->gdev->descs[0];
 }
 
 /* With descriptor prefix */