From patchwork Mon Feb 5 05:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhavin Sharma X-Patchwork-Id: 196628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp677023dyb; Sun, 4 Feb 2024 21:14:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXqCohmPJ/Y73lHKBlBPKJ9pAluh/ekQmUJU+Md9bcv1lX57LRxfiSaU5W0lYvsJNNYQf5 X-Received: by 2002:a05:6a21:a59a:b0:19c:991e:a201 with SMTP id gd26-20020a056a21a59a00b0019c991ea201mr6902870pzc.18.1707110053371; Sun, 04 Feb 2024 21:14:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVH7K3tI0dEGAHynXKOEI3R/YpADqKUqW6jj2WYqkPoetq9JQPXxc7/FEkUFpAKbtCMR4kzUggK4Z3TBzCUQJ2ukcm3LA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 20-20020a631054000000b005cfc5a55834si5442606pgq.426.2024.02.04.21.14.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 21:14:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52039-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-52039-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52039-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2280A281CA1 for ; Mon, 5 Feb 2024 05:14:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51C6ABA38; Mon, 5 Feb 2024 05:13:54 +0000 (UTC) Received: from IND01-MAX-obe.outbound.protection.outlook.com (mail-maxind01on2136.outbound.protection.outlook.com [40.107.222.136]) (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 4E36CB65D; Mon, 5 Feb 2024 05:13:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.222.136 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707110031; cv=fail; b=LhYSum4+zQvOL78H4VSxqFfg+FFF8NAh+ifZ0oZ7u5wD7NxSRQ4kgtWf3u3j4rb6sz7FzMD0vQZoj78qDVZR3T8V7w1YLQhyp/Br+ZSkR+adDZ/7Iv+oHP481zqiDAk8GZqHdT70xLZNa4blo61EFizMtUfudlNI9n5sswUtjRA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707110031; c=relaxed/simple; bh=oHK5nQriiB6h9xMedAEPg4pqI0JWQ8qWWsiADuTWufg=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=PhBaHn58tySdnRvO+NEKTUdv8ADLQS76MWSkBt6haC8vhgAPew8CSZvDhAXG4VwRr+FaxI69+tcGQWif41yAkyHabwyPND2aHJxxr/4cs7B0lu80KktTw7p/c2yaYa52fk+nvyWEPQrVYP51zhRwd8y1dek5FJkdFh6hi9rBZdE= 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.222.136 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=arcselector9901; d=microsoft.com; cv=none; b=Dk5bNu4oNJ3gVJwJNBwAuYcZDv/TbGmkJoleX8NNQg5OM0ZXQlpZtDBBefxrjCsdoRnz/yzAxRH5X9r+BJBdqcoyxqR3sx2H34CAqdb6BiQNNl+mABs0TGa6niSqyMwCVcmFXv4hLMbWNhbRlOc6jJ55xvDRFX1dfM9xLQYHHy0quHy5n6P8BGLNeuDq8BVWd/O9ouORWldNOZLlSlg8YYEwXfyIhK06irn60lq0PWnxkiI4TJvV/t/eqRP+O4ivnpeS1b8po5nfXIfi7kV0X+WNanD6q9WCd/CTQCGP/szo8kS6SQ5hQ4YwBMBeDICrfYLQtEV3fU0pGS4YIqsuJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=ck/RK1k8Lt2fShut1w+cKgVzxJDNr/D1Kx+TZP8kdbQ=; b=UjW39Q56VmXHuVKg9NDY9HHYDsrAvNKkO8Ptngzi4V4WyVdu1E5fJh4bX+8p0YnDWl7Fe6JR9nktnh5jOXT6COA1NnUgcHIudMVOF5eNJMlFLaBnuHsTK85mjKUz2rURqvJZ/zC4nxsEDTLWCjKC8HvG2VfDFCseEXwNIOe6Gt85zpK+UoaVXNBFv812mnxV9A9Hy8/i0KARp9veWIugfo6iVS/OU5EREDmAs9CTvL7c+oWCz7eMpxXmiYz4rUDVwrCq+uoOMy7enryKuAJJq9IFuzOeRrfTL/q2WD3Srmg3LLawNnVUlHPw3npeYxWLF+QGUS4PskoMjNAfRdvKkA== 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 MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:42::6) by PN0PR01MB5496.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:63::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.34; Mon, 5 Feb 2024 05:13:45 +0000 Received: from MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM ([fe80::72b4:8a64:2d93:7cc0]) by MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM ([fe80::72b4:8a64:2d93:7cc0%4]) with mapi id 15.20.7249.032; Mon, 5 Feb 2024 05:13:45 +0000 From: Bhavin Sharma To: sre@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: Bhavin Sharma , Hardevsinh Palaniya , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] power: supply: Add STC3117 fuel gauge unit driver Date: Mon, 5 Feb 2024 10:43:17 +0530 Message-Id: <20240205051321.4079933-1-bhavin.sharma@siliconsignals.io> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: PN3PR01CA0085.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:9a::21) To MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:42::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MAZPR01MB6957:EE_|PN0PR01MB5496:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cbc2cfc-6bd0-45aa-5918-08dc26093a4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OMA7eKlJac7me31QHuo3KZmDVzQUXHXDNlFUZif8xMiCTjD2fJ8xm0Zx4VKJsY+tfmLYf6QnaA9nUBmcQc+KNaLaAjjlu5772uLJsJJSvtT8f5ABUk6bUIvLQt8J/EZQnGiwVtlOncqF1QLR50lHSC4W1gKMzS7O59oz53VJiU/6tkysAyBNYGQczAwc6rDfjm+r4HuRPyxfZFNgT1fnDA4N5sxN4isECBlpQ4c274wAfZNN9jrZGh1M+IZQ78oM7mYAW4mgbOFLqXrkrJUFqD3DcKcu4y6Na/Q46tpDrU/EdHSy8qc9A0y3CgYI07R2t31BhkdG2+Uor48nteLKJ0coyyXHS7k3TkKFG5o2p9EPiFmDM1rBJMT9zKlJl8RvgCjOfpCLOVldv0m+gbWpzIOcgj3mpUhN7bxnl5sCp6A1ykmUWRtt7rszQsHzQyq9ncPLxvTVp66GA9BAPx5mTHERA6qgP3rZzVlbqdo/7qsx0hlUBdsPYtIjKl6ik/+CS+rz8v3/126nWcB0LTJYBBeAfm71kfjSN8VQythpFZgQly4AnJCN8Rr5erU/c+PM9nA7M3ahIXR+MvcDcPA/jBmFkKsFBov0Hj5OQv39VMclH6db280eHU/JhqpfkyuP X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(136003)(346002)(39830400003)(366004)(230273577357003)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(41300700001)(36756003)(38350700005)(2906002)(66476007)(6486002)(66946007)(2616005)(1076003)(52116002)(6512007)(6506007)(6666004)(478600001)(86362001)(44832011)(83380400001)(5660300002)(54906003)(26005)(316002)(8936002)(4326008)(66556008)(38100700002)(8676002);DIR:OUT;SFP:1102; X-MS-Exchange-Ant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H5n+lKNZ8Ea4VHEvXLV0Q7zQI8rrLQtevb72hQhhOMJ8YDMoYOGD+JKMpDnyHFy0CEQmDl0Mi9HD300NFJtp/vnt+cPm+ColULcQgQi4EaWWaJIwaXMgG31mvjDPp9TMgqRkV6X5EU07wd9Ko220gaEuikDkySYx4jdD2TV7E3YQJQyKvblvlthYJ8GW1YSSJANwy4UZXJvb4N0S03vl2TJDqDZvaHV2H8xNzvO+6f7CPQDtsbGbxXhzIKkDrD3y9C1pzZibflW1JMHg4Gj9Ejck/7nh4HexCiW0ZCa+1bb8kjQMGV+ZHE/qakOYn4KDsJqjzfkekjuiBrgA3al5qsHFJc23wXIdgpsLzVAteoDIOWXl3ouW4J21b6E+rhjOOG8AmTFVW0MkuASQCCphoriDXDfy1BodcyGNjOYDUSWR0YoU/BDxg8+jKoEwnlFpotLEsmTQQdjtkWz3rNuvCh+MjDwAFtyvnb9v55vLKT4w+ofd6Hh5uFYIPEc1n6ggh8Wj1BkqeXBcqaf67taQ5M/i3MG12vnExE5WwNBjLpAiwsPENIA5D0zg6eYotaJmlqUzYs/2EFqQZayoLqw9s6BZnxI= X-OriginatorOrg: siliconsignals.io X-MS-Exchange-CrossTenant-Network-Message-Id: 2cbc2cfc-6bd0-45aa-5918-08dc26093a4c X-MS-Exchange-CrossTenant-AuthSource: MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2024 05:13:45.5511 (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: b9aINSWVua3UTKxaMfQzCAjnxFwVJIipyYl8RxMTJUTFN6xUbIDDnMYeu3NwIFF3pne8iIbtYPfZZs/xeyY1VIUXSjZxZiqr/CYaUmFEy4A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN0PR01MB5496 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790034630986981285 X-GMAIL-MSGID: 1790034630986981285 Adding minimal support for stc3117 fuel gauge driver to read battery voltage level Signed-off-by: Bhavin Sharma --- Changelogs : v2 -> v3 - Resolved kernel test robot build warnings - Aligned included header files in alphabetical order - Removed unused header files - Removed unnecessary blank lines - Aligned all the macros in alphabetical order - Changed macro LSB_VALUE to VOLTAGE_LSB_VALUE - Dropped function prototypes and arranged the code accordingly - Used macros instead of static numbers for array declaration - Removed redundant code - Replaced 'power_supply_register' with 'devm_power_supply_register' and 'pr_err' with 'dev_err' - Removed global variables v1 -> v2 - No change --- drivers/power/supply/Kconfig | 7 ++ drivers/power/supply/Makefile | 1 + drivers/power/supply/stc3117_fuel_gauge.c | 107 ++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 drivers/power/supply/stc3117_fuel_gauge.c diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig index f21cb05815ec..e2e3af4bcd5f 100644 --- a/drivers/power/supply/Kconfig +++ b/drivers/power/supply/Kconfig @@ -875,6 +875,13 @@ config FUEL_GAUGE_SC27XX Say Y here to enable support for fuel gauge with SC27XX PMIC chips. +config FUEL_GAUGE_STC3117 + tristate "STMicroelectronics STC3117 fuel gauge driver" + depends on I2C + help + Say Y here to enable support for fuel gauge with STC3117 + PMIC chips. + config CHARGER_UCS1002 tristate "Microchip UCS1002 USB Port Power Controller" depends on I2C diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile index 58b567278034..be8961661bd1 100644 --- a/drivers/power/supply/Makefile +++ b/drivers/power/supply/Makefile @@ -104,6 +104,7 @@ obj-$(CONFIG_CHARGER_CROS_USBPD) += cros_usbpd-charger.o obj-$(CONFIG_CHARGER_CROS_PCHG) += cros_peripheral_charger.o obj-$(CONFIG_CHARGER_SC2731) += sc2731_charger.o obj-$(CONFIG_FUEL_GAUGE_SC27XX) += sc27xx_fuel_gauge.o +obj-$(CONFIG_FUEL_GAUGE_STC3117) += stc3117_fuel_gauge.o obj-$(CONFIG_CHARGER_UCS1002) += ucs1002_power.o obj-$(CONFIG_CHARGER_BD99954) += bd99954-charger.o obj-$(CONFIG_CHARGER_WILCO) += wilco-charger.o diff --git a/drivers/power/supply/stc3117_fuel_gauge.c b/drivers/power/supply/stc3117_fuel_gauge.c new file mode 100644 index 000000000000..29eb00b44e21 --- /dev/null +++ b/drivers/power/supply/stc3117_fuel_gauge.c @@ -0,0 +1,107 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * stc3117_fuel_gauge.c - STMicroelectronics STC3117 Fuel Gauge Driver + * + * Copyright (c) 2024 Silicon Signals Pvt Ltd. + * Author: Bhavin Sharma + * Hardevsinh Palaniya + */ + +#include +#include + +#define VOLTAGE_DATA_SIZE 2 // in bytes +#define VOLTAGE_LSB_VALUE 2200 // in micro-volts +#define VOLTAGE_REG_ADDR 0x08 +#define VOLTAGE_REG_ADDR_SIZE 1 // in bytes + +static int stc3117_get_batt_volt(const struct i2c_client *stc_client) +{ + int ret, volt = 0; + char i2c_tx = VOLTAGE_REG_ADDR, i2c_rx[VOLTAGE_DATA_SIZE] = {0}; + + ret = i2c_master_send(stc_client, &i2c_tx, VOLTAGE_REG_ADDR_SIZE); + if (ret < 0) + return ret; + + ret = i2c_master_recv(stc_client, i2c_rx, VOLTAGE_DATA_SIZE); + if (ret < 0) + return ret; + + volt = (i2c_rx[1] << 8) + i2c_rx[0]; + volt *= VOLTAGE_LSB_VALUE; + + return volt; +} + +static int stc3117_get_property(struct power_supply *psy, + enum power_supply_property psp, union power_supply_propval *val) +{ + struct i2c_client *client = to_i2c_client(psy->dev.parent); + + switch (psp) { + case POWER_SUPPLY_PROP_VOLTAGE_NOW: + val->intval = stc3117_get_batt_volt(client); + break; + default: + return -EINVAL; + } + return 0; +} + +static enum power_supply_property stc3117_battery_props[] = { + POWER_SUPPLY_PROP_VOLTAGE_NOW, +}; + +static const struct power_supply_desc stc3117_battery_desc = { + .name = "stc3117-battery", + .type = POWER_SUPPLY_TYPE_BATTERY, + .get_property = stc3117_get_property, + .properties = stc3117_battery_props, + .num_properties = ARRAY_SIZE(stc3117_battery_props), +}; + +static int stc3117_probe(struct i2c_client *client) +{ + struct power_supply_config psy_cfg = {}; + struct device *dev; + struct power_supply *stc_sply; + + dev = &client->dev; + + psy_cfg.of_node = dev->of_node; + + stc_sply = devm_power_supply_register(dev, &stc3117_battery_desc, &psy_cfg); + if (IS_ERR(stc_sply)) + dev_err(dev, "failed to register battery\n"); + + return 0; +} + +static const struct i2c_device_id stc3117_id[] = { + {"stc3117", 0}, + {}, +}; +MODULE_DEVICE_TABLE(i2c, stc3117_id); + +static const struct of_device_id stc3117_of_match[] = { + { .compatible = "st,stc3117" }, + {}, +}; +MODULE_DEVICE_TABLE(of, stc3117_of_match); + +static struct i2c_driver stc3117_i2c_driver = { + .driver = { + .name = "stc3117_i2c_driver", + .of_match_table = stc3117_of_match, + }, + .probe = stc3117_probe, + .id_table = stc3117_id, +}; + +module_i2c_driver(stc3117_i2c_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Bhavin Sharma "); +MODULE_AUTHOR("Hardevsinh Palaniya "); +MODULE_DESCRIPTION("STC3117 Fuel Gauge Driver"); From patchwork Mon Feb 5 05:13:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhavin Sharma X-Patchwork-Id: 196629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp677153dyb; Sun, 4 Feb 2024 21:14:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEV1ahk7BFlfCGlG+I0z5UikkNajiwZeXVmMi7+COhiCTEKgzlEp3W7ZtIraQ6Wq/bCtEQN X-Received: by 2002:a05:6402:3454:b0:55f:4ba4:e735 with SMTP id l20-20020a056402345400b0055f4ba4e735mr5239765edc.2.1707110075408; Sun, 04 Feb 2024 21:14:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXd2cIWbvGXeHlMXqh/Tfq/TYg+mky3I9P6/OIdeesKV5QY/2lG5DJFMSwlXHbVnenq09Y1eKpoKf22viKXe8NMyCtDag== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 5-20020a508745000000b0055cef76e489si3581512edv.84.2024.02.04.21.14.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 21:14:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52040-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-52040-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52040-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D5FC71F22A23 for ; Mon, 5 Feb 2024 05:14:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A5D3D510; Mon, 5 Feb 2024 05:14:00 +0000 (UTC) Received: from IND01-BMX-obe.outbound.protection.outlook.com (mail-bmxind01on2102.outbound.protection.outlook.com [40.107.239.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 15F45BE6F; Mon, 5 Feb 2024 05:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.239.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707110038; cv=fail; b=kUxBoobBZGLnv9Pjf9Gpywt9s+HTge5CEA1HCnLDVh/1BNu47lcbBZn4noNqbNU0AAR2Qn1mXjMwQaRyB4Ma4UG1xyxeull6nsxHUEuZaiZw5mjlJ72JyF9+nFsGzUeLoA3zRRHkvrNZtSlCS/qK2b6aIqg5X/LM11lHPoyJFdQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707110038; c=relaxed/simple; bh=0B0lcqj+owhpt/ttDtP1oTnHjLJInbPmDN4BVOHjUSw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=K5QzAKnIWZ899j7NoR0gtVX3jng8gXPLv/0wF8fRGIBZX2ShPd5+pFVoD4qlWa+UYfgt4ckkyc1lsm4Ml3IsPjPhrOuw6LC3mV+tYw72RyOzVCUSDod6kzoTaMqbHyDI+fmpnFl3Krvn9LwqqpSzArHdtRlQJAcsnzH3it29Ew4= 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.239.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=arcselector9901; d=microsoft.com; cv=none; b=IyvL/bKPRPhVdKc8dpGcaOTkhn3k2H+EFdNP1MMPU0c/+WJtSE1MhwJ21r9HZvneyICyHXv4Vi2vX5j2ULqFcHK2LvLyAChOZtROE2ibvqXe2JH5LrAm30meajT6WitcA55X3MopISAgyS9ug/FeBdJewLduDfNpnw6mopcaYA7oIMP4f08k1+CxpuNt+N0OQdF7l5ycPOZpWLonpKAF4kPDdquhihz8clm6Y/yO5fZMC7Yw7F9lNbvlLtKmpJaV5FkuoSNnkPKnuQL7Hw/KQzVBt50sowKewLSynxQQWJ+fl1Lp2kNp+FlQtr9Qdni2sqZVbSu8vUzIpLumsIs6KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=yhD2zerR0naphy4NoxcOd+wGWyxsezBEfX6T6cDvcYA=; b=MXNJwaST6AgMUgHWrWIZEPf6B7ovNmxJ1peK4IyFxgljoruPyMgDf64fcYkX7v/UtR9G2SmosXgtz+Do2UW/yccyXUMIb7UyLwYp4eqC/vDj278K6CtqTmjbB/KdTaB3BiYuF0hiH5mX7hmEem/912N7kWtE01b9cqe0rTq/UpVipPSq7Q9Rw78VRM1hJy51ZVlx2crEk/j+yrcayNsbXHlfOxXI+hZs9EEIph9M3zzyO0Uf/Hf7fIZFCgw9oCbYEOgUBf4M5pNV02NxCq+I8in1Wzn8t2CG7LkVDpXhYXLiifei/Y/DwOmt9RwfNp2OIaJar9t9knFUMwgy6v0Akg== 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 MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:42::6) by PNXPR01MB7488.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:ba::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.34; Mon, 5 Feb 2024 05:13:52 +0000 Received: from MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM ([fe80::72b4:8a64:2d93:7cc0]) by MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM ([fe80::72b4:8a64:2d93:7cc0%4]) with mapi id 15.20.7249.032; Mon, 5 Feb 2024 05:13:52 +0000 From: Bhavin Sharma To: sre@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: Bhavin Sharma , Hardevsinh Palaniya , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] dt-bindings: power: supply: st,stc3117 Date: Mon, 5 Feb 2024 10:43:18 +0530 Message-Id: <20240205051321.4079933-2-bhavin.sharma@siliconsignals.io> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240205051321.4079933-1-bhavin.sharma@siliconsignals.io> References: <20240205051321.4079933-1-bhavin.sharma@siliconsignals.io> X-ClientProxiedBy: PN3PR01CA0085.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:9a::21) To MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:42::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MAZPR01MB6957:EE_|PNXPR01MB7488:EE_ X-MS-Office365-Filtering-Correlation-Id: e4159f9a-0676-4cca-a6ac-08dc26093e52 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JxTXvFdUjRK+gLaqQr/Dzva+HsT0aDO7ftbG6haTEUYc5Je20wtsT4ZvOougokqCayYnRMWCfyAXdFSWFBvP3Zzv9zLooXY8b4UIjzl/mAYupGZhdEJc/oXzIfwyQuiZGKiLhBzMOIWnpYgPdfXaP9beF0+MP8Dw0RuqtoJopDX+Op0lgYRIKBG/F7x0Z1qSK2qnXrgL+zhKulSSf6oIcHQaWhSISSn1u7I2eXLjlrUlWunFjDRTKE3sqD87QopeQStscCLjiQAMrjZ+MMiUmiPOJIGAsNQHNqplHvBczuBicEuSyrF4xMzpR3vNYmSzMI/rfYbUAYNTQ8Zm6IjL/3abdKeM7JkBVCR0iNmW7ZkZ0azlc9Vkhaa8ETQEj2MrZDu2kKgrbeZVQGAI8plyajH1ssKuE535Hi073QnHJIEMI8IU4oEqhaC81anqqUPw81uAyaGfii+I3RpXd82JNHi9c/hm6fRbKWEtKYZfNzAZqmLyCs2lZKxOJRUOZFjhsWxWboJDdQD2u1kAVNikBfc/yOvYSxiDOu2ZJAn7uOGZLi/uVxtHes2I4hdqKqPlv0LeGUB0D/fYix6i7iCRFPYz7vXu9xNrR6AGh5IoW5M= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(346002)(376002)(39830400003)(366004)(136003)(396003)(230922051799003)(230273577357003)(451199024)(64100799003)(186009)(1800799012)(41300700001)(44832011)(5660300002)(2906002)(316002)(66476007)(66556008)(66946007)(54906003)(8676002)(8936002)(38350700005)(36756003)(4326008)(478600001)(26005)(86362001)(6666004)(52116002)(6506007)(6512007)(1076003)(2616005)(83380400001)(6486002)(38100700002)(966005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jx/H6fAaN/b95fe2REYuTFcOWTu04g6NCkOj9ssQ89LDJFnbKUt85G4O4LLRW50rgLaJanDHgqYUkGGA2TkolBEPOC37dE4NZTB8CmANPGYz7mCvHpnoBqzDTUb4J7WA1cf6s2LfVXOqCIDbDxEDC6mtUxDi8NmvSJ7jyVa9yAi2+fQWSEeg8t3cHEIOhGftQMUJN0Thu7rOtr92NeNo3fcsIE2yp8Tny7tb/yz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IBo85Y9EcpsbXuDw/xCLm/TjbwDZ2JeNk6i+avWR4+I5rJpGLdTnp/olI4PQls4pCQZG0hRDNxLLfe4SSZ/TYtU5WyUVMlRNlduXlGJze3xJk5TwWoSQyA/rRhcglxflykLJAEQ/EG2vsnbt1k9GB8klmgGL9FfgiZ4L77+1ZURd6Ihy0P2lhOLGvLXciQoG46YsD11yCVf4DJTPAlz3yE3+NDODdm6LKDT76m9n1cwhFPbmR+H0TGcJy1KHHZW3W0jfC55//QO7ckYXwnLgOIFWXLc5v9b04ED8Y2r390MhHMsLXJUPliXQO16hLF86o0= X-OriginatorOrg: siliconsignals.io X-MS-Exchange-CrossTenant-Network-Message-Id: e4159f9a-0676-4cca-a6ac-08dc26093e52 X-MS-Exchange-CrossTenant-AuthSource: MAZPR01MB6957.INDPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Feb 2024 05:13:52.2747 (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: vRq/ElbxWqBJFK8cE2BiQPJOkld8Mql0u7zF1RupEQkJxp2bRVDhY9CrkaMyE0gBC2eib8F11bg4y+ux1TgqSpMJfWivyMxZczYQETI9fUg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PNXPR01MB7488 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790034654460467471 X-GMAIL-MSGID: 1790034654460467471 Signed-off-by: Bhavin Sharma --- Changelogs : v2 -> v3 - Resolved DTC warnings and errors - Formatted the changelogs - Added monitored battery properties - Replaced 'additionalProperties' with 'unevaluatedProperties' - Replaced '&i2c6' with 'i2c' v1 -> v2 - String value is redundantly quoted with any quotes (quoted-strings) - Found character '\t' that cannot start any token --- .../bindings/power/supply/st,stc3117.yaml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/st,stc3117.yaml diff --git a/Documentation/devicetree/bindings/power/supply/st,stc3117.yaml b/Documentation/devicetree/bindings/power/supply/st,stc3117.yaml new file mode 100644 index 000000000000..9ab0b0d6b30e --- /dev/null +++ b/Documentation/devicetree/bindings/power/supply/st,stc3117.yaml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0-only +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/supply/st,stc3117.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: STMicroelectronics STC3117 Fuel Gauge Unit Power Supply + +maintainers: + - Bhavin Sharma + - Hardevsinh Palaniya + +allOf: + - $ref: power-supply.yaml# + +properties: + compatible: + enum: + - st,stc3117 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + bat: battery { + compatible = "simple-battery"; + device-chemistry = "lithium-ion-polymer"; + energy-full-design-microwatt-hours = <16800000>; + charge-full-design-microamp-hours = <4000000>; + voltage-min-design-microvolt = <3000000>; + }; + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + stc3117@70 { + compatible = "st,stc3117"; + reg = <0x70>; + monitored-battery = <&bat>; + }; + };