From: Paul Cercueil <paul@crapouillou.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
od@zcrc.me, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH] usb: common: usb-conn-gpio: Register optional charger
Date: Sun, 26 Jul 2020 12:07:52 +0200 [thread overview]
Message-ID: <4TM2EQ.P9PDF9VIY9MA1@crapouillou.net> (raw)
In-Reply-To: <20200726083922.GC448215@kroah.com>
Le dim. 26 juil. 2020 à 10:39, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> a écrit :
> On Sat, Jul 25, 2020 at 07:51:14PM +0200, Paul Cercueil wrote:
>> Hi Greg,
>>
>> Le mar. 21 juil. 2020 à 13:41, Greg Kroah-Hartman
>> <gregkh@linuxfoundation.org> a écrit :
>> > On Mon, Jun 22, 2020 at 12:48:07AM +0200, Paul Cercueil wrote:
>> > > Register a power supply charger, if the Kconfig option
>> > > USB_CONN_GPIO_CHARGER is set, whose online state depends on
>> whether
>> > > the USB role is set to device or not.
>> > >
>> > > This is useful when the USB role is the only way to know if the
>> > > device
>> > > is charging from USB. The API is the standard power supply
>> charger
>> > > API,
>> > > you get a /sys/class/power_supply/xxx/online node which tells
>> you
>> > > the
>> > > state of the charger.
>> > >
>> > > The sole purpose of this is to give userspace applications a
>> way to
>> > > know whether or not the charger is plugged.
>> > >
>> > > Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>> > > ---
>> > > drivers/usb/common/Kconfig | 11 +++++++
>> > > drivers/usb/common/usb-conn-gpio.c | 47
>> > > ++++++++++++++++++++++++++++++
>> > > 2 files changed, 58 insertions(+)
>> > >
>> > > diff --git a/drivers/usb/common/Kconfig
>> b/drivers/usb/common/Kconfig
>> > > index d611477aae41..5405ae96c68f 100644
>> > > --- a/drivers/usb/common/Kconfig
>> > > +++ b/drivers/usb/common/Kconfig
>> > > @@ -49,3 +49,14 @@ config USB_CONN_GPIO
>> > >
>> > > To compile the driver as a module, choose M here: the
>> module
>> > > will
>> > > be called usb-conn-gpio.ko
>> > > +
>> > > +if USB_CONN_GPIO
>> > > +
>> > > +config USB_CONN_GPIO_CHARGER
>> > > + bool "USB charger support"
>> > > + select POWER_SUPPLY
>> > > + help
>> > > + Register a charger with the power supply subsystem. This
>> will
>> > > allow
>> > > + userspace to know whether or not the device is charging
>> from
>> > > USB.
>> >
>> > Why make this an option at all? Why wouldn't we always want this
>> here?
>> >
>> > As this is a charger, exporting that information to userspace
>> should
>> > probably always happen, right?
>>
>> I wanted to avoid the hardcoded dependency on CONFIG_POWER_SUPPLY.
>>
>> I can very well make that non-optional.
>
> As the whole reason for this driver is to be a power supply, make it
> depend on the power supply core please.
It's the whole reason of my patch, not of the driver itself, whose
purpose is to report the USB role (device, host, unconnected).
-Paul
next prev parent reply other threads:[~2020-07-26 10:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-21 22:48 [RESEND PATCH] usb: common: usb-conn-gpio: Register optional charger Paul Cercueil
2020-07-21 11:41 ` Greg Kroah-Hartman
2020-07-25 17:51 ` Paul Cercueil
2020-07-26 8:39 ` Greg Kroah-Hartman
2020-07-26 10:07 ` Paul Cercueil [this message]
2020-07-26 10:14 ` Andy Shevchenko
2020-07-26 10:27 ` Paul Cercueil
2020-07-27 5:42 ` Chunfeng Yun
2020-07-27 15:02 ` Paul Cercueil
2020-07-28 6:04 ` Chunfeng Yun
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=4TM2EQ.P9PDF9VIY9MA1@crapouillou.net \
--to=paul@crapouillou.net \
--cc=chunfeng.yun@mediatek.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=od@zcrc.me \
/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;
as well as URLs for NNTP newsgroup(s).