From patchwork Fri Dec 13 06:38:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bhavin Sharma X-Patchwork-Id: 850658 Received: from MA0PR01CU009.outbound.protection.outlook.com (mail-southindiaazon11020132.outbound.protection.outlook.com [52.101.227.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FC0515383B; Fri, 13 Dec 2024 06:39:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.227.132 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734071955; cv=fail; b=TRA97XDVnfL58WQ6yv7jIj5b7Vw88tNyTc6YdzJ6dBXbsVUXJMKgw36+p0aYV5HIRXvl31GCfbaIIANF5V5mxa5rbO4HUEUWJMZoN+KB0yKwzdlaT7RZjMJmA3R627OuCXSNiDgU4T+KPgEwmqFpLKZOiqQklf0rPiOFH42L3uA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734071955; c=relaxed/simple; bh=V+zSLnR9L+IpyKJvXgRVSk9XihMzR3Xg0L2TFcdiAv4=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=Ct0egKYQRY1IX01Wd/XKsDWRD3Y3dkBVjrYuEdatqqyaxaQVdHWIW44S8+hJKVgV47b8KN8Jli7mSVBK3ymbFX4D5UXfHs3g8OxQq5VStykuM62khH3vAiaPA/VHSOjcDJiK8mErheEGRmWQ3W2n1NM/g4n/n2O+Y3+FrxCro4A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=siliconsignals.io; spf=pass smtp.mailfrom=siliconsignals.io; arc=fail smtp.client-ip=52.101.227.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=siliconsignals.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=siliconsignals.io ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uTNJg8n7LYBKlfZ13DfQcfo7QQRSKblUKyuMCpolMdVeBkhpr59Nm94YY4uPs2DsSBeTuHJcYc81VwqVtk2T3ygv8EryCAROpV50Ia43jEgFi01J8yNESf5lPP5ajalL66a9pARDWOhffb6NE4KNG82Tx/N3eWJ/1J/jL3a9hcVo2ZHluol9DMXkiR8bQhU1nUR0AnBUsdeL2Jeq/zgupvfZK8wgXGbufvXwiTFsX2COiRHRcTk8DH/Ecndnk5sJzZ4wYHqXvg3LMR+p/LCgRR+fS2NwY0lXvvXBZkAG7lGHwwfzxednHVakiZMBQjEIDxJpctks088kPU5dM31GZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=npEADGOmzJcQ8AHe5h3B4zh7cSxF81QCwGRI8y+BGk4=; b=gtj+xKmqTHswVqSjYYxsfTK0Fc0NBtbLwkO2+GHl/O93FZJCFcqUEiP+CaGyF64i2gbmf8N1ZVdBh9uqIqmL0ijL85+hh/7xXrKbAC+yiEPV+QIrDSX2/mDSrx/hNu+05v7Wkcu6vy8qGz1EEVDY1PUwe342KaZhypkpOBSRAXIiCMYpp9Zp+ElexHjRD4SR/eZWSZOIWgiqFNAuSZtqIV5FKR4jy4EbAB87olAhu0Qc8AYSbLk3iZyWZ+QhehlTymAs8FsZ1wa7k/XHeRteYLStF9FYhNaurzHsFixkrPhs+9nsfoAO8/7Dk9bluvq+xY7lLz3t+PA93dZzt7nxQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siliconsignals.io; dmarc=pass action=none header.from=siliconsignals.io; dkim=pass header.d=siliconsignals.io; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=siliconsignals.io; Received: from PN2PPFF679F9759.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::15d) by MAZP287MB0053.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:40::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.18; Fri, 13 Dec 2024 06:39:08 +0000 Received: from PN2PPFF679F9759.INDP287.PROD.OUTLOOK.COM ([fe80::740f:ab98:2be1:538]) by PN2PPFF679F9759.INDP287.PROD.OUTLOOK.COM ([fe80::740f:ab98:2be1:538%4]) with mapi id 15.20.8251.015; Fri, 13 Dec 2024 06:39:08 +0000 From: Bhavin Sharma To: sre@kernel.org, christophe.jaillet@wanadoo.fr Cc: Bhavin Sharma , Hardevsinh Palaniya , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 0/2] power: supply: Add STC3117 Fuel Gauge Date: Fri, 13 Dec 2024 12:08:06 +0530 Message-Id: <20241213063813.32371-1-bhavin.sharma@siliconsignals.io> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: PN2P287CA0011.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:21b::18) To PN2PPFF679F9759.INDP287.PROD.OUTLOOK.COM (2603:1096:c04:1::15d) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PN2PPFF679F9759:EE_|MAZP287MB0053:EE_ X-MS-Office365-Filtering-Correlation-Id: 331d76b8-b303-4da5-2086-08dd1b40d849 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?jf98kJYw7p1a6+z1BIqP/ggUO7QTJ2a?= =?utf-8?q?uPHa8mZNN+mmk1rXKzUw1acmtiNADXbvqOdJJAT7EzbmSFMcWOK2nrPiMfDdoQaia?= =?utf-8?q?HnZFDaUw7bJ+9PjcCMUib1Aud5qKjyUk1dvHDP/Yd7KUE0MuC/o76IkwZZ7GlNiG9?= =?utf-8?q?1LXXmukKbf2z1GxqkV0AXngqSUkitCYRipFSGsVGI8vveUKp4im8/f5gQcRjWdk1g?= =?utf-8?q?GDl+fbgFveo/TiG+6+i80gvyDOxDGpdGetao8QDChC1uZg5DORP4asRdOmmH38kKP?= =?utf-8?q?Z6PKoDkAuap/WtodKFmu3/i0InrBT6ZIBFN0moQIjp0pphsEfpjm9Lau+KNyV6ZeZ?= =?utf-8?q?SqI3hcosLKAgqycTraUUPjorAN6gzhHrG6k5iKpo+K4GBWMIZniszHfcVKJoeHXe5?= =?utf-8?q?h7b/z/CXfqdu/mSIrR3zbMSOsjtvNnmdrf/s1ZJAl5kaB6UTWeoAJrwT3SnP3Uvzr?= =?utf-8?q?RPVaIhd6ZoKJP5rerA/JlxR0lHLGn26FFxtm5FP6msM8E5aM6LuiBmdHV+pgN0fOZ?= =?utf-8?q?Ay+flOJduOfEoeUC9qluPAgLQlzYj0BPE64o1LuCtASWvLDWukUsjPHBPFBks53oo?= =?utf-8?q?odXLkt8iJFvrdadTIt+WbTPrWkxnegGGPBRLLgwn8b8g1ZniB5TjneB+6/VHvnTa4?= =?utf-8?q?kZwDMk9+71x58FAkSZcrT8dOWFRNBzpxZ9JpJ7dUkFn+9suPeSO0eLBZKhYL9kDn6?= =?utf-8?q?fCOhokyB3td4eHYt75zkg8d746wDXL4lwJRdAJ27gYjzazHa6xF60XNDalW+uG0p3?= =?utf-8?q?Ykf9iGqHepMqrcjesBmrATMbr4z3mbvsSWmahhbYLoSNftVBp5h0OhRfpqqOXVBeh?= =?utf-8?q?uP9guBipUHcm7TLP7QYO1U4urgMKN0sbyMdHnfCy3NGIoLDVAKq9Oz9yh7fjhkkJG?= =?utf-8?q?qhFcIADdrvHQ98HJeCA1v7o+RADaUDBsmASCYN5U67g0qrrh4uRWSaKR7oWZ7cDBf?= =?utf-8?q?QBPKvLxZwlArDSfpampLPuGq7j6Io5PBYK8Ds70NF5r9NUe0eeBhKmlcZnCHTjH0f?= =?utf-8?q?wGenKFZExxDIGrJ4A84HfhYszZfgPG3dvRA6IzZt8wmAeZiIQv+FeO9nzwE3vcha2?= =?utf-8?q?87EcfzsuFGLj+WVRYyhRm7s+ZzgccrxFM15OZOvF17AZKw8vOmHglkqwgAmdPi+ly?= =?utf-8?q?RhZk0nWej9TxZ/sI2JKb0JTvDoQyxcCgOAtUvUPPNRZXlSxbGjLjyB9Ie9c1FkZzu?= =?utf-8?q?xs6KevnUtMORm20USg0JlNR5uow1SfMiyP+gXdvhWRfo/4MZNCKGHShh9hhAwGtS2?= =?utf-8?q?qoDy+GKQ8DmwU9S1R4b8JzQM8NqwZL0R9OqfdNtkmajMd5hct4wwh0VxK55a6DpHr?= =?utf-8?q?NT0lzcKV8LMV?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PN2PPFF679F9759.INDP287.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(52116014)(376014)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?illR24ZPAMgMsIt/ijsw+wZHWohu?= =?utf-8?q?TGuRMgKUCdmhOlMF71Vc6BfKSUafATUPR2yn5tlDLLMm7++5d2ckdLiynKhnpe6jo?= =?utf-8?q?HNOkZPMI0UAFmAIMFamzuhsKYF/dNosb5q3gGa+YfUrFB2wUNFYab2LnoEwQCdThP?= =?utf-8?q?i2DETX9+bz26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xQ2BhstrX0S+p2mUtgpcjdbBOrBHI5sKxMrT9UbufV2llXS?= =?utf-8?q?f1F579vrYBL/WdAL1hYWzo68lor/DGF9XFr848Sn1/86Ym/4vXPAc/0ztvKcgCFNB?= =?utf-8?q?IkfBjLOhDTYCr+BxewZ0RcK7M15b1LuJUM1nqYJY+WKC9aVFE0XvdjdNwHb9RSDbK?= =?utf-8?q?4bbnk9dUgcosR9ZJ2gY+wmrZRbzF2h8nbjOa8jGt9wFmK58PUU1ojFAOXczhpPArh?= =?utf-8?q?2qMs/gTMT7DbrPj+JTh6CLCETbedWeY/1XkyXskZiNMJE+3OMBVC7CyQ1LMPxUdVa?= =?utf-8?q?s8H/OU0e0cVTdKQfi/jU0eNeHAi+ORDaV1QKPdo/JolJPWk3X2lL2W9DSN3aHIOhG?= =?utf-8?q?TnpQ/+tdOZb6mm4mEIloQroEigLxHmxQs2NxffZ//juk63nDOszrcH4eY0rvw/gvc?= =?utf-8?q?ouLOBeHmuK3+BwAaQtjtZRjoygiBxHoO+YayG4pqmx2tlcWhCane5C2SE2ZC0qxfT?= =?utf-8?q?MOqgSuqgWwo3WyGGdvEfk5OeferNMeiCahed+gxLK19Sgqjx4V7NOCU=3D?= X-OriginatorOrg: siliconsignals.io X-MS-Exchange-CrossTenant-Network-Message-Id: 331d76b8-b303-4da5-2086-08dd1b40d849 X-MS-Exchange-CrossTenant-AuthSource: PN2PPFF679F9759.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2024 06:39:07.8515 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 7ec5089e-a433-4bd1-a638-82ee62e21d37 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: n3kCiiqIDW/6Wa6ZVPvZb5M0WRAUnuuUS9udYu0DUfiPxGSkLyZg6rd6UNR3r3fenTnTEg/7p4HPMFkwb4TTx+wNi1t+iuHPZgYcRbynFVw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MAZP287MB0053 Adds initial support for the STC3117 fuel gauge. Output of test_power_supply_properties.sh: TAP version 13 1..33 # Testing device stc3117-battery ok 1 stc3117-battery.exists ok 2 stc3117-battery.uevent.NAME ok 3 stc3117-battery.sysfs.type ok 4 stc3117-battery.uevent.TYPE ok 5 stc3117-battery.sysfs.usb_type # SKIP ok 6 stc3117-battery.sysfs.online # SKIP # Reported: '1' () ok 7 stc3117-battery.sysfs.present # Reported: 'Discharging' ok 8 stc3117-battery.sysfs.status # Reported: '38' % () ok 9 stc3117-battery.sysfs.capacity ok 10 stc3117-battery.sysfs.capacity_level # SKIP ok 11 stc3117-battery.sysfs.model_name # SKIP ok 12 stc3117-battery.sysfs.manufacturer # SKIP ok 13 stc3117-battery.sysfs.serial_number # SKIP ok 14 stc3117-battery.sysfs.technology # SKIP ok 15 stc3117-battery.sysfs.cycle_count # SKIP ok 16 stc3117-battery.sysfs.scope # SKIP ok 17 stc3117-battery.sysfs.input_current_limit # SKIP ok 18 stc3117-battery.sysfs.input_voltage_limit # SKIP # Reported: '3704000' uV (3.704 V) ok 19 stc3117-battery.sysfs.voltage_now ok 20 stc3117-battery.sysfs.voltage_min # SKIP ok 21 stc3117-battery.sysfs.voltage_max # SKIP # Reported: '3200000' uV (3.2 V) ok 22 stc3117-battery.sysfs.voltage_min_design # Reported: '4200000' uV (4.2 V) ok 23 stc3117-battery.sysfs.voltage_max_design # Reported: '325000' uA (325 mA) ok 24 stc3117-battery.sysfs.current_now ok 25 stc3117-battery.sysfs.current_max # SKIP ok 26 stc3117-battery.sysfs.charge_now # SKIP ok 27 stc3117-battery.sysfs.charge_full # SKIP # Reported: '3000000' uAh (3 Ah) ok 28 stc3117-battery.sysfs.charge_full_design ok 29 stc3117-battery.sysfs.power_now # SKIP ok 30 stc3117-battery.sysfs.energy_now # SKIP ok 31 stc3117-battery.sysfs.energy_full # SKIP ok 32 stc3117-battery.sysfs.energy_full_design # SKIP ok 33 stc3117-battery.sysfs.energy_full_design # SKIP # Totals: pass:12 fail:0 xfail:0 xpass:0 skip:21 error:0 v8 -> v9 - Corrected the error message Link for V8: https://lore.kernel.org/linux-pm/20241210080954.5067-1-bhavin.sharma@siliconsignals.io/T/#t v7 -> v8 - Add output of test_power_supply_properties.sh script. - Change 0X to 0x in macros. - Fix typos and Specify units in property comments. - Remove stc3117_update_battery_status function. - Convert voltage and current from mV/mA to uV/uA. - Represent temperature in tenths of a degree Celsius (1/10 °C). - Export average current and open-circuit voltage (OCV). - Use devm_delayed_work_autocancel. Link for V7: https://lore.kernel.org/linux-pm/20241202094328.14395-1-bhavin.sharma@siliconsignals.io/T/#t v6 -> v7 - Removes extra spaces. - Fixes error handling. - Fixes the logic for checking battery status. - Fixes typos. - Removes unnecessary commas. Link for v6: https://lore.kernel.org/linux-pm/20241130094531.14885-2-bhavin.sharma@siliconsignals.io/T/#t v5 -> v6 - Use shunt-resistor-micro-ohms property instead of sense-resistor. - Remove the battery node from the binding examples. - Add interrupt bindings to the example. - Correct the Signed-off-by (SoB) order in the commit. Link for v5: https://lore.kernel.org/linux-pm/20241129114200.13351-1-bhavin.sharma@siliconsignals.io/T/#t v4 -> v5 - Fix variable names - Limit code line length to 80 columns - Add interrupt and monitor-battery properties to bindings - Correct error handling with return dev_err_probe() Link for v4: https://lore.kernel.org/linux-pm/21c08a45-34f1-443c-97d4-6baf9fa01b67@kernel.org/T/#t v3 -> v4 - Added support for current, soc, temp, and status properties. - Addressed comments and feedback provided by Krzysztof and Sebastian. Link for v3: https://lore.kernel.org/linux-pm/20240205051321.4079933-1-bhavin.sharma@siliconsignals.io/T/#t v2 -> v3 - Resolved DTC warnings and errors - Formatted the changelogs - Added monitored battery properties - Replaced 'additionalProperties' with 'unevaluatedProperties' - Replaced '&i2c6' with 'i2c' Link for v2: https://lore.kernel.org/linux-pm/202401080530.0hMWnrIg-lkp@intel.com/T/#t v1 -> v2 - String value is redundantly quoted with any quotes (quoted-strings) - Found character '\t' that cannot start any token Link for v1: https://lore.kernel.org/linux-pm/46bba29c-330d-417d-ad84-ceb5207fdb55@wanadoo.fr/T/#t Hardevsinh Palaniya(1): dt-bindings: power: supply: Add STC3117 Fuel Gauge Bhavin Sharma (2): power: supply: Add STC3117 fuel gauge unit driver .../bindings/power/supply/st,stc3117.yaml | 74 +++ MAINTAINERS | 8 + drivers/power/supply/Kconfig | 7 + drivers/power/supply/Makefile | 1 + drivers/power/supply/stc3117_fuel_gauge.c | 608 ++++++++++++++++++ 5 files changed, 698 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/st,stc3117.yaml create mode 100644 drivers/power/supply/stc3117_fuel_gauge.c