mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
cdb_assist: Support togging the fastboot key
For some devices it's not possible to use fastboot boot and as such they will not enter fastboot unless the fastboot key is held. Expose this functionality in the device api. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
@@ -583,3 +583,10 @@ void cdb_set_voltage(struct cdb_assist *cdb, unsigned mV)
|
||||
n = sprintf(buf, "u%d\r\n", mV);
|
||||
cdb_ctrl_write(cdb, buf, n);
|
||||
}
|
||||
|
||||
void cdb_fastboot_key(struct device *dev, bool on)
|
||||
{
|
||||
struct cdb_assist *cdb = dev->cdb;
|
||||
|
||||
cdb_gpio(cdb, 1, on);
|
||||
}
|
||||
|
||||
@@ -19,5 +19,6 @@ void cdb_target_break(struct cdb_assist *cdb);
|
||||
unsigned int cdb_vref(struct cdb_assist *cdb);
|
||||
void cdb_assist_print_status(struct device *dev);
|
||||
void cdb_set_voltage(struct cdb_assist *cdb, unsigned mV);
|
||||
void cdb_fastboot_key(struct device *dev, bool on);
|
||||
|
||||
#endif
|
||||
|
||||
6
device.c
6
device.c
@@ -138,3 +138,9 @@ void device_boot(struct device *device, const void *data, size_t len)
|
||||
fastboot_download(device->fastboot, data, len);
|
||||
device->boot(device);
|
||||
}
|
||||
|
||||
void device_fastboot_key(struct device *device, bool on)
|
||||
{
|
||||
if (device->fastboot_key)
|
||||
device->fastboot_key(device, on);
|
||||
}
|
||||
|
||||
2
device.h
2
device.h
@@ -25,6 +25,7 @@ struct device {
|
||||
void (*print_status)(struct device *dev);
|
||||
void (*vbus)(struct device *dev, bool on);
|
||||
int (*write)(struct device *dev, const void *buf, size_t len);
|
||||
void (*fastboot_key)(struct device *dev, bool on);
|
||||
bool set_active;
|
||||
|
||||
void *cdb;
|
||||
@@ -46,5 +47,6 @@ void device_boot(struct device *device, const void *data, size_t len);
|
||||
|
||||
void device_fastboot_boot(struct device *device);
|
||||
void device_fastboot_flash_reboot(struct device *device);
|
||||
void device_fastboot_key(struct device *device, bool on);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -99,6 +99,7 @@ static void parse_board(struct device_parser *dp)
|
||||
dev->print_status = cdb_assist_print_status;
|
||||
dev->vbus = cdb_assist_vbus;
|
||||
dev->write = cdb_target_write;
|
||||
dev->fastboot_key = cdb_fastboot_key;
|
||||
} else if (!strcmp(key, "conmux")) {
|
||||
dev->cdb_serial = strdup(value);
|
||||
|
||||
@@ -111,9 +112,13 @@ static void parse_board(struct device_parser *dp)
|
||||
} else if (!strcmp(key, "fastboot")) {
|
||||
dev->serial = strdup(value);
|
||||
|
||||
dev->boot = device_fastboot_boot;
|
||||
if (!dev->boot)
|
||||
dev->boot = device_fastboot_boot;
|
||||
} else if (!strcmp(key, "fastboot_set_active")) {
|
||||
dev->set_active = !strcmp(value, "true");
|
||||
} else if (!strcmp(key, "broken_fastboot_boot")) {
|
||||
if (!strcmp(value, "true"))
|
||||
dev->boot = device_fastboot_flash_reboot;
|
||||
} else {
|
||||
fprintf(stderr, "device parser: unknown key \"%s\"\n", key);
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user