From patchwork Mon May 4 22:12:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Bakker X-Patchwork-Id: 212129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD37FC47254 for ; Mon, 4 May 2020 22:13:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6FE82078C for ; Mon, 4 May 2020 22:13:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728134AbgEDWNd (ORCPT ); Mon, 4 May 2020 18:13:33 -0400 Received: from mail-bn8nam11olkn2099.outbound.protection.outlook.com ([40.92.20.99]:30491 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726453AbgEDWNb (ORCPT ); Mon, 4 May 2020 18:13:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XLkkTj5NYw+b44s+2NrmGjlbnkoxH1lQ+6QZOdSHXmdLedGFHH809QlWcrG0kB7IIkiuAMAmKPVtdrsJrrt5kkmK+wT7yLJWGTw9rvfhoGhuvo0W92jD5RUh+VMWpbp0g3zQFa3fO09vWKMUhBZZ3zpe19Mi86EpuHLQjFlZXb6FM/RdPA700rQ2CiRohYz6fnHLenxAhOqaJiPlcRVd8HJQg5nSxrtgeVLRFk4ORJQrv/6/qZVM/tEVq63aaX1GZtC2PsJSoZFpjcMI5veqZ3fVmA5A9wNpMUhUZXjmhC/M5PiJNF3wgzfENcNCoQws0EVqeFqMjZ/+OSLFvdq19A== 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-SenderADCheck; bh=BjDFX7OxNYJ9dpDXgqdBWyfSjC9THLPC31mAGrV8EBQ=; b=MPEava+oJlmFDR3CuUuGyQwLDLDrVHAg5dixdxswBjQQMTqOUFqXTTe+mVreqikvfXvenIT5ey1ki2wr9LqmlbP552nJRGzJBjGWDvY3UwzDu6oMeG0gg+CYPedgjp+V1AkJ+X5D98ekdQoatUWZKP2e/TLD7NpwDlaZCLDr2IXfvkaerdEcw0xUQEqW9aPPgYC4hhHsoXTXU9IPkpsGO05Me7OZ6Q/USOCpPP0lAAv99dgUA9bOC3RzDbfBCWRR+MInnHysVMLZ3uN5S9tRuVwl0SHxs6TsYVB00S4JOt7jtP15VLHIh96uKp1JTExDFiSaL/WpyvxiLS3J9x+cvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.ca; dmarc=pass action=none header.from=live.ca; dkim=pass header.d=live.ca; arc=none Received: from BN8NAM11FT010.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::4f) by BN8NAM11HT099.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::262) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19; Mon, 4 May 2020 22:13:28 +0000 Received: from BN6PR04MB0660.namprd04.prod.outlook.com (2a01:111:e400:fc4b::4d) by BN8NAM11FT010.mail.protection.outlook.com (2a01:111:e400:fc4b::309) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Mon, 4 May 2020 22:13:28 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:4D6007E31AEF8A9A2185AD085CBE1BF1311FF5835FD22518BC136F0631633D72; UpperCasedChecksum:545C498EF5A43E31BE380659542A3C8ABE875CC7C552718776E03615079AEE01; SizeAsReceived:7766; Count:50 Received: from BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc]) by BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc%6]) with mapi id 15.20.2958.029; Mon, 4 May 2020 22:13:28 +0000 From: Jonathan Bakker To: sre@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org Cc: Jonathan Bakker Subject: [PATCH 1/3] power: supply: max17040: Correct voltage reading Date: Mon, 4 May 2020 15:12:58 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200504221300.3153-1-xc-racer2@live.ca> References: <20200504221300.3153-1-xc-racer2@live.ca> X-ClientProxiedBy: MWHPR2201CA0053.namprd22.prod.outlook.com (2603:10b6:301:16::27) To BN6PR04MB0660.namprd04.prod.outlook.com (2603:10b6:404:d9::21) X-Microsoft-Original-Message-ID: <20200504221300.3153-2-xc-racer2@live.ca> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jon-hp-6570b.telus (2001:569:fb68:9c00:8067:f823:1e15:7520) by MWHPR2201CA0053.namprd22.prod.outlook.com (2603:10b6:301:16::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Mon, 4 May 2020 22:13:27 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200504221300.3153-2-xc-racer2@live.ca> X-TMN: [WGkTflbsxw0dIwykn+04DaBhHAOY46l/NDMLDEEmKCkkfbLBdRzuVm1RbH/sVrrJ] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 4f4f15c5-7f67-4772-7a70-08d7f0785f58 X-MS-TrafficTypeDiagnostic: BN8NAM11HT099: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WmgzQyya2HdaYfIWzTL22N+4XlkssgRFFCLVrjnyXkHeNLpVM/wHwgxs4fG/POcbg58xEKK/LJWq7XUH9lATyK6VE9nixBJjgWRwxY6WF30vpQCbj6MXu2kl62RiOcIuQfXyUUKZjpnP4/dAMslH//EzjP1ONyRMF1I2C2EaMfACi1Hi6gVFRRlAqvfioPI8WtKYqpy7Uez7Gag0zOO0pYBgrMsZNt7DciWGmru8ss+e1nFikwD3vdWZzgRduLWM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:0; SRV:; IPV:NLI; SFV:NSPM; H:BN6PR04MB0660.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:; DIR:OUT; SFP:1901; X-MS-Exchange-AntiSpam-MessageData: mJjyCY6y9xvwNd52CklzFcJ+/oJcFHZzo6/7HCNkh/ruPPUIBD7s9dPcVSGm+VZ5LrMjT5UdJOxWvChAV9r96fo93iNg1sst2TDepgu5eAsNxLHEB4pQj68YfC3yeci9bLt1tW7qwciXSZ3lq7JW0ivyMp/rXfqDev2jouj7ts4mgye1qFZ9O7Rvh3U9h6dt1knCu8LPkNeGU2r+hAlR0g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f4f15c5-7f67-4772-7a70-08d7f0785f58 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2020 22:13:28.7288 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM11HT099 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org According to the datasheet available at (1), the bottom four bits are always zero and the actual voltage is 1.25x this value in mV. Since the kernel API specifies that voltages should be in uV, it should report 1250x the shifted value. 1) https://datasheets.maximintegrated.com/en/ds/MAX17040-MAX17041.pdf Signed-off-by: Jonathan Bakker --- drivers/power/supply/max17040_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index 8a1f0ee493aa..48aa44665e2f 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -126,7 +126,7 @@ static void max17040_get_vcell(struct i2c_client *client) vcell = max17040_read_reg(client, MAX17040_VCELL); - chip->vcell = vcell; + chip->vcell = (vcell >> 4) * 1250; } static void max17040_get_soc(struct i2c_client *client) From patchwork Mon May 4 22:12:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Bakker X-Patchwork-Id: 212128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8497C47247 for ; Mon, 4 May 2020 22:13:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D11532078C for ; Mon, 4 May 2020 22:13:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728200AbgEDWNe (ORCPT ); Mon, 4 May 2020 18:13:34 -0400 Received: from mail-bn8nam11olkn2023.outbound.protection.outlook.com ([40.92.20.23]:11744 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726433AbgEDWNd (ORCPT ); Mon, 4 May 2020 18:13:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O7KJxVNphkxGpLTH/XU1bCG4MmBFuUo+YCk4WD51UrqPzVsxTAqCpbX0PVs4Sq4U6Kbc/bVDQIr16YkfyquhkhGnSQsYDgFDv8EP2Pi1TYUE0GoUDz23W3PWCE1waWFj6+jNbTaBMgT1cIJKgz8Da5/oJxsoQroiLJ9suD0MhaPOrKwQxkwegCUxutVcvNE5GIYLEdeEtkNfAM6+AhkTpKibOB7kjBnLEUWfYwM7KtozVRCz64TNwHxvaxGsH+DaR6Des+/ZcANJ6uWCr5vmmFGQe0YSkOBrpFkB5NHMmo2tlgRyavRds/WKIYR/dYpHJMVGgvzI0NfvVNVV3wyscg== 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-SenderADCheck; bh=IQlQFEkFCJP5s3LXh0PpwXlPhoi+wfKHEygXgJ+LySc=; b=Xs+Oikki7xASG13zGdQUJ7wcpDMsqcG9Qld02DL2AKrmQgZRVeEgK/jk1/vvLBAeM0mSLnI7W4QI27pUsuEbmmQUh1EMn2z+XrG1A7vReigb34ZW3Eyp8XUY9kqegWuMiRzlG6yDhC3MFdtjRDYXjeKY0naisOQchsIDSkgiKq1JfAIs74gXg/eOU248CwjLGKgOMY1rych+aPJlrSv+jygFW8w7OHqGfU89+yhf/gZQQ2k0PNfO4x8b/Y0kRgDsxD5L2zNdoQ02WFPGH8nNJ5eKpOoJTvKFu5KcyPWtYxkrYqReBWotcRxqESk/g9LtOJFWPrxS7N2bmsFSE4GpVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=live.ca; dmarc=pass action=none header.from=live.ca; dkim=pass header.d=live.ca; arc=none Received: from BN8NAM11FT010.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::4b) by BN8NAM11HT173.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::385) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19; Mon, 4 May 2020 22:13:30 +0000 Received: from BN6PR04MB0660.namprd04.prod.outlook.com (2a01:111:e400:fc4b::4d) by BN8NAM11FT010.mail.protection.outlook.com (2a01:111:e400:fc4b::309) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Mon, 4 May 2020 22:13:30 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E3D82FCFBB480C77A928FC454D34593C1A7BDC516AEAEC1E884C2FC111877AA0; UpperCasedChecksum:E0146A7F0D2AECC0D278F856D9BC41B9739485A62C1581A349D7FCB67CE2BF0A; SizeAsReceived:7786; Count:50 Received: from BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc]) by BN6PR04MB0660.namprd04.prod.outlook.com ([fe80::ad10:4127:4bc8:76fc%6]) with mapi id 15.20.2958.029; Mon, 4 May 2020 22:13:30 +0000 From: Jonathan Bakker To: sre@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org Cc: Jonathan Bakker Subject: [PATCH 2/3] dt-bindings: power: supply: Document maxim, rcomp-value for max17040 Date: Mon, 4 May 2020 15:12:59 -0700 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200504221300.3153-1-xc-racer2@live.ca> References: <20200504221300.3153-1-xc-racer2@live.ca> X-ClientProxiedBy: MWHPR2201CA0053.namprd22.prod.outlook.com (2603:10b6:301:16::27) To BN6PR04MB0660.namprd04.prod.outlook.com (2603:10b6:404:d9::21) X-Microsoft-Original-Message-ID: <20200504221300.3153-3-xc-racer2@live.ca> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jon-hp-6570b.telus (2001:569:fb68:9c00:8067:f823:1e15:7520) by MWHPR2201CA0053.namprd22.prod.outlook.com (2603:10b6:301:16::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Mon, 4 May 2020 22:13:29 +0000 X-Mailer: git-send-email 2.20.1 X-Microsoft-Original-Message-ID: <20200504221300.3153-3-xc-racer2@live.ca> X-TMN: [WfGrgOUezFu0vC/W30ev1tWlInh3FoVZJ91iGfU0xFXxzpVcrC12z2QEsvNAYwPB] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: fc416014-dec5-43da-5c94-08d7f078603a X-MS-TrafficTypeDiagnostic: BN8NAM11HT173: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B/c+YeRTZ8DNcMHtecsCCrHyRiHs07igOUWEblDdQYqJ4Myrhe3lEOOk+NsNekfKlmyJTC0B44YxNAA/ivqzNnRsAhYg41rDp14HGaDvrCg3x2VqQlbL/mDg/TAhmbQePHDu7tpUz73d0q67E1g3KilQEN6IIZV21Y60xZgQChyuttp5PP66YrVPxhOg7iFI7SQbvkgJrn0guEx9LRsL7g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:0; SRV:; IPV:NLI; SFV:NSPM; H:BN6PR04MB0660.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:; DIR:OUT; SFP:1901; X-MS-Exchange-AntiSpam-MessageData: 9GFcBm5oAq1K5MFL55SVtPcCgEx7WYTg1j4ni2/0jH0j2bHWhlTQywWofqn+XPNx/2J9ffc74S0ZDKTZiTlO+JCxufvWZoXAnhMDuleO8ifYcLTUXipAinCe+hvzXFP5BixLurBxsgq2UPKqV4dQmMGVG6sDTAWEyCBzQtop6B3JfvyWtQx4A6QH5FcsLPVBV1DaZhHDmVgiP9c6pW5Fug== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc416014-dec5-43da-5c94-08d7f078603a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2020 22:13:30.2631 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM11HT173 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The rcomp value is a device-specific value for configuration based on specific chemistries. There is no public documentation on how to tune it. Signed-off-by: Jonathan Bakker --- .../devicetree/bindings/power/supply/max17040_battery.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/max17040_battery.txt b/Documentation/devicetree/bindings/power/supply/max17040_battery.txt index 4e0186b8380f..14097b3ed278 100644 --- a/Documentation/devicetree/bindings/power/supply/max17040_battery.txt +++ b/Documentation/devicetree/bindings/power/supply/max17040_battery.txt @@ -11,6 +11,9 @@ Optional properties : generated. Can be configured from 1 up to 32 (%). If skipped the power up default value of 4 (%) will be used. +- maxim,rcomp-value : The value for specific lithium chemistry. If + not present, the default value of 0x97 will be + used. - interrupts : Interrupt line see Documentation/devicetree/ bindings/interrupt-controller/interrupts.txt - wakeup-source : This device has wakeup capabilities. Use this