linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: linux-pm@vger.kernel.org, sre@kernel.org,
	Sameer Nanda <snanda@chromium.org>,
	gwendal@chromium.org, linux-kernel@vger.kernel.org,
	groeck@chromium.org, Adam.Thomson.Opensource@diasemi.com,
	kernel@collabora.com, bleung@chromium.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>
Subject: Re: [PATCH v2 1/2] power: supply: add input voltage limit property.
Date: Sat, 1 Dec 2018 16:09:34 +0100	[thread overview]
Message-ID: <20181201150934.GA7052@amd> (raw)
In-Reply-To: <c122a1f9-70d7-7129-f139-4a0449c366a5@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 3495 bytes --]

Hi!

> >> We have a problem with USBPD chargers which under certain conditions
> >> can result in system overheating if the voltage provided by the USBPD
> >> port is too high. While the preferred means to control this would be
> >> through devicetree or ACPI settings, this is not always possible, and
> >> we need to have a means to set a voltage limit.
> >>
> >> This patch exposes a new property, similar to input current limit, to
> >> re-configure the maximum voltage from the external supply at runtime
> >> based on system-level knowledge or user input.
> > 
> > First, this should really be handled by dt / ACPI. If it is broken,
> > that's a hardware bug, and we can do DMI-based blacklists in kernel.
> > 
> 
> I think that handle this via dt / ACPI is not possible for our use case. It can
> be a hardware bug or a hardware/user constrain, let me try to explain better
> with an example.
> 
> On Pixel C's devices, userspace uses this to set a USB input limit of 5V when
> the screen is on for thermal reasons, but those go away when the screen is
> off/system is sleeping, so we allow 9V and 12V levels when sleeping.

So, on pixel C, what happens if userland ignores the constraint, keeps
display on and sets charger to 12V?

> > How are you supposed to fsck a system, for example?
> > 
> 
> hmm, I'm not sure I get the question, sorry, could you rephrase?

Ok, so I have just booted with init=/bin/bash, and would like to run
fsck.ext4 on my root filesystem.

> >> +What:		/sys/class/power_supply/<supply_name>/input_voltage_limit
> >> +Date:		Nov 2018
> >> +Contact:	linux-pm@vger.kernel.org
> >> +Description:
> >> +		Details the incoming VBUS voltage limit currently set in the
> >> +		supply. Normally this is configured based on the type of
> >> +		connection made.
> > 
> > "Details"?
> > 
> > Who can write to this value and when? What is the limit? If USB
> > charger is plugged in, should it show 5.0V (because that's nominal on
> > the USB) or 5.25V (because that is the real limit)?
> 
> The voltages here refer to the Typical or Nominal values defined by the USB
> specification for a Fixed power supply (or Fixed PDO). 5.0V, 5.25V, 4.75V,
> 5.5V... all of those are considered "5V" according to the USB specifications.
> 
> At the 5V level (defined in the USB PD specification as vSafe5V), a nominal
> power source is allowed to have a voltage between 4.75V and 5.50V (5V -5%/
> +10%). For simplicity, we refer to this range as 5V, the typical value.
> For all higher voltage levels other than vSafe5V, MIN voltage is PDO Voltage *
> 0.95, and MAX voltage is PDO Voltage * 1.05, where PDO Voltage is the Typical
> value (9V, 12V, 15V, 20V). [1]

> > Who can write to this and when. And what happens on write? What
> > happens if I write value that charger can't provide there?
> > 
> > Does it set the voltage power supply should produce? Or maximal it can
> > choose to produce?
> > 
> 
> This defines a maximal voltage. If you write a value it can't provide,
> it should go down to the next lowest level, and barring that, 5V is
> always allowed.
> 
> That makes me think that maybe I should also improve the implementation.
> 
> > This really needs better documentation.
> 
> Ack, I'll send a next version improving that.

Thanks.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2018-12-01 15:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-22 10:11 [PATCH v2 1/2] power: supply: add input voltage limit property Enric Balletbo i Serra
2018-11-22 10:11 ` [PATCH v2 2/2] power: supply: cros: allow to set input voltage and current limit Enric Balletbo i Serra
2018-11-22 15:24   ` Guenter Roeck
2018-11-22 16:54 ` [PATCH v2 1/2] power: supply: add input voltage limit property Adam Thomson
2018-11-23 23:22 ` Pavel Machek
2018-11-30 12:19   ` Enric Balletbo i Serra
2018-12-01 15:09     ` Pavel Machek [this message]
2018-12-03 19:58       ` Benson Leung
2018-12-05 15:47         ` Sebastian Reichel
2018-12-09  8:44         ` Pavel Machek

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=20181201150934.GA7052@amd \
    --to=pavel@ucw.cz \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=kernel@collabora.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=snanda@chromium.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).