greybus: gpio: add irq-type defines

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>
This commit is contained in:
Johan Hovold 2015-05-28 19:03:34 +02:00 committed by Greg Kroah-Hartman
parent 4bf3780982
commit 7ba864a19f
2 changed files with 20 additions and 1 deletions

View 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;

View 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;