From nobody Mon Feb 9 20:11:22 2026 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 168A932BF3D for ; Mon, 5 Jan 2026 09:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603712; cv=none; b=d1ynkGvtaPEKaRu5HFMNKgPpKTIvZizGwGKqadtBUK1ujwQttoWZFibRHeXHFV9+w7PpUx7qNF0gOq9tzHWw7uEhjJSVgwh2hR1iX5jNwru5ffzaugFWnfHnes23Uq8PwEr3Q63gfyKnLdXK6gs9eJr+VJcC/qP+uunQ1lFt0PA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767603712; c=relaxed/simple; bh=ZETZajMfvd5Cj7AwABnaIbo8YXi84LCz2hhmRM9mv6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bj0b+ymuQk/LxBwtaQ6eqFzXf2mXgNh7SC0u4yf9C8mved+Jztsj5A2ILaZisSzDiorZmcbNcBpOr39SMHIsbA62xy62/cmr8B4XINFzD6LfTUCEmlel9Hi6FzQiybEkK7uKVugxYRLkCNrefy6mRx4yDvo887tW0usPTbI8Yyg= 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=Kpym1xiZ; arc=none smtp.client-ip=209.85.218.45 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="Kpym1xiZ" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-b73161849e1so2657641266b.2 for ; Mon, 05 Jan 2026 01:01:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1767603706; x=1768208506; 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=Kpym1xiZuf7cScimQeO1H/x48ruE1eGm8QYvaGfgU2fXZxLzpuuOnFhJ+1EBs1xjzP QaujlZYVxGg/h/y1JugiVeVo0CDtvZXhY0qtVWGOjgF3UQxuCnUtDwGBJWbQzIakKeZx daYKOAT0fvh007ZaiNjCyOdYJyMOgXg/kVcGqJdwtO1J8ZF8jT56kt+N5eBRw2nNaTQ3 76xF3vFnHnqcKuMs/wIIqlhpQab1w7tfaCSBcfE4Ca2z2UCdRIF4uocLLsTxmp8y4iwf 22WB9wHzgDq7tpJ0yGPJQK9sVVhVJCEVyy/BfBigZxj2rBvVX41owHbMBcyuZJOmZehp 2GnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767603706; x=1768208506; 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=IsfmW5QBIcQQqN5VQg+t3at0vEtn527lr0f6ibWhS4U1nn48O1clYQBsFqAsq0Ebyv kHg5ndjTiwxj2QhojKuQp9Xrl9ZheNRXRzpmp9A+kA08IKoan7XEYxG+VdKIWE2aLo7T hqCKSw8JOnyc1Znco7aZJMhfFbNM6psmmkZl/jnAjJC2PsadWD5KAHiXTV7b9Qy5VxDm Yy0cpyZlB2+CE7q3s1KmdoCZiS0XUJ0DXvLimRhd2euz7m6aD0H6CG5wttcxKe/Pg2x5 yqhgsq2VaygWgIfWGHniBPIuBeEiGNkyqnFob3byHxmLUZlMqaqXm8fYTlR6sQQdQSCE +KGw== X-Forwarded-Encrypted: i=1; AJvYcCWGtZxESVold8V1L7H8M73tsk3TpZuBkZ1jZhfDn92NWmmBr6qzGSgIrZhL+a2LopyAid2j5krvhb1ZFq0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw48vJbDuasWawLbSMMI+l6lw8u3GuHT0NdTnyAlMiZUUIB8aqj eKQVywP+7Jq3HjvSV4JHWjd+aeUv47aMjnbbC/oRRjceM6gC0uGplnu2CCGwBQjSczg= X-Gm-Gg: AY/fxX7h9hKSZCkfFZuoQwApDqlERsWqvqZRv1tzJHdUSdT+av2zJxdgLfIa9bOrl8c q0yFNQ1wkrMJ5G/dNCqXW4PtLtE4D2CGRhQAf84ZNATy9XUtGQQCrlPTRZBeJDULASnRtXV9YoP ddBa8qz8JkYD1lz0H+62uOhp7dsrkoh/aEBFsF92WYSCHvIMGRTL8pApxI2iidkaOX5+wpYcGCd RyBgm1HbgtTbYgkryladNRplxb3oBO8II5+052+wYQ4QfJR7WwVvQtu4Yz53Z64yei1+yVhCea3 +wHMti0LispaMXk2cJqhQigKsh/u8YsdFLBbmWDLqCoKn/IoanSlNNJex/MGZ/uwcfe6QPGTryh LBmFLCMQC1qzxvWIWLUQCRwGxkGHFkjys8nmlRwY+dwTJdiD6dMM7jbORlYg6nKZV5paF3jKaVI +k7XTx5K2ruoZyxVbYGLYSXn67V0laKf7qxtBlPTjzeIb/EwDcqKoNwswrx23Bjy2MnfvFOlSbg 73CZQ== X-Google-Smtp-Source: AGHT+IHlDkTLEXnDdmXJOAB496ZocW/7AWPPvHl6kR9niuqDxJVFfo22iK/G7e68AW5rLvwMIepbdQ== X-Received: by 2002:a17:906:6a1d:b0:b79:f8ae:a893 with SMTP id a640c23a62f3a-b803719d4a1mr4700447566b.49.1767603705564; Mon, 05 Jan 2026 01:01:45 -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 a640c23a62f3a-b8037f0ecb9sm5384010466b.56.2026.01.05.01.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 01:01:45 -0800 (PST) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Mon, 05 Jan 2026 09:01:46 +0000 Subject: [PATCH v6 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: <20260105-s2mpg1x-regulators-v6-10-80f4b6d1bf9d@linaro.org> References: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> In-Reply-To: <20260105-s2mpg1x-regulators-v6-0-80f4b6d1bf9d@linaro.org> To: Tudor Ambarus , Rob Herring , Conor Dooley , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Lee Jones , Bartosz Golaszewski , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Linus Walleij 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