Skip to content

Commit

Permalink
ftdi_gpio: Turn on OUTPUT_ENABLE first
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
eberman-quic committed Jun 5, 2024
1 parent 6113960 commit 2899fbc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/ftdi-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,16 @@ 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)
ftdi_gpio_device_usb(ftdi_gpio, 1);
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;
Expand Down

0 comments on commit 2899fbc

Please sign in to comment.