From patchwork Mon Dec 2 13:07:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Antoine via B4 Relay X-Patchwork-Id: 13890595 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBA5BD7831A for ; Mon, 2 Dec 2024 13:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JHswpCY3MmbQGZ7K6AyXGhE2IQvmE6g63dw0yUBJV/0=; b=gp/MNc9CTv9MSxxXb+p3njoP2b 5xk5b+us+PkUO4W5NI2dHgbUHqN6uF6Oqj1/wRhtjS1zvkshP3j+OE/IqE7kroaFniuY5PTskfJRv aQUl2Qc1xggRDZ8l07JKPVGrz/QU4RjHkegElpCAHqQxMFwBshobbD+Nk+EXDjGFlzbqy1TtilRui yYrSslXYuDC4JflZj2tlUxihkYYLvb4gB6Po/3Y4cBEVcRxYzI1ieCFvbc0ijw1QKBc68CrBNgOiL +PqJyFKTJgpJLCBaGwfUAARFYADU+63fMz1eq3C7mQ1pzpwoC1nKurLL1wgoMBUGr6kZNhSznuJR2 cnOA0Ydw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tI6Dx-00000006BzV-2idq; Mon, 02 Dec 2024 13:12:25 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tI6A2-00000006BFg-3YXn for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 13:08:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C120A5C609B; Mon, 2 Dec 2024 13:07:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 42E8CC4CED6; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733144901; bh=IQep3vYgtWd8FCL4D6A8WGJH6FjqAultu89nScGyyPo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jYqXDeHD2KBV2dD8HKo1Xk16v7elrcJR3Dh6bDQaXtHQmIi6bExaFKs+u50x7+sdc wrXadhKuz1mmA8qVG6GQX11D9KJELYFlx8UqSNHH4IdHPRhDtJJtiZRDtdT6oy6h3K 4O4WMW1vi3n11akbsnatra3d1UXnhKNMpsayPB3UMFm2yrV9p8JaR+1YnKJAUjYqWU y6nQJ2uE60zrKFWYn2ETf8rUC+RndxBHIQjQBc6h2mb5M2XLqYkqxXgOZJPOHUaIX0 wpYlSgEUoocyCIkyV5QJgFj+hDhR5gDa2vPZXrtTefJ0r33yWryHgXO+hrHh25BKhc SeYqPUYye1FEg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22E06D7831A; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) From: Thomas Antoine via B4 Relay Date: Mon, 02 Dec 2024 14:07:15 +0100 Subject: [PATCH 1/4] power: supply: add support for max77759 fuel gauge MIME-Version: 1.0 Message-Id: <20241202-b4-gs101_max77759_fg-v1-1-98d2fa7bfe30@uclouvain.be> References: <20241202-b4-gs101_max77759_fg-v1-0-98d2fa7bfe30@uclouvain.be> In-Reply-To: <20241202-b4-gs101_max77759_fg-v1-0-98d2fa7bfe30@uclouvain.be> To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dimitri Fedrau , Catalin Marinas , Will Deacon , Peter Griffin , Alim Akhtar Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Antoine X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733144859; l=5861; i=t.antoine@uclouvain.be; s=20241202; h=from:subject:message-id; bh=8/hl8HCrAHHJ3VeFvt/t1hZ/LAyPgByR74YhR463vjQ=; b=H9K7tMUAoGnrOOR2rqtXyyTvA8qiFvlZ3DCQkaWfcS2uiHCV/MFpnBLMUiTYIHlnaQAMz1kUP nYlq+ZLHwpkChbCaaLqOoZw3CBZxxpq0xOXTiND8Diy6ypVR8Q9xGMS X-Developer-Key: i=t.antoine@uclouvain.be; a=ed25519; pk=sw7UYl31W1LTpgWRiX4xIF5x6ok7YWZ6XZnHqy/d3dY= X-Endpoint-Received: by B4 Relay for t.antoine@uclouvain.be/20241202 with auth_id=289 X-Original-From: Thomas Antoine X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_050822_983760_F0695BA9 X-CRM114-Status: GOOD ( 21.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: t.antoine@uclouvain.be Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thomas Antoine The Maxim max77759 fuel gauge has the same interface as the Maxim max1720x except for the non-volatile memory slave address which is not available. No slave is available at address 0xb of the i2c bus, which is coherent with the following driver from google: line 5836 disables non-volatile memory for m5 gauge. Link: https://android.googlesource.com/kernel/google-modules/bms/+/1a68c36bef474573cc8629cc1d121eb6a81ab68c/max1720x_battery.c Add support for the max77759 by allowing to use the non-volatile memory or not based on the chip. Value for RSense comes from the following stock devicetree: Link: https://android.googlesource.com/kernel/devices/google/gs101/+/33eca36d43da6c2b6a546806eb3e7411bbe6d60d/dts/gs101-raviole-battery.dtsi Signed-off-by: Thomas Antoine --- drivers/power/supply/max1720x_battery.c | 71 +++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 12 deletions(-) diff --git a/drivers/power/supply/max1720x_battery.c b/drivers/power/supply/max1720x_battery.c index 33105419e2427bb37963bda9948b647c239f8faa..faf336938dd4306dd2ceeb0a84b90ca80ad41a9f 100644 --- a/drivers/power/supply/max1720x_battery.c +++ b/drivers/power/supply/max1720x_battery.c @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -39,6 +40,7 @@ #define MAX172XX_DEV_NAME_TYPE_MASK GENMASK(3, 0) #define MAX172XX_DEV_NAME_TYPE_MAX17201 BIT(0) #define MAX172XX_DEV_NAME_TYPE_MAX17205 (BIT(0) | BIT(2)) +#define MAX172XX_DEV_NAME_TYPE_MAX77759 0 #define MAX172XX_QR_TABLE10 0x22 #define MAX172XX_BATT 0xDA /* Battery voltage */ #define MAX172XX_ATAVCAP 0xDF @@ -46,6 +48,7 @@ static const char *const max1720x_manufacturer = "Maxim Integrated"; static const char *const max17201_model = "MAX17201"; static const char *const max17205_model = "MAX17205"; +static const char *const max77759_model = "MAX77759"; struct max1720x_device_info { struct regmap *regmap; @@ -54,6 +57,21 @@ struct max1720x_device_info { int rsense; }; +struct chip_data { + u16 default_nrsense; /* in regs in 10^-5 */ + u8 has_nvmem; +}; + +static const struct chip_data max1720x_data = { + .default_nrsense = 1000, + .has_nvmem = 1, +}; + +static const struct chip_data max77759_data = { + .default_nrsense = 500, + .has_nvmem = 0, +}; + /* * Model Gauge M5 Algorithm output register * Volatile data (must not be cached) @@ -369,6 +387,8 @@ static int max1720x_battery_get_property(struct power_supply *psy, val->strval = max17201_model; else if (reg_val == MAX172XX_DEV_NAME_TYPE_MAX17205) val->strval = max17205_model; + else if (reg_val == MAX172XX_DEV_NAME_TYPE_MAX77759) + val->strval = max77759_model; else return -ENODEV; break; @@ -416,7 +436,6 @@ static int max1720x_probe_nvmem(struct i2c_client *client, .priv = info, }; struct nvmem_device *nvmem; - unsigned int val; int ret; info->ancillary = i2c_new_ancillary_device(client, "nvmem", 0xb); @@ -438,6 +457,27 @@ static int max1720x_probe_nvmem(struct i2c_client *client, return PTR_ERR(info->regmap_nv); } + nvmem = devm_nvmem_register(dev, &nvmem_config); + if (IS_ERR(nvmem)) { + dev_err(dev, "Could not register nvmem!"); + return PTR_ERR(nvmem); + } + + return 0; +} + +static int max1720x_get_rsense(struct device *dev, + struct max1720x_device_info *info, + const struct chip_data *data) +{ + unsigned int val; + int ret; + + if (!data->has_nvmem) { + info->rsense = data->default_nrsense; + return 0; + } + ret = regmap_read(info->regmap_nv, MAX1720X_NRSENSE, &val); if (ret < 0) { dev_err(dev, "Failed to read sense resistor value\n"); @@ -446,14 +486,9 @@ static int max1720x_probe_nvmem(struct i2c_client *client, info->rsense = val; if (!info->rsense) { - dev_warn(dev, "RSense not calibrated, set 10 mOhms!\n"); - info->rsense = 1000; /* in regs in 10^-5 */ - } - - nvmem = devm_nvmem_register(dev, &nvmem_config); - if (IS_ERR(nvmem)) { - dev_err(dev, "Could not register nvmem!"); - return PTR_ERR(nvmem); + dev_warn(dev, "RSense not calibrated, set %d mOhms!\n", + data->default_nrsense/100); + info->rsense = data->default_nrsense; } return 0; @@ -474,6 +509,7 @@ static int max1720x_probe(struct i2c_client *client) struct device *dev = &client->dev; struct max1720x_device_info *info; struct power_supply *bat; + const struct chip_data *data; int ret; info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); @@ -488,9 +524,19 @@ static int max1720x_probe(struct i2c_client *client) return dev_err_probe(dev, PTR_ERR(info->regmap), "regmap initialization failed\n"); - ret = max1720x_probe_nvmem(client, info); + data = device_get_match_data(dev); + if (!data) + return dev_err_probe(dev, ret, "Failed to get chip data\n"); + + if (data->has_nvmem) { + ret = max1720x_probe_nvmem(client, info); + if (ret) + return dev_err_probe(dev, ret, "Failed to probe nvmem\n"); + } + + ret = max1720x_get_rsense(dev, info, data); if (ret) - return dev_err_probe(dev, ret, "Failed to probe nvmem\n"); + return dev_err_probe(dev, ret, "Failed to get RSense"); bat = devm_power_supply_register(dev, &max1720x_bat_desc, &psy_cfg); if (IS_ERR(bat)) @@ -501,7 +547,8 @@ static int max1720x_probe(struct i2c_client *client) } static const struct of_device_id max1720x_of_match[] = { - { .compatible = "maxim,max17201" }, + { .compatible = "maxim,max17201", .data = (void *) &max1720x_data }, + { .compatible = "maxim,max77759-fg", .data = (void *) &max77759_data}, {} }; MODULE_DEVICE_TABLE(of, max1720x_of_match); From patchwork Mon Dec 2 13:07:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Antoine via B4 Relay X-Patchwork-Id: 13890596 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2818ED7831A for ; Mon, 2 Dec 2024 13:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lcZ18Acyfgn1qx2AlpkGRDPoqylUNnc81TgbKsWflLU=; b=RR3VfqVun1JVoJ+TqXY6JiXhzC uQ2p8GFkc8ZNeAx1uMB+erIJqIi94tPl8R8VDo7mAU5V2ocMaIjC0E1omQVDBaqhMo4Dz2j7hbkhx sD+dB69wmPWZ4I+GVKwjMyI7Rtg1vkLe3wxtz50jbHhRXkRUEQ952kcf+MrzZFY9jDdEPDlxBg+EZ LGPvNs+J2yHYYZ9Aj6utmV9pu2FwmV1ZkhG5IMgC4GKMx9Bepc1yGokyDPIOk3cIQtCuu2pSpbFHc Q9gGLJNcC3HWDOek45K3WUlMK/KtqB+db6FSmhLQVo1wRoy5D15dSEo0VKkQeAyWsUmIaaa1Tonbi NBqbPVog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tI6Ev-00000006C7L-18vD; Mon, 02 Dec 2024 13:13:25 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tI6A2-00000006BFi-3we2 for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 13:08:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D89E45C5CA2; Mon, 2 Dec 2024 13:07:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 53B2AC4CEDE; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733144901; bh=jEINaNWGAcKMa2bATL8ktCQNfAWj8oZ7TAUZr3ESYOI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=JHZk/A6i6SsD16eTksSkewswkSr6FifkMku5R3Wk5YVIwXPHjeCf9xqtwvOM5wb99 dhwqmSFWznNwGR1fvGGGS2Rk8GOJCpQ6r2IATIJRzsnl7Sf95x1p37xuyTTXxk/xeH C+/7ULdyRLCBcyrtSjgpqE3BW7Eetk+UBCQFN/ne6aRagI5xjcPOrusXK/XJhL3vRj XUsV1NVRgkJQJcHPQ46rJEw0yM6z8NOZ87xFHl0lp2zCzl+h6Eb4G8jv2az3dox2oa Rlo46AmrKTM6FauX8Hju/PPOMlWeROSQlVLUipQuXLWuFEsT9LL92mgNRBJrAOHj1R uNrdYJit1o+eg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40D9BD7831D; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) From: Thomas Antoine via B4 Relay Date: Mon, 02 Dec 2024 14:07:16 +0100 Subject: [PATCH 2/4] dt-bindings: power: supply: add max77759-fg flavor and don't require nvme address MIME-Version: 1.0 Message-Id: <20241202-b4-gs101_max77759_fg-v1-2-98d2fa7bfe30@uclouvain.be> References: <20241202-b4-gs101_max77759_fg-v1-0-98d2fa7bfe30@uclouvain.be> In-Reply-To: <20241202-b4-gs101_max77759_fg-v1-0-98d2fa7bfe30@uclouvain.be> To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dimitri Fedrau , Catalin Marinas , Will Deacon , Peter Griffin , Alim Akhtar Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Antoine X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733144859; l=1565; i=t.antoine@uclouvain.be; s=20241202; h=from:subject:message-id; bh=RTgptgGDXIpNksG2RFyyX00KmvPw//2EuQKYPNbTnPY=; b=lCO1iSdVtfEpPAC77nh9P49nbswY9iqm8xcrLTlOoQ/khMbOZuUNCBRNJ2ElFwDs5zIuHMEQL lx6XWdp54GpALvXJ3t8KOkKVW/Map6F2UCEye4rZu31wIix5Hm/sjwH X-Developer-Key: i=t.antoine@uclouvain.be; a=ed25519; pk=sw7UYl31W1LTpgWRiX4xIF5x6ok7YWZ6XZnHqy/d3dY= X-Endpoint-Received: by B4 Relay for t.antoine@uclouvain.be/20241202 with auth_id=289 X-Original-From: Thomas Antoine X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_050823_081266_FE11F05B X-CRM114-Status: UNSURE ( 9.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: t.antoine@uclouvain.be Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thomas Antoine As the Maxim max77759 fuel gauge has no non-volatile memory slave address, make it non-obligatory. Except for this, the max77759 seems to behave the same as the max1720x. Signed-off-by: Thomas Antoine --- .../devicetree/bindings/power/supply/maxim,max17201.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml index fe3dd9bd5585618e45220c51023391a5b21acfd2..417fc2c4a1c1961654bc54ec1ac24602012f3335 100644 --- a/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml @@ -16,6 +16,7 @@ properties: compatible: oneOf: - const: maxim,max17201 + - const: maxim,max77759-fg - items: - enum: - maxim,max17205 @@ -25,11 +26,13 @@ properties: items: - description: ModelGauge m5 registers - description: Nonvolatile registers + minItems: 1 reg-names: items: - const: m5 - const: nvmem + minItems: 1 interrupts: maxItems: 1 @@ -56,3 +59,14 @@ examples: interrupts = <31 IRQ_TYPE_LEVEL_LOW>; }; }; + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + fuel-gauge@36 { + compatible = "maxim,max77759-fg"; + reg = <0x36>; + reg-names = "m5"; + }; + }; From patchwork Mon Dec 2 13:07:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Antoine via B4 Relay X-Patchwork-Id: 13890594 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22917D7831A for ; Mon, 2 Dec 2024 13:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F8TxeOJ5sbsSSvTyCxYc77FuJJZ5C+nxlerzWVaAJl8=; b=a2vyKu5eJGeK9dfqEW5s0Q5eYI BP9OUXx+jCJuLmt2S2ddUyK60FBwJmh3ZBGVg6RuFWx+5CrMiydXm9V+WlROu5ph0tDuMX5ZyvbSg pNLBkq1i6OdeU+a+P7HPkPMKCi3glv9BQtT/H5ABNUelJ44S0JVu7i7PIzKr2AA1fIyGg4q3YRXzh dInBmqXvYHJw50OYG5AAi+381WSjp4Zj9qHxgU27HS9TnjD63I0qjt3xMXQsId0f/4XMsLtBSPrcZ +g8fNUBu7oFhozdlyAL3KbwC/EDlzaSCQuozvMyhzEI+vqw4f9Eu8/17904yM3nwU1q4H53n8VLkH lHoaJn7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tI6D0-00000006Bnb-0EaE; Mon, 02 Dec 2024 13:11:26 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tI6A2-00000006BFn-3zyV for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 13:08:25 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1B0E85C67AF; Mon, 2 Dec 2024 13:07:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 6B835C4CEDF; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733144901; bh=Ef2b8udLHuXGFaC72TBWdqafXfxqKV9+55Tg/ue3f4s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Jz8XLa9as+dSkLfDf/HTz3nQ8di7RoxUnOzJj5YZm7N0tuhlpEWQteg5decI5cqy6 si39MXQTXML09R5D+8Ecrvp9aNfXMK12PuITXtrIgJgtd8NQT41dh46bs6b0tljKGl vWsFh2LXgT5xJLn9jP/vxSBoUs8X1WJOB6te/DK6c9qoslNTITYIAfvxY5pfIqXP04 PrMxFFJ01gai+TO2BByJee1zn+rb4HUuGSh6QCDHa47BZ4SHzJiwP0z1p8hjwcLMGm cKBAyGVSPhiELkoyu5xxJIF7UzutgkHc9zeN6pWR96ZIWn4I1uF/QfmOXoORsdUgda 7HhfmIxkT5RTQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 601EAD7831E; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) From: Thomas Antoine via B4 Relay Date: Mon, 02 Dec 2024 14:07:17 +0100 Subject: [PATCH 3/4] arm64: defconfig: enable Maxim max1720x driver MIME-Version: 1.0 Message-Id: <20241202-b4-gs101_max77759_fg-v1-3-98d2fa7bfe30@uclouvain.be> References: <20241202-b4-gs101_max77759_fg-v1-0-98d2fa7bfe30@uclouvain.be> In-Reply-To: <20241202-b4-gs101_max77759_fg-v1-0-98d2fa7bfe30@uclouvain.be> To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dimitri Fedrau , Catalin Marinas , Will Deacon , Peter Griffin , Alim Akhtar Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Antoine X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733144859; l=718; i=t.antoine@uclouvain.be; s=20241202; h=from:subject:message-id; bh=ucQGph6fETnDzKTb3OS0faNFj61tkZWbwahqqiH/Ct4=; b=y+t6HStF+LnskISJskU8kHe4uHWfGmyfR/MuVZ77JEhlbV3eIjbigVk184uDWmagPkGdPINld Nd5l7ROflaEC8lFm6zxOk6bbNyZEaeI62TMXepJKVlkYcn2BsMAic7w X-Developer-Key: i=t.antoine@uclouvain.be; a=ed25519; pk=sw7UYl31W1LTpgWRiX4xIF5x6ok7YWZ6XZnHqy/d3dY= X-Endpoint-Received: by B4 Relay for t.antoine@uclouvain.be/20241202 with auth_id=289 X-Original-From: Thomas Antoine X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_050823_047942_9BB507BA X-CRM114-Status: UNSURE ( 8.56 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: t.antoine@uclouvain.be Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thomas Antoine Enable the Maxim max1720x as it is used by the gs101-oriole (Google Pixel 6) board. Signed-off-by: Thomas Antoine --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index d13218d0c30f458d9c555ab9771a1fd9139ce1aa..e7523e53f2ed26bab39e64f3b2d8c8afc7c1a1f0 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -675,6 +675,7 @@ CONFIG_NVMEM_REBOOT_MODE=m CONFIG_BATTERY_QCOM_BATTMGR=m CONFIG_BATTERY_SBS=m CONFIG_BATTERY_BQ27XXX=y +CONFIG_BATTERY_MAX1720X=m CONFIG_BATTERY_MAX17042=m CONFIG_CHARGER_MT6360=m CONFIG_CHARGER_BQ25890=m From patchwork Mon Dec 2 13:07:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Antoine via B4 Relay X-Patchwork-Id: 13890592 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D410D7831A for ; Mon, 2 Dec 2024 13:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kgnNY1XGUhWbZAxftEEOpG8eFu+AvTvB89t+IC5SzMU=; b=LnqQh/oPG0Yb1odejlV0L76qyX s5d0Df1xfnVgQaY+kh0Wwx2n12DxN90EZ3bp5DUBmE9hd78twoBnxU2abq/flm4h4FXqoGejxFKeA Qzh0bzCfXnt4pJu6zXrO0OsGddhsERq+kciryDRxw9mO1b3Ojm1/iwxArdbNwiyTa0GlLIdEL3VjZ jCoWjjnSQ5W1nvTyuvtx/V+XIixp9s2ccsxxQH59jyokS3kvuVhDzB4NcAHBWFLUyFydhHIUkiifN g9B3Zzjdw5tjxOa/uuN1JD+bwRboXrrLDidrh5ACVyH1IoaFDfQaP2kVLha7l3lUfhuB9lME9RTFx hGWfaHhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tI6B4-00000006BRC-3NIs; Mon, 02 Dec 2024 13:09:26 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tI6A2-00000006BFl-3XqV for linux-arm-kernel@lists.infradead.org; Mon, 02 Dec 2024 13:08:23 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1338D5C6794; Mon, 2 Dec 2024 13:07:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 842AEC4CEE3; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733144901; bh=cXYTMS1lyw5zl7xOiAP9Dpko8FpjZMGOckLkVavurEY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=cpOC24Xg4W2ndtFkgwlm2AeF9Yv90uBvHYCBgOEVjUSZoXYzT15uHj4BRFhtcBvpG PyJWebaESQNK8jDU4t5yhDnx7uKrxjWLU96//NUXRfcJV9LXtcuP1q4heINdpaAuLT hjEFXKRJP6m14j9WvSPX0TPJm1QYXJ4EFY+dOB097McQLMYqt4CHui5rfZcoXPtWFd 5ubXky7WfPDUAxPQyNRk8m4jzKRNh0mE5Zvzq1hncqxUJKrf1tAfL07wn/oraJfZCx EGcNscCJmdNaKvRRf0y4h8ktQdn8iJaHgfnfEa9N0JaKKFm6lYnoH2GCH7rr4IrX2/ UhLTom6hIMyUg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CA05D7831B; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) From: Thomas Antoine via B4 Relay Date: Mon, 02 Dec 2024 14:07:18 +0100 Subject: [PATCH 4/4] arm64: dts: exynos: gs101-oriole: enable Maxim max77759 fuel gauge MIME-Version: 1.0 Message-Id: <20241202-b4-gs101_max77759_fg-v1-4-98d2fa7bfe30@uclouvain.be> References: <20241202-b4-gs101_max77759_fg-v1-0-98d2fa7bfe30@uclouvain.be> In-Reply-To: <20241202-b4-gs101_max77759_fg-v1-0-98d2fa7bfe30@uclouvain.be> To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dimitri Fedrau , Catalin Marinas , Will Deacon , Peter Griffin , Alim Akhtar Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Antoine X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733144859; l=1033; i=t.antoine@uclouvain.be; s=20241202; h=from:subject:message-id; bh=C6G2HNmCWsR7T7ZeSn//curscN+6Mz2Xd6Jnx+k56sQ=; b=fA9D6CBCX7gFNZtMJUgL0dFcwNCYI4mlMT8MAW2SwI7p3XgJFaWYEPyx7u68on+520i20JHid sicaCn2SzJGABlQm0g5TkuRvsBAZOKtxj5LMxDQNSbhwKrusQCJaTxs X-Developer-Key: i=t.antoine@uclouvain.be; a=ed25519; pk=sw7UYl31W1LTpgWRiX4xIF5x6ok7YWZ6XZnHqy/d3dY= X-Endpoint-Received: by B4 Relay for t.antoine@uclouvain.be/20241202 with auth_id=289 X-Original-From: Thomas Antoine X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241202_050822_930859_39678A47 X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: t.antoine@uclouvain.be Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Thomas Antoine Add the node for the max77759 fuel gauge as a slave of the i2c. The fuel gauge has been tested and seems to give coherent results. Manual activation of the charger via i2cset shows that the sign of the current does indicate charging/discharging status. Signed-off-by: Thomas Antoine --- arch/arm64/boot/dts/exynos/google/gs101-oriole.dts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/gs101-oriole.dts b/arch/arm64/boot/dts/exynos/google/gs101-oriole.dts index 387fb779bd29ea3812331a7951f03b181c5fe659..4c45dd6fd0173889234b7b04d7abb4b382c7706c 100644 --- a/arch/arm64/boot/dts/exynos/google/gs101-oriole.dts +++ b/arch/arm64/boot/dts/exynos/google/gs101-oriole.dts @@ -90,6 +90,13 @@ eeprom: eeprom@50 { &hsi2c_12 { status = "okay"; /* TODO: add the devices once drivers exist */ + + fuel-gauge@36 { + compatible = "maxim,max77759-fg"; + reg = <0x36>; + reg-names = "m5"; + }; + }; &pinctrl_far_alive {