Commit df9e4f9d authored by Martin Kepplinger's avatar Martin Kepplinger
Browse files

hi846: add hi846_regulator_disable()

parent a5df3771
Pipeline #67452 passed with stage
in 66 minutes and 6 seconds
......@@ -1172,6 +1172,15 @@ static int hi846_regulator_enable(struct hi846 *hi846)
return regulator_enable(hi846->vdd1_regulator);
}
static void hi846_regulator_disable(struct hi846 *hi846)
{
if (regulator_is_enabled(hi846->vdd1_regulator))
regulator_disable(hi846->vdd1_regulator);
if (regulator_is_enabled(hi846->vdd_regulator))
regulator_disable(hi846->vdd_regulator);
}
static int __maybe_unused hi846_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
......@@ -1186,11 +1195,7 @@ static int __maybe_unused hi846_suspend(struct device *dev)
if (!IS_ERR(hi846->clock))
clk_disable_unprepare(hi846->clock);
if (regulator_is_enabled(hi846->vdd1_regulator))
regulator_disable(hi846->vdd1_regulator);
if (regulator_is_enabled(hi846->vdd_regulator))
regulator_disable(hi846->vdd_regulator);
hi846_regulator_disable(hi846);
return 0;
}
......@@ -1234,9 +1239,7 @@ static int __maybe_unused hi846_resume(struct device *dev)
hi846->streaming = 0;
error_regulator:
regulator_disable(hi846->vdd1_regulator);
if (regulator_is_enabled(hi846->vdd_regulator))
regulator_disable(hi846->vdd_regulator);
hi846_regulator_disable(hi846);
return ret;
}
......@@ -1552,9 +1555,7 @@ static int hi846_remove(struct i2c_client *client)
pm_runtime_set_suspended(&client->dev);
pm_runtime_put_noidle(&client->dev);
mutex_destroy(&hi846->mutex);
regulator_disable(hi846->vdd1_regulator);
if (regulator_is_enabled(hi846->vdd_regulator))
regulator_disable(hi846->vdd_regulator);
hi846_regulator_disable(hi846);
return 0;
}
......@@ -1718,9 +1719,7 @@ static int hi846_probe(struct i2c_client *client)
mutex_destroy(&hi846->mutex);
probe_error_regulator:
regulator_disable(hi846->vdd1_regulator);
if (regulator_is_enabled(hi846->vdd_regulator))
regulator_disable(hi846->vdd_regulator);
hi846_regulator_disable(hi846);
return ret;
}
......
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