Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp290645yba; Fri, 3 May 2019 01:47:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpoVnmj77rvXvj5vvQbFhAYlB7Rc3jkHCSU9GZ6z6tJN2zBzV0pKLIw3wgxB11jjQNkUDe X-Received: by 2002:a17:902:6b8b:: with SMTP id p11mr8609357plk.225.1556873223305; Fri, 03 May 2019 01:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556873223; cv=none; d=google.com; s=arc-20160816; b=rD6+MkHudj8qRCj7d9qNUGN/22NyAuxyF8KLYj2VozE4L0DBohKea01H64cPOPK3zH iDmKift6txiYAjHcSNJ2Brvz0rrdAY23hCUgyuNk01wlLxmZGoYuzY6O75PKpr3Ua33E uAC8trVElubtfVD1YAZC+s3er51ZfH/k4egVHOTf24T91+AChArXtUKTZcvWxY9nvXoC HOnud4L+OiKlSTyFQcEt2fU30fMMUiqkOQjDfwH/7U/EmReX18WkQArj0VLKqpANrPGg e5xvzfEH3MlglWZyCQo+n2twcc6ZsPLMsRFSZ92O+lFHlvGUAqrhMODO6rD6LmacT+BO nsEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=9BWo4wrOMB7S6ZNUaQSd5jSdL7ORd90HoRUjKXASCiQ=; b=E5QgfUUk6D/vCax2oHL2MbP0a6GZdokRTs2PhCjOTDt3tk9NjO5n/Z31SwBDo4AP5M 6WDr0xALPuerQ7hv+8/cFcN8fEc3jh4NpDGFc0D6RJyHRXqNZc/kxxUggLNDrTfUD6G+ p8C91Nv4iHHM0M6SuueLwLtWheJrpBtTjyrTqbIXQP0n/j2azSxm3YEyybiuSlNDaAgj SVc9HMJmom+Jeyf7x9EIoJnnuMTxiFG2rLL+jsWCZYdMxdyop0SXZBytGELUu3Nssi7j qnjX2QHfEMPxkwe5JPCYp7ihdWCCLnJVJBwEFLyAFDktjPxwOdu/UGHf+WLGfh7PIri0 G+kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HHKoFlgu; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m21si1496516pgj.417.2019.05.03.01.46.47; Fri, 03 May 2019 01:47:03 -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=@linaro.org header.s=google header.b=HHKoFlgu; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726407AbfECI3r (ORCPT + 99 others); Fri, 3 May 2019 04:29:47 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51359 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbfECI3q (ORCPT ); Fri, 3 May 2019 04:29:46 -0400 Received: by mail-wm1-f66.google.com with SMTP id t76so6047743wmt.1 for ; Fri, 03 May 2019 01:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=9BWo4wrOMB7S6ZNUaQSd5jSdL7ORd90HoRUjKXASCiQ=; b=HHKoFlguUqMrYs86X0mAjpTHbiYUGjBZBnQY2FzIfEE8KKRzBWHZ8eb57oRe4+Bfp8 yFXtFxpH7T9X0bXnNj6+VYMnbGFBJ+4kxQmuf9ONuGaS/9yK2/vEzUQPPu8dYC21rhr4 jdAvNAqaDu5WTi2WjZnyXaDS1H1aQ40jn8LY/rfrD27yN2DWrmsUSaTOXMeE6ioKxmtr S4WT3GtCL6xcU7/RgBWqRVN/VdlcdySBgBvnKbzSEIY7pyPXuHbjlgWdX627m1slu3ma 7GZaoBTOsBUMqkvmPxY/XA93MIZHMWOviSdD8ui/CJX7qRwAudIKteETxeZxnLVntxmo 26eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9BWo4wrOMB7S6ZNUaQSd5jSdL7ORd90HoRUjKXASCiQ=; b=Oqgqw2EsTAK6c5+mETV/f//GHUluRalIerncKvfY6Q7sTcyfghNOhNzuUHIJ3CjDZn 7g2rSV9Pg4OSXzH6hxLGtR4g+YFt6+swv2KFb0FTksw1NSlZiBVi+z0Shuz1lVhqrMJO N1h7sKRohci4HP6rjrqW3qwiwMyjRqnMTHDR8QrSLwWym3GcxvoiV4IPhGfPL92tn+2M levecQkmlA1e5qF6G53nfUYcktZDwldRhK+pYx5AGj0WN0g6kjn9QIIecNb17pfoH71y bioQFb6gzh3jn5XKXhtb+SbFnaFO9LZbj8RMbHDtdDv5IpOowmbzKeo8t8qF3E+1mtVI OITQ== X-Gm-Message-State: APjAAAUVNJqGXiR83LGqq0J/Dt+qtXFR7SwS4dLH2qTrhDa9MLm7YA/P pKQNZMdzS9L89UN24UZsy9FJ/84Vlb8= X-Received: by 2002:a1c:ce:: with SMTP id 197mr5168760wma.105.1556872184621; Fri, 03 May 2019 01:29:44 -0700 (PDT) Received: from [192.168.1.2] (200.red-83-34-200.dynamicip.rima-tde.net. [83.34.200.200]) by smtp.gmail.com with ESMTPSA id n4sm1714792wmk.24.2019.05.03.01.29.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 01:29:43 -0700 (PDT) Subject: Re: [PATCH 2/3] drivers: regulator: qcom: add PMS405 SPMI regulator To: Mark Brown Cc: lgirdwood@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, bjorn.andersson@linaro.org, vinod.koul@linaro.org, niklas.cassel@linaro.org, khasim.mohammed@linaro.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org References: <20190502023316.GS14916@sirena.org.uk> <20190503062626.GE14916@sirena.org.uk> From: Jorge Ramirez Message-ID: <229823c4-f5d4-4821-ded1-cc046dd0bd20@linaro.org> Date: Fri, 3 May 2019 10:29:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190503062626.GE14916@sirena.org.uk> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/3/19 08:26, Mark Brown wrote: > On Thu, May 02, 2019 at 01:30:48PM +0200, Jorge Ramirez wrote: >> On 5/2/19 04:33, Mark Brown wrote: > >>> I'm not sure I follow here, sorry - I can see that the driver needs a >>> custom get/set selector operation but shouldn't it be able to use the >>> standard list and map operations for linear ranges? > >> I agree it should, but unfortunately that is not the case; when I first >> posted the patch I was concerned that for a regulator to be supported by >> this driver it should obey to the driver's internals (ie: comply with >> all of the spmi_common_regulator_registers definitions). > > That's not a requirement that I'd particularly expect - it's not unusual > for devices to have multiple different styles of regulators in a single > chip (eg, DCDCs often have quite different register maps to LDOs). > >> However, since there was just a single range to support, the >> modifications I had to do to support this SPMI regulator were minimal - >> hence why I opted for the changes under discussion instead of writing a >> new driver (which IMO it is an overkill). > >> what do you think? > > It seems a bit of a jump to add a new driver - it's just another > descriptor and ops structure isn't it? Though as ever with the Qualcomm > stuff this driver is pretty baroque which doesn't entirely help though I > think it's just another regulator type which there's already some > handling for. > So how do we move this forward? To sum up his regulator needs to be able to bypass accesses to SPMI_COMMON_REG_VOLTAGE_RANGE and provide the range in some other way hence the change below I can't find a simpler solution than this since the function does now what is supposed to do for all the regulator types supported in the driver @@ -653,6 +708,10 @@ spmi_regulator_find_range(struct spmi_regulator *vreg) range = vreg->set_points->range; end = range + vreg->set_points->count; + /* we know we only have one range for this type */ + if (vreg->logical_type == SPMI_REGULATOR_LOGICAL_TYPE_HFS430) + return range; + spmi_vreg_read(vreg, SPMI_COMMON_REG_VOLTAGE_RANGE, &range_sel, 1); for (; range < end; range++)