From patchwork Fri Jun 27 17:15:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 32627 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AE317200B9 for ; Fri, 27 Jun 2014 17:15:22 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id m1sf30606146oag.5 for ; Fri, 27 Jun 2014 10:15:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:in-reply-to:user-agent:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-disposition; bh=/K7YspEJV2YnNRSxWCmIbjjgJi6rIq5ZqmCBI7tOOvo=; b=g6JPcIhOEnZ3uHqvj8dn7ZEdvVld5mQK+Y+VjJFPdmSzpBrMGvAEHboiHTwTLzuv7S Ljjk4e1I1zDT0z8HQYQmoKSjdgeMaikoIYlc628zn5cVMdT3NRqf7gsVF5dheLRPF7wL h4scvHxuolo0D1AOj+9vl0iNILCMNDmHuP4ZQnTWERUs04dQ35x0cmBfdDrGWScLlRZ0 43ZuIUOp2q01+HmsyCWXSCUNxnjDN/8Zew2CqnT2RpL179XB4B8vFKOKnNUjxhpMJ3qg Jak5HKZ7GhETUgCbeT0GbUo4b7t9lLSN7JtoTNr3cMM/EGe9aKS6+TeXQwn7WqjXo6OF 7L1Q== X-Gm-Message-State: ALoCoQm0WSSczjtNP3z382UhdxBb+KqwGRSnRUVUCLZ3zL6ZCWfQLfGNDvdIQitVLHESowyZFx6F X-Received: by 10.182.213.135 with SMTP id ns7mr11759279obc.46.1403889322031; Fri, 27 Jun 2014 10:15:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.244 with SMTP id u107ls709501qge.52.gmail; Fri, 27 Jun 2014 10:15:21 -0700 (PDT) X-Received: by 10.58.152.234 with SMTP id vb10mr20946340veb.21.1403889321798; Fri, 27 Jun 2014 10:15:21 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id p7si6704665vda.40.2014.06.27.10.15.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Jun 2014 10:15:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id jz11so5656416veb.3 for ; Fri, 27 Jun 2014 10:15:21 -0700 (PDT) X-Received: by 10.220.185.202 with SMTP id cp10mr21077389vcb.15.1403889321667; Fri, 27 Jun 2014 10:15:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp123632vcb; Fri, 27 Jun 2014 10:15:21 -0700 (PDT) X-Received: by 10.68.102.34 with SMTP id fl2mr32008287pbb.2.1403889320679; Fri, 27 Jun 2014 10:15:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oy9si14605988pbc.166.2014.06.27.10.15.19; Fri, 27 Jun 2014 10:15:19 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752026AbaF0RPJ (ORCPT + 27 others); Fri, 27 Jun 2014 13:15:09 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:57858 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403AbaF0RPH (ORCPT ); Fri, 27 Jun 2014 13:15:07 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5RHF3J1016133; Fri, 27 Jun 2014 12:15:03 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5RHF3ZM012282; Fri, 27 Jun 2014 12:15:03 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 27 Jun 2014 12:15:03 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5RHF3mr014805; Fri, 27 Jun 2014 12:15:03 -0500 Date: Fri, 27 Jun 2014 12:15:03 -0500 From: Nishanth Menon To: Keerthy CC: Mark Brown , Liam Girdwood , Keerthy , , , Subject: Re: [PATCH] regulator: tps65917: Fix SMPS enable/disable/is_enable Message-ID: <20140627171503.GA26734@kahuna> References: <1403807494-23907-1-git-send-email-nm@ti.com> <53AD36E1.1010700@ti.com> MIME-Version: 1.0 In-Reply-To: <53AD36E1.1010700@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nm@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Content-Disposition: inline On 14:48-20140627, Keerthy wrote: > Hello Nishanth, > > On Friday 27 June 2014 12:01 AM, Nishanth Menon wrote: > >We use regmap regulator ops to enable/disable and check if regulator > >is enabled for various SMPS. However, these depend on valid > >enable_reg, enable_mask and enable_value in regulator descriptor. > > > >So, similar to fix we did in commit 318dbb02b50c > >("regulator: palmas: Fix SMPS enable/disable/is_enabled"), populate the > >same for TPS65917 SMPS registration. LDO definitions are already in place. > > > >Fixes: d6f83370ed97 ("regulator: palmas: Add tps65917 PMIC support") > >Signed-off-by: Nishanth Menon > >--- > > > >Applies on: > > git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git > >branch: topic/palmas (4c0c9ca Merge remote-tracking branch 'regulator/fix/palmas' into regulator-palmas) > > > >Note: Ignored the minor style check from checkpatch --strict as fixing > >it would create an 80 char warning > > > > drivers/regulator/palmas-regulator.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > >diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c > >index 7c8b441..c7aa1b1 100644 > >--- a/drivers/regulator/palmas-regulator.c > >+++ b/drivers/regulator/palmas-regulator.c > >@@ -1333,6 +1333,14 @@ static int tps65917_smps_registration(struct palmas_pmic *pmic, > > pmic->current_reg_mode[id] = reg & > > PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; > >+ pmic->desc[id].enable_reg = > >+ PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, > >+ palmas_regs_info[id].ctrl_addr); > > This is wrong. Please change palmas_regs_info[id].ctrl_addr to > ddata->palmas_regs_info[id].ctrl_addr. The palmas_regs_info > should come from the driver data for specific instances as the regmap > is different for the different PMICs we support. > > Once you make the above changes please feel free to add Uggh.. just realized... since I was testing CPUFREQ with SMPS1 never realized it. and searched elsewhere on topic/palmas branch as well.. Looks like we should make the following changes? since the register data is now a parameter and it so happened that palmas_reg_info was mapping back to a valid variable and the error is easily missed - so rename the variable as well - I can break this up as proper series of patches for topic/palmas - let me know what you think.. Tested-by: Keerthy . diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 7c8b441..86fefdfb 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c @@ -41,7 +41,7 @@ static const struct regulator_linear_range smps_high_ranges[] = { REGULATOR_LINEAR_RANGE(3300000, 0x7A, 0x7f, 0), }; -static struct regs_info palmas_regs_info[] = { +static struct regs_info palmas_generic_regs_info[] = { { .name = "SMPS12", .sname = "smps1-in", @@ -1165,18 +1165,18 @@ static int palmas_smps_registration(struct palmas_pmic *pmic, pmic->desc[id].ops = &palmas_ops_smps10; pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, - PALMAS_SMPS10_CTRL); + ddata->palmas_regs_info[id].ctrl_addr); pmic->desc[id].vsel_mask = SMPS10_VSEL; pmic->desc[id].enable_reg = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, - PALMAS_SMPS10_CTRL); + ddata->palmas_regs_info[id].ctrl_addr); if (id == PALMAS_REG_SMPS10_OUT1) pmic->desc[id].enable_mask = SMPS10_SWITCH_EN; else pmic->desc[id].enable_mask = SMPS10_BOOST_EN; pmic->desc[id].bypass_reg = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, - PALMAS_SMPS10_CTRL); + ddata->palmas_regs_info[id].ctrl_addr); pmic->desc[id].bypass_mask = SMPS10_BYPASS_EN; pmic->desc[id].min_uV = 3750000; pmic->desc[id].uV_step = 1250000; @@ -1188,7 +1188,7 @@ static int palmas_smps_registration(struct palmas_pmic *pmic, * otherwise we error in probe with unsupportable * ranges. Read the current smps mode for later use. */ - addr = palmas_regs_info[id].vsel_addr; + addr = ddata->palmas_regs_info[id].vsel_addr; pmic->desc[id].n_linear_ranges = 3; ret = palmas_smps_read(pmic->palmas, addr, ®); @@ -1209,12 +1209,12 @@ static int palmas_smps_registration(struct palmas_pmic *pmic, pmic->desc[id].n_voltages = PALMAS_SMPS_NUM_VOLTAGES; pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, - palmas_regs_info[id].vsel_addr); + ddata->palmas_regs_info[id].vsel_addr); pmic->desc[id].vsel_mask = PALMAS_SMPS12_VOLTAGE_VSEL_MASK; /* Read the smps mode for later use. */ - addr = palmas_regs_info[id].ctrl_addr; + addr = ddata->palmas_regs_info[id].ctrl_addr; ret = palmas_smps_read(pmic->palmas, addr, ®); if (ret) return ret; @@ -1223,7 +1223,7 @@ static int palmas_smps_registration(struct palmas_pmic *pmic, pmic->desc[id].enable_reg = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, - palmas_regs_info[id].ctrl_addr); + ddata->palmas_regs_info[id].ctrl_addr); pmic->desc[id].enable_mask = PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; /* set_mode overrides this value */ @@ -1319,7 +1319,7 @@ static int tps65917_smps_registration(struct palmas_pmic *pmic, pmic->desc[id].n_voltages = PALMAS_SMPS_NUM_VOLTAGES; pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, - tps65917_regs_info[id].vsel_addr); + ddata->palmas_regs_info[id].vsel_addr); pmic->desc[id].vsel_mask = PALMAS_SMPS12_VOLTAGE_VSEL_MASK; @@ -1414,7 +1414,7 @@ struct palmas_pmic_driver_data palmas_ddata = { .ldo_begin = PALMAS_REG_LDO1, .ldo_end = PALMAS_REG_LDOUSB, .max_reg = PALMAS_NUM_REGS, - .palmas_regs_info = palmas_regs_info, + .palmas_regs_info = palmas_generic_regs_info, .palmas_matches = palmas_matches, .sleep_req_info = palma_sleep_req_info, .smps_register = palmas_smps_registration,