From patchwork Tue Aug 29 21:21:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xo Wang X-Patchwork-Id: 9928339 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 382266022E for ; Tue, 29 Aug 2017 21:21:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A69928A6C for ; Tue, 29 Aug 2017 21:21:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F3F928A7A; Tue, 29 Aug 2017 21:21:53 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=unavailable 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 BF05428A6C for ; Tue, 29 Aug 2017 21:21:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751733AbdH2VVj (ORCPT ); Tue, 29 Aug 2017 17:21:39 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:33164 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751745AbdH2VVg (ORCPT ); Tue, 29 Aug 2017 17:21:36 -0400 Received: by mail-pf0-f175.google.com with SMTP id r62so13654851pfj.0 for ; Tue, 29 Aug 2017 14:21:36 -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=3F94VPxALuJJiiDT1fEXGiS2dfya392cnISXh4pshr4=; b=hxI8HCWg9mn6vX3r0LdYcoJ2SWY8NVuKzOL1AyaVGeSsaGnemzzwcvWeL+F71wtkTj EuHk5PNrvhDOo8WCXklyym01FFF8bLCUDVG32HsQj+hJw0Be1usvZLsGYyGRyPON3qiD 3EdXMW3SGz63xKEbPu9a883pKcBKKWWdrvit5TKo1DkzIZ62u10MHlR2gVHnYeuGSyzQ S5/FQx3iuL9m2WfPYrAM15q+KOC83fMRLeJg1+7zlYsOqqu13RHh8z1utYxDHQcxhGAq ayOjg1sWpWgIpt5AdshlvtGwVliYPWEdx20Os3HmC+yq8409t+BUxHMqPYBYXWAEXNW7 HRcQ== 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=3F94VPxALuJJiiDT1fEXGiS2dfya392cnISXh4pshr4=; b=Lemo30NZuTOTuWoZy7RZiz87KfTms1KHgWU/xzAY/FKP2dDL3jBZ1N2lQkjwiEYgsZ YqnPIGCeAams3XGWcvabMaGWIRPcAZ2FsXUewkyK9wkw4r45nAA85dQVoHKiahwsDEOt duVLPRpB6uBJBmA1T7UtRZ0GEzHLkrygvTztPSCR6+k4e1oLZ0r1C6jT9nPM30j8hHZP 8k+yyGN3deBQTKRxmjSfAGDtteTZAn3sbPekebtb/77yXembFdvspVp2B7kmVbyu+8MD HDiUvLT2xqswFEF0qfoeDpNR/dwqoPA5PkxZfJtNuX1lcJA9u3NS8rRlRJN1b/VAvhn2 pg+Q== X-Gm-Message-State: AHYfb5gqdamxKXgcVvwEBMspH/PMW/bsGG+2Y4AsV6JBipGkauAPD4CD d594+b7VIWgvXb9o X-Google-Smtp-Source: ADKCNb7TCb2LyftN+hpGwti8/3QwyGhUgekfrQnzuuD5mnB8b4D488lAnLbO/tZLtlBE0ne5ePqXZA== X-Received: by 10.101.77.6 with SMTP id i6mr1597402pgt.129.1504041695279; Tue, 29 Aug 2017 14:21:35 -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.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 14:21:34 -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 2/2] hwmon: (pmbus/lm25066) Add support for TI LM5066I Date: Tue, 29 Aug 2017 14:21:17 -0700 Message-Id: <20170829212117.143441-3-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 The TI LM5066I hotswap controller is a more accurate version of the LM5066 device already supported. It has different measurement conversion coefficients than the LM5066, so it needs to be recognized as a different device. Signed-off-by: Xo Wang --- Documentation/hwmon/lm25066 | 9 +++++++-- drivers/hwmon/pmbus/lm25066.c | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/Documentation/hwmon/lm25066 b/Documentation/hwmon/lm25066 index 2cb20ebb234d..3fa6bf820c88 100644 --- a/Documentation/hwmon/lm25066 +++ b/Documentation/hwmon/lm25066 @@ -29,6 +29,11 @@ Supported chips: Addresses scanned: - Datasheet: http://www.national.com/pf/LM/LM5066.html + * Texas Instruments LM5066I + Prefix: 'lm5066i' + Addresses scanned: - + Datasheet: + http://www.ti.com/product/LM5066I Author: Guenter Roeck @@ -37,8 +42,8 @@ Description ----------- This driver supports hardware monitoring for National Semiconductor / TI LM25056, -LM25063, LM25066, LM5064, and LM5066 Power Management, Monitoring, Control, and -Protection ICs. +LM25063, LM25066, LM5064, and LM5066/LM5066I Power Management, Monitoring, +Control, and Protection ICs. The driver is a client driver to the core PMBus driver. Please see Documentation/hwmon/pmbus for details on PMBus client drivers. diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index 232b4af13e12..10d17fb8f283 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c @@ -28,7 +28,7 @@ #include #include "pmbus.h" -enum chips { lm25056, lm25063, lm25066, lm5064, lm5066 }; +enum chips { lm25056, lm25063, lm25066, lm5064, lm5066, lm5066i }; #define LM25066_READ_VAUX 0xd0 #define LM25066_MFR_READ_IIN 0xd1 @@ -65,7 +65,7 @@ struct __coeff { #define PSC_CURRENT_IN_L (PSC_NUM_CLASSES) #define PSC_POWER_L (PSC_NUM_CLASSES + 1) -static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = { +static struct __coeff lm25066_coeff[6][PSC_NUM_CLASSES + 2] = { [lm25056] = { [PSC_VOLTAGE_IN] = { .m = 16296, @@ -210,6 +210,41 @@ static struct __coeff lm25066_coeff[5][PSC_NUM_CLASSES + 2] = { .m = 16, }, }, + [lm5066i] = { + [PSC_VOLTAGE_IN] = { + .m = 4617, + .b = -140, + .R = -2, + }, + [PSC_VOLTAGE_OUT] = { + .m = 4602, + .b = 500, + .R = -2, + }, + [PSC_CURRENT_IN] = { + .m = 15076, + .b = -504, + .R = -2, + }, + [PSC_CURRENT_IN_L] = { + .m = 7645, + .b = 100, + .R = -2, + }, + [PSC_POWER] = { + .m = 1701, + .b = -4000, + .R = -3, + }, + [PSC_POWER_L] = { + .m = 861, + .b = -965, + .R = -3, + }, + [PSC_TEMPERATURE] = { + .m = 16, + }, + }, }; struct lm25066_data { @@ -250,6 +285,7 @@ static int lm25066_read_word_data(struct i2c_client *client, int page, int reg) ret = DIV_ROUND_CLOSEST(ret * 70, 453); break; case lm5066: + case lm5066i: /* VIN: 2.18 mV VAUX: 725 uV LSB */ ret = DIV_ROUND_CLOSEST(ret * 725, 2180); break; @@ -511,6 +547,7 @@ static const struct i2c_device_id lm25066_id[] = { {"lm25066", lm25066}, {"lm5064", lm5064}, {"lm5066", lm5066}, + {"lm5066i", lm5066i}, { } };