diff options
author | Linus Walleij | 2019-04-26 14:40:18 +0200 |
---|---|---|
committer | Linus Walleij | 2019-06-07 23:20:23 +0200 |
commit | 5923ea6c2ce626f0aa8a547d5b7e5fce705dd3dc (patch) | |
tree | e037d5e536341d577445356335e62a0c8978528d /drivers/hid | |
parent | 0aa3ebffc43cb8974f2fca92d07b9ebeba0f67c1 (diff) |
gpio: pass lookup and descriptor flags to request_own
When a gpio_chip wants to request a descriptor from itself
using gpiochip_request_own_desc() it needs to be able to specify
fully how to use the descriptor, notably line inversion
semantics. The workaround in the gpiolib.c can be removed
and cases (such as SPI CS) where we need at times to request
a GPIO with line inversion semantics directly on a chip for
workarounds, can be fully supported with this call.
Fix up some users of the API that weren't really using the
last flag to set up the line as input or output properly
but instead just calling direction setting explicitly
after requesting the line.
Cc: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-cp2112.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 47f65857408d..f6fb97a14de6 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -24,7 +24,8 @@ * https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf */ -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> +#include <linux/gpio/machine.h> #include <linux/gpio/driver.h> #include <linux/hid.h> #include <linux/hidraw.h> @@ -1203,7 +1204,9 @@ static int __maybe_unused cp2112_allocate_irq(struct cp2112_device *dev, return -EINVAL; dev->desc[pin] = gpiochip_request_own_desc(&dev->gc, pin, - "HID/I2C:Event", 0); + "HID/I2C:Event", + GPIO_ACTIVE_HIGH, + GPIOD_IN); if (IS_ERR(dev->desc[pin])) { dev_err(dev->gc.parent, "Failed to request GPIO\n"); return PTR_ERR(dev->desc[pin]); |