Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion components/drivers/regulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ menuconfig RT_USING_REGULATOR
bool "Using Voltage and Current Regulator"
select RT_USING_ADT
select RT_USING_ADT_REF
default n

config RT_REGULATOR_FAN53555
bool "Fairchild FAN53555 / TCS4525 Regulator"
depends on RT_USING_REGULATOR
depends on RT_USING_I2C
depends on RT_USING_DM
default n

config RT_REGULATOR_FIXED
Expand All @@ -27,6 +27,15 @@ config RT_REGULATOR_GPIO
depends on RT_USING_PIN
default y

config RT_REGULATOR_PWM
bool "PWM regulator support"
depends on RT_USING_REGULATOR
depends on RT_USING_DM
depends on RT_USING_PWM
depends on RT_USING_PIN
depends on RT_USING_OFW
default n

config RT_REGULATOR_SCMI
bool "SCMI regulator support"
depends on RT_USING_REGULATOR
Expand Down
3 changes: 3 additions & 0 deletions components/drivers/regulator/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ if GetDepend(['RT_REGULATOR_FIXED']):
if GetDepend(['RT_REGULATOR_GPIO']):
src += ['regulator-gpio.c']

if GetDepend(['RT_REGULATOR_PWM']):
src += ['regulator-pwm.c']

if GetDepend(['RT_REGULATOR_SCMI']):
src += ['regulator-scmi.c']

Expand Down
7 changes: 3 additions & 4 deletions components/drivers/regulator/regulator-fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static rt_err_t regulator_fixed_enable(struct rt_regulator_node *reg_np)
struct regulator_fixed *rf = raw_to_regulator_fixed(reg_np);
struct rt_regulator_param *param = &rf->param;

if (rf->enable_pin < 0 || param->always_on)
if (rf->enable_pin < 0)
{
return RT_EOK;
}
Expand All @@ -42,7 +42,7 @@ static rt_err_t regulator_fixed_disable(struct rt_regulator_node *reg_np)
struct regulator_fixed *rf = raw_to_regulator_fixed(reg_np);
struct rt_regulator_param *param = &rf->param;

if (rf->enable_pin < 0 || param->always_on)
if (rf->enable_pin < 0)
{
return RT_EOK;
}
Expand All @@ -59,12 +59,11 @@ static rt_bool_t regulator_fixed_is_enabled(struct rt_regulator_node *reg_np)
struct regulator_fixed *rf = raw_to_regulator_fixed(reg_np);
struct rt_regulator_param *param = &rf->param;

if (rf->enable_pin < 0 || param->always_on)
if (rf->enable_pin < 0)
{
return RT_TRUE;
}

rt_pin_mode(rf->enable_pin, PIN_MODE_INPUT);
active = rt_pin_read(rf->enable_pin);

if (param->enable_active_high)
Expand Down
15 changes: 0 additions & 15 deletions components/drivers/regulator/regulator-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ static rt_err_t regulator_gpio_enable(struct rt_regulator_node *reg_np)
struct regulator_gpio *rg = raw_to_regulator_gpio(reg_np);
struct rt_regulator_param *param = &rg->param;

if (param->always_on)
{
return RT_EOK;
}

if (rg->enable_pin >= 0)
{
rt_pin_mode(rg->enable_pin, PIN_MODE_OUTPUT);
Expand All @@ -70,11 +65,6 @@ static rt_err_t regulator_gpio_disable(struct rt_regulator_node *reg_np)
struct regulator_gpio *rg = raw_to_regulator_gpio(reg_np);
struct rt_regulator_param *param = &rg->param;

if (param->always_on)
{
return RT_EOK;
}

if (rg->enable_pin >= 0)
{
rt_pin_mode(rg->enable_pin, PIN_MODE_OUTPUT);
Expand All @@ -89,11 +79,6 @@ static rt_bool_t regulator_gpio_is_enabled(struct rt_regulator_node *reg_np)
struct regulator_gpio *rg = raw_to_regulator_gpio(reg_np);
struct rt_regulator_param *param = &rg->param;

if (param->always_on)
{
return RT_TRUE;
}

if (rg->enable_pin >= 0)
{
rt_uint8_t active_val = param->enable_active_high ? PIN_LOW : PIN_HIGH;
Expand Down
Loading
Loading