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 2A466C43217 for ; Tue, 5 Apr 2022 22:55:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237500AbiDEWs5 (ORCPT ); Tue, 5 Apr 2022 18:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443824AbiDEPkU (ORCPT ); Tue, 5 Apr 2022 11:40:20 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5D5D5A5B2 for ; Tue, 5 Apr 2022 07:00:12 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id f18so9955307edc.5 for ; Tue, 05 Apr 2022 07:00:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=yssQkD7Do9xm8UR+YlTAdHUKXFIsMM4DyfogZGeGdwI=; b=ZkxMexE503Eff9aL8DCM5qBZDdllnLfsgdU8bEgtKsMA0FNvX8+exKDt8wSqv7O0cP qeWqstaDcKx9wgdTMOAtcq7iCVGOSXuDbSasBuerncoIzc6tbJ1Gyd8vmiRuURoqmPWz hROPZJYXqWEEblhiinEuLB0D0uGaZgdsuy88r1t/j7MEMBsMGYPNuCgrLozjilFWQ9gT wk1iv+EW18vEyz+Os1sxl3Qsnl8RIy61YU/zd3dUlQ7UxHwOtNxlywQE1T4TV5FMMdKt 4SHQKSHmgPeG/b6l2oC+7WDAlzIHC0FNdlOgsa7JCUNVxz0s6uWX3CLd/FuT/wfTh/aC 4IAA== 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=yssQkD7Do9xm8UR+YlTAdHUKXFIsMM4DyfogZGeGdwI=; b=bHm7p5mdfXshGn/BPw59dKmgfuZw893E6PvpkDCmZhhAqZFe81GpSptbwEkeynp48E 8XM6q4q7jjzqYSV3XtcXFGcrNGW1QzYyXwC5NrYu27oED1E1dkPENDPyG46RL0vl1kWP hk9U6sXkHChJlGrWmkW75vFmg2iq5O+IJHVDVWntyzQ1NtlcqLVXWDmox+u0pFM6FOBI GFUN23dD4/WS1MXQrriftmMvLZIkiLlJm+ynrY0ZQvtZbg6j28miSJEixhfxPU3b+1SV 8JcnXdGyZDfQW/FK9jMDYynmZ1aJX0pa361LxAiwR/y6dXcnSQZZrwPTE0gXnL/WOccz cB0w== X-Gm-Message-State: AOAM531jqomxS7nlvY0wV4OwaYW6NaX9o1pGVg7aU3VPGhq4UD4ekEcu KoI3W2RjqeJdXWu1F0xJFXYV7w== X-Google-Smtp-Source: ABdhPJz1bWR2hBZu8gqH0382mWzhtYAnndbapb86xJpCSXunZFL73rVdqd6pzmIP0a/dTleS03+msQ== X-Received: by 2002:a05:6402:5243:b0:419:4ce2:cb5c with SMTP id t3-20020a056402524300b004194ce2cb5cmr3773653edd.151.1649167211320; Tue, 05 Apr 2022 07:00:11 -0700 (PDT) Received: from [192.168.0.182] (xdsl-188-155-201-27.adslplus.ch. [188.155.201.27]) by smtp.gmail.com with ESMTPSA id n5-20020a1709065e0500b006e4dae9b1besm5150568eju.145.2022.04.05.07.00.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Apr 2022 07:00:10 -0700 (PDT) Message-ID: Date: Tue, 5 Apr 2022 16:00:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 1/4 v5] dt-bindings: Add Rockchip rk817 battery charger support Content-Language: en-US To: Chris Morgan , Krzysztof Kozlowski Cc: linux-pm@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, zhangqing@rock-chips.com, zyw@rock-chips.com, jon.lin@rock-chips.com, maccraft123mc@gmail.com, sre@kernel.org, heiko@sntech.de, krzk+dt@kernel.org, robh+dt@kernel.org, lee.jones@linaro.org, Chris Morgan References: <20220404215754.30126-1-macroalpha82@gmail.com> <20220404215754.30126-2-macroalpha82@gmail.com> <74f445c2-3194-80a6-6d52-21368eb6172a@linaro.org> <20220405131228.GA20@wintermute.localdomain> <20220405135424.GA20@wintermute.localdomain> From: Krzysztof Kozlowski In-Reply-To: <20220405135424.GA20@wintermute.localdomain> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 05/04/2022 15:54, Chris Morgan wrote: > On Tue, Apr 05, 2022 at 03:35:04PM +0200, Krzysztof Kozlowski wrote: >> On 05/04/2022 15:12, Chris Morgan wrote: >>> On Tue, Apr 05, 2022 at 01:16:55PM +0200, Krzysztof Kozlowski wrote: >>>> On 04/04/2022 23:57, Chris Morgan wrote: >>>>> From: Chris Morgan >>>>> >>>>> Create dt-binding documentation to document rk817 battery and charger >>>>> usage. New device-tree properties have been added. >>>>> >>>>> - rockchip,resistor-sense-micro-ohms: The value in microohms of the >>>>> sample resistor. >>>>> - rockchip,sleep-enter-current-microamp: The value in microamps of the >>>>> sleep enter current. >>>>> - rockchip,sleep-filter-current: The value in microamps of the sleep >>>>> filter current. >>>>> >>>>> Signed-off-by: Chris Morgan >>>>> Signed-off-by: Maya Matuszczyk >>>>> --- >>>>> .../bindings/mfd/rockchip,rk817.yaml | 48 +++++++++++++++++++ >>>>> 1 file changed, 48 insertions(+) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml b/Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml >>>>> index bfc1720adc43..b949d406a487 100644 >>>>> --- a/Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml >>>>> +++ b/Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml >>>>> @@ -117,6 +117,47 @@ properties: >>>>> description: >>>>> Describes if the microphone uses differential mode. >>>>> >>>>> + battery: >>>> >>>> I wonder why do you call it a batter while it is a charger, isn't it? >>> >>> It is a driver for both the battery and charger. I'd argue about 95% of >>> it is battery functions and the other 5% is managing the IRQs for plug >>> removal/insertion and capturing the incoming voltage and current. In >>> the BSP kernel these were two seperate drivers, but there was so little >>> that needed to be done for the charger (and users probably don't need >>> plug IRQs if they aren't using a battery anyway since the system will >>> shut off on a plug out event due to no power...). >> >> What do you mean by driver for "battery"? Like some smart-battery >> system? with embedded battery (RK817 comes with embedded battery) Or a >> fuel gauge? Judging by power supply properties it looks like fuel gauge. > > It's basically just additional registers in the rk817 PMIC. The PMIC is > controlled via I2C and contains multiple regulators, an audio codec, > an RTC, some GPIO, some nvram, a columb counter for the battery, and an > ADC for measuring input current/voltage/temperature (for battery or > charger). Actually you mentioned it in the cover letter - it's a PMIC, not a battery. I doubt that it's embedded with a battery. :) > This driver deals with the columb counter, the ADC, and a few > bits of nvram for storing battery values to retain backwards > compatibility with the BSP kernel and bootloader, and handling IRQs > related to inserting or removing the charger (curiously my > implementation ALSO has a charger sense GPIO in addition to the PMIC > being able to sense that). > > The driver itself is named rk817_charger. If you think I should change > this from battery to "fuel gauge" or "charger" let me know and I can > resubmit. Whatever makes it clearer for everyone. Yeah, the property name and bindings should describe the hardware, so in such case the hardware is rather a "charger" or "fuel-gauge". Your "battery-cell" from DTS is probably just a "battery" (unless you expect multiple cells?). Best regards, Krzysztof