Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1347943pxb; Thu, 24 Mar 2022 18:22:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4aLBlkTr55rpkDGQxfLVt1wDIwt5IsaFxYCn8ErqGt6FD15VdkgHKcWPWtiah0jIOB6a3 X-Received: by 2002:a17:90b:1a81:b0:1bc:ec26:40a6 with SMTP id ng1-20020a17090b1a8100b001bcec2640a6mr9713123pjb.0.1648171377144; Thu, 24 Mar 2022 18:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648171377; cv=none; d=google.com; s=arc-20160816; b=T82Xwt0IzzelXXhxMp9373HGY4VyYksqbnhl/4iMD57w/b2M+uQCfs0nsFc/EV4sME mST4jwql8BcB+Z36vIoVpwFlQF4BhB3YLdcSJUgTDpdesXAQrnxuDCxvCtXrugteX1Y8 E0+tBM2lZZpsrFRYZlRvU6vKUocak9NSLt5QHpy1gs1wUTPQy5hnndutWC9VJTMo9MTJ I1YuUsubnGEU45TPb/0zBi/3cK3NrD1N2FGb3pfg/Yzr3CpbJH3nKk5Z5f/Oog0O/9/d cIiAc4WMQ7JRQQ8YYpbPIMqWtmqdyTv2816cYRwjvM+aTkxLzx6tGRMT6qBGufumZrlf ENIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=dFOPtoWPcTnsyVvvROBn8Be2+egyjb08ekt/mEU0j1k=; b=qQakynOU33FHJ06djG0Uxalt8JswFltBGztGoPiXBtIb2iOc5ItQhjk1S5DadhMPuU nKv5UyQ4lIsa/3GNvu8MmOIuzxrej4FusDhGG/22modLHbUc+h6GVYpr3fe2S0FQIGzR SiTSqPbtEnJEQ/vjgtSqZi/6lAWsjKAMwOH7+JSrXuozlH6g4HbPbnoC0Fbwp8Gy377q IH/mvWAAB2NQoW4EeH7Psd53p/4oIsD2Y/Zp0M5cHffqSJLAOdmADu8DkS+OJ7lAIaG4 KWZiETncgKCcXaOR/Kw6OV0c9okybCdtxLkoEwxNgq8aHIY3LCYFdGM996mPuLbYcvcI eWrg== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c8-20020a17090abf0800b001bf3623d4f5si4149738pjs.50.2022.03.24.18.22.43; Thu, 24 Mar 2022 18:22:57 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348688AbiCXLtU (ORCPT + 99 others); Thu, 24 Mar 2022 07:49:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235457AbiCXLtT (ORCPT ); Thu, 24 Mar 2022 07:49:19 -0400 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F86EA1461; Thu, 24 Mar 2022 04:47:47 -0700 (PDT) Received: by mail-ed1-f50.google.com with SMTP id b24so5282620edu.10; Thu, 24 Mar 2022 04:47:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=dFOPtoWPcTnsyVvvROBn8Be2+egyjb08ekt/mEU0j1k=; b=yBGTo3sSTgM4+UOOwcC6sPgGrb+GIP4XioqqEFeZG+gfjvVdykUHj/rBrbucmo09DJ cihpinNMLTbB2Jxs6ImVaJU/AWsllN1Ju/uFCjkaPipp6fiW5TKMTlzty0zcVQhwqyc7 keRglxHEoUbE3iUxHnkoqxzLdo4xqjdw/H1E2x4D9N73pOVXZGV7Jvc8VW9E1A6sIBRY UQGROssQauENPTai0qqltimtzA7MDKTR4uZgfOfI3RJdXOTqHtuOlPWPZPIOvgUJEqpe 05JjSppW9QE9sl32h9Q8q8KboD2qv+jVqHEQc241XG99aMJqwkpw7l8TqKObPWejdQuW vrKg== X-Gm-Message-State: AOAM532qwuxNVtUHXO8zOQH2X3MRuuEId/sWTK6pgAbMo9mtfxB99z29 45GPS7PhhNO485q+UYYRkG4= X-Received: by 2002:aa7:c348:0:b0:418:e515:69e with SMTP id j8-20020aa7c348000000b00418e515069emr6143338edr.393.1648122466050; Thu, 24 Mar 2022 04:47:46 -0700 (PDT) Received: from [192.168.0.156] (xdsl-188-155-201-27.adslplus.ch. [188.155.201.27]) by smtp.googlemail.com with ESMTPSA id dm11-20020a170907948b00b006cf488e72e3sm1031073ejc.25.2022.03.24.04.47.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Mar 2022 04:47:45 -0700 (PDT) Message-ID: Date: Thu, 24 Mar 2022 12:47:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 7/7] ARM: dts: s5pv210: Add charger support in Aries Content-Language: en-US To: Jonathan Bakker , alim.akhtar@samsung.com Cc: robh+dt@kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220323150311.26699-1-xc-racer2@live.ca> <2eee2611-d618-3fe2-4315-c57a26de6b21@kernel.org> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 On 23/03/2022 18:20, Jonathan Bakker wrote: > > > On 2022-03-23 8:31 a.m., krzk@kernel.org wrote: >> On 23/03/2022 16:03, Jonathan Bakker wrote: >>> Add charger-manager support to Aries boards to allow safe >>> charging of the battery without the need for userspace control. >>> >>> Signed-off-by: Jonathan Bakker >>> --- >>> arch/arm/boot/dts/s5pv210-fascinate4g.dts | 162 ++++++++++++++++++++++ >>> arch/arm/boot/dts/s5pv210-galaxys.dts | 144 +++++++++++++++++++ >>> 2 files changed, 306 insertions(+) >>> >>> diff --git a/arch/arm/boot/dts/s5pv210-fascinate4g.dts b/arch/arm/boot/dts/s5pv210-fascinate4g.dts >>> index 7427c84f1126..9530231b7a70 100644 >>> --- a/arch/arm/boot/dts/s5pv210-fascinate4g.dts >>> +++ b/arch/arm/boot/dts/s5pv210-fascinate4g.dts >>> @@ -57,6 +57,168 @@ >>> pinctrl-0 = <&main_micbias_ena>; >>> }; >>> >>> + thermal-zones { >>> + batt_thermal: batt-thermal { >>> + polling-delay-passive = <60000>; /* 60 seconds */ >> >> There is no passive cooling device, so why do you need it? >> > > The charger manager code needs a passive cooling device, so that's > why this is present here. > >>> + polling-delay = <600000>; /* 600 seconds */ >>> + >>> + thermal-sensors = <&batt_thermistor>; >>> + }; >>> + }; >>> + >>> + batt_thermistor: thermal-sensor-0 { >>> + compatible = "generic-adc-thermal"; >>> + #thermal-sensor-cells = <0>; >>> + io-channels = <&adc 6>; >>> + io-channel-names = "sensor-channel"; >>> + >>> + temperature-lookup-table = < >>> + (-20000) 1859 >>> + (-19000) 1846 >>> + (-18000) 1832 >>> + (-17000) 1818 >>> + (-16000) 1804 >>> + (-15000) 1790 >>> + (-14000) 1773 >>> + (-13000) 1756 >>> + (-12000) 1739 >>> + (-11000) 1722 >>> + (-10000) 1705 >>> + (-9000) 1691 >>> + (-8000) 1677 >>> + (-7000) 1663 >>> + (-6000) 1649 >>> + (-5000) 1635 >>> + (-4000) 1550 >>> + (-3000) 1510 >>> + (-2000) 1500 >>> + (-1000) 1490 >>> + 0 1480 >>> + 1000 1470 >>> + 2000 1460 >>> + 3000 1450 >>> + 4000 1430 >>> + 5000 1420 >>> + 6000 1406 >>> + 7000 1386 >>> + 8000 1366 >>> + 9000 1346 >>> + 10000 1326 >>> + 11000 1302 >>> + 12000 1278 >>> + 13000 1254 >>> + 14000 1230 >>> + 15000 1206 >>> + 16000 1182 >>> + 17000 1158 >>> + 18000 1134 >>> + 19000 1110 >>> + 20000 1086 >>> + 21000 1059 >>> + 22000 1035 >>> + 23000 1011 >>> + 24000 987 >>> + 25000 963 >>> + 26000 937 >>> + 27000 913 >>> + 28000 889 >>> + 29000 865 >>> + 30000 841 >>> + 31000 816 >>> + 32000 794 >>> + 33000 772 >>> + 34000 750 >>> + 35000 728 >>> + 36000 708 >>> + 37000 690 >>> + 38000 672 >>> + 39000 654 >>> + 40000 636 >>> + 41000 616 >>> + 42000 599 >>> + 43000 580 >>> + 44000 565 >>> + 45000 548 >>> + 46000 529 >>> + 47000 512 >>> + 48000 495 >>> + 49000 478 >>> + 50000 461 >>> + 51000 440 >>> + 52000 431 >>> + 53000 416 >>> + 54000 405 >>> + 55000 396 >>> + 56000 375 >>> + 57000 360 >>> + 58000 347 >>> + 59000 334 >>> + 60000 325 >>> + 61000 311 >>> + 62000 303 >>> + 63000 296 >>> + 64000 290 >>> + 65000 279 >>> + 66000 265 >>> + 67000 254 >>> + 68000 240 >>> + 69000 220 >>> + 70000 206>; >>> + }; >>> + >>> + charger_manager: charger-manager-0 { >>> + compatible = "charger-manager"; >> >> Sorry, this is not a hardware. It's a hack to configure kernel charging >> driver via DT which was made deprecated. > > Thanks, I missed the deprecation notice in the binding file. > > What would be the better way of creating a functional charging system? > A new device-specific driver? I am not sure, but maybe you could use charger-manager, just configure it from user-space (or add such features). Better ask power supply maintainer. But anyway charger-manager is mostly abandoned. I don't think anyone develops it. > Userspace monitoring of temperature/connected > device and extensions to the max8998 driver for enabling/disabling/configuring > charging via the power supply subsystem instead of the regulator subsystem? > Something else? Enabling charging via regulators was done only for some drivers, I think for charger-manager. I don't think it is the recommended way now. Everything should be controlled rather via power supply from user-space. How postmarketos or lineageos are doing it? > > The way I understand the charging system, there is > > - The fuelgauge (max17042) > - The max8998 charger portion, including the ability to vary the current > - The thermistor for checking battery temperature > - The FSA9480 to determine what sort of cable is connected > Best regards, Krzysztof