Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions config-samples/sample8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 10 additions & 4 deletions drivers/ftdi-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 6 additions & 5 deletions schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ properties:
minimin: 0
devicenode:
$ref: "#/$defs/device_path"
patternProperties:
"^power|fastboot_key|power_key|usb_disconnect|output_enable$":
$ref: "#/$defs/ftdi_gpio"
patternProperties:
"^power|fastboot_key|power_key|usb[01]?_disconnect|output_enable$":
$ref: "#/$defs/ftdi_gpio"
additionalProperties: false

dependentRequired:
index:
Expand All @@ -138,15 +139,15 @@ properties:
local_gpio:
description: Local GPIO
type: object
unevaluatedItems: false
additionalProperties: false
patternProperties:
"^power|fastboot_key|power_key|usb_disconnect$":
$ref: "#/$defs/local_gpio"

laurent:
description: KernelChip Laurent relays
type: object
unevaluatedItems: false
additionalProperties: false
properties:
server:
type: string
Expand Down
Loading