mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 04:42:04 -04:00
Merge "pinctrl: add restore function for sx150x"
This commit is contained in:
commit
46bb8e6b35
1 changed files with 39 additions and 0 deletions
|
|
@ -1,5 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2016, BayLibre, SAS. All rights reserved.
|
||||
* Author: Neil Armstrong <narmstrong@baylibre.com>
|
||||
*
|
||||
|
|
@ -1243,10 +1245,47 @@ static int sx150x_probe(struct i2c_client *client,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int sx150x_restore(struct device *dev)
|
||||
{
|
||||
struct i2c_client *client = to_i2c_client(dev);
|
||||
struct sx150x_pinctrl *pctl = i2c_get_clientdata(client);
|
||||
int ret;
|
||||
|
||||
ret = sx150x_init_hw(pctl);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pinctrl_force_default(pctl->pctldev);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to enable pinctrl device\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (client->irq > 0) {
|
||||
mutex_lock(&pctl->lock);
|
||||
regmap_write(pctl->regmap,
|
||||
pctl->data->reg_irq_mask, pctl->irq.masked);
|
||||
regmap_write(pctl->regmap,
|
||||
pctl->data->reg_sense, pctl->irq.sense);
|
||||
mutex_unlock(&pctl->lock);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops sx150x_pm = {
|
||||
.restore = sx150x_restore,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct i2c_driver sx150x_driver = {
|
||||
.driver = {
|
||||
.name = "sx150x-pinctrl",
|
||||
.of_match_table = of_match_ptr(sx150x_of_match),
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
.pm = &sx150x_pm,
|
||||
#endif
|
||||
},
|
||||
.probe = sx150x_probe,
|
||||
.id_table = sx150x_id,
|
||||
|
|
|
|||
Loading…
Reference in a new issue