From: Andy Shevchenko <andy@kernel.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] platform/x86: x86-android-tablets: Add Lenovo Yoga Tab 3 (YT3-X90F) charger + fuel-gauge data
Date: Mon, 28 Nov 2022 13:03:35 +0200 [thread overview]
Message-ID: <Y4SVh6qV7Se2Qc3k@smile.fi.intel.com> (raw)
In-Reply-To: <58a7f20d-dd47-1ffc-f7b2-f1d30a0a7d69@redhat.com>
On Mon, Nov 28, 2022 at 11:44:36AM +0100, Hans de Goede wrote:
> On 11/28/22 11:20, Andy Shevchenko wrote:
> > On Sun, Nov 27, 2022 at 07:24:58PM +0100, Hans de Goede wrote:
...
> >> + /*
> >> + * 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.
gpiod_toggle_active_low() is your friend, no?
> >> + ret = x86_android_tablet_get_gpiod("INT33FF:03", 19, &gpiod);
> >> + if (ret < 0)
> >> + return ret;
> >> +
> >> + gpiod_set_value(gpiod, 0);
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-11-28 11:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-27 18:24 [PATCH] platform/x86: x86-android-tablets: Add Lenovo Yoga Tab 3 (YT3-X90F) charger + fuel-gauge data Hans de Goede
2022-11-28 10:20 ` Andy Shevchenko
2022-11-28 10:44 ` Hans de Goede
2022-11-28 11:03 ` Andy Shevchenko [this message]
2022-11-28 11:24 ` Hans de Goede
2022-11-28 11:38 ` Andy Shevchenko
2022-12-08 15:09 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y4SVh6qV7Se2Qc3k@smile.fi.intel.com \
--to=andy@kernel.org \
--cc=hdegoede@redhat.com \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox