From: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Peter Rosin <peda-koto5C5qi+TLoDKTGw+V6w@public.gmane.org>,
Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: bq24735 charger and ac-detect
Date: Thu, 15 Dec 2016 10:45:05 +0000 [thread overview]
Message-ID: <21e09552-96b9-fb72-60be-7a4b9347b761@nvidia.com> (raw)
In-Reply-To: <84ede737-9e4c-b0ba-5a37-a96a7e86c3ec-koto5C5qi+TLoDKTGw+V6w@public.gmane.org>
On 14/12/16 21:22, Peter Rosin wrote:
> On 2016-12-14 18:54, Jon Hunter wrote:
...
>> Hmmm ... looking closer at the schematics I see a power-MOSFET in the
>> path of the ACOK to the Tegra and it looks like this could be inverting
>> the signal! Seems this was not caught when the code was submitted. This
>> should have been described in the device-tree somewhere :-(
>
> That's what I suspected...
>
> Ok, I expect the ship has sailed and that it's too late to actually fix
> this up with active-low in various Tegra dts files and removing the negation
> in the code, without causing ripples and regressions? Because that would
> be the clean fix!
Yes, unfortunately it has sailed as we cannot break compatibility AFAIK.
However, that said, I am not 100% certain for cases where there is a bug
like this.
I did double check this morning and verified that the gpio is low when
the charger is connected and so it is inverted.
> One other thing to possibly do is add a new binding that is not negated,
> and perhaps named after the pin in the data-sheet, i.e. ti,acok-gpios,
> and deprecate ti,ac-detect-gpios. But that's no fun as it leaves a bunch of
> compat code that wastes space and some lucky person has to maintain it.
>
> Perhaps the best thing to do is to just re-document ti,ac-detect-gpios
> to be the inverse of what is currently described, i.e. to be AC absence
> instead of AC presence? But that feels like giving up and it isn't really
> nice from a device-tree point of view either, but I guess those points are
> fairly accademic? Or are there any non-Linux users of this binding? How are
> these things handled when they pop up elsewhere?
I guess that ideally the polarity should have been specified correctly
by the gpio property, but even this looks wrong for Tegra as it is
GPIO_ACTIVE_HIGH and not LOW. The only other option is to add another
property called something like 'ti,ac-detect-override-pol' to specify
the polarity you want.
To be honest, I am not sure how this type of thing is normally handled.
So probably best to put together a patch with whatever option you feel
best and explain why this is needed and see what the dev-tree folks say.
Cheers
Jon
--
nvpublic
next prev parent reply other threads:[~2016-12-15 10:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <d796f6f9-1b6a-647c-100b-b3e85fc2f4c0@axentia.se>
[not found] ` <20161214142502.su4auesnlqmgxspv@earth>
2016-12-14 14:59 ` bq24735 charger and ac-detect Sebastian Reichel
2016-12-14 17:22 ` Jon Hunter
2016-12-14 17:54 ` Jon Hunter
2016-12-14 21:22 ` Peter Rosin
[not found] ` <84ede737-9e4c-b0ba-5a37-a96a7e86c3ec-koto5C5qi+TLoDKTGw+V6w@public.gmane.org>
2016-12-15 10:45 ` Jon Hunter [this message]
[not found] ` <21e09552-96b9-fb72-60be-7a4b9347b761-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-12-15 12:04 ` Peter Rosin
2016-12-15 14:04 ` Jon Hunter
[not found] ` <721122dd-dda8-1830-9224-40b5ed79e463-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-12-15 14:07 ` Jon Hunter
2016-12-15 15:34 ` Peter Rosin
[not found] ` <1316ab3d-8a75-6a03-e1d0-7dee55f2c90f-koto5C5qi+TLoDKTGw+V6w@public.gmane.org>
2016-12-15 16:10 ` Jon Hunter
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=21e09552-96b9-fb72-60be-7a4b9347b761@nvidia.com \
--to=jonathanh-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
--cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=peda-koto5C5qi+TLoDKTGw+V6w@public.gmane.org \
--cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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