OSDN Git Service

greybus: gpio: add irq-type defines
authorJohan Hovold <johan@hovoldconsulting.com>
Thu, 28 May 2015 17:03:34 +0000 (19:03 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 28 May 2015 21:48:30 +0000 (14:48 -0700)
Add Greybus GPIO IRQ-type defines rather than rely on the current
Linux implementation.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/gpio.c
drivers/staging/greybus/greybus_protocols.h

index 8dad9e5..9590914 100644 (file)
@@ -286,21 +286,33 @@ static int gb_gpio_irq_set_type(struct irq_data *d, unsigned int type)
        struct gpio_chip *chip = irq_data_to_gpio_chip(d);
        struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
        struct gb_gpio_line *line = &ggc->lines[d->hwirq];
+       u8 irq_type;
 
        switch (type) {
        case IRQ_TYPE_NONE:
+               irq_type = GB_GPIO_IRQ_TYPE_NONE;
+               break;
        case IRQ_TYPE_EDGE_RISING:
+               irq_type = GB_GPIO_IRQ_TYPE_EDGE_RISING;
+               break;
        case IRQ_TYPE_EDGE_FALLING:
+               irq_type = GB_GPIO_IRQ_TYPE_EDGE_FALLING;
+               break;
        case IRQ_TYPE_EDGE_BOTH:
+               irq_type = GB_GPIO_IRQ_TYPE_EDGE_BOTH;
+               break;
        case IRQ_TYPE_LEVEL_LOW:
+               irq_type = GB_GPIO_IRQ_TYPE_LEVEL_LOW;
+               break;
        case IRQ_TYPE_LEVEL_HIGH:
+               irq_type = GB_GPIO_IRQ_TYPE_LEVEL_HIGH;
                break;
        default:
                dev_err(chip->dev, "unsupported irq type: %u\n", type);
                return -EINVAL;
        }
 
-       line->irq_type = type;
+       line->irq_type = irq_type;
        line->irq_type_pending = true;
 
        return 0;
index 25c9a38..81f01d9 100644 (file)
@@ -132,6 +132,13 @@ struct gb_i2c_transfer_response {
 #define GB_GPIO_TYPE_IRQ_UNMASK                0x0d
 #define GB_GPIO_TYPE_IRQ_EVENT         0x0e
 
+#define GB_GPIO_IRQ_TYPE_NONE          0x00
+#define GB_GPIO_IRQ_TYPE_EDGE_RISING   0x01
+#define GB_GPIO_IRQ_TYPE_EDGE_FALLING  0x02
+#define GB_GPIO_IRQ_TYPE_EDGE_BOTH     0x03
+#define GB_GPIO_IRQ_TYPE_LEVEL_HIGH    0x04
+#define GB_GPIO_IRQ_TYPE_LEVEL_LOW     0x08
+
 /* line count request has no payload */
 struct gb_gpio_line_count_response {
        __u8    count;