mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Add a bare minimum regulator abstraction to be used by Rust drivers. This abstraction adds a small subset of the regulator API, which is thought to be sufficient for the drivers we have now. Regulators provide the power needed by many hardware blocks and thus are likely to be needed by a lot of drivers. It was tested on rk3588, where it was used to power up the "mali" regulator in order to power up the GPU. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20250714-topics-tyr-regulator2-v8-1-c7ab3955d524@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
43 lines
918 B
C
43 lines
918 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/regulator/consumer.h>
|
|
|
|
#ifndef CONFIG_REGULATOR
|
|
|
|
void rust_helper_regulator_put(struct regulator *regulator)
|
|
{
|
|
regulator_put(regulator);
|
|
}
|
|
|
|
int rust_helper_regulator_set_voltage(struct regulator *regulator, int min_uV,
|
|
int max_uV)
|
|
{
|
|
return regulator_set_voltage(regulator, min_uV, max_uV);
|
|
}
|
|
|
|
int rust_helper_regulator_get_voltage(struct regulator *regulator)
|
|
{
|
|
return regulator_get_voltage(regulator);
|
|
}
|
|
|
|
struct regulator *rust_helper_regulator_get(struct device *dev, const char *id)
|
|
{
|
|
return regulator_get(dev, id);
|
|
}
|
|
|
|
int rust_helper_regulator_enable(struct regulator *regulator)
|
|
{
|
|
return regulator_enable(regulator);
|
|
}
|
|
|
|
int rust_helper_regulator_disable(struct regulator *regulator)
|
|
{
|
|
return regulator_disable(regulator);
|
|
}
|
|
|
|
int rust_helper_regulator_is_enabled(struct regulator *regulator)
|
|
{
|
|
return regulator_is_enabled(regulator);
|
|
}
|
|
|
|
#endif
|