mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
drivers: ftdi-gpio: Add second USB disconnect GPIO
Some boards have more than one USB port. In that case, there is a second GPIO on the debug board to simulate a USB disconnection for those. Add the option to describe both USB disconnect GPIOs using "usb0_disconnect" and "usb1_disconnect" and change both of them when disabling USB power. In the future it might be useful to control them separately, but for now this ensures that power to the board is cut properly when the board is powered off.
This commit is contained in:
@@ -73,3 +73,32 @@ devices:
|
||||
power:
|
||||
interface: D
|
||||
line: 6
|
||||
- board: myboard-5
|
||||
name: "My Board 5"
|
||||
description: |
|
||||
My super awesome board Number 5
|
||||
console: /dev/ttyABC1
|
||||
fastboot: cacafada
|
||||
ftdi_gpio:
|
||||
vendor: "0x0403"
|
||||
product: "0x6011"
|
||||
index: 0
|
||||
power:
|
||||
interface: B
|
||||
line: 1
|
||||
active_low: true
|
||||
fastboot_key:
|
||||
interface: B
|
||||
line: 0
|
||||
active_low: true
|
||||
power_key:
|
||||
interface: B
|
||||
line: 2
|
||||
usb0_disconnect:
|
||||
interface: C
|
||||
line: 7
|
||||
active_low: true
|
||||
usb1_disconnect:
|
||||
interface: A
|
||||
line: 4
|
||||
active_low: true
|
||||
|
||||
@@ -31,7 +31,8 @@ enum {
|
||||
GPIO_POWER = 0, // Power input enable
|
||||
GPIO_FASTBOOT_KEY, // Usually volume key
|
||||
GPIO_POWER_KEY, // Key to power the device
|
||||
GPIO_USB_DISCONNECT, // Simulate main USB connection
|
||||
GPIO_USB0_DISCONNECT, // Simulate main USB connection
|
||||
GPIO_USB1_DISCONNECT, // Simulate secondary USB connection
|
||||
GPIO_OUTPUT_ENABLE, // Enable FTDI signals to flow to the board
|
||||
GPIO_COUNT
|
||||
};
|
||||
@@ -131,7 +132,7 @@ static void ftdi_gpio_parse_config(struct ftdi_gpio_options *options, char *valu
|
||||
else if (strncmp("POWER_KEY", name, off - name - 1) == 0)
|
||||
gpio_type = GPIO_POWER_KEY;
|
||||
else if (strncmp("USB_DISCONNECT", name, off - name - 1) == 0)
|
||||
gpio_type = GPIO_USB_DISCONNECT;
|
||||
gpio_type = GPIO_USB0_DISCONNECT;
|
||||
else if (strncmp("OUTPUT_ENABLE", name, off - name - 1) == 0)
|
||||
gpio_type = GPIO_OUTPUT_ENABLE;
|
||||
else
|
||||
@@ -182,7 +183,11 @@ void *ftdi_gpio_parse_options(struct device_parser *dp)
|
||||
} else if (!strcmp(key, "power_key")) {
|
||||
gpio_id = GPIO_POWER_KEY;
|
||||
} else if (!strcmp(key, "usb_disconnect")) {
|
||||
gpio_id = GPIO_USB_DISCONNECT;
|
||||
gpio_id = GPIO_USB0_DISCONNECT;
|
||||
} else if (!strcmp(key, "usb0_disconnect")) {
|
||||
gpio_id = GPIO_USB0_DISCONNECT;
|
||||
} else if (!strcmp(key, "usb1_disconnect")) {
|
||||
gpio_id = GPIO_USB1_DISCONNECT;
|
||||
} else if (!strcmp(key, "output_enable")) {
|
||||
gpio_id = GPIO_OUTPUT_ENABLE;
|
||||
} else {
|
||||
@@ -357,7 +362,8 @@ static int ftdi_gpio_device_power(struct ftdi_gpio *ftdi_gpio, bool on)
|
||||
|
||||
static void ftdi_gpio_device_usb(struct ftdi_gpio *ftdi_gpio, bool on)
|
||||
{
|
||||
ftdi_gpio_toggle_io(ftdi_gpio, GPIO_USB_DISCONNECT, on);
|
||||
ftdi_gpio_toggle_io(ftdi_gpio, GPIO_USB0_DISCONNECT, on);
|
||||
ftdi_gpio_toggle_io(ftdi_gpio, GPIO_USB1_DISCONNECT, on);
|
||||
}
|
||||
|
||||
static int ftdi_gpio_power(struct device *dev, bool on)
|
||||
|
||||
@@ -124,7 +124,7 @@ properties:
|
||||
devicenode:
|
||||
$ref: "#/$defs/device_path"
|
||||
patternProperties:
|
||||
"^power|fastboot_key|power_key|usb_disconnect|output_enable$":
|
||||
"^power|fastboot_key|power_key|usb[01]?_disconnect|output_enable$":
|
||||
$ref: "#/$defs/ftdi_gpio"
|
||||
additionalProperties: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user