From patchwork Mon Dec 16 07:04:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bhavin Sharma X-Patchwork-Id: 851342 Received: from MA0PR01CU012.outbound.protection.outlook.com (mail-southindiaazon11021102.outbound.protection.outlook.com [40.107.57.102]) (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 C4DE22E401; Mon, 16 Dec 2024 07:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.57.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734332891; cv=fail; b=Qk3LCt5JzCX2EfSPHoMG/JDnGwNuplO1rktkDYYGmWoPorOwqfTnXUVEvJ7jCg70X53lmhrMQDzxLCuY9YxE5HBh+eWSQhtd83HW45T5DZTl2rGdes5637S1DtvyJ6Q6P5zeSE6ORKj1GLrV71UzAACdNHuxttxI8bv6HE+DXJM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734332891; c=relaxed/simple; bh=qMQt1uri8UmhwOfZ7qd4UMIzS9Mr4DVSZb5Sngu/lHo=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=nccRhd58wEgsBGdlRa1xzNTDatY2800gp4gS2LJpfT4FDlKEeUGQhvUYEIzmr3BkqWdT9zR0Lb1gTqLcbzAaM1NwtP1Ozi11KnN85hgeMHm1ERtFUaW177cvbYQjDegOZJpUWLT1PmKvMW9D+oNg9GwuYEF+OQ//1ocphuNkukA= 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=40.107.57.102 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=rIKxA4zjG5/adb00UdFDHitgRcm70v6rYd8bxoTLvL/d2pEXEWCQVMenEOjyMYYT2dMcSiMGaAzptdqAHIx2mUwpFcw5c782bqN+4dynSYRkKdu5tULDkteEkblyEZeoJvwk53DMBUCdITsTWUOqmHWzUuJI/f5tFGBOYP/6l6o64swxSAVZqnm6vSqs0ZsSc6p/BNd+L1tN3nsZ5cmP5e0CntP62QWC8AHG6J0EixtfSGhU8QokCu7LcHpd0ca2rwqMuxcN/ZnVy9dUy0F+ngt26V+aI4zTu110SA3NjK0+QHvwNe92U9oM+GVm/Pbt98whb5ptkJY347WvzPoZOw== 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=HoV/pt3LjTsXHW600pzkQFtozihrwte83MTFT3+KSwY=; b=MN5iXhfjTMTtP76z0+aYJ1cXU/xpqhWD2/FRRalA3g6LtDyyp/dbjAghEeG59q9yrw+2wfxmsJqP0PEeUkq5jMCpp/ZrtOX0Thj9IM24gHJJFCmiTNLQD7OlPo/OHt4AzgYmVtd1jUWb8CCMuwt4U3jj5zJgctW5yvgHZOudj7X7K21sUcb4pFoQWNsV4/QTKOvxSDHIam6cRxDxCCbQAItPFhfAmj01O7l1Q4VxiciAarETOh41vxauDHF7aoi5wsKpQoR0BM/aPVEDPEmxoEpI9OWnJKiyWdn/0Ycur7e8uSy6J35VjsB/Bh74n7Q7WH8ZU1s6dabOvlCIxyqlsQ== 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 PN2P287MB1855.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:1ab::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.21; Mon, 16 Dec 2024 07:08:06 +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; Mon, 16 Dec 2024 07:08:06 +0000 From: Bhavin Sharma To: sre@kernel.org 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 v11 0/2] power: supply: Add STC3117 Fuel Gauge Date: Mon, 16 Dec 2024 12:34:53 +0530 Message-Id: <20241216070457.8083-1-bhavin.sharma@siliconsignals.io> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: PN3PR01CA0173.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:de::17) 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_|PN2P287MB1855:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f9f62f0-eff9-4e82-a61c-08dd1da0639a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|366016|52116014|38350700014; X-Micros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njoHRgn8hhSwJdXiPeUPBwM4T7nOZPFqvkc8A5+d1J6n+dTlfK?= =?utf-8?q?ekQFDfyb891lKtdpgba0ITRxZFzkCJ4D3ruW/1RXZnP3kNMBnJfBfImFLmf64Et0K?= =?utf-8?q?wQkMasBTaVZVBfEtZpZ3SC4Mb1lQvxxAQj5hFtxnwaYg0j4oHXYbbO/cVeguVE94/?= =?utf-8?q?zP5U20X5KBsdkyyNIOKF3PCED0taIoUyD1a2uTRBEwrMmy8QOudy8+QOsM6foB3OR?= =?utf-8?q?GHnt757+oN0465JgCWzRrnDG2rh7WOqAFyOtBJsMUwVZDdiajjmJRzOB9Og9DJ+W+?= =?utf-8?q?yEArvT5Y6H1VqzpU6+tkw/PsKYSUy/ZaTfJZ3o9F2arCS8gEO6kgLZmyKCXLwlJmk?= =?utf-8?q?sXzKs8wI9DE4g4CihI6UVicJKE/Kwp2GHRKe545bW6yFHRTAeqv7kE/cpoKVbiBXj?= =?utf-8?q?/GiW7AywoaQf3QWdi/mYDcSstdhvHsiKEQm06FJ1ijzjJjLwoy/pXCAKGMOVyphEL?= =?utf-8?q?ANAeZv7N3IPR?= 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)(376014)(1800799024)(366016)(52116014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?iw1xXArVZjNflj6DodruEHP/cnsw?= =?utf-8?q?Ml75HaH7y+bUUFFrrhXghV/43NqKMi1sz24C98eaiBq3uTHudXPDhJz9Jno0jfpDe?= =?utf-8?q?qdXMOZrbIp50SWPkxAuIPG6rsr4QWPPqKMp0jVnb9cmR47d0KqeDa5YEv1MVDvTE/?= =?utf-8?q?/gaTv1T60lxXkrubArau35kKrOX77LXSnw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Bx+f4iMKwU21Ush2Bm4H5ZxFeWrlb?= =?utf-8?q?L0MH5ZiykqCdCjIKZP8YNLIl03UqCnFv+mnL5StiNRwpTchwFOLjSZeRt8T+dxp8t?= =?utf-8?q?1bNPX7wr4Yz3HkPdgAEnzNlWzr72vMyobo5qq2IBXCxQRiv4DXGqN0KJPOLicxUDb?= =?utf-8?q?U1jsQWRLHZ8nv8iXhAsCycICblMuQc1K90vgopunBNTvkVZ5+jF/9booCCddsBZvx?= =?utf-8?q?ozuAU0Hz7JZjzOMzzFNumoF1NDeQI/tbqdDW1OxieWQaIh9JhejzOeEEfqADlN0DW?= =?utf-8?q?dy2GjFFeU7HCfIn6p8/4uxzDn1vt/VzXeYhuBnKTbdLqlXsMYUzUmwVTtxdhctaJ4?= =?utf-8?q?eeIQC1rqk5Pr1hSIFV+o2fM+cyKnJ+gOByHG7VmlVjigJOj9I7ywmJJK4s4WBAgI2?= =?utf-8?q?/vCZUO2Q2j63l1hjpFtT6MfV5u7oQjNISPLCu+0lUNUp/IxNuHJFPdD/ZqcK7bBqf?= =?utf-8?q?kk0ZGZCUS7sTtHihnSjRr0wXUSnY6/EWIx2DBHyOL0BsR0ALv9jz8lc=3D?= X-OriginatorOrg: siliconsignals.io X-MS-Exchange-CrossTenant-Network-Message-Id: 7f9f62f0-eff9-4e82-a61c-08dd1da0639a X-MS-Exchange-CrossTenant-AuthSource: PN2PPFF679F9759.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2024 07:08:06.1206 (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: 9waxoKzICF6gg/lv3RRbPMKdsvht/Gqk3waqAMOeupWjMKdZU5pV6d746uJVVEg2YNnCUDSd7B52mkFXT0FvwbgbMov1HjqZ3PX7tyL+u7k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN2P287MB1855 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 v10 -> v11 - No changes v9 -> v10 - Use error code instead of arbitrary values - Use Co-developed-by tag Link for V9: https://lore.kernel.org/linux-pm/20241213063813.32371-1-bhavin.sharma@siliconsignals.io/T/#t 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 | 607 ++++++++++++++++++ 5 files changed, 697 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/st,stc3117.yaml create mode 100644 drivers/power/supply/stc3117_fuel_gauge.c