[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200726083922.GC448215@kroah.com>
Date: Sun, 26 Jul 2020 10:39:22 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Paul Cercueil <paul@...pouillou.net>
Cc: Chunfeng Yun <chunfeng.yun@...iatek.com>, od@...c.me,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH] usb: common: usb-conn-gpio: Register optional
charger
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@...uxfoundation.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@...pouillou.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.
thanks,
greg k-h
Powered by blists - more mailing lists