Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp919316ybd; Wed, 26 Jun 2019 08:07:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzASlz+m8ktuaH6hIXuLxXWSvu2Yyk4pLxN5RNqLKWqkUiegzULBFEM4/uuPlVTQ5aQPJ43 X-Received: by 2002:a63:c5:: with SMTP id 188mr3451603pga.108.1561561650627; Wed, 26 Jun 2019 08:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561561650; cv=none; d=google.com; s=arc-20160816; b=Mp43+lrGOnVpKAQLLlbXiwuyqhZDOl4GiDCwAYggEkjhnMERIY61dbYl+f9vRrbbkN HyV+lpV3YUszkHvC0MYYsza99iydiWZLLHxCsmXf3Z/Eq7P/ixToxqt9Lk3l47MsNX7J lLYDe/0ghsFxjT5HeEh3HsIRuxFGHIQn7XgXtSZ996eOS76gA7QtsSzx9C7BxVJ0+8sB Hh7nS8Dd7TqxhuxCiEPNbrDatAV7HVtF/mxnuBMz72o9JlNT/9leB25B/Ku6AuiWAAU5 lf4RttghOAXO+RuvaEJJU/osrSPs7VTXmKYroMd/O4gChFNwiwbvfCHwPgte8j0HCeZR XtWg== 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=jNzQtnF7CSc+vMKT07mzXLcQafUP1JhZFZLSqOuS39o=; b=BUr9gh9HXxrC2F4UWQuqnubeFtCxEkS1xVwueuOYaZiY/ZEv9Ny0IpfeM6gxtK0G+l eDlU8NShTSN4mXF4/oHM/aBe7c2q6af1mtiD19TpiEMOgfM3Ndt+SrTAEHsEvDD2xG9A O9MtCHce8zBsPztwllQ6i1Bx1yZmxM/7TnQUw9/8AmpFzdgX8002nB5tmZjfAenUHcm+ iXk1BEBtwKF4RaOkp7yqvWkjgcfXWTe3mX99MyrZrnfKfWfWA0wl6ZfOSpYXc6pf/wzg IxCdhRPiQzJ5jKIUUbnX8+nu8Lr9izDNt8gyyqxRYB9VQ81tqmOK6q+tgf1fjbo8bZDQ is/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="pm9B8nT/"; 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 h96si3574114plb.281.2019.06.26.08.07.13; Wed, 26 Jun 2019 08:07:30 -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="pm9B8nT/"; 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 S1728290AbfFZPHK (ORCPT + 99 others); Wed, 26 Jun 2019 11:07:10 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:42056 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbfFZPHK (ORCPT ); Wed, 26 Jun 2019 11:07:10 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5QF77bI115167; Wed, 26 Jun 2019 10:07:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1561561627; bh=jNzQtnF7CSc+vMKT07mzXLcQafUP1JhZFZLSqOuS39o=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=pm9B8nT/Ow+sAAwTqTsKgLpvQyW3bJ6gG0GFc/0OD7c3ZEqhV5jiUA9ENBA9AUFRf aLRYKlJE4lQFoT28BxdDckqDP1N9TH9D7Mj/RUDbjpmQkIf+Kn+vbA1GRA43vWQjiG tVJM6Tz+ejdskbGD3+QTf4wzdEomH6jsfmcAPuqs= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5QF77Vr092838 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 26 Jun 2019 10:07:07 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE109.ent.ti.com (157.170.170.41) 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 10:07:07 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE111.ent.ti.com (157.170.170.22) 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 10:07:07 -0500 Received: from [10.250.65.13] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5QF767q048868; Wed, 26 Jun 2019 10:07:07 -0500 Subject: Re: [RFT][PATCH 2/2] regulator: lm363x: Fix n_voltages setting for lm36274 To: Axel Lin , Mark Brown CC: Liam Girdwood , 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 10:06:49 -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: <20190626132632.32629-2-axel.lin@ingics.com> 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 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 Lin > --- > 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 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. Dan > #define LM36274_VOLTAGE_MIN 4000000 > > /* Common */ > @@ -226,7 +226,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = { > .of_match = "vboost", > .id = LM36274_BOOST, > .ops = &lm363x_boost_voltage_table_ops, > - .n_voltages = LM36274_BOOST_VSEL_MAX, > + .n_voltages = LM36274_BOOST_VSEL_MAX + 1, > .min_uV = LM36274_VOLTAGE_MIN, > .uV_step = LM363X_STEP_50mV, > .type = REGULATOR_VOLTAGE, > @@ -239,7 +239,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = { > .of_match = "vpos", > .id = LM36274_LDO_POS, > .ops = &lm363x_regulator_voltage_table_ops, > - .n_voltages = LM36274_LDO_VSEL_MAX, > + .n_voltages = LM36274_LDO_VSEL_MAX + 1, > .min_uV = LM36274_VOLTAGE_MIN, > .uV_step = LM363X_STEP_50mV, > .type = REGULATOR_VOLTAGE, > @@ -254,7 +254,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = { > .of_match = "vneg", > .id = LM36274_LDO_NEG, > .ops = &lm363x_regulator_voltage_table_ops, > - .n_voltages = LM36274_LDO_VSEL_MAX, > + .n_voltages = LM36274_LDO_VSEL_MAX + 1, > .min_uV = LM36274_VOLTAGE_MIN, > .uV_step = LM363X_STEP_50mV, > .type = REGULATOR_VOLTAGE,