Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10581186rwr; Fri, 12 May 2023 09:57:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5OcV3KFGFR1xu6GKT17LTQhOzT2SFU99k3Pr+BgQQZX4eJ8hqntTMp8O1c5pNE8JZEcTxY X-Received: by 2002:a05:6a21:9011:b0:f5:4ab9:2fde with SMTP id tq17-20020a056a21901100b000f54ab92fdemr27281235pzb.48.1683910669477; Fri, 12 May 2023 09:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683910669; cv=none; d=google.com; s=arc-20160816; b=c6fabkODmBNqd6h3x3EfnmhGuzX98BMNtLue5MkaS7pkJzkrKNx6rlltseo7cNgbpA noqhV7jx1Ao9gA9r4YDHcD2L1/g1dxQEPrlAtIvzXFCfWBm85lJRBI+ANUy3xr8swo16 aWkPFSIxln2QjZaqxXNXLPzv+2b/TkbRbcRHU2/sF/fVdff3dQOU86trqfR1ZXFrNqcl Ij37aLLkwtATvneERd5eikncJTo1ti9TmXpkOuxUBekZTJU6/1foDm7LzHIQ5WvgV9r9 4mM8kb3qaTW+SR27NfP0EFOkLAOw6i5G5Qr2ha1Gwef7weUl8rkFIlCPAak69jUO+MOY 5l4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xhIVgT0O0B93pxlkxMyET8my5lhvuOBq3pKJv/C7VXs=; b=SdF3NwGo7JDuE6Uu7ET4YV+7B5VBs0qOR52Qihig/zrO+Q1tPXI0xfVQkxhRtw0WwA htNK5hUQmpswRAhytpYyl2JqvrolexHYk4p9Ck3zCva+kRsNVtTId4RIU5wK8D8Q43lr wZ6q66ThCTD3jzU4wp/DhTmSwYCOWKBBuNRnWk2p9MWn0TpoymtJ156O3mjDaiIuNPQM aK+TyeEG6/sLHAOLyZM5+J2pL5icFD9NUUC6l31DiP+3z1yf1Uh7y+F22VV67DcvpT6y k2oc9RcQxNZjQQIQbomxaDwLig22WmydVYiRWF5LZRhzZrUMPAryJJ2zOpln8GlaOyXV Egrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=fvotCbUb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a17090aa78e00b0024e32eb2e49si16280124pjq.17.2023.05.12.09.57.34; Fri, 12 May 2023 09:57:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ucw.cz header.s=gen1 header.b=fvotCbUb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ucw.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237362AbjELQsn (ORCPT + 99 others); Fri, 12 May 2023 12:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjELQsj (ORCPT ); Fri, 12 May 2023 12:48:39 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACF7435A4; Fri, 12 May 2023 09:48:38 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 0ABE71C0E5D; Fri, 12 May 2023 18:48:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1683910117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xhIVgT0O0B93pxlkxMyET8my5lhvuOBq3pKJv/C7VXs=; b=fvotCbUbQd/0pXRoWixNyMBXDPzPAr56EUm4qGFLweTaQCM/Vl9S0PB7uDY0gtmG5BM98O v98a99AMk2jwgMg9suebDqIR2ANF6zInsuUfw5BUFtFi3ZGUWhde54rHgefwkyft6WMCQ+ EM4B5ddRJXY592HcaTPUtAlgaKchkJ0= Date: Fri, 12 May 2023 18:48:36 +0200 From: Pavel Machek To: Caleb Connolly Cc: Sebastian Reichel , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm Subject: Re: power_supply cooling interface Message-ID: References: <164f2458-fb66-f238-7143-bdbe1e200870@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164f2458-fb66-f238-7143-bdbe1e200870@linaro.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > I've been working on a driver for the charger found in most Snapdragon > 845 phones (the OnePlus 6, SHIFT6mq, PocoPhone F1, etc). I wanted to > include support for the POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT > property. > > My understanding is that it exposes the current limit as a cooling > device so that userspace (or frameworks like DTPM) can optimise for > performance in a thermally constrained device by limiting the input > current and thus reducing the heat generated by the charger circuitry, > a similar idea was applied on the Pixel C: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a4496d52b3430cb3c4c16d03cdd5f4ee97ad1241 > > However, reading through the sysfs docs for cooling devices, and > looking at the implementation in power_supply_core.c, it seems like the > behavior here is wrong in a few ways: > 1. The values should scale from 0: no cooling to max_state: max > cooling, but the power_supply docs and the only existing implementation > (the smbb driver) just export the current_limit, such that increasing > cur_state would increase the current limit, not decrease it. > 2. (unsure?)The scale is completely different to most other cooling > devices, most cooling devices don't seem to have a max state much > beyond the double digits, but CHARGE_CONTROL_LIMIT is on the scale of > uA, so approaches like incrementing the cooling state by 1 don't really > work. Did this get solved somehow? Anyway, I am not sure mW will be useful here, as elsewhere it is mW thermal and here it is mW from charger. Most of that energy should be stored in battery, not converted to heat. Best regards, Pavel --