1
0
Fork 0

sy7636a regulator: Add mutex lock for is_enabled

This prevents a screen freeze bug.

If the regulator checks the on-off bit at the same
time as the thermal driver, the regulator_enable
call will conclude that the regulator is already
active.

Then, when the thermal driver is done checking the
temperature, it will set the PMIC back to the state
it was when it started, which is off.

In this state, the regulator driver believes the
PMIC is on, and the thermal has turned it off.

This can be considered a bit of a quick fix, to make
minimal changes to the kernel at this point. The
correct way to solve this would be to make the
sy7636a_thermal driver use the regulator network, or
moving all register access code into the sy7636a mfd
and use a mutex from there.
pull/10/head
Lars Ivar Miljeteig 2020-08-24 11:12:16 +02:00 committed by Steinar Bakkemo
parent 430a418051
commit 2c8b8ef501
1 changed files with 13 additions and 1 deletions

View File

@ -44,6 +44,18 @@ static int disable_regulator(struct regulator_dev *rdev)
return ret;
}
static int sy7636a_regulator_is_enabled(struct regulator_dev *rdev)
{
struct sy7636a *sy7636a = dev_get_drvdata(rdev->dev.parent);
int ret;
mutex_lock(&sy7636a->reglock);
ret = regulator_is_enabled_regmap(rdev);
mutex_unlock(&sy7636a->reglock);
return ret;
}
static int enable_regulator_pgood(struct regulator_dev *rdev)
{
struct sy7636a *sy7636a = dev_get_drvdata(rdev->dev.parent);
@ -97,7 +109,7 @@ static const struct regulator_ops sy7636a_vcom_volt_ops = {
.get_voltage = get_vcom_voltage_op,
.enable = enable_regulator_pgood,
.disable = disable_regulator,
.is_enabled = regulator_is_enabled_regmap,
.is_enabled = sy7636a_regulator_is_enabled,
};
struct regulator_desc desc = {