From patchwork Fri Dec 20 08:49: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: 13916358 Received: from PNYPR01CU001.outbound.protection.outlook.com (mail-centralindiaazon11020102.outbound.protection.outlook.com [52.101.225.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 E8AB21A3AB8; Fri, 20 Dec 2024 08:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.225.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734684685; cv=fail; b=tQ1jyU5OvRvB+sOa3LCZPjOCP58qLbRBqLRTYRrBviT0K+kHsBUXTJQLvNyLyuKThFaSdMsd/05XKA1o3yRLBz8xKIxkyTfgR76OFXZKNO/nQmbKzD9GgTWC3grtOux/oH478/n/4kxE9z1oF9zNE+SQlnrEuQbMv2+AhcUDkhQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734684685; c=relaxed/simple; bh=9sGyP4U+ig+XyUedWAeqlgUQVPu3O3VwW2pjOfe+hRE=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=sJYFqexdx8MimPPqeyoX7C0q3vkcAThZ5kuK/iUDuzMa5bgpT5wNG1AN0O9IAoOMe00jR/ALQE5pVA5MLpf5DzG3E5cd5f15eqIHIC/UVatSnd/xrEuBQG7/TNbZHqZImZ2jvF2yPrVbKIHu790WMV9iaTa1WyS2fiqa7dHBnnc= 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.225.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=xa4AfZcVNFfhacx7O7jK76JFlAkgFHmForM7cvhHkEoT2tf4G+7VXMdOzYuiU7gaG+vFZPwPrcDPqY+sbmOQtNrj86rc9eqfOr9e7EhvSGX92SHvOzTvaPg2IWxjKslqb4+E76IIz8apdqk7dg8vWWW1Rb1odYAyol1IIRssND387dpNuHpJSx2u7p1Fho3U0C6s/OyingSYQgKh31dHI9NTv4K8HhcoFFAJGmS894h7cCwdnOXdp3OOrPsx//LizwpBVe9OG94Tt+lJN6l6pP0OIpDYs3DfoB9M9kk4al6+h76PBcrgitZqYUt8XYfitHIzdkvcf/GjaMDM7w2A3A== 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=pFX78gU7jDK6zjtSB4OQUyezIjG6wWJxf1yn9Bl8+w8=; b=a0BMienUvKPhNctui6PzZmNl2i1DTOwQXoRzPyg5U+eYOV8jqGFOObYWGmbAwR3rLOEwBa2toXKQpu4gZwxRqkrib+CumQAR+uqRBXjnRa6KmWexetV5TdfbUDMm7kwquLKNE9aCSx7fpyo4ejWUCRpYDl+xCwwUBIvacNFBnIbylAcIVfOQTD90WCCsQA5UgorQyvWicqBj7h1JTcSR2ML2iGsElEk6BRu9h0ZuNAi6KWO97SdceyvO5qhl3Y4gXkRg+lCo7X1/e10l1+B7IGU0TvMrZ5cWf96OS8Szvr2DXGpCUX8/27IwAK7Lv26/r36QwvUVzus3ntHVkxpVJA== 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 PN0P287MB1045.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:139::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.16; Fri, 20 Dec 2024 08:51:19 +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, 20 Dec 2024 08:51:19 +0000 From: Bhavin Sharma To: sre@kernel.org Cc: tarang.raval@siliconsignals.io, 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 v13 0/2] power: supply: Add STC3117 Fuel Gauge Date: Fri, 20 Dec 2024 14:19:53 +0530 Message-Id: <20241220084958.32367-1-bhavin.sharma@siliconsignals.io> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: PN2PR01CA0254.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:21a::20) 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_|PN0P287MB1045:EE_ X-MS-Office365-Filtering-Correlation-Id: 776dd8e8-2cd1-4c60-07ff-08dd20d3786c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?2wRl35puj790IJnw+753f3bM843LsT+?= =?utf-8?q?1aBNTwA3wbKJfATFwDLOPbb2u+nh1FVhdI4nBCR8+qt6e8u9js0OmygVeVV597eCC?= =?utf-8?q?2LcYBxegCIK9oXxp17KrtayuBx7YHH/RQ8UJEkLkK/TC0lOCCSYSC9u6AmRr1oH6c?= =?utf-8?q?NFXKBjkzyIWYTHgWyIs7uV33GMd1DT8dOb6iXRUjujqO73Yggq2E4u6jNA+U944rA?= =?utf-8?q?iFFWKSK/hjMd71ctgoz2Zj59M8uYv8z41PIlANbPMCRzDFKbLrpxdxL59vzZmLo56?= =?utf-8?q?fsla54IZBeKJPdEwQJtgLCxPEXDkKfVjNC8FMJTeKaVHtMLrsQkghyPwdhFH9RR7m?= =?utf-8?q?gYqbje6i6FIQifXdwl62pTkQCmqFOhdCkHZZkDOT4lZQ2j5N70xv3pVoITqPAcRg+?= =?utf-8?q?KFT22kn8HsSKIXchh5Hp6CxBbvAgt5DvDkOyUM82xy0DusOrKmixcKXRrsYjei4bN?= =?utf-8?q?nFpdyVPkC5bx3QbNOslLHXFWGBNJLBul79FK0fXKaDqYMp3ZI5oIgw4+bVrVx+vMm?= =?utf-8?q?V1eLPwknhWT/LTXH9uliZ1tzKmLRyCpljawtnUwG6AP3Lxca1zYm5s4+pF/fyGSia?= =?utf-8?q?7sUjYtK5LJxgQbMcTuepYF8RmGZH7ftt0ktkSIaY8L61OQaLiPEaOC61z3/9LqgFw?= =?utf-8?q?uwT2xvNKTCCkPaHFnMOFjgDameZAKIDgCmlzQIIdHT6eI+CxjKuTVCziLOPrM9MSU?= =?utf-8?q?l1JElsYnBuifsvf61o82Hm4u0Cyj/DRsS7D25/JQXeqT8VmcDOeRkquRVudOUQNt/?= =?utf-8?q?zfBkbHpmYs6JNdIPZ2VRP8sD1+ZTn8d2K9DxyHtm1TXc3TkLrM7ExfO+k01x1lUEw?= =?utf-8?q?36bwIiNO0r/2NCYR2iT2e7iFz2Uk0H8KlQWL/AAJ4reOGm+07qiirpSsKQ/ZriBIM?= =?utf-8?q?HAeNb+vAKk6CML7mpjhmNH9UTCv6LqrWAwD415T8/p47PP4Qsyl2u7+kuNRnK47uj?= =?utf-8?q?UM0Jpc6AkmsJogw8LgU60hBRTZ5X9DeXPSuJLegf5YQZ7QYywKpm8u/7EeyhaRfZB?= =?utf-8?q?LkQD5WYpL1b+8ulIqv29y+ikrzk0allTFnjD0oT28ufszmxuMrxvu6SYj+oigFiR3?= =?utf-8?q?WqGMqth28PfdgJ68Qd2254BCGtxhP+ponpeP5tkhXKZYU6F+le2dFg3RKsZ60IpB3?= =?utf-8?q?wiTPKExfzKwp0SoqqS7a7QzuGM9RgJG2ytbq+QmmrajBlunC4Z1pMEt1AuEdetDkl?= =?utf-8?q?6/kztBcb9yYG8t0LE4HGwZihRs0X/cuvdPsANtkyBAPAFZXxb17f8tNIcj93NyfN/?= =?utf-8?q?ub0RQiJRxykWu6tCDLbENvfeLvRlZwZvUS3nwUtBKPmp8s1c4n0C4QZjJNp0w8AfL?= =?utf-8?q?FRkVcllUQ1kb?= 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)(366016)(376014)(1800799024)(52116014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?fkDZPIMoX5jUAuEYvr8udhzb2ch1?= =?utf-8?q?amLwQ8LPR7nshE0GCfZMKUdvEBcrEnAU8Jy2hlguCpnMtmqMRTSUpIH1ObOqTCOZR?= =?utf-8?q?0QT3jR6n3sCWGfE2am4RDNasz/odItgUseU/bU4Y7fiwTiEccT6QS8E5t6xMdZ6WG?= =?utf-8?q?121oL6uNfd/SmQUBfDOhJ5Q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nREu//5cl8O13bfSgajiJPSyAccGvYHZWdw+icG24kGhbgTn3M0?= =?utf-8?q?NiujcfWF8Ic/JHipOCMQLk+aCZldPfCSRHyfO7yg9uGW86YLGa0+QsOGj4+VwloCa?= =?utf-8?q?PreAzs7yrCN2uwOK4pf22q5zM4SOHr2qEstct/FoNfGEsyUkhAJO7e5rRhN1TzGFS?= =?utf-8?q?6bJ0LMxWtlRBxs4/qZ0yfAOYJ3GVYAe83jv7Ewqxhh5PAXwK51N/h5p/10czNVosS?= =?utf-8?q?zFo9NPgVDdzIArxbWHnoHad5XSdghLdsfbgcSD+O+4tiyIDcX0Np7UbPijMaC/BFm?= =?utf-8?q?b8Zs6jliF6nYnCTjhwfg5+xOwoQJckJ++19L6naXFcuMzjyL5+ysrzegPumFpeB4Y?= =?utf-8?q?wO5+uKu8ffGz7shAv2L6yT8ePeQ3hHPnjOUaP89B7tPm/D5KvOo1JFzgliXe6sssm?= =?utf-8?q?QQ9l9gqwMPWcKcAceB3t8V/bXpUa18zkprlKW5/Flv0fcF0BVhVzRpCuxYs3kiJdn?= =?utf-8?q?pE+PtMiFSDcUl9yljcFBSJiP8Tlam0YdiQNsCZi9ROmm/t706Nk1tOM=3D?= X-OriginatorOrg: siliconsignals.io X-MS-Exchange-CrossTenant-Network-Message-Id: 776dd8e8-2cd1-4c60-07ff-08dd20d3786c X-MS-Exchange-CrossTenant-AuthSource: PN2PPFF679F9759.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2024 08:51:18.8499 (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: AnB9N6OOmXd9+R/az0czC50TcG0gRInVw/aYGvWPtYInZuOiDNzIDoXF4iTZBGWOs3AkCpltPT6ci1IcZm3ibJlcT72Ca0Q/KO6HWnymAVo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN0P287MB1045 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: '30' % () 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: '3577000' uV (3.577 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: '206000' uA (206 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 v12 -> v13 - Battery information and RAM data add into struct stc3117_data Link for v12: https://lore.kernel.org/linux-pm/20241219094915.19059-1-bhavin.sharma@siliconsignals.io/T/#t v11 -> v12 - Removed direct scaling (* 1000) in userspace property values. - Modified stc3117_convert to ensure proper unit conversions. - Returned -ENODATA directly without scaling. - Corrected Singed-of-by & Co-developed-by Link for v11: https://lore.kernel.org/linux-pm/20241216070457.8083-1-bhavin.sharma@siliconsignals.io/T/#t 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 Bhavin Sharma (1): power: supply: Add STC3117 fuel gauge unit driver Hardevsinh Palaniya (1): dt-bindings: power: supply: Add STC3117 Fuel Gauge .../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 | 613 ++++++++++++++++++ 5 files changed, 703 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/st,stc3117.yaml create mode 100644 drivers/power/supply/stc3117_fuel_gauge.c