From patchwork Tue Aug 29 21:21:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xo Wang X-Patchwork-Id: 9928345 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 AF5CA603B4 for ; Tue, 29 Aug 2017 21:23:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A221A28A7C for ; Tue, 29 Aug 2017 21:23:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96E4628A7E; Tue, 29 Aug 2017 21:23:12 +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, 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 EA7A928A7D for ; Tue, 29 Aug 2017 21:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751835AbdH2VWD (ORCPT ); Tue, 29 Aug 2017 17:22:03 -0400 Received: from mail-pg0-f50.google.com ([74.125.83.50]:35210 "EHLO mail-pg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751669AbdH2VVe (ORCPT ); Tue, 29 Aug 2017 17:21:34 -0400 Received: by mail-pg0-f50.google.com with SMTP id 63so14192194pgc.2 for ; Tue, 29 Aug 2017 14:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NFSLZoC1pcVzi2ewP0t4QWqgbFKizllkiseWHG5FgxM=; b=UuMECx1uKUPlhe1EIVFk50gMRr98n7zi8xhPHqHy9bLrm+SOJ+ADqDuqusupw6kxNH keCWGBQVh0XzyuoF1wiEuAe8VfWAydKD7YQgfSY/ngPgo2GB46wRSNG68wXCwxw6uHwz +mgRRGHjcYQSrs/sztvHOUw0jpfR7fz8ntnzoEe9DcqGJZarNpXWecIRaEoA5SEo1pxY OnnkWjX2LdMcEDJxgmc1Z4H0++Ip2/TMvTAQb1uZj+APL2+F/krf98vchUKnu0SY1BF2 emoCNTYrJ4nNXPxGK0iQJ4mH5ZSw126Ng7vQmDyjF7Xr9xDcDTkfDtWAECVON1IajD2E H0+g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=NFSLZoC1pcVzi2ewP0t4QWqgbFKizllkiseWHG5FgxM=; b=kjJoU+I9jOYWURbIylkQDzYg97fXq1mNh9ExkZHWHgLPsVfW55MrltJCPj/niEMXl9 I/ng1ktm0WA7gYqms7AnPGP93rANSMClXyhEC2agGm9Z60UopaghsW1ULyaerM1NSKYw cP2puoBtAY0IxMzzWhEiP7OVaSekbKmRHlyWCOOrIucK+8Vlo1VavAU82V6z0swvHP86 uvW19LiPoqiIjRWI7uJ7obV1XQ1udC49soS7Z3x30+XtLpmgqYviU/YdO4lYHc8lTb/S w4DgOAs7yIvxxNJuozycOKPNk9JKhnq8gOivVAjlENy10yWAsRwrsMAiHscvKbe/kSe0 PHaA== X-Gm-Message-State: AHYfb5goHv57iuR33z3QQjCITudb9OH+CsTZz4o+t/EUeZzT0ZRn527m Fe8aV2OaPeK3Akkm X-Google-Smtp-Source: ADKCNb6wYgAOswfbUfwHlk5kv4qDbKK/pVEnByF9zF5NEj0/7JGTey7qMoh7IuIhIufV3aeEn6vkZw== X-Received: by 10.84.232.136 with SMTP id i8mr2093573plk.184.1504041693877; Tue, 29 Aug 2017 14:21:33 -0700 (PDT) Received: from pewter.svl.corp.google.com ([100.123.242.121]) by smtp.gmail.com with ESMTPSA id s77sm5558445pfa.163.2017.08.29.14.21.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 14:21:32 -0700 (PDT) From: Xo Wang To: jdelvare@suse.com, linux@roeck-us.net, corbet@lwn.net Cc: Xo Wang , linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org Subject: [PATCH 1/2] hwmon: (pmbus/lm25066) Offset coefficient depends on CL Date: Tue, 29 Aug 2017 14:21:16 -0700 Message-Id: <20170829212117.143441-2-xow@google.com> X-Mailer: git-send-email 2.14.1.342.g6490525c54-goog In-Reply-To: <20170829212117.143441-1-xow@google.com> References: <20170829212117.143441-1-xow@google.com> MIME-Version: 1.0 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 When converting the DIRECT format CURRENT_IN and POWER commands, make the offset coefficient ("b") predicate on the value of the current limit setting. Signed-off-by: Xo Wang --- drivers/hwmon/pmbus/lm25066.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index a3d912cd3b8d..232b4af13e12 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c @@ -488,16 +488,18 @@ static int lm25066_probe(struct i2c_client *client, info->m[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].m; info->b[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].b; info->R[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].R; - info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].b; info->R[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].R; - info->b[PSC_POWER] = coeff[PSC_POWER].b; info->R[PSC_POWER] = coeff[PSC_POWER].R; if (config & LM25066_DEV_SETUP_CL) { info->m[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN_L].m; + info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN_L].b; info->m[PSC_POWER] = coeff[PSC_POWER_L].m; + info->b[PSC_POWER] = coeff[PSC_POWER_L].b; } else { info->m[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].m; + info->b[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].b; info->m[PSC_POWER] = coeff[PSC_POWER].m; + info->b[PSC_POWER] = coeff[PSC_POWER].b; } return pmbus_do_probe(client, id, info);