From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D70033F8D4 for ; Wed, 5 Nov 2025 16:15:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762359309; cv=none; b=HTxLwTdSuYWD3ASVfpy/57MtRLyoQqn7tduGajt0lVF7KMkLITY3qiMOMeAPorDPvbswX2jP8cIeV5Dm+c5sn24ilUVCQd3E79sZp9uAZrHbvKxHx2KFSjVD3Rf0E0YfFysthwM4gJclkshIkrCtNCX9fvtSWeQ34hiqTEpRbL8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762359309; c=relaxed/simple; bh=uO/6iVYZ1vFXrKMD4kA3PYSBEGhevKLmMat7U8ijANM=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=C9A/6ecZLT87iHZ3egs2hQYPFEKUKyQ/XPQGLyZLEOa+oW0NqsBitg3m5qZHUxuO5qCq8tV4SiI2ilEaIXilDrZ7dyeIsbSKbmPdtJ3Bt7yha8huJFO/g9sROOMABEnOdcbmZev2x27Ja49qIzKpEFj/w3GSzQtKZeOEcSdcNn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=V1ZDJ0xv; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="V1ZDJ0xv" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-640ca678745so5818674a12.2 for ; Wed, 05 Nov 2025 08:15:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762359305; x=1762964105; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=PW+009+mxrT5Q7b6yvU7pEoFhY6Kftp+LN/SDJfngBw=; b=V1ZDJ0xvb7uRoFrhxUzsIPQlte8MdOkz2Novsgvdv55wo47Ukt/fgjcSmjlWY/lsvC XcqnnhuDP8NgVHCCOv78l9UxIkMfrdRjEyxElJK9TUX2Xb0g1N7v1XafyyGB/JzpoSeb cLmFdgZUMjEjd8euY9cicGuhRfaIgOhSDX6F4MJCoZ/FKodLgpmePVnBQQB1Rc3FpBGy Vr1iAx+UQA8rSz9UYWy9Bq2Ij3BsFxmq4PeALc3ZsCRaJzdLolTvH6k/CWrCAAeg77WD wF1XvZWMBgAQ8RjEA4pyqTEQlxWWWfu/mfHlEWMtlBXDSB1LBihExDRK6dcmSN/sdupe yfig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762359305; x=1762964105; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=PW+009+mxrT5Q7b6yvU7pEoFhY6Kftp+LN/SDJfngBw=; b=HQAix/syL2fuBNLn1Xm4fJUdSk0T8ANFio++u6piHKiWEB9XG4Z57lyclSAuP6Po5/ YZYGsmUlaOkjnDFsoQ47boJmSqO/3r2PTz5VDWxtE4hM1DjFsNQwHE7QraXIeQFb2/Mu Z6TytneW4IGDd4A+xcutVIArtCqkylGHXuWQdxE3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mr3606599a12.6.1762359305340; Wed, 05 Nov 2025 08:15:05 -0800 (PST) Received: from [172.20.148.133] ([87.213.113.147]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-640e680578esm4923886a12.10.2025.11.05.08.15.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 08:15:03 -0800 (PST) Message-ID: <8f05eb9644d1920f7158c19d769c943fd5dba9a1.camel@linaro.org> Subject: Re: [PATCH v3 10/20] regulator: add REGULATOR_LINEAR_VRANGE macro From: =?ISO-8859-1?Q?Andr=E9?= Draszik To: Mark Brown Cc: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Peter Griffin , Will McVicker , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org Date: Wed, 05 Nov 2025 16:15:02 +0000 In-Reply-To: References: <20251103-s2mpg1x-regulators-v3-0-b8b96b79e058@linaro.org> <20251103-s2mpg1x-regulators-v3-10-b8b96b79e058@linaro.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2-2+build3 Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Thanks Mark for your review! On Tue, 2025-11-04 at 14:27 +0000, Mark Brown wrote: > On Mon, Nov 03, 2025 at 07:14:49PM +0000, Andr=C3=A9 Draszik wrote: >=20 > > REGULATOR_LINEAR_VRANGE is similar to REGULATOR_LINEAR_RANGE, but > > allows a more natural declaration of a voltage range for a regulator, > > in that it expects the minimum and maximum values as voltages rather > > than as selectors. >=20 > > Using voltages arguably makes this macro easier to use by drivers and > > code using it can become easier to read compared to > > REGULATOR_LINEAR_RANGE. >=20 > It does introduce an additional layer of indirection into the validation > that the configuration is correct, the reason we use selectors is that > they should map directly onto the register in the datasheet. My datasheet mentions the range more prominently than the selectors, and as= driver author I can easily validate both (neither macro does any validation itself= ). I do believe code like this: REGULATOR_LINEAR_VRANGE(200000, 450000, 1300000, STEP_6_25_MV) looks more meaningful and is more naturally readable than REGULATOR_LINEAR_RANGE(450000, 0x28, 0xb0, STEP_6_25_MV) as it's much easier to see the actual range without doing any additional ca= lculations. I'd prefer to keep the alternative macro, but will drop this patch if you r= eally disagree that it adds any value Cheers, Andre'