HomeFreeBSD

gpioiic: set output after switching to output mode if presetting it failed

Description

gpioiic: set output after switching to output mode if presetting it failed

Some controllers cannot preset future output value while the pin is in
input mode. This adds a fallback for those controllers. The new code
assumes that a controller reports an error in that case.

For example, all hardware supported by nctgpio behaves in that way.

This is a temporary measure. In the future we will use
GPIO_PIN_PRESET_LOW / GPIO_PIN_PRESET_HIGH to preset the output either
in hardware, if supported, or in software (e.g., in
gpiobus_pin_setflags).

While here, I extracted common functionality of gpioiic_set{sda,scl} and
gpioiic_get{sda,scl} to gpioiic_setpin and gpioiic_getpin respectively.

MFC after: 2 weeks

Details

Provenance
avgAuthored on
Parents
rS354064: MFC r353727: gpioiic: add the detach method
Branches
Unknown
Tags
Unknown