Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1040584ybd; Wed, 26 Jun 2019 10:08:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqztHYt2fWXHIRTdZNdFFy+WRSzkcOv7NGVgtR8JdjZ3BYu/8RKpaukKxcjAmmHrjkm2asPm X-Received: by 2002:a17:90a:cd04:: with SMTP id d4mr120537pju.128.1561568888592; Wed, 26 Jun 2019 10:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561568888; cv=none; d=google.com; s=arc-20160816; b=okyQth4sJeuc5aaos4+cRSOaN+QZdGOvYVtU0fNxt1On/DelXblbISUGfflv0+4krY oV2McufKQMuLqel845uQ6i8Ey7Wb/0bCoUqYSj32seDD7P4GECa7iAACy6TrCoYrbYg0 xIqJjLm5YQYeBnownXr/coVe/+KmQZxQn+eJR9SUs3DiSP5FS3EPAsOnSRBr0GTRNTE6 TyH9NUuk/OUw4d+WCGFFP8lmVcogoKaU3Qv5zKwUpER2aqQS2rauWHpLpESo7BKd7570 YgPoGZHHq3Ly5qoYZlEtv8Ikj5E1c6i0ojxZZNP+ahWAzJC+KtGtRyi84tyInUELSmd0 s07Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=7VXKI/t5sNp7zNH6sC+bn1Pxq4OnvCi8fXFUinc/Hbc=; b=bcvjhK7GjQowCT533tvSTAZE2EH7FYRUTNSxcYK7Xke5/p+S4acKBiYnZpIy456Vrp Nu5lRzWJLge7KiTbsZifsi0TbENxTwlKgaxPtXwWwKNzt4tL9C2ZNwGJEsehcF5rCbbr W7NHWOBJMcbCDCzTH4cDFB+o2ezoOQmQWXXHwjlcdpbCnzZHEbDT1Erxtint3ZGZpSuh sRQQivuUoz/FP0kC7wLxVcMyDGlVxVyibXv3QnGum31+44TkeuFdhKwQLPz2iXcJ/CG5 /XNslPLDx6hYki+xcWBRI9AnrBTTomWt1UugWn1HnnZYcp8AMCqQs9fpFY+CRRFDYsnl A3bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=E8bujS7Z; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si9157287pgq.367.2019.06.26.10.07.52; Wed, 26 Jun 2019 10:08:08 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=E8bujS7Z; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726385AbfFZRHl (ORCPT + 99 others); Wed, 26 Jun 2019 13:07:41 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:42498 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbfFZRHl (ORCPT ); Wed, 26 Jun 2019 13:07:41 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5QH7clZ119197; Wed, 26 Jun 2019 12:07:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1561568858; bh=7VXKI/t5sNp7zNH6sC+bn1Pxq4OnvCi8fXFUinc/Hbc=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=E8bujS7ZZXTx/89VxZ0+2j3tGJ4t0dYMvefg5HiYYO35idkhZxKplsSe9VO9jt2wT ctpy7HW15vIwD+euYnixyVHpjq68uLHVv8RfCGbIrXKOZjWbMpq369qCn69VC2AA/4 G0Ee2cMacZgqv9oD7ZbtaP6pxqcjTAJCizTPU5mM= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5QH7cW3109292 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 26 Jun 2019 12:07:38 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 26 Jun 2019 12:07:38 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 26 Jun 2019 12:07:37 -0500 Received: from [10.250.65.13] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5QH7bvC077439; Wed, 26 Jun 2019 12:07:37 -0500 Subject: Re: [RFT][PATCH 2/2] regulator: lm363x: Fix n_voltages setting for lm36274 To: Axel Lin CC: Mark Brown , Liam Girdwood , LKML References: <20190626132632.32629-1-axel.lin@ingics.com> <20190626132632.32629-2-axel.lin@ingics.com> From: Dan Murphy Message-ID: Date: Wed, 26 Jun 2019 12:07:19 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Axel On 6/26/19 10:20 AM, Axel Lin wrote: > Dan Murphy 於 2019年6月26日 週三 下午11:07寫道: >> Hello >> >> On 6/26/19 8:26 AM, Axel Lin wrote: >>> According to the datasheet http://www.ti.com/lit/ds/symlink/lm36274.pdf: >>> Table 23. VPOS Bias Register Field Descriptions VPOS[5:0]: >>> VPOS voltage (50-mV steps): VPOS = 4 V + (Code × 50 mV), 6.5 V max >>> 000000 = 4 V >>> 000001 = 4.05 V >>> : >>> 011110 = 5.5 V (Default) >>> : >>> 110010 = 6.5 V >>> 110011 to 111111 map to 6.5 V >>> >>> So the LM36274_LDO_VSEL_MAX should be 0b110010 (0x32). >>> The valid selectors are 0 ... LM36274_LDO_VSEL_MAX, n_voltages should be >>> LM36274_LDO_VSEL_MAX + 1. Similarly, the n_voltages should be >>> LM36274_BOOST_VSEL_MAX + 1 for LM36274_BOOST. >>> >>> Fixes: bff5e8071533 ("regulator: lm363x: Add support for LM36274") >>> Signed-off-by: Axel Li >>> >>> 6.5 V >>> DISPLAY BIAS POSITIVE OUTPUT (VPOS) >>> Programmable output voltage >>> range >>> >>> >>> n >>> --- >>> drivers/regulator/lm363x-regulator.c | 8 ++++---- >>> 1 file changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/regulator/lm363x-regulator.c b/drivers/regulator/lm363x-regulator.c >>> index e4a27d63bf90..4b9f618b07e9 100644 >>> --- a/drivers/regulator/lm363x-regulator.c >>> +++ b/drivers/regulator/lm363x-regulator.c >>> @@ -36,7 +36,7 @@ >>> >>> /* LM36274 */ >>> #define LM36274_BOOST_VSEL_MAX 0x3f >>> -#define LM36274_LDO_VSEL_MAX 0x34 >>> +#define LM36274_LDO_VSEL_MAX 0x32 >>> >>> 6.5 V >>> DISPLAY BIAS POSITIVE OUTPUT (VPOS) >>> Programmable output voltage >>> range >>> >>> >> This does not seem correct the max number of voltages are 0x34. >> >> The register is zero based so you can have 33 voltage select levels and >> + 1 is 34 total selectors >> >> Liam/Mark correct me if I am incorrect. > From the datasheet, the maximum voltage 110010 = 6.5 V, the 0b110010 is 0x32. > I know it is 0 based, so .n_voltages = LM36274_LDO_VSEL_MAX + 1, > (And that coding style is to match the original code.) > > With your current code where LM36274_LDO_VSEL_MAX and n_voltages is 0x34, > the maximum voltage will become 400000 + 50000 * 0x34 = 6.6V which > does not match the datasheet. Not sure how you get 6.6v the LDO max is 6.5v. After 0x32->0x7f maps to 6.5v 000000 = 4 V 000001 = 4.05 V : 011110 = 5.5 V (Default) : 110010 = 6.5 V 110011 to 111111 map to 6.5 V <- Should never see 6.6v from LDO Page 7 of the Datasheet says range is 4v->6.5v Dan > Would you mind double check again?