From patchwork Wed Nov 22 22:07:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Lippert X-Patchwork-Id: 10071349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5443E60353 for ; Wed, 22 Nov 2017 22:08:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4682B29DF2 for ; Wed, 22 Nov 2017 22:08:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3ADD929E3E; Wed, 22 Nov 2017 22:08:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6DC229DF2 for ; Wed, 22 Nov 2017 22:08:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751274AbdKVWI2 (ORCPT ); Wed, 22 Nov 2017 17:08:28 -0500 Received: from mail-it0-f68.google.com ([209.85.214.68]:46042 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751415AbdKVWI1 (ORCPT ); Wed, 22 Nov 2017 17:08:27 -0500 Received: by mail-it0-f68.google.com with SMTP id x13so7980741iti.4; Wed, 22 Nov 2017 14:08:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ue83XZXfnRel81R1PqMzazhC7S55iBybK1asz9TEaZ8=; b=lMAcrIcXAk3E6nX1BB8U0FPSTGbHNyRK6oQkwOhBdQYnYpB4hH1MTiAESivhc1mP6t 3nC6xaUziFLfbCA1Y14Z5isoUbvzhXgJoV73woKv3KrSPR9781avM4HNLjDmvexCskLC 6jz+NTbH/25GELPqXUe3RFvEY3bQStl0uDeG7a/r3VHlwX6GM7UZk6wX1AZrSQZD0YUd 4c5iGiClQHjoc2Gd9Pe7lEy00kv1tm164+1BRTSGXrtSOUCkjpRpWkP8jEHV1DuK5sRP BFNSRI+Pfvf9dGryDruHu09efMkKXQl2EWfCkQ3H9w3JstzALaNlOHrOKj4ob4be17cF pRBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ue83XZXfnRel81R1PqMzazhC7S55iBybK1asz9TEaZ8=; b=rOWYNvYC/qzUzHDxkWdI1C4luz+DwoR8KAl9nWHZTmznv7LW4kAlByXR3BQGxVGi0r ocrhqJcGS45JhPl5hFbJvvN4acS04cNSjEw3LbbLwD2wbJ2n8KMXxXce4W2k1P/p+HOh dPx1yqd5WMpsDrgpmD+8Oh7r2DtV8cEKrLtQ2AW2bk0ph/nGRB/vxdlIzsaDPfZG9iwg olmN+cbKCXyoTvneOvqlRHt2UE9Z9qvx1zs1GSvAmJAJERTn+Wy6UngGw0ZJT5Pt1Dn/ ATU0vkdN5BuokRGIqktI9aM2Su6Re6FJ423h6oktyxmaCS8V56eeQ8pjxNGHGLZP0mcv vBGw== X-Gm-Message-State: AJaThX4R5OnP8Vtrm7SzCe1XI9YWJPxmWr+ZD2yoN+hW2rbdH1ARucxz a6dngQiVrqpzN+8rKEbQkVBErM78M3s= X-Google-Smtp-Source: AGs4zMab+g358tCjAav29texf00QgOLHSQybvilLKT3/EZQX/KL3Qa5jrfygLi6kEeJnCHvDivhmQg== X-Received: by 10.36.90.12 with SMTP id v12mr8741714ita.83.1511388506587; Wed, 22 Nov 2017 14:08:26 -0800 (PST) Received: from rlippert.svl.corp.google.com ([100.123.242.116]) by smtp.gmail.com with ESMTPSA id v125sm2736690itv.42.2017.11.22.14.08.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Nov 2017 14:08:26 -0800 (PST) From: Robert Lippert X-Google-Original-From: Robert Lippert To: linux@roeck-us.net Cc: linux-hwmon@vger.kernel.org, jdelvare@suse.com, linux-kernel@vger.kernel.org, xow@google.com, Robert Lippert Subject: [PATCH] hwmon: (pmbus/lm25066) Swap low/high current coefficients for LM5066(i) Date: Wed, 22 Nov 2017 14:07:28 -0800 Message-Id: <20171122220728.17861-1-rlippert@google.com> X-Mailer: git-send-email 2.15.0.448.gf294e3d99a-goog Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The _L low-current mode coefficient values should reference the datasheet rows with CL=VDD but it seems were mistakenly pulled from the rows with CL=GND. This causes the current/power to be reported as approximately double the actual value when CL=GND and half the actual value when CL=VDD. Signed-off-by: Robert Lippert --- drivers/hwmon/pmbus/lm25066.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index 10d17fb8f283..aa052f4449a9 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c @@ -191,19 +191,19 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 10753, + .m = 5405, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 5405, + .m = 10753, .R = -2, }, [PSC_POWER] = { - .m = 1204, + .m = 605, .R = -3, }, [PSC_POWER_L] = { - .m = 605, + .m = 1204, .R = -3, }, [PSC_TEMPERATURE] = { @@ -222,23 +222,23 @@ static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 15076, - .b = -504, + .m = 7645, + .b = 100, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 7645, - .b = 100, + .m = 15076, + .b = -504, .R = -2, }, [PSC_POWER] = { - .m = 1701, - .b = -4000, + .m = 861, + .b = -965, .R = -3, }, [PSC_POWER_L] = { - .m = 861, - .b = -965, + .m = 1701, + .b = -4000, .R = -3, }, [PSC_TEMPERATURE] = {