drivers: gpio_sx1509b: correct handling of initialized output

The data_first flag was intended to be set when the configuration
requires setting the output value before setting the direction.
Respect the intent.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-02-09 12:57:24 -06:00 committed by Johan Hedberg
parent 56a098338f
commit e83c9cc262

View file

@ -179,8 +179,10 @@ static int sx1509b_config(struct device *dev,
pins->dir &= ~BIT(pin);
if ((flags & GPIO_OUTPUT_INIT_LOW) != 0) {
pins->data &= ~BIT(pin);
data_first = true;
} else if ((flags & GPIO_OUTPUT_INIT_HIGH) != 0) {
pins->data |= BIT(pin);
data_first = true;
}
} else {
pins->dir |= BIT(pin);