Commit 5e672766 authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

media: adv748x: Configure device when resuming from sleep

If the device is powered off (for example during system suspend to ram)
the devices loses its configuration, especially the slave i2c mappings
and other configuration set at probe time. This renders the device
unusable and the only way to recover is to unbind and rebind the device
to the driver to run the probe setup again.

Add an early resume callback that reinitializes the device and setup the
slave i2c address mappings and other probe time configuration.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 42bff048
...@@ -565,6 +565,18 @@ static int adv748x_identify_chip(struct adv748x_state *state) ...@@ -565,6 +565,18 @@ static int adv748x_identify_chip(struct adv748x_state *state)
return 0; return 0;
} }
/* -----------------------------------------------------------------------------
* Suspend / Resume
*/
static int __maybe_unused adv748x_resume_early(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct adv748x_state *state = i2c_get_clientdata(client);
return adv748x_reset(state);
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* i2c driver * i2c driver
*/ */
...@@ -827,10 +839,15 @@ static const struct of_device_id adv748x_of_table[] = { ...@@ -827,10 +839,15 @@ static const struct of_device_id adv748x_of_table[] = {
}; };
MODULE_DEVICE_TABLE(of, adv748x_of_table); MODULE_DEVICE_TABLE(of, adv748x_of_table);
static const struct dev_pm_ops adv748x_pm_ops = {
SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, adv748x_resume_early)
};
static struct i2c_driver adv748x_driver = { static struct i2c_driver adv748x_driver = {
.driver = { .driver = {
.name = "adv748x", .name = "adv748x",
.of_match_table = adv748x_of_table, .of_match_table = adv748x_of_table,
.pm = &adv748x_pm_ops,
}, },
.probe_new = adv748x_probe, .probe_new = adv748x_probe,
.remove = adv748x_remove, .remove = adv748x_remove,
......
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