gpio: axp: Report the correct value for outputs

Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland 2022-07-31 18:19:39 -05:00
parent 20575f5984
commit cfb7b08923

View File

@ -33,6 +33,15 @@ static int axp_gpio_get_value(struct udevice *dev, unsigned pin)
const struct axp_gpio_desc *desc = dev_get_priv(dev);
int ret;
ret = pmic_reg_read(dev->parent, desc->pins[pin]);
if (ret < 0)
return ret;
if (ret == AXP_GPIO_CTRL_OUTPUT_LOW)
return 0;
if (ret == AXP_GPIO_CTRL_OUTPUT_HIGH)
return 1;
ret = pmic_reg_read(dev->parent, desc->status_reg);
if (ret < 0)
return ret;