Hi Andy, On 11/28/22 11:20, Andy Shevchenko wrote: > On Sun, Nov 27, 2022 at 07:24:58PM +0100, Hans de Goede wrote: >> The Lenovo Yoga Tab 3 (YT3-X90F) is an Intel Cherry Trail based tablet >> which ships with Android as Factory OS. Its DSDT contains a bunch of I2C >> devices which are not actually there, causing various resource conflicts. >> Use acpi_quirk_skip_i2c_client_enumeration() to not enumerate these. >> >> The YT3-X90F has quite a bit of exotic hardware, this adds initial >> support by manually instantiating the i2c-clients for the 2 charger + >> 2 fuel-gauge chips used for the 2 batteries. >> >> Support for other parts of the hw will be added by follow-up patches. > > ... > >> + /* >> + * The "bq25892_0" charger IC has its /CE (Charge-Enable) and OTG pins >> + * connected to GPIOs, rather then having them hardwired to the correct >> + * values as is normally done. >> + * >> + * The bq25890_charger driver controls these through I2C, but this only >> + * works if not overridden by the pins. Set these pins here: >> + * 1. Set /CE to 0 to allow charging. > > If I read this correctly then the /CE is an active low pin and setting to 0 > means active state Correct. > which... > >> + * 2. Set OTG to 0 disable V5 boost output since the 5V boost output of >> + * the main "bq25892_1" charger is used when necessary. >> + */ >> + >> + /* /CE pin */ >> + ret = x86_android_tablet_get_gpiod("INT33FF:02", 22, &gpiod); >> + if (ret < 0) >> + return ret; > >> + gpiod_set_value(gpiod, 0); > > ...contradicts with the virtual state here. Perhaps you missed the > corresponding flag to enable negation? x86_android_tablet_get_gpiod() gets the GPIO directly from the gpio-chip using gpiochip_get_desc() since these GPIOs are not described in ACPI. There is no option to pass a gpio_lookup_flags flag like GPIO_ACTIVE_LOW this way since we are not doing an actual lookup. Regards, Hans > >> + /* OTG pin */ >> + ret = x86_android_tablet_get_gpiod("INT33FF:03", 19, &gpiod); >> + if (ret < 0) >> + return ret; >> + >> + gpiod_set_value(gpiod, 0); >