From patchwork Mon Jul 26 19:01:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 486107 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 211B7C4338F for ; Mon, 26 Jul 2021 19:01:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1D7F60F6E for ; Mon, 26 Jul 2021 19:01:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233529AbhGZSVR (ORCPT ); Mon, 26 Jul 2021 14:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231548AbhGZSVQ (ORCPT ); Mon, 26 Jul 2021 14:21:16 -0400 Received: from mail-oo1-xc35.google.com (mail-oo1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB5B0C061757 for ; Mon, 26 Jul 2021 12:01:44 -0700 (PDT) Received: by mail-oo1-xc35.google.com with SMTP id k7-20020a4abd870000b029025e4d9b0a3dso2485524oop.6 for ; Mon, 26 Jul 2021 12:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xjQq4w89JxvSdKOOfsY9AtY7TN3aPy/MaODSkX355Ug=; b=UngmKHBwhsMSd1k9L9YcJfhTednReksxg+DgmLwELsHoLdvANjLKLnqOZBAps7s0zM M2xWlEArxsY96VjtLd4xp6SoyFgQugQHPoS+tSwTJulBqIExEh37mA67XCaD1PaKeaeg XWahPoH1ncKsKj4DTG+ehgiTxpkbdot+ouqHv7E7wnA6F67kb9Ds0/oOstNV8hXlAb0d R66o6f/WN0jHxp548aBmhb2YrqEy0nG2w5JVazpjjCWOf7269N4e6T7L+YA8FQI/l95P yReocm9HWLPIQEqs36yHcYYRBYwNU11qOfn5DlRhh4kIa2PpgVV7z23WOQVMrQuA3cm+ Dlkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xjQq4w89JxvSdKOOfsY9AtY7TN3aPy/MaODSkX355Ug=; b=deCGIRtGgGtqEGRd87Tu5VwDkApeCD7jnhoKrUyhToPKvg/WbJBv1Apnz50ByEtsiK YZwje2NDFeQIhMguv+2lXVqKyFGBa+ZYE9C4mRvFEdVdVWSqPzvFlEfM2alimMUIfE3P raQ2lMvfDuUtGxnpnoCrReoRCERTI2nyFY+jDQ2VHfuQyW1K2dSbmsaJmB/900aiXLd9 KSlWyrgV5PquUabyL7TPkRPrRsx8gitUD7zL8KOQF/szmwN2VU0JjH45I6Z5f42hEX16 EP/bWBFT2HFoXoN8fCqOHNNqCBQCLEVFQbEbvcj6dh6cPkxBd6evqC5Jv0sbac1GxY1y AP4w== X-Gm-Message-State: AOAM531ELA+cEBEihYnlnfcrUTyt14+V7Ok8pnwPbKgBLqjWhUvQphq6 rE9D3adDVQ5Bu5GcWxgAFETH+3aFZUs= X-Google-Smtp-Source: ABdhPJyvXA3k5XqWanLGCHj51hHNxgycx5xHgCxTPsmupY+HaT+lZvA91oxoWDYFgZ3xtt9XUCyY5g== X-Received: by 2002:a4a:e5c8:: with SMTP id r8mr11420915oov.65.1627326103607; Mon, 26 Jul 2021 12:01:43 -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 v7sm106610ooj.46.2021.07.26.12.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 12:01:43 -0700 (PDT) From: Chris Morgan To: linux-pm@vger.kernel.org Cc: linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, maccraft123mc@gmail.com, sre@kernel.org, heiko@sntech.de, robh+dt@kernel.org, lee.jones@linaro.org, Chris Morgan Subject: [RFC v2 1/4] dt-bindings: Add Rockchip rk817 battery charger support Date: Mon, 26 Jul 2021 14:01:27 -0500 Message-Id: <20210726190130.1973-2-macroalpha82@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210726190130.1973-1-macroalpha82@gmail.com> References: <20210726190130.1973-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: The value in microohms of the sample resistor. - rockchip,sleep-enter-current: 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 | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/rk808.txt b/Documentation/devicetree/bindings/mfd/rk808.txt index 23a17a6663ec..fa42b6253d26 100644 --- a/Documentation/devicetree/bindings/mfd/rk808.txt +++ b/Documentation/devicetree/bindings/mfd/rk808.txt @@ -70,13 +70,37 @@ Optional RK817 properties: - vcc8-supply: The input supply for BOOST - vcc9-supply: The input supply for OTG_SWITCH + - codec: The child node for the codec to hold additional properties. If no additional properties are required for the codec, this node can be omitted. - -- rockchip,mic-in-differential: Telling if the microphone uses differential +- 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: + rockchip,resistor-sense, rockchip,sleep-enter-current, + rockchip,sleep-filter-current, and a phandle to a + monitored-battery node that contains a valid value for + 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: 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: 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: 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 +483,13 @@ Example: }; }; + rk817_battery: battery { + monitored-battery = <&battery_cell>; + rockchip,resistor-sense = <10000>; + rockchip,sleep-enter-current = <300000>; + rockchip,sleep-filter-current = <100000>; + }; + rk817_codec: codec { rockchip,mic-in-differential; }; From patchwork Mon Jul 26 19:01:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 486105 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 DBD15C43214 for ; Mon, 26 Jul 2021 19:01:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB5D560F5D for ; Mon, 26 Jul 2021 19:01:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232799AbhGZSVX (ORCPT ); Mon, 26 Jul 2021 14:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233441AbhGZSVU (ORCPT ); Mon, 26 Jul 2021 14:21:20 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4920C061757 for ; Mon, 26 Jul 2021 12:01:45 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id y18so12139559oiv.3 for ; Mon, 26 Jul 2021 12:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cB1/AbegbOKUFF7ZFth5GO71zeXj6fXOTx2GEHYhefE=; b=ZrWJGv2wKPV3JOO+Z1opgUMw1SXTdrokunTFWnSzgB0PRYZQ0o6Bukz9iTzAooP/sM NBo2UvlEyrVCMMwaD57BM2agekXiUKjdVWL7n1AgnyPGuVRqgNiNb3V0lclrQ2wy6ci5 LOJUCY+DR6K+bYVHIGUnI7AIeVhLsekUI8s80KRf0gFJ0HQK7djfZpJDc7UoOCp6NU06 KXqQmenoU07/e+LW9dZNAyAMUh+RkY8lLhZJzaxrLwYswxQVIo9vDgYLkxb9Lmx809zO laJiUi89zxhzRm9Frt4pu1Ys5wNz2QpeHqU0xWfNt9Tj9c9tcBgGeKy65oexRz56Yq7B i/lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cB1/AbegbOKUFF7ZFth5GO71zeXj6fXOTx2GEHYhefE=; b=qmUvTj6y3gXZfX7NZjy6m6R1dBBwuuoCjfMJVY1GMr+esfz8VJ+aqwAXQ87ZswQkH4 NRn42w1Eg7kZykc5CYykvlH6tHNyj/ektxlH3cfMVZ4g64ktdhxTOQa5aqeChgMQClSr unKPGMc1bBmFBpye6z1HJ/qUfF1OVpC09iJ0OPbtIcNEOOHhO6M82v2+Np63WL0KR6pI i7ZoibEVaWyDkLI88tMbF/vRu3HlLqKNyz1TZIwwRJpCd7PXTSoBmwPfWQcDFIUWLGqU jQvXIFjiezsiAt4YZw5GRkqz81I2imYmFVbjlgQ0Tt62PtiWvPdlaGUwm+SdPvZI+1yX Y2yw== X-Gm-Message-State: AOAM530GU/DlZmI+DAlBRthEhvxJOGWEe5mSe9OJRSvx4G8Ak+LO23Ob RMMqLtZiKwgFeIniBDwspmMSAawC3e0= X-Google-Smtp-Source: ABdhPJzYJpCARU3n8Q+mSyLR80NW7MFFLUgl7fsbAZ95NfakJ3zRj21iKCit1X7EAGJOhor3HOjvrg== X-Received: by 2002:aca:5d83:: with SMTP id r125mr2650678oib.113.1627326104976; Mon, 26 Jul 2021 12:01:44 -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 v7sm106610ooj.46.2021.07.26.12.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 12:01:44 -0700 (PDT) From: Chris Morgan To: linux-pm@vger.kernel.org Cc: linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, maccraft123mc@gmail.com, sre@kernel.org, heiko@sntech.de, robh+dt@kernel.org, lee.jones@linaro.org, Chris Morgan Subject: [RFC v2 2/4] mfd: Add Rockchip rk817 battery charger support Date: Mon, 26 Jul 2021 14:01:28 -0500 Message-Id: <20210726190130.1973-3-macroalpha82@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210726190130.1973-1-macroalpha82@gmail.com> References: <20210726190130.1973-1-macroalpha82@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Chris Morgan Add rk817 charger support cell to rk808 mfd driver. Signed-off-by: Chris Morgan Signed-off-by: Maya Matuszczyk --- drivers/mfd/rk808.c | 16 ++++++- include/linux/mfd/rk808.h | 87 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 77ccd31ca1d9..edc779aee667 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -66,6 +66,10 @@ static bool rk817_is_volatile_reg(struct device *dev, unsigned int reg) case RK817_SECONDS_REG ... RK817_WEEKS_REG: case RK817_RTC_STATUS_REG: case RK817_CODEC_DTOP_LPT_SRST: + case RK817_GAS_GAUGE_ADC_CONFIG0 ... RK817_GAS_GAUGE_CUR_ADC_K0: + case RK817_PMIC_CHRG_STS: + case RK817_PMIC_CHRG_OUT: + case RK817_PMIC_CHRG_IN: case RK817_INT_STS_REG0: case RK817_INT_STS_REG1: case RK817_INT_STS_REG2: @@ -73,7 +77,7 @@ static bool rk817_is_volatile_reg(struct device *dev, unsigned int reg) return true; } - return true; + return false; } static const struct regmap_config rk818_regmap_config = { @@ -126,6 +130,11 @@ static const struct resource rk817_pwrkey_resources[] = { DEFINE_RES_IRQ(RK817_IRQ_PWRON_FALL), }; +static const struct resource rk817_charger_resources[] = { + DEFINE_RES_IRQ(RK817_IRQ_PLUG_IN), + DEFINE_RES_IRQ(RK817_IRQ_PLUG_OUT), +}; + static const struct mfd_cell rk805s[] = { { .name = "rk808-clkout", }, { .name = "rk808-regulator", }, @@ -165,6 +174,11 @@ static const struct mfd_cell rk817s[] = { .resources = &rk817_rtc_resources[0], }, { .name = "rk817-codec",}, + { + .name = "rk817-charger", + .num_resources = ARRAY_SIZE(rk817_charger_resources), + .resources = &rk817_charger_resources[0], + }, }; static const struct mfd_cell rk818s[] = { diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index a96e6d43ca06..1390432c0222 100644 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h @@ -518,6 +518,74 @@ enum rk809_reg_id { #define MIC_DIFF_DIS (0x0 << 7) #define MIC_DIFF_EN (0x1 << 7) +/* RK817 Battery Registers */ +#define RK817_GAS_GAUGE_ADC_CONFIG0 0x50 +#define RK817_GG_EN (0x1 << 7) +#define RK817_SYS_VOL_ADC_EN (0x1 << 6) +#define RK817_TS_ADC_EN (0x1 << 5) +#define RK817_USB_VOL_ADC_EN (0x1 << 4) +#define RK817_BAT_VOL_ADC_EN (0x1 << 3) +#define RK817_BAT_CUR_ADC_EN (0x1 << 2) + +#define RK817_GAS_GAUGE_ADC_CONFIG1 0x55 + +#define RK817_CUR_CALIB_UPD (0x1 << 7) +#define RK817_VOL_CALIB_UPD (0x1 << 6) + +#define RK817_GAS_GAUGE_GG_CON 0x56 +#define RK817_GAS_GAUGE_GG_STS 0x57 + +#define RK817_RELAX_VOL_UPD (0x3 << 2) +#define RK817_RELAX_STS (0x1 << 1) + +#define RK817_GAS_GAUGE_RELAX_THRE_H 0x58 +#define RK817_GAS_GAUGE_RELAX_THRE_L 0x59 +#define RK817_GAS_GAUGE_OCV_THRE_VOL 0x62 +#define RK817_GAS_GAUGE_OCV_VOL_H 0x63 +#define RK817_GAS_GAUGE_OCV_VOL_L 0x64 +#define RK817_GAS_GAUGE_PWRON_VOL_H 0x6b +#define RK817_GAS_GAUGE_PWRON_VOL_L 0x6c +#define RK817_GAS_GAUGE_PWRON_CUR_H 0x6d +#define RK817_GAS_GAUGE_PWRON_CUR_L 0x6e +#define RK817_GAS_GAUGE_OFF_CNT 0x6f +#define RK817_GAS_GAUGE_Q_INIT_H3 0x70 +#define RK817_GAS_GAUGE_Q_INIT_H2 0x71 +#define RK817_GAS_GAUGE_Q_INIT_L1 0x72 +#define RK817_GAS_GAUGE_Q_INIT_L0 0x73 +#define RK817_GAS_GAUGE_Q_PRES_H3 0x74 +#define RK817_GAS_GAUGE_Q_PRES_H2 0x75 +#define RK817_GAS_GAUGE_Q_PRES_L1 0x76 +#define RK817_GAS_GAUGE_Q_PRES_L0 0x77 +#define RK817_GAS_GAUGE_BAT_VOL_H 0x78 +#define RK817_GAS_GAUGE_BAT_VOL_L 0x79 +#define RK817_GAS_GAUGE_BAT_CUR_H 0x7a +#define RK817_GAS_GAUGE_BAT_CUR_L 0x7b +#define RK817_GAS_GAUGE_USB_VOL_H 0x7e +#define RK817_GAS_GAUGE_USB_VOL_L 0x7f +#define RK817_GAS_GAUGE_SYS_VOL_H 0x80 +#define RK817_GAS_GAUGE_SYS_VOL_L 0x81 +#define RK817_GAS_GAUGE_Q_MAX_H3 0x82 +#define RK817_GAS_GAUGE_Q_MAX_H2 0x83 +#define RK817_GAS_GAUGE_Q_MAX_L1 0x84 +#define RK817_GAS_GAUGE_Q_MAX_L0 0x85 +#define RK817_GAS_GAUGE_SLEEP_CON_SAMP_CUR_H 0x8f +#define RK817_GAS_GAUGE_SLEEP_CON_SAMP_CUR_L 0x90 +#define RK817_GAS_GAUGE_CAL_OFFSET_H 0x91 +#define RK817_GAS_GAUGE_CAL_OFFSET_L 0x92 +#define RK817_GAS_GAUGE_VCALIB0_H 0x93 +#define RK817_GAS_GAUGE_VCALIB0_L 0x94 +#define RK817_GAS_GAUGE_VCALIB1_H 0x95 +#define RK817_GAS_GAUGE_VCALIB1_L 0x96 +#define RK817_GAS_GAUGE_IOFFSET_H 0x97 +#define RK817_GAS_GAUGE_IOFFSET_L 0x98 +#define RK817_GAS_GAUGE_BAT_R1 0x9a +#define RK817_GAS_GAUGE_BAT_R2 0x9b +#define RK817_GAS_GAUGE_BAT_R3 0x9c +#define RK817_GAS_GAUGE_DATA3 0xa0 +#define RK817_GAS_GAUGE_DATA4 0xa1 +#define RK817_GAS_GAUGE_DATA5 0xa2 +#define RK817_GAS_GAUGE_CUR_ADC_K0 0xb0 + #define RK817_POWER_EN_REG(i) (0xb1 + (i)) #define RK817_POWER_SLP_EN_REG(i) (0xb5 + (i)) @@ -543,10 +611,29 @@ enum rk809_reg_id { #define RK817_LDO_ON_VSEL_REG(idx) (0xcc + (idx) * 2) #define RK817_BOOST_OTG_CFG (0xde) +#define RK817_PMIC_CHRG_OUT 0xe4 +#define RK817_CHRG_VOL_SEL (0x07 << 4) +#define RK817_CHRG_CUR_SEL (0x07 << 0) + +#define RK817_PMIC_CHRG_IN 0xe5 +#define RK817_USB_VLIM_EN (0x01 << 7) +#define RK817_USB_VLIM_SEL (0x07 << 4) +#define RK817_USB_ILIM_EN (0x01 << 3) +#define RK817_USB_ILIM_SEL (0x07 << 0) +#define RK817_PMIC_CHRG_TERM 0xe6 +#define RK817_CHRG_TERM_ANA_DIG (0x01 << 2) +#define RK817_CHRG_TERM_ANA_SEL (0x03 << 0) +#define RK817_CHRG_EN (0x01 << 6) + +#define RK817_PMIC_CHRG_STS 0xeb +#define RK817_CHG_STS (0x07 << 4) + #define RK817_ID_MSB 0xed #define RK817_ID_LSB 0xee #define RK817_SYS_STS 0xf0 +#define RK817_PLUG_IN_STS (0x1 << 6) + #define RK817_SYS_CFG(i) (0xf1 + (i)) #define RK817_ON_SOURCE_REG 0xf5 From patchwork Mon Jul 26 19:01:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 486106 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 B1760C4338F for ; Mon, 26 Jul 2021 19:01:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9722860F11 for ; Mon, 26 Jul 2021 19:01:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233534AbhGZSVW (ORCPT ); Mon, 26 Jul 2021 14:21:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233240AbhGZSVU (ORCPT ); Mon, 26 Jul 2021 14:21:20 -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 967F2C061760 for ; Mon, 26 Jul 2021 12:01:48 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id x15-20020a05683000cfb02904d1f8b9db81so10926437oto.12 for ; Mon, 26 Jul 2021 12:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vZfHRgT3Nz1lZYd7karZdl8CVKgaGTnZLjBxunPxNVw=; b=PNOfy3Hm9aXJEig+isQo3IM60LQrOlNBuPH4HHe+eTLZyHaDKOpmKItM3UUwwdXU8m PxJm3GU3oWHf2xM/DjGTjUEya1YOAXwdEjPhN9HvcV9eP7aJDCWmQYABzi8E/zaDcnfn Fv6ZGZiJNuRIW8g/7/KZdFTL/0VuZLZDhnWqXKgRjk3rsPG0ZD9sgNeXuSSaZLpf4z3u BrrefWncHg+temdILD1BkzmCOis1pBWbWiCSNdf0XSZQdsIkwlmJmS6cXXbSfdiGLtyr Jm+g7mCrzI1RrNw9y1E0B6LxCFpiWzhkyQN4mtzjIToJYG5rpbXNyl1biRIQItMtDFaR /29g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vZfHRgT3Nz1lZYd7karZdl8CVKgaGTnZLjBxunPxNVw=; b=AcYS6YOSF4jjsN7IokOsqpqUBatnQ7uTjGhXoVvkHNaGZN3NuJ690asb2bTQF83ur+ gpzTVj2MqM/3VVBuAOlnCSEX3+lz0AER1XBKnJcOtRAEUqCs6ztYwlzYnO7jSGQAt0ZV ey8Ll9G65fcDJaOFYr/yjJ7oYbi2iDEcV6jBdb0SdbBwLq96mS4W4SYasTmgUkgKx06n MsrXNNUZtICuFg5Xy4cmbvZxYFyqLxxZ35kRxYxH4bCScKEyRIjGvYrTyXZnLSoRN3dR fo6qSVUwNoAgMT36Acc5zcqr6QNMcqsHYsVIo97MLRPgRWU+1JoetLvSCYYNWnlt3pBN bElA== X-Gm-Message-State: AOAM533S21vpjq4Ct7pnYHamF02X4hhDsU0el50pliW34o9T7coqvKLZ 3hnuyXi8PAE89m+eFvr6uWiCEA7HZLA= X-Google-Smtp-Source: ABdhPJxXNYp3ueyrRFGE3rLDg2ezTp+nMBK/elezfPDGJqQc4RY2bdb4DQU7t87TXRF3yoyeLwgyQg== X-Received: by 2002:a9d:550c:: with SMTP id l12mr1495048oth.169.1627326107547; Mon, 26 Jul 2021 12:01:47 -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 v7sm106610ooj.46.2021.07.26.12.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 12:01:47 -0700 (PDT) From: Chris Morgan To: linux-pm@vger.kernel.org Cc: linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, maccraft123mc@gmail.com, sre@kernel.org, heiko@sntech.de, robh+dt@kernel.org, lee.jones@linaro.org, Chris Morgan Subject: [RFC v2 4/4] arm64: dts: rockchip: add rk817 charger to Odroid Go Advance Date: Mon, 26 Jul 2021 14:01:30 -0500 Message-Id: <20210726190130.1973-5-macroalpha82@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210726190130.1973-1-macroalpha82@gmail.com> References: <20210726190130.1973-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..333bcf8da450 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 = <10000>; + rockchip,sleep-enter-current = <300000>; + rockchip,sleep-filter-current = <100000>; + }; + rk817_codec: codec { rockchip,mic-in-differential; };