summaryrefslogtreecommitdiff
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-15 08:24:19 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-15 08:24:19 -0800
commit348e77b8145676184fb49063d5543e054fd74909 (patch)
tree18c396d17359a3f4800f6120b8a49cca059d3d16 /drivers/input/misc
parent13c916af3abf98f4a2a00b9463d2fc00cc6bc00e (diff)
parent273a171dee33cb77070d7259c469d9440548c7df (diff)
Merge tag 'input-for-v7.0-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov: - support for FocalTech FT8112 added to i2c-hid driver - support for FocalTech FT3518 added to edt-ft5x06 driver - support for power buttons in TWL603x chips added to twl4030-pwrbutton driver - an update to gpio-decoder driver to make it usable on non-OF platforms and to clean up the code - an update to synaptics_i2c driver switching it to use managed resources and a fix to restarting polling after resume - an update to gpio-keys driver to fall back to getting IRQ from resources if not specified using other means - an update to ili210x driver to support polling mode - a number of input drivers switched to scnprintf() to suppress truncation warnings - a number of updates and conversions of device tree bindings to yaml format - fixes to spelling in comments and messages in several drivers - other assorted fixups * tag 'input-for-v7.0-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits) dt-bindings: input: qcom,pm8941-pwrkey: Document PMM8654AU dt-bindings: input: touchscreen: imagis: allow linux,keycodes for ist3038 Input: apbps2 - fix comment style and typos Input: gpio_keys - fall back to platform_get_irq() for interrupt-only keys Input: novatek-nvt-ts - drop wake_type check dt-bindings: input: touchscreen: tsc2007: document '#io-channel-cells' Input: ili210x - add support for polling mode dt-bindings: touchscreen: trivial-touch: Drop 'interrupts' requirement for old Ilitek Input: appletouch - fix potential race between resume and open HID: i2c-hid: Add FocalTech FT8112 dt-bindings: input: i2c-hid: Introduce FocalTech FT8112 Input: synaptics_i2c - switch to using managed resources Input: synaptics_i2c - guard polling restart in resume Input: gpio_decoder - don't use "proxy" headers Input: gpio_decoder - make use of the macros from bits.h Input: gpio_decoder - replace custom loop by gpiod_get_array_value_cansleep() Input: gpio_decoder - unify messages with help of dev_err_probe() Input: gpio_decoder - make use of device properties Input: serio - complete sizeof(*pointer) conversions Input: wdt87xx_i2c - switch to use dev_err_probe() ...
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/cs40l50-vibra.c4
-rw-r--r--drivers/input/misc/gpio_decoder.c74
-rw-r--r--drivers/input/misc/palmas-pwrbutton.c2
-rw-r--r--drivers/input/misc/pf1550-onkey.c2
-rw-r--r--drivers/input/misc/twl4030-pwrbutton.c67
5 files changed, 94 insertions, 55 deletions
diff --git a/drivers/input/misc/cs40l50-vibra.c b/drivers/input/misc/cs40l50-vibra.c
index 7aa7d577e01b..90410025bbae 100644
--- a/drivers/input/misc/cs40l50-vibra.c
+++ b/drivers/input/misc/cs40l50-vibra.c
@@ -308,7 +308,6 @@ err_free:
list_add(&effect->list, &vib->effect_head);
}
err_pm:
- pm_runtime_mark_last_busy(vib->dev);
pm_runtime_put_autosuspend(vib->dev);
err_exit:
work_data->error = error;
@@ -368,7 +367,6 @@ static void cs40l50_start_worker(struct work_struct *work)
dev_err(vib->dev, "Effect to play not found\n");
}
- pm_runtime_mark_last_busy(vib->dev);
pm_runtime_put_autosuspend(vib->dev);
err_free:
kfree(work_data);
@@ -384,7 +382,6 @@ static void cs40l50_stop_worker(struct work_struct *work)
vib->dsp.write(vib->dev, vib->regmap, vib->dsp.stop_cmd);
- pm_runtime_mark_last_busy(vib->dev);
pm_runtime_put_autosuspend(vib->dev);
kfree(work_data);
@@ -456,7 +453,6 @@ static void cs40l50_erase_worker(struct work_struct *work)
list_del(&erase_effect->list);
kfree(erase_effect);
err_pm:
- pm_runtime_mark_last_busy(vib->dev);
pm_runtime_put_autosuspend(vib->dev);
err_exit:
work_data->error = error;
diff --git a/drivers/input/misc/gpio_decoder.c b/drivers/input/misc/gpio_decoder.c
index ee668eba302f..f0759dd39b35 100644
--- a/drivers/input/misc/gpio_decoder.c
+++ b/drivers/input/misc/gpio_decoder.c
@@ -6,13 +6,18 @@
* encoded numeric value into an input event.
*/
-#include <linux/device.h>
+#include <linux/bitmap.h>
+#include <linux/dev_printk.h>
+#include <linux/device/devres.h>
+#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/input.h>
-#include <linux/kernel.h>
+#include <linux/minmax.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
-#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
+#include <linux/types.h>
struct gpio_decoder {
struct gpio_descs *input_gpios;
@@ -24,23 +29,18 @@ struct gpio_decoder {
static int gpio_decoder_get_gpios_state(struct gpio_decoder *decoder)
{
struct gpio_descs *gpios = decoder->input_gpios;
- unsigned int ret = 0;
- int i, val;
-
- for (i = 0; i < gpios->ndescs; i++) {
- val = gpiod_get_value_cansleep(gpios->desc[i]);
- if (val < 0) {
- dev_err(decoder->dev,
- "Error reading gpio %d: %d\n",
- desc_to_gpio(gpios->desc[i]), val);
- return val;
- }
-
- val = !!val;
- ret = (ret << 1) | val;
+ DECLARE_BITMAP(values, 32);
+ unsigned int size;
+ int err;
+
+ size = min(gpios->ndescs, 32U);
+ err = gpiod_get_array_value_cansleep(size, gpios->desc, gpios->info, values);
+ if (err) {
+ dev_err(decoder->dev, "Error reading GPIO: %d\n", err);
+ return err;
}
- return ret;
+ return bitmap_read(values, 0, size);
}
static void gpio_decoder_poll_gpios(struct input_dev *input)
@@ -61,7 +61,7 @@ static int gpio_decoder_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct gpio_decoder *decoder;
struct input_dev *input;
- u32 max;
+ u32 max;
int err;
decoder = devm_kzalloc(dev, sizeof(*decoder), GFP_KERNEL);
@@ -72,18 +72,18 @@ static int gpio_decoder_probe(struct platform_device *pdev)
device_property_read_u32(dev, "linux,axis", &decoder->axis);
decoder->input_gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
- if (IS_ERR(decoder->input_gpios)) {
- dev_err(dev, "unable to acquire input gpios\n");
- return PTR_ERR(decoder->input_gpios);
- }
+ if (IS_ERR(decoder->input_gpios))
+ return dev_err_probe(dev, PTR_ERR(decoder->input_gpios),
+ "unable to acquire input gpios\n");
- if (decoder->input_gpios->ndescs < 2) {
- dev_err(dev, "not enough gpios found\n");
- return -EINVAL;
- }
+ if (decoder->input_gpios->ndescs < 2)
+ return dev_err_probe(dev, -EINVAL, "not enough gpios found\n");
+
+ if (decoder->input_gpios->ndescs > 31)
+ return dev_err_probe(dev, -EINVAL, "too many gpios found\n");
if (device_property_read_u32(dev, "decoder-max-value", &max))
- max = (1U << decoder->input_gpios->ndescs) - 1;
+ max = BIT(decoder->input_gpios->ndescs) - 1;
input = devm_input_allocate_device(dev);
if (!input)
@@ -96,33 +96,27 @@ static int gpio_decoder_probe(struct platform_device *pdev)
input_set_abs_params(input, decoder->axis, 0, max, 0, 0);
err = input_setup_polling(input, gpio_decoder_poll_gpios);
- if (err) {
- dev_err(dev, "failed to set up polling\n");
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err, "failed to set up polling\n");
err = input_register_device(input);
- if (err) {
- dev_err(dev, "failed to register input device\n");
- return err;
- }
+ if (err)
+ return dev_err_probe(dev, err, "failed to register input device\n");
return 0;
}
-#ifdef CONFIG_OF
static const struct of_device_id gpio_decoder_of_match[] = {
{ .compatible = "gpio-decoder", },
- { },
+ { }
};
MODULE_DEVICE_TABLE(of, gpio_decoder_of_match);
-#endif
static struct platform_driver gpio_decoder_driver = {
.probe = gpio_decoder_probe,
.driver = {
.name = "gpio-decoder",
- .of_match_table = of_match_ptr(gpio_decoder_of_match),
+ .of_match_table = gpio_decoder_of_match,
}
};
module_platform_driver(gpio_decoder_driver);
diff --git a/drivers/input/misc/palmas-pwrbutton.c b/drivers/input/misc/palmas-pwrbutton.c
index 39fc451c56e9..d9c5aae143dc 100644
--- a/drivers/input/misc/palmas-pwrbutton.c
+++ b/drivers/input/misc/palmas-pwrbutton.c
@@ -91,7 +91,7 @@ static irqreturn_t pwron_irq(int irq, void *palmas_pwron)
pm_wakeup_event(input_dev->dev.parent, 0);
input_sync(input_dev);
- mod_delayed_work(system_wq, &pwron->input_work,
+ mod_delayed_work(system_dfl_wq, &pwron->input_work,
msecs_to_jiffies(PALMAS_PWR_KEY_Q_TIME_MS));
return IRQ_HANDLED;
diff --git a/drivers/input/misc/pf1550-onkey.c b/drivers/input/misc/pf1550-onkey.c
index 9be6377151cb..0d1b570bbe47 100644
--- a/drivers/input/misc/pf1550-onkey.c
+++ b/drivers/input/misc/pf1550-onkey.c
@@ -173,7 +173,7 @@ static int pf1550_onkey_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(pf1550_onkey_pm_ops, pf1550_onkey_suspend,
+static DEFINE_SIMPLE_DEV_PM_OPS(pf1550_onkey_pm_ops, pf1550_onkey_suspend,
pf1550_onkey_resume);
static const struct platform_device_id pf1550_onkey_id[] = {
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index f85cc289c053..b0feef19515d 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -20,27 +20,43 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <linux/bits.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/input.h>
#include <linux/interrupt.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
#include <linux/platform_device.h>
#include <linux/mfd/twl.h>
-#define PWR_PWRON_IRQ (1 << 0)
+#define PWR_PWRON_IRQ BIT(0)
-#define STS_HW_CONDITIONS 0xf
+struct twl_pwrbutton_chipdata {
+ u8 status_reg;
+ bool need_manual_irq;
+};
+
+static const struct twl_pwrbutton_chipdata twl4030_chipdata = {
+ .status_reg = 0xf,
+ .need_manual_irq = false,
+};
+
+static const struct twl_pwrbutton_chipdata twl6030_chipdata = {
+ .status_reg = 0x2,
+ .need_manual_irq = true,
+};
static irqreturn_t powerbutton_irq(int irq, void *_pwr)
{
struct input_dev *pwr = _pwr;
+ const struct twl_pwrbutton_chipdata *pdata = dev_get_drvdata(pwr->dev.parent);
int err;
u8 value;
- err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS);
+ err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, pdata->status_reg);
if (!err) {
pm_wakeup_event(pwr->dev.parent, 0);
input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
@@ -55,10 +71,17 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
static int twl4030_pwrbutton_probe(struct platform_device *pdev)
{
+ const struct twl_pwrbutton_chipdata *pdata;
struct input_dev *pwr;
int irq = platform_get_irq(pdev, 0);
int err;
+ pdata = device_get_match_data(&pdev->dev);
+ if (!pdata)
+ return -EINVAL;
+
+ platform_set_drvdata(pdev, (void *)pdata);
+
pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
dev_err(&pdev->dev, "Can't allocate power button\n");
@@ -85,24 +108,50 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
return err;
}
+ if (pdata->need_manual_irq) {
+ err = twl6030_interrupt_unmask(0x01, REG_INT_MSK_LINE_A);
+ if (err)
+ return err;
+
+ err = twl6030_interrupt_unmask(0x01, REG_INT_MSK_STS_A);
+ if (err)
+ return err;
+ }
+
device_init_wakeup(&pdev->dev, true);
return 0;
}
-#ifdef CONFIG_OF
+static void twl4030_pwrbutton_remove(struct platform_device *pdev)
+{
+ const struct twl_pwrbutton_chipdata *pdata = platform_get_drvdata(pdev);
+
+ if (pdata->need_manual_irq) {
+ twl6030_interrupt_mask(0x01, REG_INT_MSK_LINE_A);
+ twl6030_interrupt_mask(0x01, REG_INT_MSK_STS_A);
+ }
+}
+
static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
- { .compatible = "ti,twl4030-pwrbutton" },
- {},
+ {
+ .compatible = "ti,twl4030-pwrbutton",
+ .data = &twl4030_chipdata,
+ },
+ {
+ .compatible = "ti,twl6030-pwrbutton",
+ .data = &twl6030_chipdata,
+ },
+ { }
};
MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
-#endif
static struct platform_driver twl4030_pwrbutton_driver = {
.probe = twl4030_pwrbutton_probe,
+ .remove = twl4030_pwrbutton_remove,
.driver = {
.name = "twl4030_pwrbutton",
- .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
+ .of_match_table = twl4030_pwrbutton_dt_match_table,
},
};
module_platform_driver(twl4030_pwrbutton_driver);