Received: by 10.223.164.202 with SMTP id h10csp2387293wrb; Mon, 27 Nov 2017 16:34:48 -0800 (PST) X-Google-Smtp-Source: AGs4zMYcYOSFJuutlpqluHpzlJXyEfbSVD/ofm1hNo4c6dbHpvHea6+RG/A+eNdKmdtqttEl426G X-Received: by 10.84.251.130 with SMTP id w2mr36983175pll.24.1511829288011; Mon, 27 Nov 2017 16:34:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511829287; cv=none; d=google.com; s=arc-20160816; b=nwIAq3Ib/Wu/0DZ06TsT0pIVLaZtpaH/aIKj+bvwI7Sjg1pOIzOjxAS3uC5BPa2/u4 X49OU95AUxoF7ZC8dIFihyRaAfrRKgnhIfsH7mtdi6fEZ/Gk5uY/F+7DMVtr1WMYAz2t y7i4PPephE+D+fUtvRgNGZhRKbZOwCpkXSnB/nIOwO6f3WTVeaFNi0r8o1ZXeU9yabSM 9FSjO4Q21NKfOAE/rt3h5pqI3ju44gDpueHvgtNWRl0Qk0Ad4qtbPRlz7WrPCwT7+zhZ i79f90toECbAcpt2dU/i8LpKXnfiREwLRNhrLS63zCXvKBAWO6K93DJ6V3rGydjKUiuq JUDw== 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=fRBqp8OYeAwFEdHf5EG+GCDpGp30w6Cm5/+aMYsn3Mk=; b=F95TbNqlIJR/R+8sEPl1jjiy8AhPXqf7ABTZzO7QgMB20NmWu9g4FqS2hVsqfr+x1I feQi3fH1fZ2KEynPtMPDLJRfqwF4+gCOD9CHilNMSxBMgek9XllesCyXmdRxg4xk6B+2 Ke5o+2OJZ/o8cr+Bn0aWPcicwjcMTBq5bcs6KyHT9AYE9fjU/kIUAYIIwy7mMInn+eQu iPs4ocLRiTw3srnmNay+o9HsZECH4+umtW8ScuNUioLN25IOG9GLDjm5HzxuBQmcvr4b v5kbh+xiLA/sRiXOy3N7RcN8wXhvbGWDiVmSdJEhLdtvl7JGgnKBR4CYQ4JGTY8hVw9S K7aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BinIeWWk; 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 r3si19365040plb.814.2017.11.27.16.34.35; Mon, 27 Nov 2017 16:34:47 -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=BinIeWWk; 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 S1753006AbdK1AcE (ORCPT + 78 others); Mon, 27 Nov 2017 19:32:04 -0500 Received: from mail-qt0-f181.google.com ([209.85.216.181]:34294 "EHLO mail-qt0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752638AbdK1AcC (ORCPT ); Mon, 27 Nov 2017 19:32:02 -0500 Received: by mail-qt0-f181.google.com with SMTP id 33so32731686qtv.1 for ; Mon, 27 Nov 2017 16:32:02 -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=fRBqp8OYeAwFEdHf5EG+GCDpGp30w6Cm5/+aMYsn3Mk=; b=BinIeWWkwG1hFpWcCueWV6N4rf9STXYQy5TRl8BIqi9C1WjBQzMe7ccGmhcqMqaITJ PQ3gGrfjEzsg3qmx6DxfX5THUW4sRMPwV7B4/O5J8z3x2WT1yfL9+y8dbsufXXzGkD7T iv/9x8tnYdZPntdtasQkoqarOqAkyklU1M4x1HNkpdFwejHRK5OjaQJ6IJvDEd9cdewS 1O5yDUeoB+Aqu8uHYhnkDJ1h6YAKIS7NCbsi9vAOEkazU5pr1s/9D8CQ0WNuczga4RSw glYkOIr72RKICX3tTqIIfa1fk7m3qe0tou/mZICmUF9gHltyof6pLdceQr0W+0jqinWi stKA== 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=fRBqp8OYeAwFEdHf5EG+GCDpGp30w6Cm5/+aMYsn3Mk=; b=Ueu+tMezSVpHT1VZ15IepqPEaoZr1HMI0v3SRS0MdnkDAJ0MTJwUAxL8p6K33vNdrt ZWuuOtdJIw6eAG+UEnrc94lXWmezlBWucHSfqAmHkv26rBbUQplOw7d20Iltp/+6/IQ3 Qnp70pj3FtZmNiKEBiC05O5VWg7XIfzfUDVr3AZv91ovM71zCTAZIAv6Hw5VkmuebWRa syVSRI/mIQume9aVm4UYpLfdtsl52VMOQvyAxKnvmLn1XZHQW6fkqo5c7b4I8ouZHgGu XhPmfMEH/fuViwWoUvZWyu7iOT5RqAQDLCIKL00zsNBvmMbwN67Iy1U5VrEwtNiG4H2I JEGQ== X-Gm-Message-State: AJaThX6lDngaKr8xw61p/QosbRyYmAI150kxYdCpl5PULZ+SwQbifsrV tMu124Srp1LijKf+kVIBTFOtk3Rw9Or6auxjM+SqtQ== X-Received: by 10.200.46.167 with SMTP id h36mr33023889qta.267.1511829121367; Mon, 27 Nov 2017 16:32:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.35.17 with HTTP; Mon, 27 Nov 2017 16:31:40 -0800 (PST) In-Reply-To: <20171127220810.GA3848@roeck-us.net> References: <20171122220728.17861-1-rlippert@google.com> <20171122232816.GA4615@roeck-us.net> <91322e5e-23e3-ea6a-04bd-1c23fedadbf7@roeck-us.net> <20171127220810.GA3848@roeck-us.net> From: Rob Lippert Date: Mon, 27 Nov 2017 16:31:40 -0800 Message-ID: Subject: Re: [PATCH] hwmon: (pmbus/lm25066) Swap low/high current coefficients for LM5066(i) 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 2:08 PM, Guenter Roeck wrote: > On Mon, Nov 27, 2017 at 01:51:35PM -0800, Rob Lippert wrote: >> On Wed, Nov 22, 2017 at 5:17 PM, Guenter Roeck wrote: >> > Hi Rob, >> > >> > On 11/22/2017 03:39 PM, Rob Lippert wrote: >> >> >> >> On Wed, Nov 22, 2017 at 3:28 PM, Guenter Roeck wrote: >> >>> >> >>> >> >>> On Wed, Nov 22, 2017 at 02:07:28PM -0800, Robert Lippert wrote: >> >>>> >> >>>> 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. >> >>>> >> >>> >> >>> This would affect all chips supported by this driver. Hmm, and I was sure >> >>> I tested this. I'll have to dig out my hardware and confirm. >> >> >> >> >> >> I'm still not 100% convinced this commit is correct as I haven't been >> >> able to validate the measurements against an external probe yet (and >> >> my test board uses a non-standard sense resistor which means it needs >> >> additional massaging of the data anyhow). >> >> >> >>> >> >>> >> >>> The code currently only uses bit 4 of the DEVICE_SETUP (D9h) command >> >>> to determine which current limit setting to use. Looking into the >> >>> datasheet, it looks like it also has to evaluate bit 2, and I wonder >> >>> if there is a means to determine CL if bit 2 = 0. Any idea ? >> >> >> >> >> >> On my test board CL=floating (equivalent to GND) and the value of >> >> register 0xD9 is all zeroes. >> >> >> > Are you sure that floating is equivalent to GND ? I didn't check the >> > datasheet, but it is more common for chips to have an internal pull-up. >> > >> >>> >> >>> Does bit 4 report the CL pin value if bit 2 = 0 ? >> >> >> >> >> >> I can't tell by reading the datasheet that 0xD9 bit4 will ever report >> >> the pin value as the language is difficult to parse :) >> > >> > >> > Same here. >> > >> >> But I don't have any hardware setup with CL=VDD to test... >> >> >> > >> > I do have various evaluation boards, so I should be able to do some testing. >> > I hope I'll get to it over the weekend. >> >> Actually turns out my board does tie CL=VDD as recommended by the >> LM5066i datasheet to improve the current/power reporting accuracy. >> But the value in 0xD9 is always zero so it seems there is no way to >> read this CL pin setting from the device. >> >> I think my commit is technically correct but it seems will likely >> break the readings for most boards that follow the datasheet typical >> circuit which recommends CL=VDD. >> >> Would it make sense to remove the code trying to read the CL setting >> and default the coefficient values to the "low current limit" CL=VDD >> setting? (and maybe something in devtree or module param to pick the >> other coefficients?) >> > > The code should also check bit 2. If bit 2 is not set, it is ok to assume > CL=VDD. We can add a devicetree property if/when needed. Question though > is still how to handle the problem for the other chips supported by the > driver; if we change the code we should fix the problem for all chips, > not just for one. Wonder if we can just swap the defines to minimize code > changes. OK sent patch "hwmon: (pmbus/lm25066) Default coefficients for low current limit" that I think does what was discussed. I have not checked any of the other chip variant datasheet tables or recommended default designs to see if they all match up though... -Rob From 1585258739180344292@xxx Mon Nov 27 22:09:04 +0000 2017 X-GM-THRID: 1584805791154205642 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread