ftdi_gpio: Turn on OUTPUT_ENABLE first

Observed instability in controlling devices when OUTPUT_ENABLE wasn't
enabled in the first step. I couldn't find any documented reason why
this is, but the documentation does say: "FtdiOutput Pin always kept at
1".

Alpaca always keeps OUTUT_ENABLE as 1, and never turns it off. The
documentation seems to imply it should always be left on. This change
updates the open sequence so that the OUTPUT_ENABLE bit is set first.

Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
This commit is contained in:
Elliot Berman
2024-06-04 17:24:02 -07:00
parent 61139604fb
commit 2899fbcbb1

View File

@@ -311,6 +311,9 @@ static void *ftdi_gpio_open(struct device *dev)
if (ftdi_gpio->options->gpios[GPIO_POWER_KEY].present)
dev->has_power_key = true;
if (ftdi_gpio->options->gpios[GPIO_OUTPUT_ENABLE].present)
ftdi_gpio_toggle_io(ftdi_gpio, GPIO_OUTPUT_ENABLE, 1);
ftdi_gpio_device_power(ftdi_gpio, 0);
if (dev->usb_always_on)
@@ -318,9 +321,6 @@ static void *ftdi_gpio_open(struct device *dev)
else
ftdi_gpio_device_usb(ftdi_gpio, 0);
if (ftdi_gpio->options->gpios[GPIO_OUTPUT_ENABLE].present)
ftdi_gpio_toggle_io(ftdi_gpio, GPIO_OUTPUT_ENABLE, 1);
usleep(500000);
return ftdi_gpio;