mfd: display-serdes: power off remote serdes while shutdown

Signed-off-by: Luo Wei <lw@rock-chips.com>
Change-Id: Ic358750583e2cb94a79710cabc84bc739bf12b12
This commit is contained in:
Luo Wei
2023-10-16 19:33:55 +08:00
committed by Tao Huang
parent abdfc22491
commit 8bbe906daa
3 changed files with 36 additions and 3 deletions

View File

@@ -334,7 +334,8 @@ int serdes_set_pinctrl_default(struct serdes *serdes);
int serdes_set_pinctrl_sleep(struct serdes *serdes);
int serdes_device_suspend(struct serdes *serdes);
int serdes_device_resume(struct serdes *serdes);
void serdes_device_shutdown(struct serdes *serdes);
void serdes_device_poweroff(struct serdes *serdes);
int serdes_device_shutdown(struct serdes *serdes);
int serdes_irq_init(struct serdes *serdes);
void serdes_irq_exit(struct serdes *serdes);
void serdes_auxadc_init(struct serdes *serdes);

View File

@@ -376,7 +376,7 @@ int serdes_device_resume(struct serdes *serdes)
}
EXPORT_SYMBOL_GPL(serdes_device_resume);
void serdes_device_shutdown(struct serdes *serdes)
void serdes_device_poweroff(struct serdes *serdes)
{
int ret = 0;
@@ -385,6 +385,29 @@ void serdes_device_shutdown(struct serdes *serdes)
if (ret)
dev_err(serdes->dev, "could not set sleep pins\n");
}
if (!IS_ERR(serdes->vpower)) {
ret = regulator_disable(serdes->vpower);
if (ret)
dev_err(serdes->dev, "fail to disable vpower regulator\n");
}
}
EXPORT_SYMBOL_GPL(serdes_device_poweroff);
int serdes_device_shutdown(struct serdes *serdes)
{
int ret = 0;
if (!IS_ERR(serdes->vpower)) {
ret = regulator_disable(serdes->vpower);
if (ret) {
dev_err(serdes->dev, "fail to disable vpower regulator\n");
return ret;
}
}
return ret;
}
EXPORT_SYMBOL_GPL(serdes_device_shutdown);

View File

@@ -223,6 +223,14 @@ static int serdes_i2c_probe(struct i2c_client *client,
return 0;
}
static void serdes_i2c_shutdown(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct serdes *serdes = dev_get_drvdata(dev);
serdes_device_shutdown(serdes);
}
static int serdes_i2c_prepare(struct device *dev)
{
return 0;
@@ -264,7 +272,7 @@ static int serdes_i2c_poweroff(struct device *dev)
{
struct serdes *serdes = dev_get_drvdata(dev);
serdes_device_shutdown(serdes);
serdes_device_poweroff(serdes);
return 0;
}
@@ -315,6 +323,7 @@ static struct i2c_driver serdes_i2c_driver = {
.of_match_table = of_match_ptr(serdes_of_match),
},
.probe = serdes_i2c_probe,
.shutdown = serdes_i2c_shutdown,
};
static int __init serdes_i2c_init(void)