summaryrefslogtreecommitdiff
path: root/drivers/input/keyboard/cypress-sf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/keyboard/cypress-sf.c')
-rw-r--r--drivers/input/keyboard/cypress-sf.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/input/keyboard/cypress-sf.c b/drivers/input/keyboard/cypress-sf.c
index c28996028e80..335b72efc5aa 100644
--- a/drivers/input/keyboard/cypress-sf.c
+++ b/drivers/input/keyboard/cypress-sf.c
@@ -61,6 +61,14 @@ static irqreturn_t cypress_sf_irq_handler(int irq, void *devid)
return IRQ_HANDLED;
}
+static void cypress_sf_disable_regulators(void *arg)
+{
+ struct cypress_sf_data *touchkey = arg;
+
+ regulator_bulk_disable(ARRAY_SIZE(touchkey->regulators),
+ touchkey->regulators);
+}
+
static int cypress_sf_probe(struct i2c_client *client)
{
struct cypress_sf_data *touchkey;
@@ -121,6 +129,12 @@ static int cypress_sf_probe(struct i2c_client *client)
return error;
}
+ error = devm_add_action_or_reset(&client->dev,
+ cypress_sf_disable_regulators,
+ touchkey);
+ if (error)
+ return error;
+
touchkey->input_dev = devm_input_allocate_device(&client->dev);
if (!touchkey->input_dev) {
dev_err(&client->dev, "Failed to allocate input device\n");
@@ -154,7 +168,7 @@ static int cypress_sf_probe(struct i2c_client *client)
return 0;
};
-static int __maybe_unused cypress_sf_suspend(struct device *dev)
+static int cypress_sf_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct cypress_sf_data *touchkey = i2c_get_clientdata(client);
@@ -173,7 +187,7 @@ static int __maybe_unused cypress_sf_suspend(struct device *dev)
return 0;
}
-static int __maybe_unused cypress_sf_resume(struct device *dev)
+static int cypress_sf_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct cypress_sf_data *touchkey = i2c_get_clientdata(client);
@@ -191,11 +205,11 @@ static int __maybe_unused cypress_sf_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(cypress_sf_pm_ops,
- cypress_sf_suspend, cypress_sf_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(cypress_sf_pm_ops,
+ cypress_sf_suspend, cypress_sf_resume);
-static struct i2c_device_id cypress_sf_id_table[] = {
- { CYPRESS_SF_DEV_NAME, 0 },
+static const struct i2c_device_id cypress_sf_id_table[] = {
+ { CYPRESS_SF_DEV_NAME },
{ }
};
MODULE_DEVICE_TABLE(i2c, cypress_sf_id_table);
@@ -211,11 +225,11 @@ MODULE_DEVICE_TABLE(of, cypress_sf_of_match);
static struct i2c_driver cypress_sf_driver = {
.driver = {
.name = CYPRESS_SF_DEV_NAME,
- .pm = &cypress_sf_pm_ops,
+ .pm = pm_sleep_ptr(&cypress_sf_pm_ops),
.of_match_table = of_match_ptr(cypress_sf_of_match),
},
.id_table = cypress_sf_id_table,
- .probe_new = cypress_sf_probe,
+ .probe = cypress_sf_probe,
};
module_i2c_driver(cypress_sf_driver);