Skip to content

Commit 4832565

Browse files
charleskeepaxbroonie
authored andcommitted
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: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent c1f615e commit 4832565

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

drivers/regulator/core.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4321,6 +4321,7 @@ EXPORT_SYMBOL_GPL(regulator_set_load);
43214321
int regulator_allow_bypass(struct regulator *regulator, bool enable)
43224322
{
43234323
struct regulator_dev *rdev = regulator->rdev;
4324+
const char *name = rdev_get_name(rdev);
43244325
int ret = 0;
43254326

43264327
if (!rdev->desc->ops->set_bypass)
@@ -4335,18 +4336,26 @@ int regulator_allow_bypass(struct regulator *regulator, bool enable)
43354336
rdev->bypass_count++;
43364337

43374338
if (rdev->bypass_count == rdev->open_count) {
4339+
trace_regulator_bypass_enable(name);
4340+
43384341
ret = rdev->desc->ops->set_bypass(rdev, enable);
43394342
if (ret != 0)
43404343
rdev->bypass_count--;
4344+
else
4345+
trace_regulator_bypass_enable_complete(name);
43414346
}
43424347

43434348
} else if (!enable && regulator->bypass) {
43444349
rdev->bypass_count--;
43454350

43464351
if (rdev->bypass_count != rdev->open_count) {
4352+
trace_regulator_bypass_disable(name);
4353+
43474354
ret = rdev->desc->ops->set_bypass(rdev, enable);
43484355
if (ret != 0)
43494356
rdev->bypass_count++;
4357+
else
4358+
trace_regulator_bypass_disable_complete(name);
43504359
}
43514360
}
43524361

include/trace/events/regulator.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,38 @@ DEFINE_EVENT(regulator_basic, regulator_disable_complete,
7070

7171
);
7272

73+
DEFINE_EVENT(regulator_basic, regulator_bypass_enable,
74+
75+
TP_PROTO(const char *name),
76+
77+
TP_ARGS(name)
78+
79+
);
80+
81+
DEFINE_EVENT(regulator_basic, regulator_bypass_enable_complete,
82+
83+
TP_PROTO(const char *name),
84+
85+
TP_ARGS(name)
86+
87+
);
88+
89+
DEFINE_EVENT(regulator_basic, regulator_bypass_disable,
90+
91+
TP_PROTO(const char *name),
92+
93+
TP_ARGS(name)
94+
95+
);
96+
97+
DEFINE_EVENT(regulator_basic, regulator_bypass_disable_complete,
98+
99+
TP_PROTO(const char *name),
100+
101+
TP_ARGS(name)
102+
103+
);
104+
73105
/*
74106
* Events that take a range of numerical values, mostly for voltages
75107
* and so on.

0 commit comments

Comments
 (0)