Skip to content

Commit

Permalink
regulator: fixed: add off-on-delay
Browse files Browse the repository at this point in the history
Depends on board design, the gpio controlling regulator may
connects with a big capacitance. When need off, it takes some time
to let the regulator to be truly off. If not add enough delay, the
regulator might have always been on, so introduce off-on-delay to
handle such case.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1572311875-22880-3-git-send-email-peng.fan@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Peng Fan authored and Mark Brown committed Oct 29, 2019
1 parent 96da2d9 commit f7907e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/regulator/fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ of_get_fixed_voltage_config(struct device *dev,
config->enabled_at_boot = true;

of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
of_property_read_u32(np, "off-on-delay-us", &config->off_on_delay);

if (of_find_property(np, "vin-supply", NULL))
config->input_supply = "vin";
Expand Down Expand Up @@ -189,6 +190,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
}

drvdata->desc.enable_time = config->startup_delay;
drvdata->desc.off_on_delay = config->off_on_delay;

if (config->input_supply) {
drvdata->desc.supply_name = devm_kstrdup(&pdev->dev,
Expand Down
1 change: 1 addition & 0 deletions include/linux/regulator/fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct fixed_voltage_config {
const char *input_supply;
int microvolts;
unsigned startup_delay;
unsigned int off_on_delay;
unsigned enabled_at_boot:1;
struct regulator_init_data *init_data;
};
Expand Down

0 comments on commit f7907e5

Please sign in to comment.