devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Peter Chen <peter.chen@nxp.com>
Cc: Sebastian Reichel <sre@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	od@zcrc.me, linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: RE: [PATCH v2 3/3] power/supply: Add generic USB charger driver
Date: Thu, 19 Dec 2019 12:35:37 +0100	[thread overview]
Message-ID: <1576755337.3.0@crapouillou.net> (raw)
In-Reply-To: <VI1PR04MB53273342340E350BFFFDE12F8B530@VI1PR04MB5327.eurprd04.prod.outlook.c om>

Hi Peter,


Le mer., déc. 18, 2019 at 02:46, Peter Chen <peter.chen@nxp.com> a 
écrit :
> 
>>  >>  >
>>  >>  >>  >>  +
>>  >>  >>  >>  +	desc = &charger->desc;
>>  >>  >>  >>  +	desc->name = "usb-charger";
>>  >>  >>  >>  +	desc->properties = usb_charger_properties;
>>  >>  >>  >>  +	desc->num_properties = 
>> ARRAY_SIZE(usb_charger_properties);
>>  >>  >>  >>  +	desc->get_property = usb_charger_get_property;
>>  >>  >>  >>  +	desc->type = POWER_SUPPLY_TYPE_USB;
>>  >>  >>  >
>>  >>  >>  > What's your further plan for this generic USB charger?
>>  >>  >>  > To support BC1.2, we need to know charger type, and how we
>>  >> could  >> get  > it?
>>  >>  >>  >
>>  >>  >>  > Peter
>>  >>  >>
>>  >>  >>  Well I don't really know. The USB role framework does not 
>> give
>>  >> any  >> info about  what's plugged.
>>  >>  >>
>>  >>  >
>>  >>  > What's the use case for this patch set? How it be used?
>>  >>
>>  >>  My devicetree:
>>  >>
>>  >>  usb_otg: usb@13440000 {
>>  >>  	compatible = "ingenic,jz4770-musb", "simple-mfd";
>>  >>  	reg = <0x13440000 0x10000>;
>>  >>  	[...]
>>  >>
>>  >>  	usb-role-switch;
>>  >>
>>  >>  	connector {
>>  >>  		compatible = "gpio-usb-b-connector", "usb-b-connector";
>>  >>  		label = "mini-USB";
>>  >>  		type = "mini";
>>  >>
>>  >>  		id-gpios = <&gpf 18 GPIO_ACTIVE_HIGH>;
>>  >>  		vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>;
>>  >>  		[...]
>>  >>  	};
>>  >>
>>  >>  	usb_charger: usb-charger {
>>  >>  		compatible = "usb-charger";
>>  >>  	};
>>  >>  };
>>  >>
>>  >>  The new gpio-usb-connector driver uses the ID/VBUS GPIOs to 
>> detect
>>  >> in  which state (device, host, unconnected) a OTG connector is.
>>  >> However,  that means I cannot use the standard gpio-charger 
>> driver to
>>  >> detect the  presence of a charger based on the state of the VBUS
>>  >> gpio, since it's  already requested here. So the point of this
>>  >> patchset is to provide an  alternative to gpio-charger that works
>>  >> with OTG controllers compatible  with 'usb-role-switch'.
>>  >>
>>  >
>>  > Thanks for explaining it.
>>  >
>>  > What's the user for this USB charger,  PMIC or what else? How the 
>> user
>>  > uses this USB charger interface?
>> 
>>  It's exported as a standard charger, so it can be passed to client 
>> drivers through
>>  devicetree, and its online status can be retrieved from sysfs.
>> 
> 
> Hi Paul,
> 
> If you would like to get role from usb-role-switch, the udc driver 
> may probably have already worked.
> There is a 'state' entry under the udc device to indicate USB Ch9 
> state. Try to see if it could
> satisfy your requirement.

This is not the proper way to retrieve charger status.
Linux supports chargers through the power supply subsystem, that's 
where it should be exported.

Cheers,
-Paul



  parent reply	other threads:[~2019-12-19 11:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 15:50 [PATCH v2 1/3] dt-bindings: power/supply: Document generic USB charger Paul Cercueil
2019-12-11 15:50 ` [PATCH v2 2/3] usb: roles: Add API to register notifiers Paul Cercueil
2019-12-11 15:50 ` [PATCH v2 3/3] power/supply: Add generic USB charger driver Paul Cercueil
2019-12-12  9:18   ` Peter Chen
2019-12-13 20:49     ` Paul Cercueil
2019-12-16  1:24       ` Peter Chen
     [not found]         ` <VI1PR04MB5327401FFD2D32E937548DD48B510@VI1PR04MB5327.eurprd04.prod.outlook.c om>
2019-12-16 10:52           ` Paul Cercueil
2019-12-17  1:32             ` Peter Chen
     [not found]               ` <VI1PR04MB5327B8EF35340FC4B2D02DE88B500@VI1PR04MB5327.eurprd04.prod.outlook.c om>
2019-12-17 21:24                 ` Paul Cercueil
2019-12-18  2:46                   ` Peter Chen
     [not found]                     ` <VI1PR04MB53273342340E350BFFFDE12F8B530@VI1PR04MB5327.eurprd04.prod.outlook.c om>
2019-12-19 11:35                       ` Paul Cercueil [this message]
2019-12-19 21:38             ` Rob Herring
2019-12-21 13:55               ` Paul Cercueil

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=1576755337.3.0@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=od@zcrc.me \
    --cc=peter.chen@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@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;
as well as URLs for NNTP newsgroup(s).