Received: by 10.192.165.156 with SMTP id m28csp1712916imm; Wed, 18 Apr 2018 14:36:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx49HOhc8jrzBEqYKKjo61XStRpGcd8Zugg60LwutfZ91lKxdTywuQI6rCea9tUGTmj5qIfp6 X-Received: by 2002:a17:902:44a4:: with SMTP id l33-v6mr3481235pld.27.1524087370661; Wed, 18 Apr 2018 14:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524087370; cv=none; d=google.com; s=arc-20160816; b=ynFiHzGKP9Wt4+lXewy8xo8HpG8OE89B2AALIZqAYT76POwRybCPSDWnME61GHHmXk gsHsuJzvbE7KYPpC91bdl2uNfeyY2023r2oFOmVADOz1pbdKR8pRlMI/UAI668VnY87N 9Vi8Vf9T0RQ7pdiss/nlVyvDUGbl7w0gYA/p+xDDW+4smW0dgSHoJ8vdUEa8NEcztMRr YCfKBoW0KA0ELJUu3rMW0zVZ5hjlO8CSfeiglLj9IaYLunPT0bL6cWMAvMlkoTNwm4pS FVzRygWczuPe8SrSkOhQe/m5juuSJ9z6VoCf1GodWYjSQX7hi4v0X4dJ/73mP76AgQ4t NNfw== 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:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=UR4iTBLqlIp1xLDWHHm1+qECuhUwHiN5upgWYKw/OYM=; b=OveHk2ZLuG0yxDRqBTIS5eHU3Ypp5tbrxlpbu3fsADyOHYd60UqHgk+jBQEwSv2StI MVzf/hBled5bEblD2SZi0Y1H3/IN/t41dhH5CKVYdoOoPq68hIqY/PRLNptytVzbGF+A X9MT81UH6/tP7hnR4DwMRFbBpw2OnFx/0wkICIrLT5mNe14JJx+Eatomj6F5gQTdJSWO fVHj7556v9Pe1x9grR1B6UX5PaAFUUNqlsFPSOpIRc05zRAGD6fVJkk8FB+W0EvbBzYX yTpwMbi4vfGiMtPz7NYjKo54ahpGZj0AvCkQvNNICiDb4lCMszA0V/sON0Q+daOyZb5B tvKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=eAXELzdQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=H/F9toH/; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8si1681095pgp.506.2018.04.18.14.35.55; Wed, 18 Apr 2018 14:36:10 -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=@codeaurora.org header.s=default header.b=eAXELzdQ; dkim=pass header.i=@codeaurora.org header.s=default header.b=H/F9toH/; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752749AbeDRVeq (ORCPT + 99 others); Wed, 18 Apr 2018 17:34:46 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:56172 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752328AbeDRVeo (ORCPT ); Wed, 18 Apr 2018 17:34:44 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 452C360246; Wed, 18 Apr 2018 21:34:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524087284; bh=YyamODTV26KrqKWoalPkvnX6O9Drngzhv+5gfL6A56A=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=eAXELzdQjwohzrpgfcxycG1NkkSaFwCkVTUdFnbdsvYP1eBj0QukqPROYfSvf88e9 uzwk+B0A5AqyGZ4vr6oW/AiQ5lLi7/b57AfcF+XGHy1AmUPDtx3vBJUevw2v3Qf8IQ 9pyz7W9nHXbAX7lBiVwYDgMsTgLOVOhKoWf/+aEc= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.46.164.143] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: collinsd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2B83C60376; Wed, 18 Apr 2018 21:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524087283; bh=YyamODTV26KrqKWoalPkvnX6O9Drngzhv+5gfL6A56A=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=H/F9toH/SpKfAndjo19XC860t72jBUo4Rs5sF8jxP6DXYK/boiEwLUQLVVHvsDt3n 3gqYd8wxN1EuXwjlSGqaIMVCvseHL3eJyZKxEdzA/4rmywCj1GEshgBzUkorkyim7+ /tk1sxXRys/8olRSsatZGrvoxRZD8a9UGbh5M0Rc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2B83C60376 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=collinsd@codeaurora.org Subject: Re: [v2,2/2] regulator: add QCOM RPMh regulator driver To: Matthias Kaehlcke Cc: broonie@kernel.org, lgirdwood@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, rnayak@codeaurora.org, sboyd@kernel.org, dianders@chromium.org References: <4b45f41996ea3344340e44fab2dc9e487572e209.1523673467.git.collinsd@codeaurora.org> <20180417182347.GD244487@google.com> <2e45c0e5-7e79-3479-de18-9613e8eacf15@codeaurora.org> <20180417194755.GE244487@google.com> From: David Collins Message-ID: <68fd7aa7-25fc-73d6-ffc9-ca8ce5c3d9b9@codeaurora.org> Date: Wed, 18 Apr 2018 14:34:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20180417194755.GE244487@google.com> Content-Type: text/plain; charset=utf-8 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 04/17/2018 12:47 PM, Matthias Kaehlcke wrote: > On Tue, Apr 17, 2018 at 12:15:18PM -0700, David Collins wrote: >> On 04/17/2018 11:23 AM, Matthias Kaehlcke wrote: >>> On Fri, Apr 13, 2018 at 07:50:35PM -0700, David Collins wrote: >>>> [...] >>>> +static const u32 pmic_mode_map_pmic4_ldo[REGULATOR_MODE_STANDBY + 1] = { >>>> + [REGULATOR_MODE_STANDBY] = 4, >>>> + [REGULATOR_MODE_IDLE] = 5, >>>> + [REGULATOR_MODE_NORMAL] = -EINVAL, >>>> + [REGULATOR_MODE_FAST] = 7, >>>> +}; >>> >>> Define constants for the modes on the PMIC4 side? >> >> Are you suggesting something like this? >> >> #define PMIC4_LDO_MODE_RETENTION 4 >> #define PMIC4_LDO_MODE_LPM 5 >> #define PMIC4_LDO_MODE_HPM 7 >> >> static const u32 pmic_mode_map_pmic4_ldo[REGULATOR_MODE_STANDBY + 1] = { >> [REGULATOR_MODE_STANDBY] = PMIC4_LDO_MODE_RETENTION, >> [REGULATOR_MODE_IDLE] = PMIC4_LDO_MODE_LPM, >> [REGULATOR_MODE_NORMAL] = -EINVAL, >> [REGULATOR_MODE_FAST] = PMIC4_LDO_MODE_HPM, >> }; >> >> #define PMIC4_SMPS_MODE_RETENTION 4 >> #define PMIC4_SMPS_MODE_PFM 5 >> #define PMIC4_SMPS_MODE_AUTO 6 >> #define PMIC4_SMPS_MODE_PWM 7 >> >> static const u32 pmic_mode_map_pmic4_smps[REGULATOR_MODE_STANDBY + 1] = { >> [REGULATOR_MODE_STANDBY] = PMIC4_SMPS_MODE_RETENTION, >> [REGULATOR_MODE_IDLE] = PMIC4_SMPS_MODE_PFM, >> [REGULATOR_MODE_NORMAL] = PMIC4_SMPS_MODE_AUTO, >> [REGULATOR_MODE_FAST] = PMIC4_SMPS_MODE_PWM, >> }; >> >> I considered using this approach, but it didn't seem like it increased >> readability and did increase the line count. Each of the constants would >> only be used once. Would you prefer this style (or something else)? > > Personally I prefer this style, since the constants are more > expressive than the literals. I agree that the 'inline' constant > definition is a bit noisy, perhaps it would be better to move the > definitions to the top of the file or group them before the definition > of pmic_mode_map_pmic4_ldo. Alteratively you could create a > drivers/regulator/qcom_rpmh-regulator.h and also move the definitions > of struct struct rpmh_vreg_hw_data, rpmh_vreg, ... there. I'll add constants for the per-type regulator modes at the top of the file. We'll see if other reviewers like them. Take care, David -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project