From patchwork Thu Sep 16 19:42:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 513408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56E0CC4332F for ; Thu, 16 Sep 2021 19:42:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E5E361241 for ; Thu, 16 Sep 2021 19:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232447AbhIPTng (ORCPT ); Thu, 16 Sep 2021 15:43:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbhIPTnf (ORCPT ); Thu, 16 Sep 2021 15:43:35 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01A0BC061574; Thu, 16 Sep 2021 12:42:15 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id n27so10675516oij.0; Thu, 16 Sep 2021 12:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S7nWRCZmwjD+iwvzS4vZhsQdwavMwcQaNBQdnSbFlKY=; b=aq65laZEGaBneTeUAWeK0cRoJPs0aDXNFaqH9ALmB2M8PE0PG1LXTkb6YJ1Or6F9v6 Zk8bWregqLPA9FTfO8PCbzy70/MnjEK8Y+Fn5qfqOfLzooP3l6NXDlHGSN+gy9vAQkEE X2LVnBIYv+FQ6VulRW/swQUSPLtn3e9u3CEoPfxD5xyoQOWjD2OgtpeJ6lxZT1HaTKXY sAvtyO/TgGjgxujfgVXSXexcWvxDZ4FK8F33W3FLxGfCtJx4b/s7YACqApptgjlx+Wxg V0epJG695HpLElIkfH0EhIEj1yJXqaSQ3LtZgDZkUhi+fIDFeLggAP0iC9/r5rnX+b4E pBjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S7nWRCZmwjD+iwvzS4vZhsQdwavMwcQaNBQdnSbFlKY=; b=vno1ii1fIsPgSfSi5LrtiiYCh/Ypbv7C0A4vn0j3Xug5yb0bwkNAs9gHWwNfyP91NY j6r7pnMRhCg8O1ciqC3p6CGO8SOwvVLUXGTkp7QRZ9ohkKyS1EmdNRr05ODSSJX1d/Is 4JalHsG+VG+E2pL5bpuPq5vLsDJKSmK149jVpstEzZ/uKrX1oOM+c9mQ1vdS2xKa81NX fZmx3HJjfAnHJIjvkCanWoT3gHEKGYCO6WOKEHbrBMlgy1sGRv3ByofCNCWjTJvRh5Ke UVTqFPGngN1tOQ3NwbHO9izLu52yUQaRwX/UgwRjLgILZ92drmN+eMfA6VOamiFzVDGl fkNA== X-Gm-Message-State: AOAM533rsP/ZTgh4ZLQRlesgXCzsfTt2393B0LQIAAFJTdzjF+RG7Em9 7Z+UjRibrtCetvolo+6IFhU= X-Google-Smtp-Source: ABdhPJwm5s/uqFNpTdZIvJyXMFkPPjyG0uo/lKViHNAMfiQiuNeY79omrgLK6DLyUtu1D7Dn6/2glQ== X-Received: by 2002:a05:6808:8e3:: with SMTP id d3mr1194590oic.92.1631821334367; Thu, 16 Sep 2021 12:42:14 -0700 (PDT) Received: from wintermute.localdomain (cpe-76-183-134-35.tx.res.rr.com. [76.183.134.35]) by smtp.gmail.com with ESMTPSA id c10sm963359ooi.11.2021.09.16.12.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 12:42:13 -0700 (PDT) From: Chris Morgan To: linux-rockchip@lists.infradead.org Cc: lee.jones@linaro.org, robh+dt@kernel.org, heiko@sntech.de, sre@kernel.org, maccraft123mc@gmail.com, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, Chris Morgan Subject: [PATCH v4 RESEND 1/4] dt-bindings: Add Rockchip rk817 battery charger support Date: Thu, 16 Sep 2021 14:42:05 -0500 Message-Id: <20210916194208.10387-2-macroalpha82@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210916194208.10387-1-macroalpha82@gmail.com> References: <20210916194208.10387-1-macroalpha82@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 --- .../devicetree/bindings/mfd/rk808.txt | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/rk808.txt b/Documentation/devicetree/bindings/mfd/rk808.txt index 23a17a6663ec..6e1b9fb1f64a 100644 --- a/Documentation/devicetree/bindings/mfd/rk808.txt +++ b/Documentation/devicetree/bindings/mfd/rk808.txt @@ -77,6 +77,37 @@ Optional RK817 properties: - rockchip,mic-in-differential: Telling if the microphone uses differential mode. Should be under the codec child node. +- battery: The child node for the charger to hold additional properties. + If a battery is not in use, this node can be omitted. If a + battery node is used, the following values are required in the + battery node itself: + rockchip,resistor-sense-micro-ohms, + rockchip,sleep-enter-current-microamp, + rockchip,sleep-filter-current-microamp, + Additionally, a phandle to a monitored-battery node that + contains the following is also required: + charge-full-design-microamp-hours, + charge-term-current-microamp, + constant-charge-current-max-microamp, + constant-charge-voltage-max-microvolt, + voltage-max-design-microvolt, + voltage-min-design-microvolt, + and a valid ocv-capacity table. +- rockchip,resistor-sense-micro-ohms: Value in microohms of the battery sense + resistor. The PMIC only supports values + of either 10000 or 20000. This value is + used by the driver to set the correct + divisor value to translate ADC readings + into the proper units of measure. +- rockchip,sleep-enter-current-microamp: Value in microamps of the sleep enter + current for the charger. Value is used + by the driver to calibrate the relax + threshold. +- rockchip,sleep-filter-current-microamp: Value in microamps of the sleep + filter current for the charger. + Value is used by the driver to derive + the sleep sample current. + Optional RK818 properties: - vcc1-supply: The input supply for DCDC_REG1 - vcc2-supply: The input supply for DCDC_REG2 @@ -459,6 +490,13 @@ Example: }; }; + rk817_battery: battery { + monitored-battery = <&battery_cell>; + rockchip,resistor-sense-micro-ohms = <10000>; + rockchip,sleep-enter-current-microamp = <300000>; + rockchip,sleep-filter-current-microamp = <100000>; + }; + rk817_codec: codec { rockchip,mic-in-differential; }; From patchwork Thu Sep 16 19:42:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 513407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DACA5C4321E for ; Thu, 16 Sep 2021 19:42:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C2FAC61354 for ; Thu, 16 Sep 2021 19:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233847AbhIPTnj (ORCPT ); Thu, 16 Sep 2021 15:43:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233824AbhIPTnj (ORCPT ); Thu, 16 Sep 2021 15:43:39 -0400 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401F5C061574; Thu, 16 Sep 2021 12:42:18 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id c8-20020a9d6c88000000b00517cd06302dso9709632otr.13; Thu, 16 Sep 2021 12:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CTuSMH4A7Ffb6ZlHMh0V3hg0lEYSc6xST4UQtOrkdPg=; b=iDHZt+X3Ab83QWM+zioYv8T9mPVyWyN18lkIQ67D0wE5HebPGEb8XAXU1FmswZdEON 0I8TR39I0TIgpEMqMnTVu3GO4vSIiNv2zZORBrfBCCVr+BS6POJsjYC2SeJN+OMg81ns YvzHde2N5G1pDD58k5cO7tnBF9CdEetD4wjAZwvEFv/dO56IVkMBwq8nPZE46Ruizfkt Z4nVz0zFbKptl5Aa4F3Y0kdJDtbGXFnp1xbx7ILUCyoFT0MwbxDzactX+fLOl+zQuKTG ydBoaNphuuV6UOjfj0k2XeXNBqtsnIrMjmdNQ2sxKQQ7d3pFRl6JeMcBSuEy8r+5HXKd uASg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CTuSMH4A7Ffb6ZlHMh0V3hg0lEYSc6xST4UQtOrkdPg=; b=GiY1IOUVmXTH3fA2riwKKqEFYMkM62KL1NOuye4VOgC0NGoyOMIACCZjyJvagngOGZ RjfTifv73dYeWVb2vQsTlogmvDRzl1tWMv6vSIuNHeTvMdt7u7UxxsaHvdMYzZxgDOLI CkRRIklyeklsJzJMT1BLKKGgq+H89fa4OfO8NhSvI30ZsJ1GaIAVKhw6PY4F3FmSHE2v IkS9hjGETcJekg5JWwtJKj0me9oVvWxAY2As01nufCTws6ENW2tQR5t2x/vB+wgptzS+ gnM2WJ+Hmg4t3xBY0WhamI20x1tnl1N/F+Ql56PoQZu/dmvaSA6YZX0LlV64SXYVM4D1 lxvA== X-Gm-Message-State: AOAM531r/7/eu7d5rItIIimDU2AS8A2dAfpx9OP2HVNYP7PzEzchJGwQ XhMaxSbn07WRXd08LMkgYSI= X-Google-Smtp-Source: ABdhPJwhg8JOIgJgx1O1LOuW4rSayLJgA72Qlw2tltl2ImAglUJNyczSTwL0CnDUqhd49eJOWr3Htg== X-Received: by 2002:a9d:798f:: with SMTP id h15mr6000781otm.227.1631821337664; Thu, 16 Sep 2021 12:42:17 -0700 (PDT) Received: from wintermute.localdomain (cpe-76-183-134-35.tx.res.rr.com. [76.183.134.35]) by smtp.gmail.com with ESMTPSA id c10sm963359ooi.11.2021.09.16.12.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 12:42:17 -0700 (PDT) From: Chris Morgan To: linux-rockchip@lists.infradead.org Cc: lee.jones@linaro.org, robh+dt@kernel.org, heiko@sntech.de, sre@kernel.org, maccraft123mc@gmail.com, devicetree@vger.kernel.org, linux-pm@vger.kernel.org, Chris Morgan Subject: [PATCH v4 RESEND 4/4] arm64: dts: rockchip: add rk817 charger to Odroid Go Advance Date: Thu, 16 Sep 2021 14:42:08 -0500 Message-Id: <20210916194208.10387-5-macroalpha82@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210916194208.10387-1-macroalpha82@gmail.com> References: <20210916194208.10387-1-macroalpha82@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Chris Morgan Add the new rk817 charger driver to the Odroid Go Advance. Create a monitored battery node as well for the charger to use. All values from monitored battery are gathered from the BSP kernel for the Odroid Go Advance provided by HardKernel. Signed-off-by: Chris Morgan Signed-off-by: Maya Matuszczyk --- .../boot/dts/rockchip/rk3326-odroid-go2.dts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts index 7fc674a99a6c..aff8d0768c5a 100644 --- a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +++ b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts @@ -52,6 +52,25 @@ backlight: backlight { pwms = <&pwm1 0 25000 0>; }; + battery_cell: battery-cell { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3000000>; + charge-term-current-microamp = <300000>; + constant-charge-current-max-microamp = <2000000>; + constant-charge-voltage-max-microvolt = <4200000>; + factory-internal-resistance-micro-ohms = <180000>; + voltage-max-design-microvolt = <4100000>; + voltage-min-design-microvolt = <3500000>; + + ocv-capacity-celsius = <20>; + ocv-capacity-table-0 = <4106000 100>, <4071000 95>, <4018000 90>, <3975000 85>, + <3946000 80>, <3908000 75>, <3877000 70>, <3853000 65>, + <3834000 60>, <3816000 55>, <3802000 50>, <3788000 45>, + <3774000 40>, <3760000 35>, <3748000 30>, <3735000 25>, + <3718000 20>, <3697000 15>, <3685000 10>, <3625000 5>, + <3500000 0>; + }; + gpio-keys { compatible = "gpio-keys"; pinctrl-names = "default"; @@ -462,6 +481,13 @@ regulator-state-mem { }; }; + rk817_battery: battery { + monitored-battery = <&battery_cell>; + rockchip,resistor-sense-micro-ohms = <10000>; + rockchip,sleep-enter-current-microamp = <300000>; + rockchip,sleep-filter-current-microamp = <100000>; + }; + rk817_codec: codec { rockchip,mic-in-differential; };