summaryrefslogtreecommitdiff
path: root/drivers/input/keyboard/tm2-touchkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/keyboard/tm2-touchkey.c')
-rw-r--r--drivers/input/keyboard/tm2-touchkey.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c
index fb078e049413..55d699d9037d 100644
--- a/drivers/input/keyboard/tm2-touchkey.c
+++ b/drivers/input/keyboard/tm2-touchkey.c
@@ -19,7 +19,6 @@
#include <linux/leds.h>
#include <linux/module.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/pm.h>
#include <linux/regulator/consumer.h>
@@ -48,7 +47,7 @@ struct tm2_touchkey_data {
struct input_dev *input_dev;
struct led_classdev led_dev;
struct regulator *vdd;
- struct regulator_bulk_data regulators[2];
+ struct regulator_bulk_data regulators[3];
const struct touchkey_variant *variant;
u32 keycodes[4];
int num_keycodes;
@@ -156,6 +155,8 @@ static irqreturn_t tm2_touchkey_irq_handler(int irq, void *devid)
goto out;
}
+ input_event(touchkey->input_dev, EV_MSC, MSC_SCAN, index);
+
if (data & TM2_TOUCHKEY_BIT_PRESS_EV) {
for (i = 0; i < touchkey->num_keycodes; i++)
input_report_key(touchkey->input_dev,
@@ -179,8 +180,7 @@ out:
return IRQ_HANDLED;
}
-static int tm2_touchkey_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
+static int tm2_touchkey_probe(struct i2c_client *client)
{
struct device_node *np = client->dev.of_node;
struct tm2_touchkey_data *touchkey;
@@ -204,6 +204,7 @@ static int tm2_touchkey_probe(struct i2c_client *client,
touchkey->regulators[0].supply = "vcc";
touchkey->regulators[1].supply = "vdd";
+ touchkey->regulators[2].supply = "vddio";
error = devm_regulator_bulk_get(&client->dev,
ARRAY_SIZE(touchkey->regulators),
touchkey->regulators);
@@ -249,6 +250,11 @@ static int tm2_touchkey_probe(struct i2c_client *client,
touchkey->input_dev->name = TM2_TOUCHKEY_DEV_NAME;
touchkey->input_dev->id.bustype = BUS_I2C;
+ touchkey->input_dev->keycode = touchkey->keycodes;
+ touchkey->input_dev->keycodemax = touchkey->num_keycodes;
+ touchkey->input_dev->keycodesize = sizeof(touchkey->keycodes[0]);
+
+ input_set_capability(touchkey->input_dev, EV_MSC, MSC_SCAN);
for (i = 0; i < touchkey->num_keycodes; i++)
input_set_capability(touchkey->input_dev, EV_KEY,
touchkey->keycodes[i]);
@@ -290,7 +296,7 @@ static int tm2_touchkey_probe(struct i2c_client *client,
return 0;
}
-static int __maybe_unused tm2_touchkey_suspend(struct device *dev)
+static int tm2_touchkey_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct tm2_touchkey_data *touchkey = i2c_get_clientdata(client);
@@ -301,7 +307,7 @@ static int __maybe_unused tm2_touchkey_suspend(struct device *dev)
return 0;
}
-static int __maybe_unused tm2_touchkey_resume(struct device *dev)
+static int tm2_touchkey_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct tm2_touchkey_data *touchkey = i2c_get_clientdata(client);
@@ -316,12 +322,12 @@ static int __maybe_unused tm2_touchkey_resume(struct device *dev)
return ret;
}
-static SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops,
- tm2_touchkey_suspend, tm2_touchkey_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tm2_touchkey_pm_ops,
+ tm2_touchkey_suspend, tm2_touchkey_resume);
static const struct i2c_device_id tm2_touchkey_id_table[] = {
- { TM2_TOUCHKEY_DEV_NAME, 0 },
- { },
+ { TM2_TOUCHKEY_DEV_NAME },
+ { }
};
MODULE_DEVICE_TABLE(i2c, tm2_touchkey_id_table);
@@ -346,8 +352,8 @@ MODULE_DEVICE_TABLE(of, tm2_touchkey_of_match);
static struct i2c_driver tm2_touchkey_driver = {
.driver = {
.name = TM2_TOUCHKEY_DEV_NAME,
- .pm = &tm2_touchkey_pm_ops,
- .of_match_table = of_match_ptr(tm2_touchkey_of_match),
+ .pm = pm_sleep_ptr(&tm2_touchkey_pm_ops),
+ .of_match_table = tm2_touchkey_of_match,
},
.probe = tm2_touchkey_probe,
.id_table = tm2_touchkey_id_table,