From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4C27C7EE23 for ; Fri, 12 May 2023 16:48:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237324AbjELQsk (ORCPT ); Fri, 12 May 2023 12:48:40 -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> Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 --