diff options
author | Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> | 2021-06-03 07:42:12 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-06-21 14:08:41 +0200 |
commit | 89a6a5e56c8248a077d12424a1383a6b18ea840b (patch) | |
tree | 31a8361eae067daac0747acaac685a5db14cffad /drivers/regulator/qcom-labibb-regulator.c | |
parent | regulator: IRQ based event/error notification helpers (diff) | |
download | linux-89a6a5e56c8248a077d12424a1383a6b18ea840b.tar.xz linux-89a6a5e56c8248a077d12424a1383a6b18ea840b.zip |
regulator: add property parsing and callbacks to set protection limits
Add DT property parsing code and setting callback for regulator over/under
voltage, over-current and temperature error limits.
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/e7b8007ba9eae7076178bf3363fb942ccb1cc9a5.1622628334.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/qcom-labibb-regulator.c')
-rw-r--r-- | drivers/regulator/qcom-labibb-regulator.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/regulator/qcom-labibb-regulator.c b/drivers/regulator/qcom-labibb-regulator.c index de25e3279b4b..b3da0dc58782 100644 --- a/drivers/regulator/qcom-labibb-regulator.c +++ b/drivers/regulator/qcom-labibb-regulator.c @@ -307,13 +307,21 @@ end: return IRQ_HANDLED; } -static int qcom_labibb_set_ocp(struct regulator_dev *rdev) +static int qcom_labibb_set_ocp(struct regulator_dev *rdev, int lim, + int severity, bool enable) { struct labibb_regulator *vreg = rdev_get_drvdata(rdev); char *ocp_irq_name; u32 irq_flags = IRQF_ONESHOT; int irq_trig_low, ret; + /* + * labibb supports only protection - and does not support setting + * limit. Furthermore, we don't support disabling protection. + */ + if (lim || severity != REGULATOR_SEVERITY_PROT || !enable) + return -EINVAL; + /* If there is no OCP interrupt, there's nothing to set */ if (vreg->ocp_irq <= 0) return -EINVAL; |