gpio: fix init for BH edition PinePhone

BH PinePhone don't have the modem's `STATUS` pin connected to the SoC,
and as such require using `libusb` for checking the modem power state.
We didn't handle this case previously due to lack of on-device testing,
causing BH phones to fail with newer versions.

This patch ignores the `status` GPIO for devices relying on `libusb`,
which are only pre-CE PinePhones.
This commit is contained in:
Arnaud Ferraris
2022-02-16 18:35:36 +01:00
committed by Arnaud Ferraris
parent a3c51fc513
commit 19eb488e29

View File

@@ -196,8 +196,13 @@ int gpio_init(struct EG25Manager *manager, toml_table_t *config[])
for (i = 0; i < GPIO_IN_COUNT; i++) {
toml_table_t *table;
toml_datum_t chip, line;
if (!config_get_table(gpio_config, gpio_in_names[i], &table))
if (!config_get_table(gpio_config, gpio_in_names[i], &table)) {
// BH edition don't have the STATUS line connected, ignore it
if (manager->use_libusb && g_strcmp0(gpio_in_names[i], "status") == 0)
continue;
g_error("Unable to get config for input GPIO '%s'", gpio_in_names[i]);
}
chip = toml_int_in(table, "chip");
if (!chip.ok || chip.u.i < 0 || chip.u.i > 2)