Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7111820yba; Thu, 2 May 2019 04:33:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6WBuyEWBUVRPbGWrxgNqVea8ZM+mNjaad4lHCRG30WeQY75la9IqW0V4gxn1yldybbYN6 X-Received: by 2002:aa7:92c4:: with SMTP id k4mr3722596pfa.183.1556796839022; Thu, 02 May 2019 04:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556796839; cv=none; d=google.com; s=arc-20160816; b=q9lmzHQG7BDl7Wrz6+mqW1yh47R6ZsyA5o74er9fwTsaZ1aPxS2uqrvy7g3HnFCD2K iMwa5Emzr3wuEBFhRhqA1UilWjFw+oRSrWTN93NN0rnAAjFfSNKyXPWYlNNC75m1c8gG TAxMngCEIYb0bXxTwLFHlNO4TWAemwgJ2Ym/xeMHAzWv2qn/j1ID2GsavHP4MMpLK6Ns JLKpFQsFnlpkXWs4EDzytE9MARGm+0MXfPLAHX3RGcoO9ajDkXqbNtprc8n4+xXOa01T 6l41lJhwl/W//tgLCUKPQ/h86o+Kj/QrxGf8MMZdRw32sEhhZxKl1WKlwrThyRVR06wB 0f8g== 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=DXweF0jQ0QB/k/rGJN+kfbonyACUsE7waASKG6bvRoQ=; b=kHKXIOZMgdebklpeEsVFZhw7Wh3dOFEGFWmDUWXN8zbW7vBAnDRuyX3m77jrIkSlnX /s46heyO3pbfp7PoDPzmVd3dZmVNTfmukNVBI+5d5gR8Y1z9e1DetSxSpg8QM772rVX7 cCIbUtyWY+yOghlpqdJQe6vZgAm/e4gmT72KdpF2bybMfKE3SQkMoAvdwTuU2I2EbuPH p/Jw5gXO1+x8/NUG9+pxaDYL850lU/1WF/n5aBzaLRvxvuQo9Vxxirvn9fmmzhxFvKk2 nYQyqWxXS8oywq0C8+IE2O2SL0DjFgjQEWb6lMdhnQgdDg9Y4gfWKD0zPOJaihBIByU2 V2aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bbEOY3UB; 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 h38si43045362plb.259.2019.05.02.04.33.43; Thu, 02 May 2019 04:33:59 -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=bbEOY3UB; 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 S1726458AbfEBLaw (ORCPT + 99 others); Thu, 2 May 2019 07:30:52 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39235 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726302AbfEBLav (ORCPT ); Thu, 2 May 2019 07:30:51 -0400 Received: by mail-wr1-f65.google.com with SMTP id a9so2836778wrp.6 for ; Thu, 02 May 2019 04:30:50 -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=DXweF0jQ0QB/k/rGJN+kfbonyACUsE7waASKG6bvRoQ=; b=bbEOY3UBWHA9nrQiL1gJZ2/gGVMCmQ6IF+6rrt9NByakcOnI7qfP0GyEywuponu8xB Dv2Bb3Jc64sYLe+fXZr2qbenmUgi8hnFHldZqseiduLJ2q/YlmgBNbXjTURjAkHNn3Ou pa1yF34FYttPcROYRQITT0SEDMbW+CZAzXOI/p89sIqxq5rKvuW+VXXOxJ66KwyR+Qn+ M1ynLwYzCUjoYIHrm2VcbjzjSyM1NRBx8z49mmDG7tTys2sFTZL1nL8QX5xPGWDR427+ uq5L3RbwTSfeZVFJ9fWZOpBY7qyLSOJIVHGVM7VPRC0Z7yd1BZH8a9qefylcyFkJST8K KBVw== 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=DXweF0jQ0QB/k/rGJN+kfbonyACUsE7waASKG6bvRoQ=; b=avvBmLVGcWveE6OmmLD47azhcD5Fx/4f6ISDi3s03lHtmoA3O9N5pqOq3ET/dzr85l MskaojXx8T/aNZxMjpybimwIm7/YMi4si9xIu/pr9VCJO6QTYyLuy6tPNcrbTWvlBmzL h3kGAW/oRAbP775SjQDuwKbYvSd6Vy3m5It5UMNK2TA2CaaYM35hljy8BAk0yLAbn0el 39zc5Xe8OYLx8hmQVUjR/489ofXeHqv7RVOgMIQE7rJoTjz6RnOEg2K4j6/ctj/VTBwU KpUvn7KEX7rLoCMhUsXuDm286i44VBY/oduYKq6qRwCziH8RTS9zCOvw3+6jDBbl/Qqk 5wxw== X-Gm-Message-State: APjAAAWMQdjcJK7SgUr1B5oD8epEp7pB8TJsSZ2dID9+V6jv6/WvOiuL vDKX7y8LOHIk6wjTaQHBx6skrg== X-Received: by 2002:adf:c748:: with SMTP id b8mr2404630wrh.292.1556796650078; Thu, 02 May 2019 04:30:50 -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 k16sm844785wrd.17.2019.05.02.04.30.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 May 2019 04:30:49 -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> From: Jorge Ramirez Message-ID: Date: Thu, 2 May 2019 13:30:48 +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: <20190502023316.GS14916@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/2/19 04:33, Mark Brown wrote: > On Mon, Apr 29, 2019 at 02:31:55PM +0200, Jorge Ramirez wrote: >> On 4/27/19 20:21, Mark Brown wrote: > >>> Since the point of this change is AFAICT that this regulator only has a >>> single linear range it seems like it should just be able to use the >>> existing generic functions shouldn't it? > >> yes that would have been ideal but it does not seem to be the case for >> this hardware. > >> The register that stores the voltage range for all other SPMI regulators >> (SPMI_COMMON_REG_VOLTAGE_RANGE 0x40) is used by something else in the >> HFS430: SPMI_HFS430_REG_VOLTAGE_LB 0x40 stores the voltage level in two >> bytes 0x40 and 0x41; > >> This overlap really what is creating the pain: HFS430 cant use 0x40 to >> store the range (even if it is only one) > >> so yeah, most of the changes in the patch are working around this fact. > > 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). 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? > >> >> enum spmi_common_regulator_registers { >> SPMI_COMMON_REG_DIG_MAJOR_REV = 0x01, >> SPMI_COMMON_REG_TYPE = 0x04, >> SPMI_COMMON_REG_SUBTYPE = 0x05, >> SPMI_COMMON_REG_VOLTAGE_RANGE = 0x40, ****** >> SPMI_COMMON_REG_VOLTAGE_SET = 0x41, >> SPMI_COMMON_REG_MODE = 0x45, >> SPMI_COMMON_REG_ENABLE = 0x46, >> SPMI_COMMON_REG_PULL_DOWN = 0x48, >> SPMI_COMMON_REG_SOFT_START = 0x4c, >> SPMI_COMMON_REG_STEP_CTRL = 0x61, >> }; >> >> enum spmi_hfs430_registers { >> SPMI_HFS430_REG_VOLTAGE_LB = 0x40, ******* >> SPMI_HFS430_REG_VOLTAGE_VALID_LB = 0x42, ah, this definition I can remove and use the common one above. I'll do that. >> SPMI_HFS430_REG_MODE = 0x45, >> }; >> >> It just needs it's own >>> set/get_voltage_sel() operations. As far as I can see the main thing >>> the driver is doing with the custom stuff is handling the fact that >>> there's multiple ranges but that's not an issue for this regulator. >>> It's possible I'm missing something there but that was the main thing >>> (and we do have some generic support for multiple linear ranges in the >>> helper code already, can't remember why this driver isn't using that - >>> the ranges overlap IIRC?). >>> >>> TBH looking at the uses of find_range() I'm not sure they're 100% >>> sensible as they are - the existing _time_sel() is assuming we only need >>> to work out the ramp time between voltages in the same range which is >>> going to have trouble. >>> >>