Skip to content
Snippets Groups Projects
Commit f3b87af9 authored by Tobias Kahlki's avatar Tobias Kahlki Committed by Tobias Kahlki
Browse files

driver:gpio: Get input status from PI4IO

The driver didn't support the reading of the input status yet.

BCS 746-001155
parent 60d4da69
No related branches found
No related tags found
No related merge requests found
...@@ -111,7 +111,16 @@ static int pi4io_gpio_get(struct gpio_chip *chip, unsigned offset) ...@@ -111,7 +111,16 @@ static int pi4io_gpio_get(struct gpio_chip *chip, unsigned offset)
struct pi4io_priv *pi4io = gpiochip_get_data(chip); struct pi4io_priv *pi4io = gpiochip_get_data(chip);
struct device *dev = &pi4io->i2c->dev; struct device *dev = &pi4io->i2c->dev;
ret = regmap_read(pi4io->regmap, PI4IO_OUTPUT, &out); ret = pi4io_gpio_get_direction(chip, offset);
if (ret == GPIOF_DIR_IN) {
ret = regmap_read(pi4io->regmap, PI4IO_INPUT_STATUS, &out);
} else if(ret == GPIOF_DIR_OUT) {
ret = regmap_read(pi4io->regmap, PI4IO_OUTPUT, &out);
} else {
return ret;
}
if (ret) { if (ret) {
dev_err(dev, "Failed to read output: %d", ret); dev_err(dev, "Failed to read output: %d", ret);
return ret; return ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment