Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5005794imu; Sat, 1 Dec 2018 07:18:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/WOYXr0YHM3gjQi0qgrY28lMTxfZ/ckPjS3pKu54j1CSIqN9JFV8FOXMhMlzAem1SQs2bzL X-Received: by 2002:a62:4851:: with SMTP id v78mr9674676pfa.97.1543677497601; Sat, 01 Dec 2018 07:18:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543677497; cv=none; d=google.com; s=arc-20160816; b=ITVxeV7K5Z5k9NIxX4igpQ/BBYTIb70tQ5eI1ZtpY7auSRNg3OLuIaHmTdRlnPF5j9 6vCuo7SgBdb8CNjjuWttRDerAjXzFsiW0+2QLE0E/IQbDzK21v0E6AS8MxylpUFDyGGp WKk+GQ40/0Li4jnqkD0mb2ls5J4TOhOILusTlGRh3ajo82s0nsySMIa1Y97KP7JoUfew AMiP97wNPcs7Nqo2sSOfsRuzzFmxyNBR1ZS2rrs1iOGS0YOoT5Rlz79wexiDRaEioMyh rOMyZfVosjXGRVip6BEUAPaXnEL5ceFOOpx6dYowaBXhbQPkQP+p4bqStZNxES5Fhc6V mCXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/hFNIICxBU7uoczwqInedJ4sk/DkUhealDIamk5usb0=; b=fochhBKsKQMlhiWcUCr2Sdp+fzNqu0rLvNFfVn61xGjpnP3UoNCBdtw7Iq3lQ4S2S3 giuU94fikq9JIMp1gx4Q99HGJjzgkQWx1XN/3h2xyzTfzH0zGCdt2o/jPWeV22T+iCV4 rzb7yAB/dAnrVnFepk+NdaiNdUiWZWVpVGrTVAVmaXQLFuow9gSCj0qzvboIN3ygz3C2 ipjCoBC7TCPd2FbXs82EuY1C84r6x/tUxyWy7kbv8RtDCN3jgWGRbUf+nYBoZq89IBWQ Hf+XhUCzrKRgv+lE+HD1ynPKosu7xyrNWIZtVbIG42LTpsBHDdurglrOki8VZnMRISrq 5Bnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si8821137pll.116.2018.12.01.07.18.00; Sat, 01 Dec 2018 07:18:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726885AbeLBCWV (ORCPT + 99 others); Sat, 1 Dec 2018 21:22:21 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:56654 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbeLBCWV (ORCPT ); Sat, 1 Dec 2018 21:22:21 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 6A63F80A46; Sat, 1 Dec 2018 16:09:31 +0100 (CET) Date: Sat, 1 Dec 2018 16:09:34 +0100 From: Pavel Machek To: Enric Balletbo i Serra Cc: linux-pm@vger.kernel.org, sre@kernel.org, Sameer Nanda , 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" , Len Brown Subject: Re: [PATCH v2 1/2] power: supply: add input voltage limit property. Message-ID: <20181201150934.GA7052@amd> References: <20181122101119.29194-1-enric.balletbo@collabora.com> <20181123232203.GA3852@amd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. > >=20 > > 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. > >=20 >=20 > 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 bet= ter > with an example. >=20 > 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? > >=20 >=20 > hmm, I'm not sure I get the question, sorry, could you rephrase? Ok, so I have just booted with init=3D/bin/bash, and would like to run fsck.ext4 on my root filesystem. > >> +What: /sys/class/power_supply//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. > >=20 > > "Details"? > >=20 > > 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)? >=20 > The voltages here refer to the Typical or Nominal values defined by the U= SB > 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 specificati= ons. >=20 > At the 5V level (defined in the USB PD specification as vSafe5V), a nomin= al > 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 Volt= age * > 0.95, and MAX voltage is PDO Voltage * 1.05, where PDO Voltage is the Typ= ical > 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? > >=20 > > Does it set the voltage power supply should produce? Or maximal it can > > choose to produce? > >=20 >=20 > 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. >=20 > That makes me think that maybe I should also improve the implementation. >=20 > > This really needs better documentation. >=20 > Ack, I'll send a next version improving that. Thanks. Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --4Ckj6UjgE2iN1+kY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlwCpC4ACgkQMOfwapXb+vJ7uACcCRDA8FIQmuQCK/hagMsggeRk D5kAnA+7vLPHIhWH3NHCkoY8AhnasD5b =Rpx/ -----END PGP SIGNATURE----- --4Ckj6UjgE2iN1+kY--