From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB113314A73 for ; Fri, 27 Feb 2026 07:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176513; cv=none; b=I1GT91y8B6Qfg7fCh0xP8M6YHHdGwTSMAuqftmM6L1IVwIzrEO1csUYdTXrDuFjoD+Gaam4pXcqtKgN9IgBbr9sU7wPhexZB/tep9mDo8SRo5OmZ6+PoCjfE8qH0EvPfFo11hy8u1DkIDt9yOnN4kOBP9X3uKZs5k9FY1IICkOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176513; c=relaxed/simple; bh=/augY00zIPRmjio8jqvj1SCmtf+8/FE6pZ+zQ7AN0mI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C35e4iENkt31LVgLqUfEnNesckcZd32VwsBjkLp1luF6+1AoJI0QMQ7hYpmnZbRRwTqaZx5X+g2M1KHYzD9bB5yrLbRmetsf5fNiUmB04PONaDrL/Bs+k37xQdaQi7/QE7S573am9t7XHOgvTbBPLJ0hBNyu/TvZ+1k/nDqnl5c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=BZpfxDqx; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BZpfxDqx" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-b7cf4a975d2so223091966b.2 for ; Thu, 26 Feb 2026 23:15:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176510; x=1772781310; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PE+eVQ/Q4S/u1SH29EMKN7g0w+RRX3/eaSSvWEMkQE4=; b=BZpfxDqxQskupfXeSV3uxV1fqMm4Rfz8Qf1Y31jq15Y2wOhb9KEGkP9RY/m3XMxe0g 19ycnh5/USh6CT7EUHrrNKsPjG/NeqGrADETztc4XyvjDqAzL6koQt5sz7aZSZPad7VU 5ilLmhpR4LBxMR8XIdpdMAJL855mdTtTF7t2x3i1B2Yzl6pvq0kOJTr/unRahXL8VkXF RtVTVFZLKzZPkKB9Teiy+Ubk0Zqro7PGoTvDB9U1JgFWaspBGm57EcdizRPiqKpd/2vG eExJIJbhBxIpkkwPDN8R1Ot8etD4H90bGoUstH/nbjTCGYxa08LO9DIfkjD/EB5/9cfx NogQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176510; x=1772781310; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=PE+eVQ/Q4S/u1SH29EMKN7g0w+RRX3/eaSSvWEMkQE4=; b=TbmXDQiWVoaz4uXcrMqmz79AvbFXkKbhA/FOHp03cwI2wQj4VdpFu7uVBsPjjU+2id IzWayx1xRQ5vkK5cj2VNrU1ovo9DmbHWkcFrhOmJMCnSIgrFWlk4W9oTcRkEXs/yXYEr oTs+PMFgbDwdpZruYYAYBhdBmu2/JL5bbVX99AQJH81Rvn0b2Xhhk1egO2csxISDZraT BYH9Hu2VlxBJJSd9n9OdljTuIqzlQg3EE2LkbE4DaFQijo0PuWy9x1Smv0QmvyXGioGj penlaUKRU28OLNRFYaqPcsuEEtYHiF+bwkYa4C9vFJodlBFR7J62kjizuf1eWEdqFhId 8Mpw== X-Forwarded-Encrypted: i=1; AJvYcCXOpEoQPh94rsDAQW2O0q7Qm4J+C+6Jo5jYjHQQaXFulAdS82luxR6OzeUCFQyu8ILxgka/5W4Xg8qMp2o=@vger.kernel.org X-Gm-Message-State: AOJu0YyFkzaP74Nn9CRh7Ps3fVgHbr8NrlfaL6wDmauiW7B9B0ssuZfc UIemQN2U+xdRXR+yW2dXb/09tdQfO0y/UgOhtLOgrCqCtzTPTbrMronnBL05miCo7PU= X-Gm-Gg: ATEYQzwp83FD1C116+rfD5UeBsNNXXghF1ayH0StCbhfIrt84eOMnUoqn6lsu5rldXG /4qD35TcijFhtlVNnJSMuVr7Vxng1cIZxrnhg240EGaRPcyWLeE+pbWgFat4/s+JYVsFED4gOOv stcJiLZcBrcRtPPnzJMdIS3dZCQ3MXkdviqPwp8grphJ+1bX6zUQoJaJh/Wt8P0L7LXKq8/SsTF e7mg3K6+f2E3yORjn25rWp83T4sNVRb4XJXDbR83C0bWBche5AbteVx+NIEhtatXKRM0qD66k5u cJCdeYM+qB6qd6Zc4K/ARS3cuBH8+wKV/+hofni3X3o8eelGlj2f98aX/Q1qTj4lSaZahcpZ9Dt /+ctSdsaLExwxiVA6HYDMfhxL57fadQKo4CmQa8W8S6WPKDFul0oP9L7eVoCJv7NoTk3TS/8SqA n23k9qqKWTOnlUwL91plbxYKM+LWz3Koxx8HGv5+Xh78+D2ornvfWzHreIZnQRwLffnR1dWe7G6 EEIBs3no1jmbhCy1A== X-Received: by 2002:a17:906:209a:b0:b87:38e0:4403 with SMTP id a640c23a62f3a-b937654e1d9mr59219566b.40.1772176509910; Thu, 26 Feb 2026 23:15:09 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:09 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:06 +0000 Subject: [PATCH v2 01/11] dt-bindings: power: supply: max17042: add support for max77759 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-1-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Conor Dooley X-Mailer: b4 0.14.3 The Maxim MAX77759 is a companion PMIC intended for use in mobile phones and tablets. It is used on Google Pixel 6 and 6 Pro (oriole and raven). Amongst others, it contains a fuel gauge that is similar to the ones supported by this binding. The fuel gauge can measure battery charge and discharge current, battery voltage, battery temperature, and the Type C connector's temperature. Acked-by: Conor Dooley Signed-off-by: Andr=C3=A9 Draszik --- Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17042.= yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml index 14242de7fc08..055d1f2ee0ba 100644 --- a/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml @@ -20,6 +20,7 @@ properties: - maxim,max17050 - maxim,max17055 - maxim,max77705-battery + - maxim,max77759-fg - maxim,max77849-battery =20 reg: @@ -28,7 +29,7 @@ properties: interrupts: maxItems: 1 description: | - The ALRT pin, an open-drain interrupt. + The ALRT pin (or FG_INTB pin on MAX77759), an open-drain interrupt. =20 maxim,rsns-microohm: $ref: /schemas/types.yaml#/definitions/uint32 --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F0392BD11 for ; Fri, 27 Feb 2026 07:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176513; cv=none; b=Mrno4/mNdjnImDpbUWEkY3fepyEr0we2/UnswiV9dYiw8zYvsyFCDHeaV0oPgfmjhfhMWL6jykYE46EsKtTKoktHdhjGJGDOms9SWU13ZWjztMx3+44vHfj7II91si8cQieAH+bBlK6rSIuRzR1bSsrSrt4CjL6zc9KJ5OwUBuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176513; c=relaxed/simple; bh=3JVAjTwT3ohLd4vEPh2z093Td9rgxW04VPfzBtVCgZw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h5JhDPPh0e5gjvG0XEryjpKI7m5/fjRboilbp3tPoxE2g6RRUzaWzR6ozA2yiOSn8TpNYNXrjFEuPgLYoif+HZ9UnBUJOO1rO/HoG/9tFr6yBkAmG4xBdkbET2LdrwmZ9CjCXc3kaR+Qw1kkSbX3J5iJjGEWBBzwdOd+JhaISsQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=O0xMzaZc; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O0xMzaZc" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-b9361c771e9so225289766b.3 for ; Thu, 26 Feb 2026 23:15:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176511; x=1772781311; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=cVZfNr8fycE2VrenjkdzC65ZyvHlcR25n7A+WBQPeq0=; b=O0xMzaZcya6f9y+Bm3XLvOVDdnIz/z9Eu2xZzHFYTDkXYHSKknvXyfHwK9OwJ8UEEE mcXtNSasw0aqtsk9EfuWfzkIF2Cr8RQST9S5qfOmVN5n3lGKAOg+ZrXUc/bHcylqFs/X u/k3hAbjVHLEwv5DQrD/LGtk2LazPm8669zSHfIt+29xBfPmYQPOcDoaRxuSiohAZh+b FlWy49/D+J+f4w9yVfdtDLvOpeXzt3/55o7/x9smLnMGpg9lngSVcTEwLWz48CR0zloj N+A8dNXwXtj/Fvf/qkFVj1kBz7kAtEodlognniKd88Wgy6POH5QkF1TRbDgGBFuepHN0 h/iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176511; x=1772781311; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=cVZfNr8fycE2VrenjkdzC65ZyvHlcR25n7A+WBQPeq0=; b=H4O2CsElE+Tz3yYa7DQYUHHKTOmJEdfCVDGuAlQ49fLq7V6f3lm9WkDz6RAcZ96SVB N/b1tqWcmQfk1Bb8CzQhBKqPxDYDlP+uRKNr/3A2RqwUGHZ3jf8KQnpIUvLQnS3bexjJ B+eGhLwTJdOCm55FdLcTyyjHN33/V6fkZvaxjVnBjaHf86TuGCXAmWKZ5kdaimCpJx+3 iJaF3o2vCqUsIvJEuLpw9Cppaz3VoteoinGDQoCks9k8HHgCxfmlTIXLh7maop1htDIr TbfHkpYukN7JIpFe0xsgzlg4hIhBux1YZ/JSD9+e8gZfP4jH6VkKAQkgx0SeZyR2K5O2 7qmg== X-Forwarded-Encrypted: i=1; AJvYcCWf4MV5QX+4yRZQVPEeE36GbNWimPCu0T0dxtU2gCaJ6MTj8TUY9zhg2XDPk3kGgwHPkUZ4AT6IpvoUM0E=@vger.kernel.org X-Gm-Message-State: AOJu0Yzf3wyPCtGV8iSMw3JA7jlr3ZYrtnFCOaunGI5uMsmVjRBN4hSI hyt+0TSElUlyHEjJ3IRXrpQWmnUYGLxt9jTfpXFAWbsPNoeP4q1cMqiYiEakNKD5eaM= X-Gm-Gg: ATEYQzwWnuF3oBr3rYI9/To/b7UdOs9AdTydWQPjR/Br7UiQhJIoapMjNfAZf2wEbzr aWpuKnGEgBZEHYI+vRhmD13X2nRgZIyRX4HzoHIuW62PlpFXwY3ODK8jUtADWk0hyBXRqskEZzo o6eTPllDhYCG8WlNVe1WfzFNGexsVfklKFtBSKk10EqghjNiJ0t3la+2MEsjEtqHnr4TdCH0DS4 dhmrglJ8amUZ9w0HjM2aW8jj3wphc0n/O10nANH5o/wHurKetqVcun1QafDvqhB4zunaXwsMEhz riz9pljTvcXUqyW1dbM/ScEHpjAq11hfblkVh/hB662VXjzhGQ1nKJ+zEuhkVJT0J/Ie+1Pf5d8 DzMb5MSLkebpGspdEKtqcJXvbsyCrG9SDtAPBkBPNccYrbQky8W9cAoowkFtEbNbRhx0Ywytp0U 44rGyc1VLJNjVIizRGcVeucYwSzmQG/qhmzHMVua3Ufn4tpWSscHoQDCoBd/D58oOeGr3WEQp5z 36F7oHK2H94b/jXkQ== X-Received: by 2002:a17:907:3e9c:b0:b8e:7d43:edd7 with SMTP id a640c23a62f3a-b9376510131mr98725866b.30.1772176510504; Thu, 26 Feb 2026 23:15:10 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:10 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:07 +0000 Subject: [PATCH v2 02/11] dt-bindings: power: supply: max17042: support shunt-resistor-micro-ohms Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-2-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Conor Dooley X-Mailer: b4 0.14.3 This binding supports the vendor-specific property maxim,rsns-microohm to describe the value of a shunt resistor required when measuring currents. shunt-resistor-micro-ohms is a standard property with the same meaning. Standard properties should be used instead of vendor- specific ones of similar intention when possible. Allow this standard property here, while also deprecating the existing vendor-specific property maxim,rsns-microohm. Acked-by: Conor Dooley Signed-off-by: Andr=C3=A9 Draszik --- Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml | 6 +++= +++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17042.= yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml index 055d1f2ee0ba..25ea8e19b980 100644 --- a/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml @@ -31,7 +31,13 @@ properties: description: | The ALRT pin (or FG_INTB pin on MAX77759), an open-drain interrupt. =20 + shunt-resistor-micro-ohms: + description: + Resistance of rsns resistor in micro Ohms (datasheet-recommended val= ue is 10000). + Defining this property enables current-sense functionality. + maxim,rsns-microohm: + deprecated: true $ref: /schemas/types.yaml#/definitions/uint32 description: | Resistance of rsns resistor in micro Ohms (datasheet-recommended val= ue is 10000). --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0B26255E43 for ; Fri, 27 Feb 2026 07:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176514; cv=none; b=DAcj4PI8MvNtK27SDqMfcGqUOStUVCjxMgKAV8FzaRVwp+PU3Kyg4yhd9MBHZwKFq58FDu4HZwyFK1MvTmqYEL4dG+OujPj9iTVPRBtPFxemWWlzjs+wBNvFQj/nwd0let0EruEO8Lp6b4qNcTzDEW4BxcA+j0Cb0GSLxKLM/i8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176514; c=relaxed/simple; bh=tN/WXJoP7ER+xNNQ3wof85nYFtwctlJaEphC1C0qnK0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UnDHBo3w4XQKn+70XkjYIJfEVyZm3n2pE8tYdbfRaZby46hQm25pMLPfdDM5GZsucTRrtKMypbggxzF75nwjmmUDYRJnXOTNetBkqeA6+wI+KO+rpaHDgaU/OzGyXMpCPGXfodvSzh3ZJTcXYpjKGjmVq4j9s/5sez93yds8qP4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=S6nxxV/N; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S6nxxV/N" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-b9361c771e9so225291366b.3 for ; Thu, 26 Feb 2026 23:15:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176511; x=1772781311; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=46zMNmq5bUi3mZ6HnIKgyhoL+nelJFQRkft5kdOS8cA=; b=S6nxxV/N10+VtAOO+TfHZ1+41AIEUOqRkUvAnxa8kJzCaeLpp7Ic2AGjcH/m9mCjoa rUJnxLv8XvwmUZwRq84xdWQ4M+Yjy/N82cn574oWLW8RoKvJbd0iSBStRq4ZIpkThLv5 zLiA6vyRct7RaZ5NgbXQ/lKLO/eQ3TAtM+0hCQlq90USZLWXNFaF1/gmHtoheCc4uoPX OlInbaau+mG8ZGj1bHIo+KaxNIe34mA9zCdO/mst5gC9HnRMIDYBKEvJ8hVJvnBWBZws qcuJ6Uqd8U6YkuV+cOMc82/I43h/7OsneZ13GH2ypQ91orq0XoUnLp3gpP5EMqiw6fzS efPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176511; x=1772781311; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=46zMNmq5bUi3mZ6HnIKgyhoL+nelJFQRkft5kdOS8cA=; b=hN6Y8qONSw5zgZ8h1FtqGbUesfVRpSUaiwIeDNtYNgpdk2qGvAxZRg6eK8dHEEsTGZ jBmnXkfn9GF0oySn5Kb8VMcxcePyTtok6ymaxAlM+lsXYMVITkQIfAzbK8hJ9Mda8jFt qsc9TW3PFEewuavTvaQWtYZvkD9U9jufD/XjZnd7V2jK6EABaEw5AXaTx5hcRk7SVk/r G/H6lpqsYRUtOk5jS/S3OVa+pGxUy2McpgHszfHKHeNY90BCcNysvCchkmhKEmHzV/iF LNpydqIoVgmI1FrQ3b75QynvIwWs74/FNnLpPucz1eyEdV3uIZBBf4AdCcvbOeegL99B 1/KA== X-Forwarded-Encrypted: i=1; AJvYcCWWYm6dqo94O96tJ93SKwzgJ+4l5iCWiRN0x4cid9GAfO/WoLgfGuf9p6zx3OVgPrwHXVa47+NJk6aYc48=@vger.kernel.org X-Gm-Message-State: AOJu0YwR1rxiwtWR4oV4cMfNmQygyLO0EzS8p72EzH/HejnVU6YI3bX+ LFrGNtNhVqLJlcyRSOqcqLoE6hQMimZFUlrVs2/281IDj4lTz8WzVWw3ZrVOwQlKhOg= X-Gm-Gg: ATEYQzzKURpVqq5kSG/AE/Y5c8UFlJ5qkh3tsA42NQHUcwaUwsBhQjwgfvn0Rmgrjtu qTL0Snm5CAkiYOtDNk5nVO4Sk6J1AqE8P6em1kEc7X+CbTmaFw7xUruZsPkeT3ctNTQlL+1GKaj Zt1Yo3X1BG3tOyt2GRsZylHpx+v/o7GPPkpigsS+pmZfK/Sh+XU2bXG+qTiY+Cu6xUyW65lq2On PVwABzj7+0GnjQ5Ew/at8/6l4RXWn31N5z+6FsS/keRzWannxImy2n5yO+tazpbkOagSpfmV8vl ZVOVzYGhly2DuHzMtGSlNw+ob7CNENPzpKGsTEu9q/bcvJO0p9tu20LIVRGVaWhRiImpeVj2udC AdIV2/Kylrggv/wak5zNJSZ+69YhVJ4g62FY5PTyAiKzDLZhkmp5kLWNHLHpwl97a8pX4cwMQy3 lbGXaeR2JUAJbg/GlgTvCbYs1Pg47AeJf19jmP+psQsEVgisR0Z4sVzf+bLOq0u691ZvgrjfYYB Va8/UA5jAFZdoXVHA== X-Received: by 2002:a17:907:3e9c:b0:b87:1839:2600 with SMTP id a640c23a62f3a-b93765109f5mr93414566b.33.1772176511023; Thu, 26 Feb 2026 23:15:11 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:10 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:08 +0000 Subject: [PATCH v2 03/11] dt-bindings: power: supply: max17042: drop formatting specifier | Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-3-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= , Conor Dooley X-Mailer: b4 0.14.3 | denotes a literal (preformatted) block and is not necessary here. Drop them from this file. Acked-by: Conor Dooley Signed-off-by: Andr=C3=A9 Draszik --- .../devicetree/bindings/power/supply/maxim,max17042.yaml | 12 ++++++--= ---- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17042.= yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml index 25ea8e19b980..242b33f2bcba 100644 --- a/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml @@ -28,7 +28,7 @@ properties: =20 interrupts: maxItems: 1 - description: | + description: The ALRT pin (or FG_INTB pin on MAX77759), an open-drain interrupt. =20 shunt-resistor-micro-ohms: @@ -39,31 +39,31 @@ properties: maxim,rsns-microohm: deprecated: true $ref: /schemas/types.yaml#/definitions/uint32 - description: | + description: Resistance of rsns resistor in micro Ohms (datasheet-recommended val= ue is 10000). Defining this property enables current-sense functionality. =20 maxim,cold-temp: $ref: /schemas/types.yaml#/definitions/uint32 - description: | + description: Temperature threshold to report battery as cold (in tenths of degree= Celsius). Default is not to report cold events. =20 maxim,over-heat-temp: $ref: /schemas/types.yaml#/definitions/uint32 - description: | + description: Temperature threshold to report battery as over heated (in tenths of= degree Celsius). Default is not to report over heating events. =20 maxim,dead-volt: $ref: /schemas/types.yaml#/definitions/uint32 - description: | + description: Voltage threshold to report battery as dead (in mV). Default is not to report dead battery events. =20 maxim,over-volt: $ref: /schemas/types.yaml#/definitions/uint32 - description: | + description: Voltage threshold to report battery as over voltage (in mV). Default is not to report over-voltage events. =20 --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B0983176E0 for ; Fri, 27 Feb 2026 07:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176516; cv=none; b=gJlhk5cZ0HYuG4wvDOVL5Lapu8DzzwDjzTtSzQaCHmMNObv5OS6Ks6HyX4/laX7bNilHuK4Vu1Rk7yi0heW0HxQgWoFbjZhTuFgZg0Bh7dUUOj/gUZs6z5+AQJFIy9aORFswGY0IDtq4a09zEdCnUyPT33eKmsjUX6e1cBs8JiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176516; c=relaxed/simple; bh=kKTFsrTeIjXnchyGp8SnByWTExbxMZ64ELwHVKAY21w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P+yiR2Yna+cpn42P+Cquv9vKK6m5D8P4mOO9w4dxOxrNg7hUFL43QJ2n4+B0IncyGewEPzLUTuxqF8gHlHknyGWT/HNKLVfT0PvnWRHHW1QmWhXsIIVKUY7cua4xN+1E1ZZ3EuROgJw9diZXQjDroaCu1Vl43LovSao5w4pSLeU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MNiBz3Zs; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MNiBz3Zs" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-b8fa449e618so238835966b.0 for ; Thu, 26 Feb 2026 23:15:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176512; x=1772781312; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zgWrxE7EqiAv9jTaPHb4K7l0finKeYTH/5fyrp1MuBs=; b=MNiBz3ZsEz5m0XB6z+gNEwBaouhEYxxPTMXoRms2jrx4ii2ut+FA1wxTKTXHqM/yr7 V6+Ti8T64ROmvhxNSEGnNoZyaYtXwfM0jVRJMAyyAHqE2P6bkWE9kJuXD/phzx/V37Ew fe8tpYsppZmxkjGqmfzdUhoDmnRjvNZ5+zLWl2M3JhPdac+XJA02YLCDT6TL2rzPinbY 8q9toIDcV1d/JUmySxmerMrqdvp9KishpVtjiv0HoS+j3B6CxtyUkL7UkjuEVene08kd Vbgf78SYs5SLTP0zplHz8qDKkTkHi9YVT8UOtQAi//qMm1CVSDp7GmM1Wt+VfWDuRdrU 6ZkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176512; x=1772781312; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=zgWrxE7EqiAv9jTaPHb4K7l0finKeYTH/5fyrp1MuBs=; b=bZZg0mFnc4VbHeiQImsQwgGiDsKE+ku3ZVndToRd1Mz9PZ67oYxig7o3zpk0SGTasJ B4uHxxfMV/Z8y1F8wY/xyroDaB/TH0ZNPFbmiprpPMh+BlY79cYmkXqiM+AG++u/KLZC Sg2cXIfCtgzCptciBKkpoWVK9DawUbIfp0AQjtF4tjfN8TTz/Ubec/piVfXyenuLw7QQ /go5NS11ulAZGtH++wCLJaAM6JIZjDF4OA6uORCE7YrNksCMx3C6sQhjXjiGHmRikxBt 77hCE4o8ns+/KURglx+3FtvaonKU8SJKn2MtJituTJ4upu5Y+v2c1BHurtxEHqSdbusQ dP8A== X-Forwarded-Encrypted: i=1; AJvYcCVVZMODr/D1Ax1YAVpW9EvwNSKCeQBIsGvNWjQ58dojzJZb2CUy6kpdVuF58Mne+c9ZPa6vd09UVpRDO9U=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2/rvikdr8JQ5DtjYKYzVwucyvN/lz8I4Yxp6v682RjpLJzUzn ZKDiCsK+7QVpyKF6mVpkwK7IjYbt2EfBCOa3hXljYllVw9natwVKpEsUK0XTCjDKB6U= X-Gm-Gg: ATEYQzzD+tcNzS+bZUDUR/0HbEd1vvwpfm5ccKe2tyId0r/uWdqq3QKe2bsdG/MWPZv +UPKNMxqDDn96Syu++T4YFuVlRgTwKW5tm2gjnq1MOUQqlGzy+YFmi3Jk7rLqZAhMkJ3c1faT22 uqZQEc+W78oBcE7IpSzKQtXpzxh+JRPBSX9/FCqUw6g+bKUgl8qxGIoCGPUC/xEES09/xT2ERkp SNQL0Ry2BCQjjPnr49ToaEOB19vv0NyvK95mcx8ahKQzFNAmRnlvuRrPCebhSUEoKyAzvGygTP7 k+uP9WU+9PV+nLji6HSqiUlT4Yc7XHrigXQSkmW27YEGpO6O8kwmJIL1imWBEUK54H4uS0YyeWH ijufl2OOL+nWHi9bkNHAKJhHwWl94sxU3URc4BH1TNiPTtzJtRegtGg3rI05iF1ieQsN/pSgkOH +LDoK+ssSpU/7T/LFkp1CmNqnR3CUFsPA85RypgdMBeNYVipL6p4w8Ih8zO6V/Mty58UpAFnZTA DH2M/vwuPKwEWxS5A== X-Received: by 2002:a17:906:fd84:b0:b87:3168:2ccc with SMTP id a640c23a62f3a-b93764ba217mr89539266b.39.1772176511547; Thu, 26 Feb 2026 23:15:11 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:11 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:09 +0000 Subject: [PATCH v2 04/11] power: supply: max17042: fix a comment typo (then -> than) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-4-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.3 Fix this trivial typo where than should be used instead of then. Signed-off-by: Andr=C3=A9 Draszik --- drivers/power/supply/max17042_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply= /max17042_battery.c index acea176101fa..07759d4fdc37 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -131,7 +131,7 @@ static int max17042_get_status(struct max17042_chip *ch= ip, int *status) * FullCAP to match RepCap when it detects end of charging. * * When this cycle the battery gets charged to a higher (calculated) - * capacity then the previous cycle then FullCAP will get updated + * capacity than the previous cycle then FullCAP will get updated * continuously once end-of-charge detection kicks in, so allow the * 2 to differ a bit. */ --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAF05332625 for ; Fri, 27 Feb 2026 07:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176515; cv=none; b=X4hcwzCLv6tSuPTQhRUOhnO9KISP5HwMLD0mUUrsCJINSUCJp6fmmQ2RsKyzDulz2Z+Bi79kvnM4kSYze5W3Q79PryPT7+96rb8wS26o/nkPXMSIaBz9ovlJEq1wKf3Q590WUAwbNfhWnHQRJawzLmt69FMOjDQBpU1laaDeAw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176515; c=relaxed/simple; bh=SW0KsH0zfeD8rz2BxR1U12qdNdVFhIs86kUgS/R+a3w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HAGT519gH16bSc8jCRdow84M9SrshJjgLYpIYuQhK3kivaMe8WjHc/RgT8DDHIc91dT8junzJ+N8o+1LmtkEL7iPyXVtEIVY4fB8Ypp8Z2MLdGDO9wyofDnXZDcf2s8vn74/7Z3Af+F8vNAQFX3kkHvFRxbognv49+u99eL7axs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wNOdNsHG; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wNOdNsHG" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-b8f8d80faebso457856866b.1 for ; Thu, 26 Feb 2026 23:15:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176512; x=1772781312; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mSygevmpkuj28iNV7zrww7IIgn1pA3j+kvHDTNdICpE=; b=wNOdNsHG+JkebgsSzY5ZxPl2Q8eJNyeQUXPWY/HXkHYO0ygRjcuvtl/i/fNRe1/gsr 58Q+fXHOdrRoHOuhwD8mXZLPPVQfO+oSOowHEq7VpAw7rHo9Y66KonYbGLBBE/cRMruQ A+mgH/I4WnR4vCGa0N/QKBotGvI1nLVKjKKx98UPpNmNgvmYLOXHfDGszZtZaAOiWmQJ c09cJTExkGD6C8hvfkk0yLRwalgb7in+vvvgLnL6ae/7jsSFsw9ggqew8pQJkkskP7+E FpIjRAD1q/2Gdcqpl+FSOT9t0+d3bTt6yZNrmQj8NGRVW7yALlTAKSzxAhQChfVoPbpx kimg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176512; x=1772781312; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=mSygevmpkuj28iNV7zrww7IIgn1pA3j+kvHDTNdICpE=; b=AQjOapyeBJJY8+6OBiCjWPt0yfaSGaHkWYo8UwQb7sTtkzWcC3NLQHvpxOzyGAFzPH /Lno2f+RqRj1inMVlC0aZOfsMn/GHjB03RICUjBWTMCz5rATee8PmyyIVoDgRLtC4+N2 cBSSZOoZBO+z0IDu0sXLwIQhEKbE0KJi5tq1uAm1ajl17v3yF0l+Uwo8O8C4Ny/7IH9f qg0+CS645ErHkLkOxsgUbyINwK7LC8zbxIEtbuIfppAd7Z1M6Ukl1MKDacNnu3ZziQ86 cLXQitjzH2WynTEob4qaBrR0eAtSLU+QHqLEqrvZVcue9WzA0NhX6GoW0rJ0HOltielB FDOQ== X-Forwarded-Encrypted: i=1; AJvYcCUi9gZmB6QyrmKwq37i5BTYpu5EUUdcPzXvtnBXVvw5QCFbQgjDfKclt/0T10fRenk5pCQTsh4lXXd36eQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7JzVUEusjVrvMzVSonoA9OttCM5NUIPdiOsRVQEpqQxIQOH/e eKdCZVUuZfHqaCbdLUbnbh7oMC6nt2WAZzn/9Y3dsIfLE98QiMImktXC4gshwKPNaAs= X-Gm-Gg: ATEYQzw7nVHiwECkmpJIQkp03UPxi1s9lqwr9uIKKhweiWGK/TZYKlvkJPBjtfNAiCM Fq3jj++rC+QLWGNcjCHUF8c4i+HTlboT5CTORSz9rT/gOsqWzZRof9xV8Tn2IDdQ87Me8QcHz5n 1qqA0yZkUna66e0e9NcqOWFGDUHJpRL/zm3ScgxQBuYbgMcE3e38qx78T1mWqXDwtix2PAiJAe/ KwDtQCSgPoz9vLdj5XYPCWFDOThPUBY5JQEsioZ2TUwgsBnmcnBzku6aSfsb8Fhna6SRS4lICWZ q1F2UewIkQCMdiDREoDcmZWJzY/Q9FO4qjrZaiVjDMeaiGa6rHkMPZE/SAMpRvCeXSgOtayTzC6 W1Tx1EaJSOQ/Q1c3nTppdgC6ouTV8FM5QAI6M8DgxwNZBsUPQpU08+0BlSV9Zw1atlnazVuz8dX xYBFY1MYqu+52YtePOPi/CURaownJAjjL/WAU+4JlnUfaMDncN9QNO1TlpY3LVW8aOHWKm7mdcI j9j/t90efuG2Os9Gg== X-Received: by 2002:a17:907:97ce:b0:b93:56a4:d6d3 with SMTP id a640c23a62f3a-b9356ed6a7amr349717566b.1.1772176512050; Thu, 26 Feb 2026 23:15:12 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:11 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:10 +0000 Subject: [PATCH v2 05/11] power: supply: max17042: use dev_err_probe() where appropriate Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-5-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.3 dev_err_probe() exists to simplify code, harmonise error messages, and set the deferred probe reason if relevant - there's no reason not to use it here. Signed-off-by: Andr=C3=A9 Draszik --- drivers/power/supply/max17042_battery.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply= /max17042_battery.c index 07759d4fdc37..b9277f81a25d 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -1053,16 +1053,14 @@ static int max17042_probe(struct i2c_client *client= , struct device *dev, int irq chip->dev =3D dev; chip->chip_type =3D chip_type; chip->regmap =3D devm_regmap_init_i2c(client, &max17042_regmap_config); - if (IS_ERR(chip->regmap)) { - dev_err(dev, "Failed to initialize regmap\n"); - return -EINVAL; - } + if (IS_ERR(chip->regmap)) + return dev_err_probe(dev, PTR_ERR(chip->regmap), + "Failed to initialize regmap\n"); =20 chip->pdata =3D max17042_get_pdata(chip); - if (!chip->pdata) { - dev_err(dev, "no platform data provided\n"); - return -EINVAL; - } + if (!chip->pdata) + return dev_err_probe(dev, -EINVAL, + "no platform data provided\n"); =20 dev_set_drvdata(dev, chip); psy_cfg.drv_data =3D chip; @@ -1090,10 +1088,9 @@ static int max17042_probe(struct i2c_client *client,= struct device *dev, int irq =20 chip->battery =3D devm_power_supply_register(dev, max17042_desc, &psy_cfg); - if (IS_ERR(chip->battery)) { - dev_err(dev, "failed: power supply register\n"); - return PTR_ERR(chip->battery); - } + if (IS_ERR(chip->battery)) + return dev_err_probe(dev, PTR_ERR(chip->battery), + "failed: power supply register\n"); =20 if (irq) { unsigned int flags =3D IRQF_ONESHOT | IRQF_SHARED | IRQF_PROBE_SHARED; --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4841A35A397 for ; Fri, 27 Feb 2026 07:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176516; cv=none; b=aa3JJLUjXcHwecwJuo9RCZz0qWH2JlMRRuqf44ffluMvxQ2MQrM2y25n4eoECeobgleWZ4WCuapnd10iMGOpbYL9v0KvZOUkll9isiwfB8Na51i1v8un2/H8YkJXjm58I4Ts7u2cWA9b5F6gFTARD9cxXTK0cUvSFq8A91L/gAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176516; c=relaxed/simple; bh=Yt0sNw9b+pj9fmaA7tM3vgRmJfOjPqWF3O7G+LpIrnI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NSiIFoudW+8KQt9kNZtFRcRMfY4ki1SoPsl/JukgaHjYEUKGYuHCbgDhOQp0INvhlOMx6BafqzoUuWBFZVReZM7Vwte6fF/sSyJo11q7RGr8RgH92H0lel01TW/DnsNLhv32h7qSfMq/x6jHBLigWr6c6p/UoQrHolbzajFazXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=stESTL+C; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="stESTL+C" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-65bf302471dso2019452a12.1 for ; Thu, 26 Feb 2026 23:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176513; x=1772781313; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=WClHPYuZJqN8n1xZlLHGmGajkWi1sdB8zHmMALTl0VI=; b=stESTL+Cj6Rs2il/ypkebqlgradv5Sh2J1GLm2AtBXiMblJy6GdIxvIPLKEA3km20F D6ybw12H+LoQMTpMlkxWAIHWew/YQ7aAh226SLiSjaiGhp/twLtOP1otHBXq24lJ7++r 9NefHOQzCjsM1CB1G+X7bLxgdo0o2YjKPBChSe6hM+RCmcCs9ozUHP5IUoEYi5UamkpI qgtLMSKbsiF0s3VZQP2ZTEiLea0Z7m41ZvDCmot3/DTLmPCBZGpibd+Wx4ni9yFbrkUA x7hudALjSr/V5/q1dXCJhefFojFmuOIEO+rXsHtho//BuL9zt0SSwN9Woq/sk5KkHisP 3eZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176513; x=1772781313; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=WClHPYuZJqN8n1xZlLHGmGajkWi1sdB8zHmMALTl0VI=; b=KfqOyS4lsgMpy5zHwdiXJjuwOLMi1hpZ5NJGChepn/PgvFyYGiXTBgiJzefct2eZ9u R1ee6TxEzHhWtcT95GF67/BrkDO4DHZ7L1OH58T55MectV1TPUM5iz/hBFCiR/dqe4Xo I+Td++6mOLYMHASfILk4FaqzJh3peLoeafP1KKUSg+jhTSqTsI/ogddF6YIxUh66QVlP 43L0atXYn+0GuBpWneznnbop6Velr+H/0MB+t7QYGwIsz7BHxrnHB1dWVaf8TjdbSV4R nYXuAKD1ZMo8ogerfmBcGvjItBrWn+R2UEhZZoYycSoknza+qzuKHGjIpdjwZZWQWfGB 2GEg== X-Forwarded-Encrypted: i=1; AJvYcCVgC3/SKJLxGJHf/IdYBVN3KW4UbEPxEMy+uCpMc36Olk7LVY7+ZeHQ0sMjtukmzMO9WP6KQDBsn60Ag88=@vger.kernel.org X-Gm-Message-State: AOJu0YzFNVCyDyQ4O4GvjOSHs6KP+nJf4kQb/ebeiVqJJDBwCV553K2/ PTGJjOR/gEiImw8mGS7qThZsjc77HV1+WZSNi+FKexoaz1oqsC4PeEnCfO7Sr6luOd0= X-Gm-Gg: ATEYQzzvwIf28HHbhKgo03GjOJQI8teqLwrkmi1SMcVIThmPHGKCKbylykqe0WKhnq+ Ep6qBHI1v54R/nUAyEpBPb/cjxxpbAQp7/6Tmp9RkQNgH21H/JuGAFtuEv8vT/ffHQ5imI9SXz+ d5qSYCS7eFyAECn1pfVTXZzGGGFHtNTrLcwkcsWzig0xX0063PeHWEPI/ltcZgmYq5NPVaOLyY+ YiU2Ph284zc6+x1yHlzJEzjZEt48jcc4e2vTSQeegGSrtgZ4yqa8fwB5N5jKO0ZuOfJ1vW5uvJk cgqnuvvpxUFqvyN47aeSdVxiKi8UAWQcudYB5n9n0+iIBxnJCd/ZEDsGMtjcJpVQxiC5tzINuAH 55RNFe8IiIhrT2WWcFvOKZJfNeQFQyIsjaXs2uUIhArcLOTUpwsBb7nEwYiIY6/NPexHBkrRDMj FgScTZggsH2QfDTLu4amamJLvfKZfaE48Ne1oimFlYO85k5auAZqfp/cPvZ5LOcZ6x8kqZiTDaV 3ldwP3ORHPSv5Yb4A== X-Received: by 2002:a17:907:3e91:b0:b93:5521:b57a with SMTP id a640c23a62f3a-b93764b5f90mr102410666b.31.1772176512558; Thu, 26 Feb 2026 23:15:12 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:12 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:11 +0000 Subject: [PATCH v2 06/11] power: supply: max17042: avoid overflow when determining health Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-6-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.3 If vmax has the default value of INT_MAX (e.g. because not specified in DT), battery health is reported as over-voltage. This is because adding any value to vmax (the vmax tolerance in this case) causes it to wrap around, making it negative and smaller than the measured battery voltage. Avoid that by using size_add(). Signed-off-by: Andr=C3=A9 Draszik --- drivers/power/supply/max17042_battery.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply= /max17042_battery.c index b9277f81a25d..8808c0d2ad10 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -201,7 +201,11 @@ static int max17042_get_battery_health(struct max17042= _chip *chip, int *health) goto out; } =20 - if (vbatt > chip->pdata->vmax + MAX17042_VMAX_TOLERANCE) { + /* avoid + * /sys/class/power_supply/max170xx_battery/health:Over voltage + * due to overflow + */ + if (vbatt > size_add(chip->pdata->vmax, MAX17042_VMAX_TOLERANCE)) { *health =3D POWER_SUPPLY_HEALTH_OVERVOLTAGE; goto out; } --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C960936494A for ; Fri, 27 Feb 2026 07:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176516; cv=none; b=EigRhe48fW9xXOq4CO15vRNYPKa40Q4al6E2YMYLfLBUdtpVtqXqKE+KKuRlZVlk2w94kc2k+tkWjIixGzMSks4gPPgVvlUUtwv5m6r7Sym8Qaoat2DZaqebbgZrW3cWyrXkD+z2Bu8OPQnhFUJ4feinKKkgWrFox/ObAhP34ms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176516; c=relaxed/simple; bh=wYi6aEFxaLqRH1kvID/rgCJp6pAPIM8UPMfwfiqMHiA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O6Vm6364cPjgVi9CrXMVv0j7Z90Wea5yFDd10q6skdun73nzI6x1cySMFk7H9EC4EIXNqECFLlvjQ2muk5wlT3Qr4yWu+WE7fXCV4RUAQLiEnU9wibmGITyVvvXTc/HzOWGyMuZwBu8b0HVQsR+r/sy8bB4kEhnPJfc8/7noY1s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=CkxkEXLi; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CkxkEXLi" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-65fa79f5c98so3021725a12.1 for ; Thu, 26 Feb 2026 23:15:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176513; x=1772781313; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=q2F5zLIEaaTfnN0o0tOAwvcRtoPgGDxKclbiaC7adGw=; b=CkxkEXLiRlo9wXZ3FRRVttkwWtrtLmkQdfRZ3WXDAcTyF/hrx/1fvAtsBN4SbHIpKO rE4fpdrsSQx88/nu93xja0d8EMzzFTmDq9uFj23vRP69anHdLjLedEcnA0GQ04HWSD4N 63A/esQNMyr/lnPg/cXNQSNpmTAw3QDLRj3/OQ6FXnLRAiHpfkeQAUPCXxy38/NgjV1K MEzzAbaPAByfBVWZXjb/hqq4gEywkk7JDO3J8jDQbb3b34oxZOLEjwZ3vfFGxBmu03ve vHK0FeogP1I2IdLzSINSxz3qaD6HGZsORMJ+Hs4+XNqUU51epa1uD7qfbmRBhA5tinVg WaZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176513; x=1772781313; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=q2F5zLIEaaTfnN0o0tOAwvcRtoPgGDxKclbiaC7adGw=; b=m+EljgvsXTZZ/XEGkuOaXNjSWTKpLnRXbMLG/gPJZgduafLVBg4erbKpKxCAxYimKZ M9TKG3K4WOGRqY0EqAyV4/DFBZiFnZ/2WSIjirIORU91An8q/gCXJIldof3DRIeDZTvo nlLC6AT/LCqjm4BLos8cC0xgaBwaydj2m7SpNTof6Rdb7L2xBSR5UNbC+40LDZqNSY6Z N9/ZtevMDiPUUIPKzGKUl3XrsRB2nGc0cZt+9nlgNLEXChJ5TmllN9BlcvycciiqTrcB 69M2D2eCxtw1C0EOVTZVpU49C2w0CaEJdPzAVaaBPyaoblknl4hSYUeBlZ7R1YOb8tD5 8kyA== X-Forwarded-Encrypted: i=1; AJvYcCWsHXnzvACD2trxRgNDiFWmDDXWFzKpHmuWL0FN2H91reDREDcSS6PulH+KJkmFIyGGfsq7rRZe2h/UVZM=@vger.kernel.org X-Gm-Message-State: AOJu0YzkQEIDRIIDCB9Z/f5fCrw18v08D4jjyBgEqqxrdiPIuyZGP8qe bASsLJKDGpjnxze8bgYX3gLktjMOWf00HtIEN+6aioQMdPbS9xU9TCWTt0k17GxM2Kk= X-Gm-Gg: ATEYQzz2ZP+Kvca5L0W3axUEohjJ/DiP1YjTKYJh/zDZTdlaAxmS7I5Vx9KR/skCZPH JMUvB9I0gGzwoCK7iusf5LniLYor7F7G66u13pVFW0EIqrFEdiEWW0h1ZOWx52X9BKqYV2ICWny NHF/DVd9EqcSadBXr5IWfSp0TAXUkHwNlANfE8omXbo1WQhO6PezyvTUhGpMlyU/m3gg3M2vmoG 8K7jm6/MTrDJclJWG4oxsrzh1/TY61fvQaCxSUEbcvJOK4txoOXLcMEvo0OvnB21FNOFQa8ZYtB KkN+3yyVFsMJjeQ8C2GO7/QBbH8U8wiufrAFdyDzHyCzC4EvXAnHAg0pSBHBhdBfLo63K3iohCH JOOJtGPTrzChSVVtTyg0j49A+vbqsMu1ZKpQQjtPAktxF7VaYHJd6uidwBT7A0FLadrVlmZ8HQu NMrBhQ1ySCi+tGpwxi7u0UO1cUuI32IdMNVXh6VZSEWby5tUf8JMSPauVTQ5CiyR6eLJnZx/FQF xzM4oLNr9XchtdT2NlptyRy3U4u X-Received: by 2002:a17:906:eec2:b0:b87:31d1:4133 with SMTP id a640c23a62f3a-b937596b79amr86272566b.25.1772176513052; Thu, 26 Feb 2026 23:15:13 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:12 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:12 +0000 Subject: [PATCH v2 07/11] power: supply: max17042: time to empty is meaningless when charging Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-7-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.3 When charging, the fuel gauge reports U16_MAX as time to empty. Ignoring this special case (as this driver currently does), causes the remaining time to be reported as ~102hours, which is incorrect. Update the code to not return anything in this case. Signed-off-by: Andr=C3=A9 Draszik Reviewed-by: Peter Griffin --- drivers/power/supply/max17042_battery.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply= /max17042_battery.c index 8808c0d2ad10..bae0670e2496 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -434,6 +434,10 @@ static int max17042_get_property(struct power_supply *= psy, if (ret < 0) return ret; =20 + /* when charging, the value is not meaningful */ + if (data =3D=3D U16_MAX) + return -ENODATA; + val->intval =3D data * 5625 / 1000; break; default: --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E70336C0CD for ; Fri, 27 Feb 2026 07:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176517; cv=none; b=seAUJ2y+9ibB8jBPi+Gjzp123QnZfCUJIbMIK8RRur6+WiiWtul2TFeBok5DH0fc1QJZmYfQ1hyv5kS/fXXCIbzHTfkWp4c3lBZX4597JJj5rKuu8nHR9zFQ3IWvmExL5ZH1XFH2hM5e504CpydOrwf3mCoqXZyuH1bbsctOa4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176517; c=relaxed/simple; bh=wVYvUIvThmeYxK9y1dkxq/j7c+TyFXalQgUYZy7JXWk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NdMFRtRa47egtTiPKCaap2/b9PEt/7zjQR/ATcasyssZV/r6adZ2DeI0XkjXJKNnajqc/6fHzp/qeJRUVtSumoP5V1fi8nXfPn2axty0iJvddjQfBIaZMx9Hi76Sy7iWK+lDqyLBN7cp498U+N7HqEbGzBAxYfux7EeT2W9d/xQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=VjawdX1s; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VjawdX1s" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-65a2fea1a1eso4422354a12.0 for ; Thu, 26 Feb 2026 23:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176514; x=1772781314; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=kxP6griohT9HSxEeETfyibe+6CSx5ahGktEAwrsPHxE=; b=VjawdX1s8rgx96og/2Qb/OfG4aWnjM0am6JvuNJ+nDB52EgZXQazHHVECz3+/vC5xQ la7OLFlp2K9o21MoltWNEb+jYPSZGv8XIQFauOxTYPlty5LiHYUpoHsAB9VFsE0xiwXu HEI2XHBKET7SrHf/FfEaWXj+ha4KU09By95W+1xSD0F9qgjTX2DE60klfcUyuqmQRK33 2+z+HL7OIPbvOZ9xXqz8F/tp1WDddQdYCfSe0GvwuR9OgKt3kQ/NjQlyqi9JX3dFdi08 h+LYa0LEcvhK398t1qru8N9oaITGjuQiv/Ry9bsrBRM6GU0m56Jk5vI4J7/TjzdiAb5H KyXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176514; x=1772781314; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=kxP6griohT9HSxEeETfyibe+6CSx5ahGktEAwrsPHxE=; b=nj0sXjMArv0vWzOl1645u+NNr2vyGMfvytOfq4R/l8wO01EUcJzGd2YO1GHcvtROQr oiqAQgffWmA45crFElTtW78P0wlhiHomwxlO5xsMqygsPfvhGBQpVJ0kNMjRH3ixAcNL hK7gtNpg+mAMJN0+vPNn4FsZdlavpGhbXKdf0tME0SRBWgGUTLO8YCRe1rJQ8VU9oWzJ A/sWj4RkDWsqIh4sIM3ae7Bip3oG963svW4RS+1vj8D+q7lbRBqbL000nK0ZA+GZLp2t HN1UHvzUnBSlosmaF9xeDXifvIJCQUq1jDYjU5Q/aI/Ub6lDNUSOJ/NPWEVls79jG6V5 +g3g== X-Forwarded-Encrypted: i=1; AJvYcCVgRO7nqI9pcPhboj2X2QeQIHRaCe2kLHjzvWTMv2emkFZpZZhJRQnDDRPRWfIF5ojvSsQcNHbborR+ZRA=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+pHyNtt0bU1dSzPfx8bUz0GTuwQXwkHLI1BPWLNpyBzARERb8 iK7nitQNjDLKup3ZTiezxLIPbkCFy1A30DeZJK64BZp8laiOG3mzk6pgBLb85xQiBLo= X-Gm-Gg: ATEYQzxZX95Prrz705w26541YA+edE5cdYgJGew60fo4DvkmVx+SApfOtiieaEPUwHY udG3xJmtLT7d2myKuGvcnfYP5kXcCBj8mODRMaOXY87Acr5B8OiRDulNfQ4Q9I0GNJ7Qag1EVlT Uvikc1eP3N2nCpNYEHBftBmbTt/U/b2T/ELjhRCUxa392rsmQ1pWImXOll94IOs6gzUhPCa9svB aCvxbkQR07fVOcFEBCnPQiFWLX3TElLi4edPiu5LVZuV/N27Pw0E8aZO190BgpbmaEJb3UGd3HV +KfN0OHzmSOgm8/RgW1f3Mwn6J53hdM1U+j0ZddiCdLa8Wf9aqcb0zAjnyiGtSm8ZkWSH3TUbMq RV28JkVRw0cCCV/lTh/v69S/LSIPph6bTINgTj1MyYogjsxBZwm2E3krIVBU/1MDwvFyH7tNP7y AzRJV5XsYjp5jaw5hSqqLg2/HicSMtVaTe7G68LBMOVSr3vd12i8NIBuWlb+ynpjb8RzH3bX3mV v/1xiS7gNScDuB78w== X-Received: by 2002:a17:907:d11:b0:b87:6bb4:9eaa with SMTP id a640c23a62f3a-b9356f38f98mr305079966b.8.1772176513601; Thu, 26 Feb 2026 23:15:13 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:13 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:13 +0000 Subject: [PATCH v2 08/11] power: supply: max17042: support standard shunt-resistor-micro-ohms DT property Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-8-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.3 shunt-resistor-micro-ohms is a standard property used to describe the value of a shunt resistor required when measuring currents. Standard properties should be used instead of vendor-specific ones of similar intention when possible. Try to read it from DT, and fall back to the vendor-specific property maxim,rsns-microohm if unsuccessful for compatibility with existing DTs. Signed-off-by: Andr=C3=A9 Draszik Reviewed-by: Peter Griffin --- drivers/power/supply/max17042_battery.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply= /max17042_battery.c index bae0670e2496..823533ea5a17 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -929,8 +929,12 @@ max17042_get_of_pdata(struct max17042_chip *chip) /* * Require current sense resistor value to be specified for * current-sense functionality to be enabled at all. + * maxim,rsns-microohm is the property name used by older DTs and kept + * for compatibility. */ - if (of_property_read_u32(np, "maxim,rsns-microohm", &prop) =3D=3D 0) { + if ((of_property_read_u32(np, "shunt-resistor-micro-ohms", + &prop) =3D=3D 0) || + (of_property_read_u32(np, "maxim,rsns-microohm", &prop) =3D=3D 0)) { pdata->r_sns =3D prop; pdata->enable_current_sense =3D true; } --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8083372B52 for ; Fri, 27 Feb 2026 07:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176518; cv=none; b=XUDUEK0mIwV7dPVOFIUimGMP46l5C5hal7RK8Ik6FqSvcAESB7gh3ny+9bShq8oE+FGWcrbDdID7yiYoVXamwkQXkVVbzgvwat4dpI9NbWmjcnHLihAIRs9dCyOmbNtpPtLpQ9hWhQzoRHn0dMB2DiZ7pD4QEcKOpbT27R/wIsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176518; c=relaxed/simple; bh=fv/17d6jilgTODgpruVYpOT+gHVFDnCbMA/pv2NE/eM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ei6a2dGfMEWJigejPhQbGsuvQ/NDZxI/cdM2mlVKP3b6s4rwW/9RjjVv1nPA9CpifwRjX02e4n6xWylOOO47yUac0fJ2HUlpFQYYqU/o5S5ilxSiEZrDjmo10rGpGe3P9yccGoK+w618DNpgY+w8onCB8P6qxhAtu8r/bwsNWBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ghKYGctr; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ghKYGctr" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-b932fe2e1a7so241753966b.1 for ; Thu, 26 Feb 2026 23:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176514; x=1772781314; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=VcFko9vHiFHIBVVslk4GTSxZFkyv6j0wJU+j7yMMfnE=; b=ghKYGctrtFaY4MWW1ANKPGcRHwnxBUaSU2Zn8jc0+wlzyhuZWyBGJhfo/LZ3yXRrh/ WFVDcpkESfdQZHvoYuy07XLA7tOVCo0KafHt7KhII2FW4ufru6wthhzskI9eM8TIxHLY jURmwyuVUCxmPgovhzRbFd3agWT3O0Mj8XdDOkC6Rn2RoUzq3U+XBo7tfGNpOm5ZR9Xm 7WvbuTEU/u+thjZUw/oQsd9QSP7P4ROTnochNNo73NI1W5uqTIcPQiMy884DO96QQ4oz +KYpIJW2g+BzgRmZ6gEo6sou5O+m/Rznzj1iXWu4JjM9qpcDxEHZiry5m2H8Spi6NSQr llcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176514; x=1772781314; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=VcFko9vHiFHIBVVslk4GTSxZFkyv6j0wJU+j7yMMfnE=; b=FJt9L8n2RK19Lrp7mWKXu33voHfPisAITp26M9sXoRm4s6gx49Ocg4PQDQ6s8wfzUT wAGz53ywlCZBWVEgYrQ/6JWp6IkUKW6HWPy3emE0dP0VVOoV+J+A6YlpYm+89gV/rYLd qHsmr7s/KKwLdqXEJSuo15h7/BT+8V722yU4bssT9Eua3KS3OcZ0fA2eERiqsCxGD7EU OoergOJT7eZN9ui4vQHM3dO7A5XuApg29k65C8jTj1XCUhX4RPEYxQIaAHcOP65Q4JrH Nvg07ZT5SYaccVKDzOyOKLcWoMRRMws4Ug0/p9rQXzrNbvizaJWPTQ8EcIcj+iIBYGUq yPPg== X-Forwarded-Encrypted: i=1; AJvYcCV0RI8kBtyGGh6VnGH27FhSQjjRqWQlPzaizyjJJKPJChW/ItE4JWGbpmlHidu4T26rLJvbLvwj9nOGR6c=@vger.kernel.org X-Gm-Message-State: AOJu0Yxb2PAtIr9nroMzuUzLrgRZ/kKqlPyIRrztdIkHk3pitdzX8QsZ cSqvNQbktor+iRqnVQTXkvJCjq+I90nAbTrWTyF1dXGK2XEms8g4SEIuoT3gsAWurjc= X-Gm-Gg: ATEYQzxh/FxDmkbE2CbiRuqKeO3KnhhRHyhz/8w9aC7l4al6qI9WU0Zadb10QA4rxAk 4sEjGbLbhN3Ggtx5Ji/v1tlcgEagenYPWgZwqMCpyLsqyJnlzK7VsOERdEcAZcYz8G4l/XAFPI8 XS6cSiWNsQyVijxXKmLlworJj5gFca6NqWoxEnFPfJRxNR3AxS7RjW43igXFcz+oIYquCAAYxBs RiYnhBepVMKkQFK2N5Zvn7sVPRG+UP6SUZRZ1EMAKInDyvFTKWQFUYh55ts5byg7a5Gyznpw34L j2bWkYiq97mriyRLg+IXZi2BdPfjmhDg4ozF4CI1J/GWAmaibfdOSpPGyr39RXHSor2KxSjrFJ8 Nhy/npmrk0jwGKBFIEPyBCwT+bZ+/pI14UMaMUpqUx+3ry7oZKIa7AISFpLjpSBRO17mq1klzBA VBZA0qfXB2CbsSO8DeI+ysBIYbelsIbl1ppKEWs4tymjjbkAqL8bDJrz4AhYqIGpQNTW1X+cWHM CwnlSiYYJOHg41ugA== X-Received: by 2002:a17:906:f59a:b0:b8f:abff:9ce7 with SMTP id a640c23a62f3a-b93764f4640mr94258566b.32.1772176514119; Thu, 26 Feb 2026 23:15:14 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:13 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:14 +0000 Subject: [PATCH v2 09/11] power: supply: max17042: initial support for Maxim MAX77759 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-9-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.3 The Maxim MAX77759 is a companion PMIC intended for use in mobile phones and tablets. It is used on Google Pixel 6 and 6 Pro (oriole and raven). Amongst others, it contains a fuel gauge that is similar to the ones supported by this driver. The fuel gauge can measure battery charge and discharge current, battery voltage, battery temperature, and the Type C connector's temperature. The MAX77759 incorporates the Maxim ModelGauge m5 algorithm. It, as well as previous generations like m3 on max17047/max17050, requires the host to save/restore some register values across power cycles to maintain full accuracy. Extending the driver for such support is out of scope in this initial commit. Signed-off-by: Andr=C3=A9 Draszik Reviewed-by: Peter Griffin --- v2: fix typo MAX77759_T_convert -> MAX77759_Tconvert --- drivers/power/supply/max17042_battery.c | 59 +++++++++++++++++++++++++++++= +--- include/linux/power/max17042_battery.h | 24 ++++++++++++-- 2 files changed, 77 insertions(+), 6 deletions(-) diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply= /max17042_battery.c index 823533ea5a17..44626abdab34 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -654,7 +654,8 @@ static void max17042_write_config_regs(struct max17042_= chip *chip) regmap_write(map, MAX17042_RelaxCFG, config->relax_cfg); if (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17047 || chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17050 || - chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17055) + chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17055 || + chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX77759) regmap_write(map, MAX17047_FullSOCThr, config->full_soc_thresh); } @@ -791,7 +792,8 @@ static inline void max17042_override_por_values(struct = max17042_chip *chip) =20 if ((chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17042) || (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17047) || - (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17050)) { + (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17050) || + (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX77759)) { max17042_override_por(map, MAX17042_IAvg_empty, config->iavg_empty); max17042_override_por(map, MAX17042_TempNom, config->temp_nom); max17042_override_por(map, MAX17042_TempLim, config->temp_lim); @@ -800,7 +802,8 @@ static inline void max17042_override_por_values(struct = max17042_chip *chip) =20 if ((chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17047) || (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17050) || - (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17055)) { + (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX17055) || + (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX77759)) { max17042_override_por(map, MAX17047_V_empty, config->vempty); } } @@ -1023,6 +1026,45 @@ static const struct regmap_config max17042_regmap_co= nfig =3D { .val_format_endian =3D REGMAP_ENDIAN_NATIVE, }; =20 +static const struct regmap_range max77759_fg_registers[] =3D { + regmap_reg_range(MAX17042_STATUS, MAX77759_MixAtFull), + regmap_reg_range(MAX17042_VFSOC0Enable, MAX17042_VFSOC0Enable), + regmap_reg_range(MAX17042_MLOCKReg1, MAX17042_MLOCKReg2), + regmap_reg_range(MAX17042_MODELChrTbl, MAX17055_TimerH), + regmap_reg_range(MAX77759_IIn, MAX77759_IIn), + regmap_reg_range(MAX17055_AtQResidual, MAX17055_AtAvCap), + regmap_reg_range(MAX17042_OCVInternal, MAX17042_OCVInternal), + regmap_reg_range(MAX17042_VFSOC, MAX17042_VFSOC), +}; + +static const struct regmap_range max77759_fg_ro_registers[] =3D { + regmap_reg_range(MAX17042_FSTAT, MAX17042_FSTAT), + regmap_reg_range(MAX17042_OCVInternal, MAX17042_OCVInternal), + regmap_reg_range(MAX17042_VFSOC, MAX17042_VFSOC), +}; + +static const struct regmap_access_table max77759_fg_write_table =3D { + .yes_ranges =3D max77759_fg_registers, + .n_yes_ranges =3D ARRAY_SIZE(max77759_fg_registers), + .no_ranges =3D max77759_fg_ro_registers, + .n_no_ranges =3D ARRAY_SIZE(max77759_fg_ro_registers), +}; + +static const struct regmap_access_table max77759_fg_rd_table =3D { + .yes_ranges =3D max77759_fg_registers, + .n_yes_ranges =3D ARRAY_SIZE(max77759_fg_registers), +}; + +static const struct regmap_config max77759_fg_regmap_cfg =3D { + .reg_bits =3D 8, + .val_bits =3D 16, + .max_register =3D 0xff, + .wr_table =3D &max77759_fg_write_table, + .rd_table =3D &max77759_fg_rd_table, + .val_format_endian =3D REGMAP_ENDIAN_NATIVE, + .cache_type =3D REGCACHE_NONE, +}; + static const struct power_supply_desc max17042_psy_desc =3D { .name =3D "max170xx_battery", .type =3D POWER_SUPPLY_TYPE_BATTERY, @@ -1049,6 +1091,7 @@ static int max17042_probe(struct i2c_client *client, = struct device *dev, int irq { struct i2c_adapter *adapter =3D client->adapter; const struct power_supply_desc *max17042_desc =3D &max17042_psy_desc; + const struct regmap_config *regmap_config; struct power_supply_config psy_cfg =3D {}; struct max17042_chip *chip; int ret; @@ -1064,7 +1107,12 @@ static int max17042_probe(struct i2c_client *client,= struct device *dev, int irq =20 chip->dev =3D dev; chip->chip_type =3D chip_type; - chip->regmap =3D devm_regmap_init_i2c(client, &max17042_regmap_config); + + if (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX77759) + regmap_config =3D &max77759_fg_regmap_cfg; + else + regmap_config =3D &max17042_regmap_config; + chip->regmap =3D devm_regmap_init_i2c(client, regmap_config); if (IS_ERR(chip->regmap)) return dev_err_probe(dev, PTR_ERR(chip->regmap), "Failed to initialize regmap\n"); @@ -1245,6 +1293,8 @@ static const struct of_device_id max17042_dt_match[] = __used =3D { .data =3D (void *) MAXIM_DEVICE_TYPE_MAX17055 }, { .compatible =3D "maxim,max77705-battery", .data =3D (void *) MAXIM_DEVICE_TYPE_MAX17047 }, + { .compatible =3D "maxim,max77759-fg", + .data =3D (void *) MAXIM_DEVICE_TYPE_MAX77759 }, { .compatible =3D "maxim,max77849-battery", .data =3D (void *) MAXIM_DEVICE_TYPE_MAX17047 }, { }, @@ -1257,6 +1307,7 @@ static const struct i2c_device_id max17042_id[] =3D { { "max17047", MAXIM_DEVICE_TYPE_MAX17047 }, { "max17050", MAXIM_DEVICE_TYPE_MAX17050 }, { "max17055", MAXIM_DEVICE_TYPE_MAX17055 }, + { "max77759-fg", MAXIM_DEVICE_TYPE_MAX77759 }, { "max77849-battery", MAXIM_DEVICE_TYPE_MAX17047 }, { } }; diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/m= ax17042_battery.h index c417abd2ab70..05097f08ea36 100644 --- a/include/linux/power/max17042_battery.h +++ b/include/linux/power/max17042_battery.h @@ -105,7 +105,7 @@ enum max17042_register { =20 MAX17042_OCV =3D 0xEE, =20 - MAX17042_OCVInternal =3D 0xFB, /* MAX17055 VFOCV */ + MAX17042_OCVInternal =3D 0xFB, /* MAX17055/77759 VFOCV */ =20 MAX17042_VFSOC =3D 0xFF, }; @@ -156,7 +156,7 @@ enum max17055_register { MAX17055_AtAvCap =3D 0xDF, }; =20 -/* Registers specific to max17047/50/55 */ +/* Registers specific to max17047/50/55/77759 */ enum max17047_register { MAX17047_QRTbl00 =3D 0x12, MAX17047_FullSOCThr =3D 0x13, @@ -167,12 +167,32 @@ enum max17047_register { MAX17047_QRTbl30 =3D 0x42, }; =20 +enum max77759_register { + MAX77759_AvgTA0 =3D 0x26, + MAX77759_AtTTF =3D 0x33, + MAX77759_Tconvert =3D 0x34, + MAX77759_AvgCurrent0 =3D 0x3B, + MAX77759_THMHOT =3D 0x40, + MAX77759_CTESample =3D 0x41, + MAX77759_ISys =3D 0x43, + MAX77759_AvgVCell0 =3D 0x44, + MAX77759_RlxSOC =3D 0x47, + MAX77759_AvgISys =3D 0x4B, + MAX77759_QH0 =3D 0x4C, + MAX77759_MixAtFull =3D 0x4F, + MAX77759_VSys =3D 0xB1, + MAX77759_TAlrtTh2 =3D 0xB2, + MAX77759_VByp =3D 0xB3, + MAX77759_IIn =3D 0xD0, +}; + enum max170xx_chip_type { MAXIM_DEVICE_TYPE_UNKNOWN =3D 0, MAXIM_DEVICE_TYPE_MAX17042, MAXIM_DEVICE_TYPE_MAX17047, MAXIM_DEVICE_TYPE_MAX17050, MAXIM_DEVICE_TYPE_MAX17055, + MAXIM_DEVICE_TYPE_MAX77759, =20 MAXIM_DEVICE_TYPE_NUM }; --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63B0438553E for ; Fri, 27 Feb 2026 07:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176518; cv=none; b=iIv7eE+lQMuMzth0/xXqpMtjUbDelJ0pJvjrYLQ28QstwfJxGq/rmra3LqiBc9LzgGBoNVo9TShyDyqNe7PrHZkADxrffLQb678NdDUEYB5IxeodgQFBG4bvc4gDzn9wtIgSN3L+qt7vFUR/AjUZf6NQCWR+Fr2XAZVZlquNS+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176518; c=relaxed/simple; bh=aSX81ZyZDrEK62Qx+282skeF6cwlfyKFGDM/zj98kpI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LqGfxg6lL1zteUGBpemJSecC8DPEZZyKXmfL26t1braEKdRbWr2gQ2S4sWTJhRtbX5B2r7dyxBIGn6Qm+xR8nP4hWndhJ0gfSToDv2DgSn2Ao0kybP74YJkvPFWkg2bmK44nnvsABUwwBkylB0aMt00BXoDqrqm71dur2nnC7tE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=uSqFNPfp; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uSqFNPfp" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-b886fc047d5so284943066b.3 for ; Thu, 26 Feb 2026 23:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176515; x=1772781315; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6JgNbWns3UwEKgdueIS9H9aOU4yehTOts0vV7aSX/bI=; b=uSqFNPfplF/QefouVlA5AM+Q639C6kVQ81yCLxbS9NctbH/RH4juFR/8nogik3PdOV iQbVAGotM6U252OdMzyZeKrk8gAUkkRQUyBhRkPAhJ1P2whLslb1ueHKNLSu2OyyhKeU RbaO6HU/bIUqkRHJiX1h6KlfIlOouoYamKcU0DTD27aY2HIfFowwHHaoQImMX1Qt6+/Z APHO4bsajkxY0YNeuTuFb1UlcKk/AnDrnGnyNMDzwMfqO3idx6iLqxIwhwNjwWPI/Ckm 63QmPpZtX+3kZR5sUxp+cIBSFlkLtza0WXsBKCUMqlBio+8O/fMI9M4j2CazUgz28SG7 NvdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176515; x=1772781315; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6JgNbWns3UwEKgdueIS9H9aOU4yehTOts0vV7aSX/bI=; b=Zn5kxQDChnFNvVs6OQ28Yi2imNP67Z5xDGa9JmjQDvtEHYIyISkTF5EML3j/k6d+mh KcB3YcvieYe1486TIL/5L9GbKrlUrNvPUzht1EaYokTvss64eyjguD+Lxb9xlDF2TRNQ O783nbyddZu0BqPQ+9Ck4xZO5ZbByjFz/O+i012A3cIcR0mrUsDmgdkaxrfikVq7kOf3 tzjNo+9SOmGT92WeOCQt55ChMQMcWcrHHIsRJJvVQilLodZ74xZRK7DwK9HTZotBo/FA ttIzMzbFIV5fUe+TC8pYnS3/KqxqwLzxRdQQ9gdxb6F7cgDgyBRe8UO++mpN+t6jVWEF ZG6A== X-Forwarded-Encrypted: i=1; AJvYcCUozHwdbXwVCHlZTZvl24bXMR9eD2if1RXbfV+KBoiz2fO5Rbzjw04ftadOSlF5myoQReQatfGlUYUaWfw=@vger.kernel.org X-Gm-Message-State: AOJu0Yznpa1Au1mQKuQC+6zWTw3FtWxc/CEdosUxYZwgsM+f+FyBf5Ef Rg0ikymU2I4WaXLRv6eG2ujpMgIKaX3wPSiCaY8cKlP3AYt2CAhpzUjvdsW9Gk3xKfk= X-Gm-Gg: ATEYQzyAEk5wl8o3vYAckLOp3lugL62cJy47Jh4uwPDsDxVbt+QRlXLEuFdEb7Zy2Cc Vb+DaqwzUABSf/twh+/P/ZUE7Wg3dywoyueO2qJFk+rN35VeoY4T9lfzqMQyd6+/h2vYas3jVD8 qpArPPvLilk5eTT7BNLZrmcoo8LQgdumwlosfNgTAASvIU5xPmbT7/QwREQKv0fGU1k6+ZdpYwG PzGk1X/KTB1uOq4gNzAlouOnZjMGRE3L0Gf8zHoTqrsztJaIgdEVo5q3H+vqFdfWfZBBW11ukCk AbsWuVH1s+h9zJ+lCdJF43uQrOfWybIwYkWhdNFydFkY0gele66oe+akw//oxYOCfAnCBKSthwa qiAVxBtF9QwqCml//mAOP9VL92C8YeTTHsq3Fyy/1VYKtr02ckVrffBbS1lK5YweVyIBKIb97+W uKdLuuDttBbsQRUMcf1xtAEkG/80UzlMPeFKNmJkhwIMUS+XGWgdJyx5SByG2CK76O/6uHh4a09 uQwGAjG6MfF9/biSA== X-Received: by 2002:a17:907:1c93:b0:b88:64e9:899d with SMTP id a640c23a62f3a-b93764f4458mr110537166b.34.1772176514701; Thu, 26 Feb 2026 23:15:14 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:14 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:15 +0000 Subject: [PATCH v2 10/11] power: supply: max17042: consider task period (max77759) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-10-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.3 Several (register) values reported by the fuel gauge depend on its internal task period and it needs to be taken into account when calculating results. All relevant example formulas in the data sheet assume the default task period (of 5760) and final results need to be adjusted based on the task period in effect. Update the code as and where necessary. Signed-off-by: Andr=C3=A9 Draszik Reviewed-by: Peter Griffin --- While I do believe this should apply to all devices supported by this driver, given the register description in max17042_battery.h, I've made this change specific to max77759, as I have no way to confirm this works as expected on those. I've found a data sheet for max17047/max17050 online, which does describe the relevant register 0x3c as 'reserved', hence I'm a bit hesitant to enable this for all. v2: * update commit message subject prefix --- drivers/power/supply/max17042_battery.c | 20 ++++++++++++++++++++ include/linux/power/max17042_battery.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply= /max17042_battery.c index 44626abdab34..89909b140cf9 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -61,6 +61,7 @@ struct max17042_chip { struct work_struct work; int init_complete; int irq; + int task_period; }; =20 static enum power_supply_property max17042_battery_props[] =3D { @@ -335,6 +336,8 @@ static int max17042_get_property(struct power_supply *p= sy, return ret; =20 data64 =3D data * 5000000ll; + data64 *=3D chip->task_period; + do_div(data64, MAX17042_DEFAULT_TASK_PERIOD); do_div(data64, chip->pdata->r_sns); val->intval =3D data64; break; @@ -344,6 +347,8 @@ static int max17042_get_property(struct power_supply *p= sy, return ret; =20 data64 =3D data * 5000000ll; + data64 *=3D chip->task_period; + do_div(data64, MAX17042_DEFAULT_TASK_PERIOD); do_div(data64, chip->pdata->r_sns); val->intval =3D data64; break; @@ -353,6 +358,8 @@ static int max17042_get_property(struct power_supply *p= sy, return ret; =20 data64 =3D data * 5000000ll; + data64 *=3D chip->task_period; + do_div(data64, MAX17042_DEFAULT_TASK_PERIOD); do_div(data64, chip->pdata->r_sns); val->intval =3D data64; break; @@ -362,6 +369,8 @@ static int max17042_get_property(struct power_supply *p= sy, return ret; =20 data64 =3D sign_extend64(data, 15) * 5000000ll; + data64 *=3D chip->task_period; + data64 =3D div_s64(data64, MAX17042_DEFAULT_TASK_PERIOD); val->intval =3D div_s64(data64, chip->pdata->r_sns); break; case POWER_SUPPLY_PROP_TEMP: @@ -1146,6 +1155,17 @@ static int max17042_probe(struct i2c_client *client,= struct device *dev, int irq regmap_write(chip->regmap, MAX17042_LearnCFG, 0x0007); } =20 + chip->task_period =3D MAX17042_DEFAULT_TASK_PERIOD; + if (chip->chip_type =3D=3D MAXIM_DEVICE_TYPE_MAX77759) { + ret =3D regmap_read(chip->regmap, MAX17042_TaskPeriod, &val); + if (ret) + return dev_err_probe(dev, ret, + "failed to read task period\n"); + chip->task_period =3D val; + } + dev_dbg(dev, "task period: %#.4x (%d)\n", chip->task_period, + chip->task_period); + chip->battery =3D devm_power_supply_register(dev, max17042_desc, &psy_cfg); if (IS_ERR(chip->battery)) diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/m= ax17042_battery.h index 05097f08ea36..d5b08313cf11 100644 --- a/include/linux/power/max17042_battery.h +++ b/include/linux/power/max17042_battery.h @@ -17,6 +17,7 @@ #define MAX17042_DEFAULT_VMAX (4500) /* LiHV cell max */ #define MAX17042_DEFAULT_TEMP_MIN (0) /* For sys without temp sensor */ #define MAX17042_DEFAULT_TEMP_MAX (700) /* 70 degrees Celcius */ +#define MAX17042_DEFAULT_TASK_PERIOD (5760) =20 /* Consider RepCap which is less then 10 units below FullCAP full */ #define MAX17042_FULL_THRESHOLD 10 --=20 2.53.0.473.g4a7958ca14-goog From nobody Thu Apr 9 12:06:53 2026 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 061EF389E1F for ; Fri, 27 Feb 2026 07:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176518; cv=none; b=jHZEt0bD94qRxrrWQoRc7Gh2T0Y7j0/iSgejqzTz94vyMg432YrsFSt85EJucCqnxSqYsAf1ZXHJsce2lNEmtS+VO/0lAZT3CXnPwlp55mVAlFw2cL2DCdlk4hnPy79EEUiUJAxxG19mgJWSEp/COZm07Mb43h/Ie3/Es4zgnVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772176518; c=relaxed/simple; bh=mdMwa+4vXJFSq1mBJLsIE/rDEGn2SDuqUw2L2ipYiws=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LtgVEhbszrHSmlfnWI1CxoalULOhjTZT3/jzdk4L9dXVm3g06GN3wlFTK1il5PnTDVUuNEzhHkYVXRJC5LDyXE4PJKwguhQF+fhZUTSaoa8jCYEZ0rCq+AUPz59LPERHSwrOOGVePClrEhNRlIxEtaUzq5sdevYTrIIkQd7JoXk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=qJwObES6; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qJwObES6" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-b93718302beso113962866b.3 for ; Thu, 26 Feb 2026 23:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772176515; x=1772781315; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Pb9+a6UQI9eJoPAfaI075Xgk+AX6ysZxadZXLoPE5ik=; b=qJwObES6t1BuEALPr1QuOyfP1m6V6NmCubcWrKqzWkVr5xZfl4fks2KyN0PGsVGy4B 0/oUld4DixrrLsk6cQXeV23WDGZDmzOCPdrcWK76peUvh4qJw6Mdt656C9n/EARFMwNW KD5T0XaAAGoLKWeUe5ui7mgwcze4KS/IEwYZ1yHfMoYRU2G5e9IfE2jUMOEoTLglCgOo Vl6dC7FMUx9Xo+lyl3YKBhM808DBg2wVctAq1UjlIzdhLgMpvr8krZ/L8VFNshTrzItz D0Qi2dRNrfiDPAFfoW5bEsWnpohwKbQ0t+aZuYYepds6rrwmUA5kPUxc2HN6hNLHv6Uw dLGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772176515; x=1772781315; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Pb9+a6UQI9eJoPAfaI075Xgk+AX6ysZxadZXLoPE5ik=; b=NduHPnlL9F1NID296n4rNwVbgPVzeGRBrWmsHxbVTB6KbZLVkf4mqILf1egSm7IqYP OnaBKHhUW5sVDk9teIMROFX3hB4SnvRhG/ifzED/KzS3jRKkJewLWeQ14zfA99q/T1jk Kahgt5v3qo91PtUDIJgBt7ic/uGCQhLSPwB/o1T93pzUbFQjXCdizG1IhEfi4sTrgu67 03Rz0V1mMS0Uw1h5lccN1CBnVR6NG8akoTuN7pcPZ00mpQDo1Z/3ND38wumLIlS92MA0 X8lISbQj8h+cE3wZstGrEk2di+HYNgOrESSAG7EUPpjJd+3ABh1g8BQ+Sk0DZn2vjvWZ 3aJw== X-Forwarded-Encrypted: i=1; AJvYcCXpyiGiTjWEhDcoEc8z9DaEfYhHP9tw2El3UD2k0ozGMNKEn2/lz1Sr2ZUdLSCzx+64FArrLwicVCIow6o=@vger.kernel.org X-Gm-Message-State: AOJu0YzvN8S9sjrlx9e4sq58JthQ4qSb/lZy20rsbiGCEkiuHVyfifvS 0MEJh+TsIxfCA75ZGkb494xOqkFjamOxEu2nt838Xrqx+M/9M599wokaoWhWL53wM5c= X-Gm-Gg: ATEYQzyZ/UiuMrLRkym+9JR0Rt8lXCTpatfcl+7YbSNZZv4SqJcmyHpEAfJEo53kSp6 Th24pt/T/gdehG2gW1Z7mq/FBsTKtg3ayZfV8nADkh2u0j0affsgC8t9XtB9LLD2ID18XcFErPE tFbYKq2eVEPLP+UIPDPqXgzpi/xHhYZYh4zg1uMJF3yfONwQKv708cF7w8bmWY3AZN/OuFVZ+f9 oWEQEgEHYTtztn3gMaI0+MPgnaBrZmywdAcNmToV5q/LUXxNPcAj2THzXUrJwaBA29DCIl45MkW F1q4X7b597+r9wRuSttxJFDqvh/KtkFy737zhwh5UlTy8l3lHMR7iLR5QKplyUFb5xwjNDsPrEI 5Py3V5z2iwok6OtTQiWtkv0C0xM5+GqmRVGwoDS7QxA9m219UN80xttnjazFOkbWg86Nrv2rkCl wePtsFSGO5lJCI9zhLvHSr6Y60uxr4IJs/aRHwrPuoZy/aoKjs+aztwbJd9UEpHn4G1ZvgO4Ikz LwfqZmh606RegrK1A== X-Received: by 2002:a17:907:d05:b0:b87:965:907a with SMTP id a640c23a62f3a-b93765210c0mr101186166b.32.1772176515213; Thu, 26 Feb 2026 23:15:15 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b935aeee867sm124205066b.66.2026.02.26.23.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 23:15:14 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Fri, 27 Feb 2026 07:15:16 +0000 Subject: [PATCH v2 11/11] power: supply: max17042: report time to full (max17055 & max77759) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-max77759-fg-v2-11-e50be5f191f0@linaro.org> References: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> In-Reply-To: <20260227-max77759-fg-v2-0-e50be5f191f0@linaro.org> To: Hans de Goede , Krzysztof Kozlowski , Marek Szyprowski , Sebastian Krzyszkowiak , Purism Kernel Team , Sebastian Reichel , Rob Herring , Conor Dooley Cc: Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.3 Report the remaining time to full as calculated by the firmware for devices that implement this. Similar to time to empty, the reported value is only meaningful when charging, i.e. if it is !=3D U16_MAX. Signed-off-by: Andr=C3=A9 Draszik --- v2: - limit to max17055 & max77759, the datasheet for max17047 and max17050 describes the register as 'reserved'. I was mislead by the comment and enum ordering in max17042_battery.h - report as POWER_SUPPLY_PROP_TIME_TO_FULL_NOW (not _AVG). The max17050 datasheet is a bit clearer than the max77759 one on that. --- drivers/power/supply/max17042_battery.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply= /max17042_battery.c index 89909b140cf9..770d806033b9 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c @@ -89,6 +89,7 @@ static enum power_supply_property max17042_battery_props[= ] =3D { POWER_SUPPLY_PROP_HEALTH, POWER_SUPPLY_PROP_SCOPE, POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, // these two have to be at the end on the list POWER_SUPPLY_PROP_CURRENT_NOW, POWER_SUPPLY_PROP_CURRENT_AVG, @@ -447,6 +448,21 @@ static int max17042_get_property(struct power_supply *= psy, if (data =3D=3D U16_MAX) return -ENODATA; =20 + val->intval =3D data * 5625 / 1000; + break; + case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW: + if (chip->chip_type !=3D MAXIM_DEVICE_TYPE_MAX17055 && + chip->chip_type !=3D MAXIM_DEVICE_TYPE_MAX77759) + return -EINVAL; + + ret =3D regmap_read(map, MAX17055_TTF, &data); + if (ret < 0) + return ret; + + /* when discharging, the value is not meaningful */ + if (data =3D=3D U16_MAX) + return -ENODATA; + val->intval =3D data * 5625 / 1000; break; default: --=20 2.53.0.473.g4a7958ca14-goog