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: 13890583 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABA408F6B; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733144901; cv=none; b=l/eOsTKP6vvcvFNoiDGwhfzCRLx1BghbZ13ILa3XGI6psCN7lokl81qe0GLmOO9NLGNcDXAM6c8qwl5mauj5J4fNLkdNu3iAU2dhX2iDpbSUVbRRnf3mO2JEmDnftRZL1M4tcy5kEQtmzYweXprGs7L4clwGfW2F8Qti6awoRPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733144901; c=relaxed/simple; bh=IQep3vYgtWd8FCL4D6A8WGJH6FjqAultu89nScGyyPo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Zlrr7FzfGlq78BtS7cD5SiEEmmz4t42XIDIgGT0y/rPSQTE4+0uzgIWd2AxkH6R+UxM2+1i6dqa6hyGlICNYIJUuJ+RJ1DCIav2eh//3PXvjlHT4rUywHRz5SkQVyEuowc8UjZK8+98SKKklaVF6OMAEpqUIC38EAxWQ5k6+pWU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jYqXDeHD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jYqXDeHD" 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 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Reply-To: t.antoine@uclouvain.be 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: 13890584 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABA7AA95C; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733144901; cv=none; b=hyCIQmiuNPqwPD0Ceewzxwfj3YABLsvFmNl+Kttg9Sh6ZeAD68dV5/glRSSm1Sb+vT5t93VLP5C2UwGSL1644ddd1Fg/TceZmdu8SBQO3YjIbQcXwCF5IimQacTJY2W0VGAb8EQ/zvsdGazc2DuhupC4J2ZWGzdArKOjRfw2We0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733144901; c=relaxed/simple; bh=jEINaNWGAcKMa2bATL8ktCQNfAWj8oZ7TAUZr3ESYOI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T7RHcxYUXuo941odrcC8/HCE3MrGAz2SVhOAa5w8LZR7QiZV/p72oaKN8QTdRF9NXWGYhYK7M7wNfjGTa84iT6UX4e1XNjIgBQHS0+JBlC1V9a03NQ1s1PLB9FvEUzI1UQQJCNtin4RgJP31xC2NUlbspamhcttF3kAIbTvmbvI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JHZk/A6i; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JHZk/A6i" 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 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Reply-To: t.antoine@uclouvain.be 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: 13890586 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E16E01FDE05; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733144902; cv=none; b=JFcQMUEAN98Hq6j4mkp2OoaB+s+aOEgcGZ10Zlcc+IxWoIWy+d94aXWPKhMH7lrenbwwdCeVVJYZTRajrHPmj5f4hAYq7wsXGqYJDx7Fcfy2B9WJ2C2t+XnwOuC5F7u6QV5w81dtDZaW0r2IYlwN5Snae12egPks1qapItM0OYY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733144902; c=relaxed/simple; bh=Ef2b8udLHuXGFaC72TBWdqafXfxqKV9+55Tg/ue3f4s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Nob6B4p3ycQl1w5NjwIrLgMBj1ZaoxbwDLCzHAvJPnCncME8/wX+xfe/FwFOQl4CNu3CdgdC7MEJ3QPiSzVimlMYGhstK2dC4DF/QJPUyCBvaCiRDrXNvV6zVjvGD0qaTq4wtg7oH/HNHwJkOh+mdRDfPEcreLM/Ajg2RmO+eK4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jz8XLa9a; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Jz8XLa9a" 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 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Reply-To: t.antoine@uclouvain.be 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: 13890585 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E165D1FC7FF; Mon, 2 Dec 2024 13:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733144902; cv=none; b=Z2Yg72YbgtnLrPgMp4CdOxoVVvj3CWY3c9vDzBBmrG8CL8IDGNf6HdhKftU7NP78hYdm7ZN0ziUya0Gz3zy6x9mp877Y0zbF1VWWLazKiHC2Nm/JRPsjKlwMatpyzbe/zLd//n2DQu1Vkvv1fdfUgyBWwRRTU5ODZbqjvJ2snGc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733144902; c=relaxed/simple; bh=cXYTMS1lyw5zl7xOiAP9Dpko8FpjZMGOckLkVavurEY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cSIrrz0ZyW24BvN1vGNGpEWmvMi0Ybp0GyEAYsikFAvjauei0DDHPsAwWlEu0fVT/woVrTkvQCbIMmnS8Uf/o+JR2KBEjUeioQio4GC1mPIR4Q302m+0TnX77tizkMKMNlsor0A2kjLL4JSruLM+f13NYX+jAAswR9gmpYDrYe8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cpOC24Xg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cpOC24Xg" 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 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Reply-To: t.antoine@uclouvain.be 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 {