Skip to content

Commit 2899fbc

Browse files
committed
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 <[email protected]>
1 parent 6113960 commit 2899fbc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/ftdi-gpio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,16 @@ static void *ftdi_gpio_open(struct device *dev)
311311
if (ftdi_gpio->options->gpios[GPIO_POWER_KEY].present)
312312
dev->has_power_key = true;
313313

314+
if (ftdi_gpio->options->gpios[GPIO_OUTPUT_ENABLE].present)
315+
ftdi_gpio_toggle_io(ftdi_gpio, GPIO_OUTPUT_ENABLE, 1);
316+
314317
ftdi_gpio_device_power(ftdi_gpio, 0);
315318

316319
if (dev->usb_always_on)
317320
ftdi_gpio_device_usb(ftdi_gpio, 1);
318321
else
319322
ftdi_gpio_device_usb(ftdi_gpio, 0);
320323

321-
if (ftdi_gpio->options->gpios[GPIO_OUTPUT_ENABLE].present)
322-
ftdi_gpio_toggle_io(ftdi_gpio, GPIO_OUTPUT_ENABLE, 1);
323-
324324
usleep(500000);
325325

326326
return ftdi_gpio;

0 commit comments

Comments
 (0)