From nobody Tue Feb 10 01:31:28 2026 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 5F4AC44CF2C for ; Thu, 22 Jan 2026 15:43:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096648; cv=none; b=C9PRU4BPwDgaMihu+wZYh+CH6suZWkGNlYwMVErAaPY29/bjYAAPVDO1bCi/E8pDP0t/UAr5OQhQuChplhWlY7phcs/Qz2B5JFrC/GOZlxrqjiL5OW+NiMvbYCfpIebl6mk+8yCVo8AHatIfVvAIQvp47Ck1cu3LJCIf3lchmO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769096648; c=relaxed/simple; bh=GVzTile/yZwpKHms32vEGpKMdnPMenoAs31RnHnr0vo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UyOfBrxV6Gotv3sYDSG6uQr8NTeu34y5UynO+pSSj24ztzAN1Pp44TV8n8wnwY3I9kX/3sn6iFlYsQE+P63pzrG3+s5bu0dip5RCiNsXSb3+mEcRoS8+XhRRjtfLNS8I10ipT6Tc0nb3LQRO/vK87goOTSog6RBwM+zEhqdEejc= 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=IZa+UIUn; arc=none smtp.client-ip=209.85.208.43 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="IZa+UIUn" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-65801ce918eso2393231a12.2 for ; Thu, 22 Jan 2026 07:43:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769096623; x=1769701423; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5mnYMLTw+v58WgRJpE4wU5fkf6SbugO2jmsGWp983LU=; b=IZa+UIUnxuvCSVrceV9c9aeWUpLVihpwcjYklH+anAqCNWYmznLgqdLr5ZiVC5Ywrd y60FCfX2LBUzMHwuLysQWqMnOOltb4KsoVDyUsLf9i9ku6kcrlxVPLnjGSClJxciFikO anp7vvJGjmepNZ1R0yZ0J8QJ+Xi+KdAF4MKNCJdYpkjAo3Zzh2BqlhdEMTPxAfweQ9aY s0/pyr+f4Mh9/BS4X/IHzOdQG8g0dImjxrz0ELzyVGEniNEFs/ep7gAD4d1O6omWVjhp z2YIw9yhwhB70p1R+F8HrWhkNEpEDfqUOAz5QCnwCQJLqySgpfeuy5nxejPkE9W7qgFs g6vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769096623; x=1769701423; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=5mnYMLTw+v58WgRJpE4wU5fkf6SbugO2jmsGWp983LU=; b=ciPVA4aa4fXJrq0LvalUteSRm0MVq52W1eggSOmNiVmsudJnQNL5VaVlKeZw1Oupc9 ojMzXRxeRTxEfi4MYILVEG8C0f+Z5YRErbgW0DR+hqqZiPpHJKGhn3w5aIOMBakgRzom RgEf5KJXqHhltZrJfpGfuEpZqkD/kO8qycLOh/2Z6GPCfz1hPQQ+4Qvf8klHjG57lQBh wDS8Z4/lo+avL12Og2k/5Gt6e6Q5MleSCepDnuKodtNmEhc3/0B90lDw7MT9iTAA2/nD rn8FodT+74ScToeQGxv1cccwC88sefoFW8RBanZHLf0MeGwjPxzmNjbCVe28IG3i9Les c9Ug== X-Forwarded-Encrypted: i=1; AJvYcCVYkRz7ekyPLKbzM5jO9crZFLJFcT2A5p0ub/g/VRzzJzgBlj5THfBOYOjvfWecxQi41z0jRjbIDxLHUEs=@vger.kernel.org X-Gm-Message-State: AOJu0Yw58Gy/7BlI9A1Dal5sG+ci7yLyEQlw1mhKlj4mb4yUewWo6eXa zOisT9mGQ5OJaHKJVstIMNRyTxiT6Ct9GqnG5F1rgbJIHPCdMpHxxKw9+crQ0XqXtZk= X-Gm-Gg: AZuq6aLedx34HSDqUdQok9iZiffygei5hDZahymDbsQKVcEQo8PQxhQAID7XNLw/HF3 fhPWThclmcqyIYbeq21A/ZzG4JTLD3wJmuyc1DwkpH8Ook857IBCrvZLg1kOEPuXpceVLwSDLjy xbWs/2taISmIJHjJtgIjdN5VHX7jOhWeIAsxO+2GmPfHW+AQWg8tORZjOMdjr0SLgdL7u+v0TV1 rex0Mat+EboIK9OlbM0wh+H3wLCSWEn33eSCK8JyqiVlZTMmPhKDB9bvRDw5OAB/OVtQojDq/L1 A5g+/4n978RtxuvqYhiL+WWeg+ikKFIhtP4JhlMafWwX8/6HoOQJHjf7QZ3QdutFPbl1kuEHC2G AmEeiIQE3+tItU3vc0gK9Q1SkH8JEbveP9EW8pSgfLIPoUSjz/lfhc1vqJc/t6A1gjahidRVvK3 M08dGJxEMgeeEZQcuyPqwXSx5rQOf5DKRaMx+mEslYX08fIe8bA5jbAjJN1NrzEJmNlqWt04FdJ TJuvQ== X-Received: by 2002:a05:6402:50c9:b0:64d:2082:d027 with SMTP id 4fb4d7f45d1cf-658487b933amr25772a12.29.1769096622839; Thu, 22 Jan 2026 07:43:42 -0800 (PST) Received: from puffmais2.c.googlers.com (244.175.141.34.bc.googleusercontent.com. [34.141.175.244]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-654535c49f4sm16334363a12.31.2026.01.22.07.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:43:42 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 22 Jan 2026 15:43:37 +0000 Subject: [PATCH v7 10/20] regulator: add REGULATOR_LINEAR_VRANGE macro Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260122-s2mpg1x-regulators-v7-10-3b1f9831fffd@linaro.org> References: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> In-Reply-To: <20260122-s2mpg1x-regulators-v7-0-3b1f9831fffd@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Linus Walleij , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski Cc: Peter Griffin , Will McVicker , Juan Yescas , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Draszik?= X-Mailer: b4 0.14.2 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. 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. Signed-off-by: Andr=C3=A9 Draszik --- While this commit doesn't introduce any users, the upcoming s2mpg10 and s2mpg11 drivers are using it. v3: - new patch --- include/linux/regulator/driver.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/dri= ver.h index 978cf593b6624228fe1fd9c2a3e186b53ef172f8..977755db64c6dfaea7246067eab= 0d9a2971caa01 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -53,6 +53,11 @@ enum regulator_detection_severity { #define REGULATOR_LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV) \ LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV) =20 +/* Initialize struct linear_range using voltages, not selectors */ +#define REGULATOR_LINEAR_VRANGE(_offs_uV, _min_uV, _max_uV, _step_uV) \ + LINEAR_RANGE(_min_uV, ((_min_uV) - (_offs_uV)) / (_step_uV), \ + ((_max_uV) - (_offs_uV)) / (_step_uV), _step_uV) + /** * struct regulator_ops - regulator operations. * --=20 2.52.0.457.g6b5491de43-goog