Commit 48325655 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

regulator: core: Add regulator bypass trace points

Add new trace points for the start and end of enabling bypass on a
regulator, to allow monitoring of when regulators are moved into bypass
and how long that takes.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200529152216.9671-1-ckeepax@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c1f615e4
...@@ -4321,6 +4321,7 @@ EXPORT_SYMBOL_GPL(regulator_set_load); ...@@ -4321,6 +4321,7 @@ EXPORT_SYMBOL_GPL(regulator_set_load);
int regulator_allow_bypass(struct regulator *regulator, bool enable) int regulator_allow_bypass(struct regulator *regulator, bool enable)
{ {
struct regulator_dev *rdev = regulator->rdev; struct regulator_dev *rdev = regulator->rdev;
const char *name = rdev_get_name(rdev);
int ret = 0; int ret = 0;
if (!rdev->desc->ops->set_bypass) if (!rdev->desc->ops->set_bypass)
...@@ -4335,18 +4336,26 @@ int regulator_allow_bypass(struct regulator *regulator, bool enable) ...@@ -4335,18 +4336,26 @@ int regulator_allow_bypass(struct regulator *regulator, bool enable)
rdev->bypass_count++; rdev->bypass_count++;
if (rdev->bypass_count == rdev->open_count) { if (rdev->bypass_count == rdev->open_count) {
trace_regulator_bypass_enable(name);
ret = rdev->desc->ops->set_bypass(rdev, enable); ret = rdev->desc->ops->set_bypass(rdev, enable);
if (ret != 0) if (ret != 0)
rdev->bypass_count--; rdev->bypass_count--;
else
trace_regulator_bypass_enable_complete(name);
} }
} else if (!enable && regulator->bypass) { } else if (!enable && regulator->bypass) {
rdev->bypass_count--; rdev->bypass_count--;
if (rdev->bypass_count != rdev->open_count) { if (rdev->bypass_count != rdev->open_count) {
trace_regulator_bypass_disable(name);
ret = rdev->desc->ops->set_bypass(rdev, enable); ret = rdev->desc->ops->set_bypass(rdev, enable);
if (ret != 0) if (ret != 0)
rdev->bypass_count++; rdev->bypass_count++;
else
trace_regulator_bypass_disable_complete(name);
} }
} }
......
...@@ -70,6 +70,38 @@ DEFINE_EVENT(regulator_basic, regulator_disable_complete, ...@@ -70,6 +70,38 @@ DEFINE_EVENT(regulator_basic, regulator_disable_complete,
); );
DEFINE_EVENT(regulator_basic, regulator_bypass_enable,
TP_PROTO(const char *name),
TP_ARGS(name)
);
DEFINE_EVENT(regulator_basic, regulator_bypass_enable_complete,
TP_PROTO(const char *name),
TP_ARGS(name)
);
DEFINE_EVENT(regulator_basic, regulator_bypass_disable,
TP_PROTO(const char *name),
TP_ARGS(name)
);
DEFINE_EVENT(regulator_basic, regulator_bypass_disable_complete,
TP_PROTO(const char *name),
TP_ARGS(name)
);
/* /*
* Events that take a range of numerical values, mostly for voltages * Events that take a range of numerical values, mostly for voltages
* and so on. * and so on.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment