From nobody Tue Feb 10 10:58:50 2026 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 94D6832ED37 for ; Sat, 27 Dec 2025 12:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838281; cv=none; b=HfnNmXctjSIyKRZ7OQLHlNrbTlndZsVzbJOgon4exNeADFxv99cXGMV8z35ZfeBZa0COaUGUjbHX61t7ld8I9Y9XFp7phKO4s5XQFP3GtoEYV1o9Zsa7+GDthHBlzWb+3wId0MIJsWTnr6OwK5JJLXMbAnoJU2H3I74n4Pe3KVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766838281; c=relaxed/simple; bh=ZETZajMfvd5Cj7AwABnaIbo8YXi84LCz2hhmRM9mv6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KrKi4tO/a+f8vOPOXF8KmOWLAy6KarX8NX3QeB7DFnXK3Fnoo//+fyK1jkwWhpPiVhppJpIjLkDOZX7K7m3rfi2Z1zH6uL/sdHa6a9tWYWjw4uqwTgLR5cLq2aJ2J6F1GjR5iUn4RVf9vcIIVIG4LiZY8+O4zY6r4i6z7/yv6cM= 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=JVdSOk3v; arc=none smtp.client-ip=209.85.208.46 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="JVdSOk3v" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-64b83949fdaso10191820a12.2 for ; Sat, 27 Dec 2025 04:24:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1766838273; x=1767443073; 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=ydYm6Jwl4gZ6fxTGOTSVWGkOP7GwrBDA3cOK9JtPOwA=; b=JVdSOk3vCMomAwy8cm71LE1sMdttZxiV6D9ZzAACcub7eaQ252VliCAxzqQrCPeezu GLNKu3vWJNb6omFnwI8kXbNCaZpexqVadyvlqn+7V0bLHxxziUa0d1urTvxGHNSWqMCn 7vpkNm502YsFg6w/dDiIlLPrvImSHLbfZ0vFOR79xW3rHhWiTda4cAw7yoiIsB+DWWCG TXW8uIWkzjS4R9YDX6mFDsrFFl2KTi/+Z3ixRRh4UaaUSU7OC3HAI34kNArNsVaz49d0 eQiO4p81sPLfAJN44j5/zHIyjeZ1iJNb0HTxLRGd2dFaP5yiZb998QS1b5g8p2I4+byl TZww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766838273; x=1767443073; 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=ydYm6Jwl4gZ6fxTGOTSVWGkOP7GwrBDA3cOK9JtPOwA=; b=ssijEVW+Nq9HefmJ1SPaDy0Su5B8B3lqCOeqe22q6Qp58AzVsAzmZd+3DcAA0zLdiO s7qeZH0rJeU42DXjJCzBA0WE4Unfs+CVtW7ktMXwmzC1M5HC248RxwuU5QN5mg6BsBGO OZXXSX/Qpg8jsll35ngUThyeRER0XGVpgOYTIA1flv1skTm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402:4414:b0:64b:70cd:ac2c with SMTP id 4fb4d7f45d1cf-64b8ede3550mr23179595a12.32.1766838273410; Sat, 27 Dec 2025 04:24:33 -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-64b916adc61sm25932659a12.31.2025.12.27.04.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 04:24:33 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Sat, 27 Dec 2025 12:24:32 +0000 Subject: [PATCH v5 10/21] 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: <20251227-s2mpg1x-regulators-v5-10-0c04b360b4c9@linaro.org> References: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@linaro.org> In-Reply-To: <20251227-s2mpg1x-regulators-v5-0-0c04b360b4c9@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.351.gbe84eed79e-goog