Received: by 10.223.164.202 with SMTP id h10csp3401856wrb; Tue, 28 Nov 2017 10:41:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMY/P+wPlrMCLz5Hgta7AxH/WUbMA0pr0c0eoLQrMK3qlT1tuWXAFTGyUFsOzXgVQTt5BbII X-Received: by 10.99.63.3 with SMTP id m3mr94229pga.384.1511894468354; Tue, 28 Nov 2017 10:41:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511894468; cv=none; d=google.com; s=arc-20160816; b=dOEOrxjXZy7+8bZZCqKDCRVYJn+QaGUuEW/Flea5jxLBcJtkGj4D7I/1fcZkdBm2t3 TZJUK0SFaWYITjY2Srv+WGIn5QWr4yDtj89/8PMaZD5TLGBhAyLisyLnKLc3BNcHnARx fTtEGTTuuGfd3IW7K91M+kVEo0+8xxEVefGsTbJ4BkkFwKQo6qTaeieNuninBAwClnR2 VCBfmDwEihTQsFWGpjLByic1iBRIBJBObVDJ5JRjIXcKXgLLU0chQZe0zLH2sl+zLdeu Pt2nek0EOrlTgA3zFA+acFnDqlrinFPru1Nt5L9LKno8nhfbWra/nqOK0zS3T1MKfXUO mU3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=CoEdtfekns64Nnh7/ZuAuLoQET5WOjwN8jEXbKGmFJE=; b=rOniyRztdyEKCYc6P1mH7LV5bXL2NJZeSfp6rLHy7j2Q5u912PmobTbZ6woMzl3tPT LR0PVOd7VARmFNJ4QOcz/tlwJBoDNFl0/8R6qaP+eYIdnO084Lm86+cuamPKJbM8uxTR X5aF4hys6Dw7+5c0+XpuPEW6GSIKKWFy7U4CgGV3yPH6A4I6G91cosPI6GtcAAb1McBT ng1Yg97rxlrga49MoIhOqTudar2JleUQ716wXlemZIBky4fCr2ToJbP5HTbPny4qy6YW FjXH2xf4rFmQiAs1lcTj/FEs7x8CUFqf62cVWLKC4K2lp1ShD8uR895Jt3diWb784Emw 6qKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fGN1Mae/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si25744600plr.746.2017.11.28.10.40.56; Tue, 28 Nov 2017 10:41:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fGN1Mae/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753789AbdK1Sje (ORCPT + 78 others); Tue, 28 Nov 2017 13:39:34 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:46874 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753392AbdK1Sjc (ORCPT ); Tue, 28 Nov 2017 13:39:32 -0500 Received: by mail-qt0-f194.google.com with SMTP id r39so1084632qtr.13 for ; Tue, 28 Nov 2017 10:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CoEdtfekns64Nnh7/ZuAuLoQET5WOjwN8jEXbKGmFJE=; b=fGN1Mae/lhLRp3A9S0aoGt+3X4eiQTPDPcJs48GljQRLGIXfZuk8x087rTHQKUvhi2 hgA19WCyCE6rieLdB+uAeHpJyvmPrweFIhbB97PygPAiWt4h/EFuLLgWncGIfWbDSzxp 4Fpf0cX1egA+2qjp9ESxBJz33GTk5aUP09Mf0VHyGQpfhTsaQ9pL/BdnbJAqoypT2TFr Aa4hpqY0Eq6ENdrGLI9XCIYq4+uKnIQc170gOH5KttLcL3DDQTICoI2wVsg2NAqbEqOS 9lYcVo75UqjNZPlySJrUBJLMERsjhxEGH6TYyV6QyGJt3s7qpHCxigKWm1P0D96RsO7T iD+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CoEdtfekns64Nnh7/ZuAuLoQET5WOjwN8jEXbKGmFJE=; b=KfraSRx3UxajLKNiMnMLpdFrrHKtfAhq4DIuXIyDxBwDUSB1JSljtlsTHaCw5k1bPF CXziQfPgMcVkqTWy2IanxtI7GgLq/3FXhzidksV79WiXZeHup0b1acFojtNQHDzpLhrr 0c694gtQiY0b6bdL0qxY+c9Yh/hB8QveRAJ2LYXjWhQ2NXyXtmboHQCDXu+Y7Ph0cLNE EtsduOWlx2qIkEW3dBels6urTIl6Y75yzONywAkxUPHsAi5kvaJpUAlxnkz2Af128bcF eb2JYiyeVP9C5RVqpyhlEmRgbAROrlpJrdzKlFEtBESsN1y24mGSPZywOvQkBcIWxMSL s32g== X-Gm-Message-State: AJaThX5R5JgJAbTLx+MQ2EzSkAoeULajBh5KCuIEzx6AgfZPYPA0Ai7I UruDQE2E1LfZuD3QQK11VgcFhpLC92bQ3aMlorm4uA== X-Received: by 10.237.62.76 with SMTP id m12mr240334qtf.8.1511894370816; Tue, 28 Nov 2017 10:39:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.35.17 with HTTP; Tue, 28 Nov 2017 10:39:10 -0800 (PST) In-Reply-To: <40bff1ab-dd3f-0d70-5ca2-8132af350380@roeck-us.net> References: <20171128002858.1821-1-rlippert@google.com> <40bff1ab-dd3f-0d70-5ca2-8132af350380@roeck-us.net> From: Rob Lippert Date: Tue, 28 Nov 2017 10:39:10 -0800 Message-ID: Subject: Re: [PATCH] hwmon: (pmbus/lm25066) Default coefficients for low current limit To: Guenter Roeck Cc: Robert Lippert , linux-hwmon@vger.kernel.org, jdelvare@suse.com, linux-kernel@vger.kernel.org, Xo Wang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 27, 2017 at 8:26 PM, Guenter Roeck wrote: > On 11/27/2017 04:28 PM, Robert Lippert wrote: >> >> There seems to be no way to detect the value of the CL/GAIN pin >> from the device using PMBus. >> >> Low current mode seems to be recommended (from LM5066 datasheet) for >> improved current reporting accuracy in a typical design. >> >> Assume the device is in low current mode unless the register override >> bit is set and indicates high current limit mode. >> >> Signed-off-by: Robert Lippert > > > Applied (silently fixed continuation line alignment). > > Looking at the most recent version of various datasheets for the chips > supported > by the driver, looks like TI changed the coefficients (again). Not the first > time. > Time to go through all chips and update coefficients. Might be worthwhile > to do that at least for the chips(s) which are of interest for you. This patch also needs commit "hwmon: (pmbus/lm25066) Swap low/high current coefficients for LM5066(i)" to maintain the existing reporting behavior for LM5066 devices atleast. (as now it will be pulling from the _L values by default) I spot checked the coeff values for lm25056 with the online datasheet and they also seem to be swapped although it is a little hard to be sure since the meaning of GAIN input seems to be opposite of CL input: GAIN=0 is low current and GAIN=1 is high current. -Rob > > Thanks, > Guenter > > >> --- >> drivers/hwmon/pmbus/lm25066.c | 19 +++++++++++++------ >> 1 file changed, 13 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c >> index aa052f4449a9..f6ae7b4cf705 100644 >> --- a/drivers/hwmon/pmbus/lm25066.c >> +++ b/drivers/hwmon/pmbus/lm25066.c >> @@ -43,6 +43,7 @@ enum chips { lm25056, lm25063, lm25066, lm5064, lm5066, >> lm5066i }; >> #define LM25066_READ_AVG_IIN 0xde >> #define LM25066_READ_AVG_PIN 0xdf >> +#define LM25066_DEV_SETUP_CL_CONFIG BIT(2) /* Use pin or SMBus values >> */ >> #define LM25066_DEV_SETUP_CL BIT(4) /* Current limit */ >> /* LM25056 only */ >> @@ -526,16 +527,22 @@ static int lm25066_probe(struct i2c_client *client, >> info->R[PSC_VOLTAGE_OUT] = coeff[PSC_VOLTAGE_OUT].R; >> info->R[PSC_CURRENT_IN] = coeff[PSC_CURRENT_IN].R; >> 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 { >> + >> + /* >> + * Assume chip is in low current limit/gain mode by default unless >> + * the register override is asserted AND indicates high limit >> mode. >> + */ >> + if ((config & LM25066_DEV_SETUP_CL_CONFIG) && >> + (config & LM25066_DEV_SETUP_CL)) { >> 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; >> + } else { >> + 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; >> } >> return pmbus_do_probe(client, id, info); >> > From 1585282511758699370@xxx Tue Nov 28 04:26:55 +0000 2017 X-GM-THRID: 1585267654739883667 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread