mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Cc: "Sebastian Reichel (sre@kernel.org)" <sre@kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Yueyao Zhu <yueyao.zhu@gmail.com>,
	Rui Miguel Silva <rmfrfs@gmail.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Support Opensource <Support.Opensource@diasemi.com>
Subject: Re: [RFC PATCH v2 6/7] typec: tcpm: Represent source supply through power_supply class
Date: Tue, 28 Nov 2017 13:45:17 +0200	[thread overview]
Message-ID: <20171128114517.GA10750@kuha.fi.intel.com> (raw)
In-Reply-To: <2E89032DDAA8B9408CB92943514A0337014C1B15A4@SW-EX-MBX01.diasemi.com>

On Mon, Nov 27, 2017 at 04:54:08PM +0000, Adam Thomson wrote:
> On 27 November 2017 14:12, Heikki Krogerus wrote:
> 
> > Hi Adam,
> > 
> > On Fri, Nov 24, 2017 at 02:05:27PM +0000, Adam Thomson wrote:
> > > On 24 November 2017 12:19, Heikki Krogerus wrote:
> > > > Is it OK to everybody that the type of the psy is changed like that?
> > > > Hans?!
> > > >
> > > > We do have drivers that already change the type, for example
> > > > drivers/power/supply/isp1704_charger.c, but what does the user space
> > > > expect? The ABI for the power supply class was never documented I
> > > > guess.
> > > >
> > >
> > > Hi Heikki,
> > >
> > > Appreciate your time in reviewing this.
> > >
> > > Yes, I actually saw that as an example when I considered this approach. I didn't
> > > see anything obvious for this in the ABI documentation. Any ideas Sebastian?
> > > What is user-space expectation for the 'type' property of a power_supply? I
> > > assume having this dynamic is ok given existing drivers can already do something
> > > like this, but would be good to have clarification.
> > >
> > > > I'm not against changing the type, but I think that we should have an
> > > > attribute file listing all supported types a psy can have if we go
> > > > forward with this. Ideally the type file would just list them as space
> > > > separated values, and show the current one with asterisk in front of
> > > > it. The output would be similar we have with some of the other files
> > > > under /sys/power, at least /sys/power/state, but that would break the
> > > > ABI.
> > > >
> > >
> > > I added this as I wanted the user to know what was connected rather than
> > > blindly trying to set the 'online' property to enable PPS, even if the attached
> > > source partner didn't support this. As you say, am not sure we could change the
> > > 'TYPE' property as that to my knowledge has always been a single string.
> > >
> > > Maybe the addition of a 'SUPPORTED_TYPES' property or something similar could
> > > close this gap (as you eluded to), at least by providing a RO list of all
> > > supported types? Another option would be to add a type which indicates the
> > > supply supports multiple types, and then based on this we can read another
> > > property which does as you suggest with multiple strings and one being
> > > highlighted? Am certainly open to discussion on this.
> > 
> > It looks like this is USB specific problem. I think the type should
> > actually be just USB, and there should be an other USB only attribute
> > file which should list the current and supported connection types.
> > Well, maybe it does not even need to be USB only.
> 
> I believe in Android (BatteryMonitor) right now it maps the various USB
> types that can be reported by a power_supply driver to an internal Android 'AC'
> type (or 'USB' for 'PD_DRP') for use in upper level software, so they handle the
> various USB reported types but simplify reporting. That code seems like it would
> also handle changes in type as well because the type is re-read when dealing
> with updates. So there is a wide spread user which already 'copes' with current
> driver implementations. That's not saying it's necessarily the correct way to go
> in the future but wanted to highlight current usage.
> 
> Personally what you're suggesting seems reasonable to me. I would however like
> to get a general consensus on this as I guess this could potentially change
> future power_supply driver implementations.

Agreed. What ever the final solution will be, the power supply ABI
should be documented at the same time.

> Sebastian, do you have any thoughts on this topic?


Cheers,

-- 
heikki

  reply	other threads:[~2017-11-28 11:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 11:44 [RFC PATCH v2 0/7] typec: tcpm: Add sink side support for PPS Adam Thomson
2017-11-14 11:44 ` [RFC PATCH v2 1/7] typec: tcpm: Add PD Rev 3.0 definitions to PD header Adam Thomson
2017-11-14 11:44 ` [RFC PATCH v2 2/7] typec: tcpm: Add ADO header for Alert message handling Adam Thomson
2017-11-14 11:44 ` [RFC PATCH v2 3/7] typec: tcpm: Add SDB header for Status " Adam Thomson
2017-11-14 11:44 ` [RFC PATCH v2 4/7] typec: tcpm: Add core support for sink side PPS Adam Thomson
2017-11-14 11:44 ` [RFC PATCH v2 5/7] power: supply: Add type for USB PD PPS chargers Adam Thomson
2017-11-14 11:44 ` [RFC PATCH v2 6/7] typec: tcpm: Represent source supply through power_supply class Adam Thomson
2017-11-24 12:19   ` Heikki Krogerus
2017-11-24 14:05     ` Adam Thomson
2017-11-27 14:11       ` Heikki Krogerus
2017-11-27 16:54         ` Adam Thomson
2017-11-28 11:45           ` Heikki Krogerus [this message]
2017-11-25 14:03     ` Hans de Goede
2017-11-27 13:38       ` Heikki Krogerus
2017-11-27 13:43       ` Adam Thomson
2017-11-14 11:44 ` [RFC PATCH v2 7/7] typec: tcpm: Add support for sink PPS related messages Adam Thomson
2017-11-21 13:35 ` [RFC PATCH v2 0/7] typec: tcpm: Add sink side support for PPS Heikki Krogerus
2017-11-21 13:51   ` Adam Thomson
2017-11-21 14:18     ` Heikki Krogerus
2017-11-21 14:21       ` Adam Thomson

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=20171128114517.GA10750@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=Support.Opensource@diasemi.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rmfrfs@gmail.com \
    --cc=sre@kernel.org \
    --cc=yueyao.zhu@gmail.com \
    /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

Powered by JetHome