mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
alpaca: Add configuration for keeping USB always connected
USB on the Primus acts up when we toggle USB in Alpaca, so add a configuration option to force it on at all times. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
10
alpaca.c
10
alpaca.c
@@ -73,7 +73,11 @@ void *alpaca_open(struct device *dev)
|
||||
err(1, "failed to open %s", dev->alpaca_dev);
|
||||
|
||||
alpaca_device_power(alpaca, 0);
|
||||
alpaca_usb_device_power(alpaca, 0);
|
||||
|
||||
if (dev->usb_always_on)
|
||||
alpaca_usb_device_power(alpaca, 1);
|
||||
else
|
||||
alpaca_usb_device_power(alpaca, 0);
|
||||
|
||||
usleep(500000);
|
||||
|
||||
@@ -156,7 +160,9 @@ int alpaca_power_on(struct device *dev)
|
||||
int alpaca_power_off(struct device *dev)
|
||||
{
|
||||
alpaca_device_power(dev->cdb, 0);
|
||||
alpaca_usb_device_power(dev->cdb, 0);
|
||||
|
||||
if (!dev->usb_always_on)
|
||||
alpaca_usb_device_power(dev->cdb, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
1
device.h
1
device.h
@@ -19,6 +19,7 @@ struct device {
|
||||
unsigned voltage;
|
||||
bool tickle_mmc;
|
||||
bool pshold_shutdown;
|
||||
bool usb_always_on;
|
||||
struct fastboot *fastboot;
|
||||
unsigned int fastboot_key_timeout;
|
||||
|
||||
|
||||
@@ -138,6 +138,8 @@ static void parse_board(struct device_parser *dp)
|
||||
dev->description = strdup(value);
|
||||
} else if (!strcmp(key, "fastboot_key_timeout")) {
|
||||
dev->fastboot_key_timeout = strtoul(value, NULL, 10);
|
||||
} else if (!strcmp(key, "usb_always_on")) {
|
||||
dev->usb_always_on = !strcmp(value, "true");
|
||||
} else {
|
||||
fprintf(stderr, "device parser: unknown key \"%s\"\n", key);
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user