From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796545524; b=5TPz7DCY0HLQlPbCg7afhnPw/ivc7DFwS8PQ+Q15qhTXAe+Ns6oJb1bNJRuSsJ1lEdLX 5KxFN7u1j0i1CUI1F5neHVc1ySMSmcQuktieL/aq+iqgXhtMsogMlklKTI73aC3RXUoWF 40YN9F5L2BXqN/uGU2wejo41o5i7MjDix1SFpANCTIG0r9EulbWtyfosJgjo4qGeNoWem gfqezkH2l2ZEuh9TmrIt4p0psJf6jU4krYyTHzxZ87llVGlC7k2aMVFTAaaMCk4u8t+lT 6ZhC4M2SjxGbPmDltK/knzi5xPK5MgutrmgaVa0MC5ALTOCfbDFn6Ndso2PRF5IDVbw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796545524; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=69IWSSJRHeSJr3K6WvdRCFJ42UqThjDNAKSbCalMgUY=; b=pW4Dl31rqJ1er+WHaTKeHW+jAJuizb3xy24OMN9v3Y6gqKc03H5cppRZtExNyjsEDOpR RzmPLNEytQrW11aaiSYWoLD9iUfFKx0K2MMSkBKpXzsgzNXB9KbV1n8pg3YcCqSBp5nUU 1w5nDUwb30jUYJ1J8wCU3W7bzdeNj1akfKe65ccrRj4GMjCis3qnasQmevNmeu3ycVrBO Kp718EjIQ0/0ItOx8NEqjD5Q5dkLGdIxDe5M5spKaNHhfxOXsI9v23KILyFKkSRcmtOvX fcAMnBUjiAauipg5tP3/0/i9hdykXMqESoxnCKNWHam5/RqB2IDFxQxqr2PCQ4zF56A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=JJcK18C+; arc=none smtp.remote-ip=74.125.82.47 Received: from mail-dl1-f47.google.com (mail-dl1-f47.google.com [74.125.82.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 611C1606A322 for ; Sun, 6 Dec 2026 08:25:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 611C1606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=JJcK18C+ Received: by mail-dl1-f47.google.com with SMTP id a92af1059eb24-1a2761c69fbso5468196c88.0 for ; Sun, 06 Dec 2026 00:25:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796545523; x=1797150323; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=69IWSSJRHeSJr3K6WvdRCFJ42UqThjDNAKSbCalMgUY=; b=JJcK18C+WqtDD5wKgCOvQ364FSJ8ykMaQlw7enk34Y6LMfO1BoaYmrNXd4FrQT7ptP qPutwsQa6CYvzBT+EgFGOoQlWBZdQDKlgbUHOMIMSEt0U9zBYQnnG5XNthPg+ZgarLha JBu40UrAgWhbkBn0t49iS5WPWqJqwSUir7lNhOlmHifkv+PmPIn3D2hbtDgx/GXinJy1 nZtMo0EvCIu1VKThaj3waVz7b+2tFf8JsLDqdZ99MYdLqf68/cYT/tO/doMCW4A7PN8m +iMhG6PigN2P7XlT8lCFMHMU4K3eemv1Y51Ybgi/h1lDjLIccD5fZlVGDplsqdva5qfK UL2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796545523; x=1797150323; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=69IWSSJRHeSJr3K6WvdRCFJ42UqThjDNAKSbCalMgUY=; b=JxgJ3cAImFmbATJokK+jacfUIoGk4BrGYSFBIBZyeily5gXOL3BcFRW+OK2c8qM+pC m8AZNgD9obz1eV8Q+jAn3cLRp5NwNcCk9Z1VQGNgZnVzlpsZMG/Ck7j0CwBA8EEFGV3q XrX/RmLg6rOBmM73xnMoVyBibotDzTD8BrDizwIbb2Ovj4rmH/y+99LCf+aaxuRS2wGI hPXNKIDsevUflj35nGsSFeulJtg7Ux20dVTSQI02feNPkHZTTs8hWLi3s7VLL/mG6Vx8 JmTMILa1KyzDt4lL/g+No8UWRFqT09HNbGTEpMVkZARTFbObC3m20bNZG2aXFEfRfy6M JIaw== X-Forwarded-Encrypted: i=1; AL+hErHnJqTvWfpWjNmw18EQvm1ApCoafgElxtr9vx7ltkAWgLXKPKja5MCXz2XyxOr0dH3KKzHOHiH3DClZpNg=@vger.kernel.org X-Gm-Message-State: APuU4Z/uTbsmfeC6U+RP88iinmqUXvjpABQs9SsO/Ce3gRE4VZtLQyL0 4BUZUs/kZxPK4Nw5OoJF0bAkJKEM2SzQuEnvFRWmz4lhtPV/8EUkIpAa X-Gm-Gg: AZFdTZeEkmq6c6qwz7j6qgJBy0aIL4RQb/wwaflKhN2Fu8FH3WkFanI7O3Wi/gAUZYx QO8vNM4hXAdTHqrc8lV9lpypB+e0QPajLPEclYDUpcao7E4cx5dxNUJcY50G2KUIkawKTZDsH+w pJnOlK3xE3g2q5X5fUJuvstpiR2jY32Ifrl5bSEjC6alTXjhN5xHU/z3Nen18eraiNLM524Wxui cw+IKKodPkTTwg6nX8CWrrGX5/2mCCHR/QyWQuKc1gqtFNj3zLHnU19ZXS/PNvNxOXYtAo34cV8 +vR3q2AZNpYLYufL3MnFHfO5mbDGU6f6JCidkSRzg/axNvm6BpkNH9WaHaqVDwLqy1nFdr+JGrE O9yepYFKocabVYkLIHmm+gPBCTNKbYeab3q4LvHZTWHjJ3FLwGfFo52CrI8aaPOHFaqXiUlrEkF y0zw43qWANJ3wnBBsqpbNZzcuu0h1v9qR0jBuLn3LvaSjHGlm8+og34+ehZBGOwj/MZsfbmKDfE 7BrXy1yWrBil+fnSi3I7bfnCyBQPO5smMh/hG8D0EUsyzyflJVN1clUFI9HFOzcK2UQRtB7MhRo XYRaD8K+rqc+QR/KhcX8+uqGWdBpRmyP3kZgAFn1SIYtrXewyIsrrlbU7Q== X-Received: by 2002:a05:701b:2203:b0:1b5:c1c7:6a4a with SMTP id a92af1059eb24-1b5d70ed213mr7090159c88.25.1796545523348; Sun, 06 Dec 2026 00:25:23 -0800 (PST) Received: from DESKTOP-0MCCH07.localdomain ([103.240.170.43]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5d644171bsm23353219c88.7.2026.12.06.00.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Dec 2026 00:25:22 -0800 (PST) From: Prachoday Sutar To: sre@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, pali@kernel.org, afd@ti.com Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prachoday Sutar Subject: [PATCH v3 0/2] Add TI BQ27Z558 fuel gauge support Date: Sun, 6 Dec 2026 13:54:59 +0530 Message-Id: <20261206082501.10506-1-prachodaysutar7@gmail.com> X-Mailer: git-send-email 2.25.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The TI BQ27Z558 is a single-cell fuel gauge documented in the same Technical Reference Manual as the BQ27Z561-R2 (SLUUC54) and is register compatible with the BQ27Z561. Patch 1 makes the bq27xxx I2C driver take the chip type from the OF match data via i2c_get_match_data() and use client->name for the battery name. Until now, probe always looked up the client name in the I2C ID table, so a device bound through a fallback compatible got a NULL ID and crashed. Patch 2 adds "ti,bq27z558" to the binding with "ti,bq27z561" as the fallback. With patch 1 applied no BQ27Z558-specific driver change is needed, and the battery is still named after the exact chip ("bq27z558-N"). Testing: - Build-tested on x86_64 with W=1, with and without CONFIG_OF. - dt_binding_check for bq27xxx.yaml and checkpatch --strict are clean. - Hardware: Kneron KL630-based board with a BQ27Z558, running a vendor Linux 4.9 kernel with BQ27Z561 support backported and "bq27z558" added to the driver's I2C ID and OF match tables, with only "ti,bq27z558" in the DT. Voltage, current, capacity, status and temperature read correctly. This shows that the BQ27Z558 works with the BQ27Z561 register map; it did not exercise this series or the fallback compatible. Changes in v3: - Keep "ti,bq27z561" as the fallback compatible (Sebastian). - New patch 1: add the chip type as .data to all OF match entries and use i2c_get_match_data() and client->name instead of i2c_client_get_device_id() (suggested by Andrew). - Drop the v2 patch adding a "bq27z558" I2C device ID; it is no longer needed after patch 1. - Drop the separate "Add BQ27Z558 support" driver patch planned in the v2 discussion, for the same reason. - Put the driver change first, so the fallback binding never exists without a driver that can handle it. - Correct the testing description. The v1 and v2 cover letters wrongly said the fallback compatible was tested. Changes in v2: - Add a patch with a "bq27z558" I2C device ID. Binding via the fallback compatible alone left i2c_client_get_device_id() returning NULL in probe (reported by the Sashiko AI review). - Binding patch: drop the claim that no driver changes are needed. Link to v2: https://lore.kernel.org/r/20261126201959.28743-1-prachodaysutar7@gmail.com Link to v1: https://lore.kernel.org/r/20261126191906.25708-1-prachodaysutar7@gmail.com Prachoday Sutar (2): power: supply: bq27xxx: Use i2c_get_match_data() dt-bindings: power: supply: bq27xxx: Add BQ27Z558 .../bindings/power/supply/bq27xxx.yaml | 72 +++++++++--------- drivers/power/supply/bq27xxx_battery_i2c.c | 76 ++++++++++--------- 2 files changed, 78 insertions(+), 70 deletions(-) base-commit: 7778cfebeb93187a47251df6ad3fbbb5709e6786 -- 2.25.1