aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/input/sprd,sc27xx-vibra.txt23
-rw-r--r--drivers/input/input-mt.c12
-rw-r--r--drivers/input/keyboard/goldfish_events.c9
-rw-r--r--drivers/input/misc/Kconfig10
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/sc27xx-vibra.c154
-rw-r--r--drivers/input/rmi4/Kconfig1
-rw-r--r--drivers/input/rmi4/rmi_2d_sensor.c34
-rw-r--r--drivers/input/rmi4/rmi_bus.c50
-rw-r--r--drivers/input/rmi4/rmi_bus.h10
-rw-r--r--drivers/input/rmi4/rmi_driver.c52
-rw-r--r--drivers/input/rmi4/rmi_f01.c10
-rw-r--r--drivers/input/rmi4/rmi_f03.c9
-rw-r--r--drivers/input/rmi4/rmi_f11.c42
-rw-r--r--drivers/input/rmi4/rmi_f12.c8
-rw-r--r--drivers/input/rmi4/rmi_f30.c9
-rw-r--r--drivers/input/rmi4/rmi_f34.c5
-rw-r--r--drivers/input/rmi4/rmi_f54.c6
-rw-r--r--include/linux/input/mt.h2
-rw-r--r--include/linux/rmi.h2
20 files changed, 337 insertions, 112 deletions
diff --git a/Documentation/devicetree/bindings/input/sprd,sc27xx-vibra.txt b/Documentation/devicetree/bindings/input/sprd,sc27xx-vibra.txt
new file mode 100644
index 000000000000..f2ec0d4f2dff
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/sprd,sc27xx-vibra.txt
@@ -0,0 +1,23 @@
1Spreadtrum SC27xx PMIC Vibrator
2
3Required properties:
4- compatible: should be "sprd,sc2731-vibrator".
5- reg: address of vibrator control register.
6
7Example :
8
9 sc2731_pmic: pmic@0 {
10 compatible = "sprd,sc2731";
11 reg = <0>;
12 spi-max-frequency = <26000000>;
13 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
14 interrupt-controller;
15 #interrupt-cells = <2>;
16 #address-cells = <1>;
17 #size-cells = <0>;
18
19 vibrator@eb4 {
20 compatible = "sprd,sc2731-vibrator";
21 reg = <0xeb4>;
22 };
23 };
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index a1bbec9cda8d..4a69716e5461 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -131,8 +131,10 @@ EXPORT_SYMBOL(input_mt_destroy_slots);
131 * inactive, or if the tool type is changed, a new tracking id is 131 * inactive, or if the tool type is changed, a new tracking id is
132 * assigned to the slot. The tool type is only reported if the 132 * assigned to the slot. The tool type is only reported if the
133 * corresponding absbit field is set. 133 * corresponding absbit field is set.
134 *
135 * Returns true if contact is active.
134 */ 136 */
135void input_mt_report_slot_state(struct input_dev *dev, 137bool input_mt_report_slot_state(struct input_dev *dev,
136 unsigned int tool_type, bool active) 138 unsigned int tool_type, bool active)
137{ 139{
138 struct input_mt *mt = dev->mt; 140 struct input_mt *mt = dev->mt;
@@ -140,22 +142,24 @@ void input_mt_report_slot_state(struct input_dev *dev,
140 int id; 142 int id;
141 143
142 if (!mt) 144 if (!mt)
143 return; 145 return false;
144 146
145 slot = &mt->slots[mt->slot]; 147 slot = &mt->slots[mt->slot];
146 slot->frame = mt->frame; 148 slot->frame = mt->frame;
147 149
148 if (!active) { 150 if (!active) {
149 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); 151 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
150 return; 152 return false;
151 } 153 }
152 154
153 id = input_mt_get_value(slot, ABS_MT_TRACKING_ID); 155 id = input_mt_get_value(slot, ABS_MT_TRACKING_ID);
154 if (id < 0 || input_mt_get_value(slot, ABS_MT_TOOL_TYPE) != tool_type) 156 if (id < 0)
155 id = input_mt_new_trkid(mt); 157 id = input_mt_new_trkid(mt);
156 158
157 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, id); 159 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, id);
158 input_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, tool_type); 160 input_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, tool_type);
161
162 return true;
159} 163}
160EXPORT_SYMBOL(input_mt_report_slot_state); 164EXPORT_SYMBOL(input_mt_report_slot_state);
161 165
diff --git a/drivers/input/keyboard/goldfish_events.c b/drivers/input/keyboard/goldfish_events.c
index f6e643b589b6..e8dae6195b30 100644
--- a/drivers/input/keyboard/goldfish_events.c
+++ b/drivers/input/keyboard/goldfish_events.c
@@ -45,7 +45,7 @@ struct event_dev {
45static irqreturn_t events_interrupt(int irq, void *dev_id) 45static irqreturn_t events_interrupt(int irq, void *dev_id)
46{ 46{
47 struct event_dev *edev = dev_id; 47 struct event_dev *edev = dev_id;
48 unsigned type, code, value; 48 unsigned int type, code, value;
49 49
50 type = __raw_readl(edev->addr + REG_READ); 50 type = __raw_readl(edev->addr + REG_READ);
51 code = __raw_readl(edev->addr + REG_READ); 51 code = __raw_readl(edev->addr + REG_READ);
@@ -57,7 +57,7 @@ static irqreturn_t events_interrupt(int irq, void *dev_id)
57} 57}
58 58
59static void events_import_bits(struct event_dev *edev, 59static void events_import_bits(struct event_dev *edev,
60 unsigned long bits[], unsigned type, size_t count) 60 unsigned long bits[], unsigned int type, size_t count)
61{ 61{
62 void __iomem *addr = edev->addr; 62 void __iomem *addr = edev->addr;
63 int i, j; 63 int i, j;
@@ -99,6 +99,7 @@ static void events_import_abs_params(struct event_dev *edev)
99 99
100 for (j = 0; j < ARRAY_SIZE(val); j++) { 100 for (j = 0; j < ARRAY_SIZE(val); j++) {
101 int offset = (i * ARRAY_SIZE(val) + j) * sizeof(u32); 101 int offset = (i * ARRAY_SIZE(val) + j) * sizeof(u32);
102
102 val[j] = __raw_readl(edev->addr + REG_DATA + offset); 103 val[j] = __raw_readl(edev->addr + REG_DATA + offset);
103 } 104 }
104 105
@@ -112,7 +113,7 @@ static int events_probe(struct platform_device *pdev)
112 struct input_dev *input_dev; 113 struct input_dev *input_dev;
113 struct event_dev *edev; 114 struct event_dev *edev;
114 struct resource *res; 115 struct resource *res;
115 unsigned keymapnamelen; 116 unsigned int keymapnamelen;
116 void __iomem *addr; 117 void __iomem *addr;
117 int irq; 118 int irq;
118 int i; 119 int i;
@@ -150,7 +151,7 @@ static int events_probe(struct platform_device *pdev)
150 for (i = 0; i < keymapnamelen; i++) 151 for (i = 0; i < keymapnamelen; i++)
151 edev->name[i] = __raw_readb(edev->addr + REG_DATA + i); 152 edev->name[i] = __raw_readb(edev->addr + REG_DATA + i);
152 153
153 pr_debug("events_probe() keymap=%s\n", edev->name); 154 pr_debug("%s: keymap=%s\n", __func__, edev->name);
154 155
155 input_dev->name = edev->name; 156 input_dev->name = edev->name;
156 input_dev->id.bustype = BUS_HOST; 157 input_dev->id.bustype = BUS_HOST;
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 572b15fa18c2..c761c0c4f2b8 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -841,4 +841,14 @@ config INPUT_RAVE_SP_PWRBUTTON
841 To compile this driver as a module, choose M here: the 841 To compile this driver as a module, choose M here: the
842 module will be called rave-sp-pwrbutton. 842 module will be called rave-sp-pwrbutton.
843 843
844config INPUT_SC27XX_VIBRA
845 tristate "Spreadtrum sc27xx vibrator support"
846 depends on MFD_SC27XX_PMIC || COMPILE_TEST
847 select INPUT_FF_MEMLESS
848 help
849 This option enables support for Spreadtrum sc27xx vibrator driver.
850
851 To compile this driver as a module, choose M here. The module will
852 be called sc27xx_vibra.
853
844endif 854endif
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 72cde28649e2..9d0f9d1ff68f 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -66,6 +66,7 @@ obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
66obj-$(CONFIG_INPUT_AXP20X_PEK) += axp20x-pek.o 66obj-$(CONFIG_INPUT_AXP20X_PEK) += axp20x-pek.o
67obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o 67obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o
68obj-$(CONFIG_INPUT_RK805_PWRKEY) += rk805-pwrkey.o 68obj-$(CONFIG_INPUT_RK805_PWRKEY) += rk805-pwrkey.o
69obj-$(CONFIG_INPUT_SC27XX_VIBRA) += sc27xx-vibra.o
69obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o 70obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
70obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.o 71obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.o
71obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o 72obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o
diff --git a/drivers/input/misc/sc27xx-vibra.c b/drivers/input/misc/sc27xx-vibra.c
new file mode 100644
index 000000000000..295251abbdac
--- /dev/null
+++ b/drivers/input/misc/sc27xx-vibra.c
@@ -0,0 +1,154 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2018 Spreadtrum Communications Inc.
4 */
5
6#include <linux/module.h>
7#include <linux/of_address.h>
8#include <linux/platform_device.h>
9#include <linux/regmap.h>
10#include <linux/input.h>
11#include <linux/workqueue.h>
12
13#define CUR_DRV_CAL_SEL GENMASK(13, 12)
14#define SLP_LDOVIBR_PD_EN BIT(9)
15#define LDO_VIBR_PD BIT(8)
16
17struct vibra_info {
18 struct input_dev *input_dev;
19 struct work_struct play_work;
20 struct regmap *regmap;
21 u32 base;
22 u32 strength;
23 bool enabled;
24};
25
26static void sc27xx_vibra_set(struct vibra_info *info, bool on)
27{
28 if (on) {
29 regmap_update_bits(info->regmap, info->base, LDO_VIBR_PD, 0);
30 regmap_update_bits(info->regmap, info->base,
31 SLP_LDOVIBR_PD_EN, 0);
32 info->enabled = true;
33 } else {
34 regmap_update_bits(info->regmap, info->base, LDO_VIBR_PD,
35 LDO_VIBR_PD);
36 regmap_update_bits(info->regmap, info->base,
37 SLP_LDOVIBR_PD_EN, SLP_LDOVIBR_PD_EN);
38 info->enabled = false;
39 }
40}
41
42static int sc27xx_vibra_hw_init(struct vibra_info *info)
43{
44 return regmap_update_bits(info->regmap, info->base, CUR_DRV_CAL_SEL, 0);
45}
46
47static void sc27xx_vibra_play_work(struct work_struct *work)
48{
49 struct vibra_info *info = container_of(work, struct vibra_info,
50 play_work);
51
52 if (info->strength && !info->enabled)
53 sc27xx_vibra_set(info, true);
54 else if (info->strength == 0 && info->enabled)
55 sc27xx_vibra_set(info, false);
56}
57
58static int sc27xx_vibra_play(struct input_dev *input, void *data,
59 struct ff_effect *effect)
60{
61 struct vibra_info *info = input_get_drvdata(input);
62
63 info->strength = effect->u.rumble.weak_magnitude;
64 schedule_work(&info->play_work);
65
66 return 0;
67}
68
69static void sc27xx_vibra_close(struct input_dev *input)
70{
71 struct vibra_info *info = input_get_drvdata(input);
72
73 cancel_work_sync(&info->play_work);
74 if (info->enabled)
75 sc27xx_vibra_set(info, false);
76}
77
78static int sc27xx_vibra_probe(struct platform_device *pdev)
79{
80 struct vibra_info *info;
81 int error;
82
83 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
84 if (!info)
85 return -ENOMEM;
86
87 info->regmap = dev_get_regmap(pdev->dev.parent, NULL);
88 if (!info->regmap) {
89 dev_err(&pdev->dev, "failed to get vibrator regmap.\n");
90 return -ENODEV;
91 }
92
93 error = device_property_read_u32(&pdev->dev, "reg", &info->base);
94 if (error) {
95 dev_err(&pdev->dev, "failed to get vibrator base address.\n");
96 return error;
97 }
98
99 info->input_dev = devm_input_allocate_device(&pdev->dev);
100 if (!info->input_dev) {
101 dev_err(&pdev->dev, "failed to allocate input device.\n");
102 return -ENOMEM;
103 }
104
105 info->input_dev->name = "sc27xx:vibrator";
106 info->input_dev->id.version = 0;
107 info->input_dev->close = sc27xx_vibra_close;
108
109 input_set_drvdata(info->input_dev, info);
110 input_set_capability(info->input_dev, EV_FF, FF_RUMBLE);
111 INIT_WORK(&info->play_work, sc27xx_vibra_play_work);
112 info->enabled = false;
113
114 error = sc27xx_vibra_hw_init(info);
115 if (error) {
116 dev_err(&pdev->dev, "failed to initialize the vibrator.\n");
117 return error;
118 }
119
120 error = input_ff_create_memless(info->input_dev, NULL,
121 sc27xx_vibra_play);
122 if (error) {
123 dev_err(&pdev->dev, "failed to register vibrator to FF.\n");
124 return error;
125 }
126
127 error = input_register_device(info->input_dev);
128 if (error) {
129 dev_err(&pdev->dev, "failed to register input device.\n");
130 return error;
131 }
132
133 return 0;
134}
135
136static const struct of_device_id sc27xx_vibra_of_match[] = {
137 { .compatible = "sprd,sc2731-vibrator", },
138 {}
139};
140MODULE_DEVICE_TABLE(of, sc27xx_vibra_of_match);
141
142static struct platform_driver sc27xx_vibra_driver = {
143 .driver = {
144 .name = "sc27xx-vibrator",
145 .of_match_table = sc27xx_vibra_of_match,
146 },
147 .probe = sc27xx_vibra_probe,
148};
149
150module_platform_driver(sc27xx_vibra_driver);
151
152MODULE_DESCRIPTION("Spreadtrum SC27xx Vibrator Driver");
153MODULE_LICENSE("GPL v2");
154MODULE_AUTHOR("Xiaotong Lu <xiaotong.lu@spreadtrum.com>");
diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig
index 7172b88cd064..fad2eae4a118 100644
--- a/drivers/input/rmi4/Kconfig
+++ b/drivers/input/rmi4/Kconfig
@@ -3,6 +3,7 @@
3# 3#
4config RMI4_CORE 4config RMI4_CORE
5 tristate "Synaptics RMI4 bus support" 5 tristate "Synaptics RMI4 bus support"
6 select IRQ_DOMAIN
6 help 7 help
7 Say Y here if you want to support the Synaptics RMI4 bus. This is 8 Say Y here if you want to support the Synaptics RMI4 bus. This is
8 required for all RMI4 device support. 9 required for all RMI4 device support.
diff --git a/drivers/input/rmi4/rmi_2d_sensor.c b/drivers/input/rmi4/rmi_2d_sensor.c
index 8bb866c7b985..8eeffa066022 100644
--- a/drivers/input/rmi4/rmi_2d_sensor.c
+++ b/drivers/input/rmi4/rmi_2d_sensor.c
@@ -32,15 +32,15 @@ void rmi_2d_sensor_abs_process(struct rmi_2d_sensor *sensor,
32 if (obj->type == RMI_2D_OBJECT_NONE) 32 if (obj->type == RMI_2D_OBJECT_NONE)
33 return; 33 return;
34 34
35 if (axis_align->swap_axes)
36 swap(obj->x, obj->y);
37
38 if (axis_align->flip_x) 35 if (axis_align->flip_x)
39 obj->x = sensor->max_x - obj->x; 36 obj->x = sensor->max_x - obj->x;
40 37
41 if (axis_align->flip_y) 38 if (axis_align->flip_y)
42 obj->y = sensor->max_y - obj->y; 39 obj->y = sensor->max_y - obj->y;
43 40
41 if (axis_align->swap_axes)
42 swap(obj->x, obj->y);
43
44 /* 44 /*
45 * Here checking if X offset or y offset are specified is 45 * Here checking if X offset or y offset are specified is
46 * redundant. We just add the offsets or clip the values. 46 * redundant. We just add the offsets or clip the values.
@@ -120,15 +120,15 @@ void rmi_2d_sensor_rel_report(struct rmi_2d_sensor *sensor, int x, int y)
120 x = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)x)); 120 x = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)x));
121 y = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)y)); 121 y = min(RMI_2D_REL_POS_MAX, max(RMI_2D_REL_POS_MIN, (int)y));
122 122
123 if (axis_align->swap_axes)
124 swap(x, y);
125
126 if (axis_align->flip_x) 123 if (axis_align->flip_x)
127 x = min(RMI_2D_REL_POS_MAX, -x); 124 x = min(RMI_2D_REL_POS_MAX, -x);
128 125
129 if (axis_align->flip_y) 126 if (axis_align->flip_y)
130 y = min(RMI_2D_REL_POS_MAX, -y); 127 y = min(RMI_2D_REL_POS_MAX, -y);
131 128
129 if (axis_align->swap_axes)
130 swap(x, y);
131
132 if (x || y) { 132 if (x || y) {
133 input_report_rel(sensor->input, REL_X, x); 133 input_report_rel(sensor->input, REL_X, x);
134 input_report_rel(sensor->input, REL_Y, y); 134 input_report_rel(sensor->input, REL_Y, y);
@@ -141,17 +141,10 @@ static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor)
141 struct input_dev *input = sensor->input; 141 struct input_dev *input = sensor->input;
142 int res_x; 142 int res_x;
143 int res_y; 143 int res_y;
144 int max_x, max_y;
144 int input_flags = 0; 145 int input_flags = 0;
145 146
146 if (sensor->report_abs) { 147 if (sensor->report_abs) {
147 if (sensor->axis_align.swap_axes) {
148 swap(sensor->max_x, sensor->max_y);
149 swap(sensor->axis_align.clip_x_low,
150 sensor->axis_align.clip_y_low);
151 swap(sensor->axis_align.clip_x_high,
152 sensor->axis_align.clip_y_high);
153 }
154
155 sensor->min_x = sensor->axis_align.clip_x_low; 148 sensor->min_x = sensor->axis_align.clip_x_low;
156 if (sensor->axis_align.clip_x_high) 149 if (sensor->axis_align.clip_x_high)
157 sensor->max_x = min(sensor->max_x, 150 sensor->max_x = min(sensor->max_x,
@@ -163,14 +156,19 @@ static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor)
163 sensor->axis_align.clip_y_high); 156 sensor->axis_align.clip_y_high);
164 157
165 set_bit(EV_ABS, input->evbit); 158 set_bit(EV_ABS, input->evbit);
166 input_set_abs_params(input, ABS_MT_POSITION_X, 0, sensor->max_x, 159
167 0, 0); 160 max_x = sensor->max_x;
168 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, sensor->max_y, 161 max_y = sensor->max_y;
169 0, 0); 162 if (sensor->axis_align.swap_axes)
163 swap(max_x, max_y);
164 input_set_abs_params(input, ABS_MT_POSITION_X, 0, max_x, 0, 0);
165 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, max_y, 0, 0);
170 166
171 if (sensor->x_mm && sensor->y_mm) { 167 if (sensor->x_mm && sensor->y_mm) {
172 res_x = (sensor->max_x - sensor->min_x) / sensor->x_mm; 168 res_x = (sensor->max_x - sensor->min_x) / sensor->x_mm;
173 res_y = (sensor->max_y - sensor->min_y) / sensor->y_mm; 169 res_y = (sensor->max_y - sensor->min_y) / sensor->y_mm;
170 if (sensor->axis_align.swap_axes)
171 swap(res_x, res_y);
174 172
175 input_abs_set_res(input, ABS_X, res_x); 173 input_abs_set_res(input, ABS_X, res_x);
176 input_abs_set_res(input, ABS_Y, res_y); 174 input_abs_set_res(input, ABS_Y, res_y);
diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index c5fa53adba8d..bd0d5ff01b08 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -9,6 +9,8 @@
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/irq.h>
13#include <linux/irqdomain.h>
12#include <linux/list.h> 14#include <linux/list.h>
13#include <linux/pm.h> 15#include <linux/pm.h>
14#include <linux/rmi.h> 16#include <linux/rmi.h>
@@ -167,6 +169,39 @@ static inline void rmi_function_of_probe(struct rmi_function *fn)
167{} 169{}
168#endif 170#endif
169 171
172static struct irq_chip rmi_irq_chip = {
173 .name = "rmi4",
174};
175
176static int rmi_create_function_irq(struct rmi_function *fn,
177 struct rmi_function_handler *handler)
178{
179 struct rmi_driver_data *drvdata = dev_get_drvdata(&fn->rmi_dev->dev);
180 int i, error;
181
182 for (i = 0; i < fn->num_of_irqs; i++) {
183 set_bit(fn->irq_pos + i, fn->irq_mask);
184
185 fn->irq[i] = irq_create_mapping(drvdata->irqdomain,
186 fn->irq_pos + i);
187
188 irq_set_chip_data(fn->irq[i], fn);
189 irq_set_chip_and_handler(fn->irq[i], &rmi_irq_chip,
190 handle_simple_irq);
191 irq_set_nested_thread(fn->irq[i], 1);
192
193 error = devm_request_threaded_irq(&fn->dev, fn->irq[i], NULL,
194 handler->attention, IRQF_ONESHOT,
195 dev_name(&fn->dev), fn);
196 if (error) {
197 dev_err(&fn->dev, "Error %d registering IRQ\n", error);
198 return error;
199 }
200 }
201
202 return 0;
203}
204
170static int rmi_function_probe(struct device *dev) 205static int rmi_function_probe(struct device *dev)
171{ 206{
172 struct rmi_function *fn = to_rmi_function(dev); 207 struct rmi_function *fn = to_rmi_function(dev);
@@ -178,7 +213,14 @@ static int rmi_function_probe(struct device *dev)
178 213
179 if (handler->probe) { 214 if (handler->probe) {
180 error = handler->probe(fn); 215 error = handler->probe(fn);
181 return error; 216 if (error)
217 return error;
218 }
219
220 if (fn->num_of_irqs && handler->attention) {
221 error = rmi_create_function_irq(fn, handler);
222 if (error)
223 return error;
182 } 224 }
183 225
184 return 0; 226 return 0;
@@ -230,12 +272,18 @@ err_put_device:
230 272
231void rmi_unregister_function(struct rmi_function *fn) 273void rmi_unregister_function(struct rmi_function *fn)
232{ 274{
275 int i;
276
233 rmi_dbg(RMI_DEBUG_CORE, &fn->dev, "Unregistering F%02X.\n", 277 rmi_dbg(RMI_DEBUG_CORE, &fn->dev, "Unregistering F%02X.\n",
234 fn->fd.function_number); 278 fn->fd.function_number);
235 279
236 device_del(&fn->dev); 280 device_del(&fn->dev);
237 of_node_put(fn->dev.of_node); 281 of_node_put(fn->dev.of_node);
238 put_device(&fn->dev); 282 put_device(&fn->dev);
283
284 for (i = 0; i < fn->num_of_irqs; i++)
285 irq_dispose_mapping(fn->irq[i]);
286
239} 287}
240 288
241/** 289/**
diff --git a/drivers/input/rmi4/rmi_bus.h b/drivers/input/rmi4/rmi_bus.h
index b7625a9ac66a..96383eab41ba 100644
--- a/drivers/input/rmi4/rmi_bus.h
+++ b/drivers/input/rmi4/rmi_bus.h
@@ -14,6 +14,12 @@
14 14
15struct rmi_device; 15struct rmi_device;
16 16
17/*
18 * The interrupt source count in the function descriptor can represent up to
19 * 6 interrupt sources in the normal manner.
20 */
21#define RMI_FN_MAX_IRQS 6
22
17/** 23/**
18 * struct rmi_function - represents the implementation of an RMI4 24 * struct rmi_function - represents the implementation of an RMI4
19 * function for a particular device (basically, a driver for that RMI4 function) 25 * function for a particular device (basically, a driver for that RMI4 function)
@@ -26,6 +32,7 @@ struct rmi_device;
26 * @irq_pos: The position in the irq bitfield this function holds 32 * @irq_pos: The position in the irq bitfield this function holds
27 * @irq_mask: For convenience, can be used to mask IRQ bits off during ATTN 33 * @irq_mask: For convenience, can be used to mask IRQ bits off during ATTN
28 * interrupt handling. 34 * interrupt handling.
35 * @irqs: assigned virq numbers (up to num_of_irqs)
29 * 36 *
30 * @node: entry in device's list of functions 37 * @node: entry in device's list of functions
31 */ 38 */
@@ -36,6 +43,7 @@ struct rmi_function {
36 struct list_head node; 43 struct list_head node;
37 44
38 unsigned int num_of_irqs; 45 unsigned int num_of_irqs;
46 int irq[RMI_FN_MAX_IRQS];
39 unsigned int irq_pos; 47 unsigned int irq_pos;
40 unsigned long irq_mask[]; 48 unsigned long irq_mask[];
41}; 49};
@@ -76,7 +84,7 @@ struct rmi_function_handler {
76 void (*remove)(struct rmi_function *fn); 84 void (*remove)(struct rmi_function *fn);
77 int (*config)(struct rmi_function *fn); 85 int (*config)(struct rmi_function *fn);
78 int (*reset)(struct rmi_function *fn); 86 int (*reset)(struct rmi_function *fn);
79 int (*attention)(struct rmi_function *fn, unsigned long *irq_bits); 87 irqreturn_t (*attention)(int irq, void *ctx);
80 int (*suspend)(struct rmi_function *fn); 88 int (*suspend)(struct rmi_function *fn);
81 int (*resume)(struct rmi_function *fn); 89 int (*resume)(struct rmi_function *fn);
82}; 90};
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index f5954981e9ee..cb6d983e8033 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -21,6 +21,7 @@
21#include <linux/pm.h> 21#include <linux/pm.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/irqdomain.h>
24#include <uapi/linux/input.h> 25#include <uapi/linux/input.h>
25#include <linux/rmi.h> 26#include <linux/rmi.h>
26#include "rmi_bus.h" 27#include "rmi_bus.h"
@@ -127,28 +128,11 @@ static int rmi_driver_process_config_requests(struct rmi_device *rmi_dev)
127 return 0; 128 return 0;
128} 129}
129 130
130static void process_one_interrupt(struct rmi_driver_data *data,
131 struct rmi_function *fn)
132{
133 struct rmi_function_handler *fh;
134
135 if (!fn || !fn->dev.driver)
136 return;
137
138 fh = to_rmi_function_handler(fn->dev.driver);
139 if (fh->attention) {
140 bitmap_and(data->fn_irq_bits, data->irq_status, fn->irq_mask,
141 data->irq_count);
142 if (!bitmap_empty(data->fn_irq_bits, data->irq_count))
143 fh->attention(fn, data->fn_irq_bits);
144 }
145}
146
147static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) 131static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev)
148{ 132{
149 struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev); 133 struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
150 struct device *dev = &rmi_dev->dev; 134 struct device *dev = &rmi_dev->dev;
151 struct rmi_function *entry; 135 int i;
152 int error; 136 int error;
153 137
154 if (!data) 138 if (!data)
@@ -173,16 +157,8 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev)
173 */ 157 */
174 mutex_unlock(&data->irq_mutex); 158 mutex_unlock(&data->irq_mutex);
175 159
176 /* 160 for_each_set_bit(i, data->irq_status, data->irq_count)
177 * It would be nice to be able to use irq_chip to handle these 161 handle_nested_irq(irq_find_mapping(data->irqdomain, i));
178 * nested IRQs. Unfortunately, most of the current customers for
179 * this driver are using older kernels (3.0.x) that don't support
180 * the features required for that. Once they've shifted to more
181 * recent kernels (say, 3.3 and higher), this should be switched to
182 * use irq_chip.
183 */
184 list_for_each_entry(entry, &data->function_list, node)
185 process_one_interrupt(data, entry);
186 162
187 if (data->input) 163 if (data->input)
188 input_sync(data->input); 164 input_sync(data->input);
@@ -1000,9 +976,13 @@ EXPORT_SYMBOL_GPL(rmi_driver_resume);
1000static int rmi_driver_remove(struct device *dev) 976static int rmi_driver_remove(struct device *dev)
1001{ 977{
1002 struct rmi_device *rmi_dev = to_rmi_device(dev); 978 struct rmi_device *rmi_dev = to_rmi_device(dev);
979 struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
1003 980
1004 rmi_disable_irq(rmi_dev, false); 981 rmi_disable_irq(rmi_dev, false);
1005 982
983 irq_domain_remove(data->irqdomain);
984 data->irqdomain = NULL;
985
1006 rmi_f34_remove_sysfs(rmi_dev); 986 rmi_f34_remove_sysfs(rmi_dev);
1007 rmi_free_function_list(rmi_dev); 987 rmi_free_function_list(rmi_dev);
1008 988
@@ -1034,7 +1014,8 @@ int rmi_probe_interrupts(struct rmi_driver_data *data)
1034{ 1014{
1035 struct rmi_device *rmi_dev = data->rmi_dev; 1015 struct rmi_device *rmi_dev = data->rmi_dev;
1036 struct device *dev = &rmi_dev->dev; 1016 struct device *dev = &rmi_dev->dev;
1037 int irq_count; 1017 struct fwnode_handle *fwnode = rmi_dev->xport->dev->fwnode;
1018 int irq_count = 0;
1038 size_t size; 1019 size_t size;
1039 int retval; 1020 int retval;
1040 1021
@@ -1045,7 +1026,6 @@ int rmi_probe_interrupts(struct rmi_driver_data *data)
1045 * being accessed. 1026 * being accessed.
1046 */ 1027 */
1047 rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Counting IRQs.\n", __func__); 1028 rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Counting IRQs.\n", __func__);
1048 irq_count = 0;
1049 data->bootloader_mode = false; 1029 data->bootloader_mode = false;
1050 1030
1051 retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_count_irqs); 1031 retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_count_irqs);
@@ -1057,6 +1037,15 @@ int rmi_probe_interrupts(struct rmi_driver_data *data)
1057 if (data->bootloader_mode) 1037 if (data->bootloader_mode)
1058 dev_warn(dev, "Device in bootloader mode.\n"); 1038 dev_warn(dev, "Device in bootloader mode.\n");
1059 1039
1040 /* Allocate and register a linear revmap irq_domain */
1041 data->irqdomain = irq_domain_create_linear(fwnode, irq_count,
1042 &irq_domain_simple_ops,
1043 data);
1044 if (!data->irqdomain) {
1045 dev_err(&rmi_dev->dev, "Failed to create IRQ domain\n");
1046 return -ENOMEM;
1047 }
1048
1060 data->irq_count = irq_count; 1049 data->irq_count = irq_count;
1061 data->num_of_irq_regs = (data->irq_count + 7) / 8; 1050 data->num_of_irq_regs = (data->irq_count + 7) / 8;
1062 1051
@@ -1079,10 +1068,9 @@ int rmi_init_functions(struct rmi_driver_data *data)
1079{ 1068{
1080 struct rmi_device *rmi_dev = data->rmi_dev; 1069 struct rmi_device *rmi_dev = data->rmi_dev;
1081 struct device *dev = &rmi_dev->dev; 1070 struct device *dev = &rmi_dev->dev;
1082 int irq_count; 1071 int irq_count = 0;
1083 int retval; 1072 int retval;
1084 1073
1085 irq_count = 0;
1086 rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Creating functions.\n", __func__); 1074 rmi_dbg(RMI_DEBUG_CORE, dev, "%s: Creating functions.\n", __func__);
1087 retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_create_function); 1075 retval = rmi_scan_pdt(rmi_dev, &irq_count, rmi_create_function);
1088 if (retval < 0) { 1076 if (retval < 0) {
diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c
index 8a07ae147df6..4edaa14fe878 100644
--- a/drivers/input/rmi4/rmi_f01.c
+++ b/drivers/input/rmi4/rmi_f01.c
@@ -681,9 +681,9 @@ static int rmi_f01_resume(struct rmi_function *fn)
681 return 0; 681 return 0;
682} 682}
683 683
684static int rmi_f01_attention(struct rmi_function *fn, 684static irqreturn_t rmi_f01_attention(int irq, void *ctx)
685 unsigned long *irq_bits)
686{ 685{
686 struct rmi_function *fn = ctx;
687 struct rmi_device *rmi_dev = fn->rmi_dev; 687 struct rmi_device *rmi_dev = fn->rmi_dev;
688 int error; 688 int error;
689 u8 device_status; 689 u8 device_status;
@@ -692,7 +692,7 @@ static int rmi_f01_attention(struct rmi_function *fn,
692 if (error) { 692 if (error) {
693 dev_err(&fn->dev, 693 dev_err(&fn->dev,
694 "Failed to read device status: %d.\n", error); 694 "Failed to read device status: %d.\n", error);
695 return error; 695 return IRQ_RETVAL(error);
696 } 696 }
697 697
698 if (RMI_F01_STATUS_BOOTLOADER(device_status)) 698 if (RMI_F01_STATUS_BOOTLOADER(device_status))
@@ -704,11 +704,11 @@ static int rmi_f01_attention(struct rmi_function *fn,
704 error = rmi_dev->driver->reset_handler(rmi_dev); 704 error = rmi_dev->driver->reset_handler(rmi_dev);
705 if (error) { 705 if (error) {
706 dev_err(&fn->dev, "Device reset failed: %d\n", error); 706 dev_err(&fn->dev, "Device reset failed: %d\n", error);
707 return error; 707 return IRQ_RETVAL(error);
708 } 708 }
709 } 709 }
710 710
711 return 0; 711 return IRQ_HANDLED;
712} 712}
713 713
714struct rmi_function_handler rmi_f01_handler = { 714struct rmi_function_handler rmi_f01_handler = {
diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c
index 88822196d6b7..aaa1edc95522 100644
--- a/drivers/input/rmi4/rmi_f03.c
+++ b/drivers/input/rmi4/rmi_f03.c
@@ -244,8 +244,9 @@ static int rmi_f03_config(struct rmi_function *fn)
244 return 0; 244 return 0;
245} 245}
246 246
247static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits) 247static irqreturn_t rmi_f03_attention(int irq, void *ctx)
248{ 248{
249 struct rmi_function *fn = ctx;
249 struct rmi_device *rmi_dev = fn->rmi_dev; 250 struct rmi_device *rmi_dev = fn->rmi_dev;
250 struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); 251 struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev);
251 struct f03_data *f03 = dev_get_drvdata(&fn->dev); 252 struct f03_data *f03 = dev_get_drvdata(&fn->dev);
@@ -262,7 +263,7 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits)
262 /* First grab the data passed by the transport device */ 263 /* First grab the data passed by the transport device */
263 if (drvdata->attn_data.size < ob_len) { 264 if (drvdata->attn_data.size < ob_len) {
264 dev_warn(&fn->dev, "F03 interrupted, but data is missing!\n"); 265 dev_warn(&fn->dev, "F03 interrupted, but data is missing!\n");
265 return 0; 266 return IRQ_HANDLED;
266 } 267 }
267 268
268 memcpy(obs, drvdata->attn_data.data, ob_len); 269 memcpy(obs, drvdata->attn_data.data, ob_len);
@@ -277,7 +278,7 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits)
277 "%s: Failed to read F03 output buffers: %d\n", 278 "%s: Failed to read F03 output buffers: %d\n",
278 __func__, error); 279 __func__, error);
279 serio_interrupt(f03->serio, 0, SERIO_TIMEOUT); 280 serio_interrupt(f03->serio, 0, SERIO_TIMEOUT);
280 return error; 281 return IRQ_RETVAL(error);
281 } 282 }
282 } 283 }
283 284
@@ -303,7 +304,7 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits)
303 serio_interrupt(f03->serio, ob_data, serio_flags); 304 serio_interrupt(f03->serio, ob_data, serio_flags);
304 } 305 }
305 306
306 return 0; 307 return IRQ_HANDLED;
307} 308}
308 309
309static void rmi_f03_remove(struct rmi_function *fn) 310static void rmi_f03_remove(struct rmi_function *fn)
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index bc5e37f30ac1..5f2e1ef5accc 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -570,9 +570,7 @@ static inline u8 rmi_f11_parse_finger_state(const u8 *f_state, u8 n_finger)
570} 570}
571 571
572static void rmi_f11_finger_handler(struct f11_data *f11, 572static void rmi_f11_finger_handler(struct f11_data *f11,
573 struct rmi_2d_sensor *sensor, 573 struct rmi_2d_sensor *sensor, int size)
574 unsigned long *irq_bits, int num_irq_regs,
575 int size)
576{ 574{
577 const u8 *f_state = f11->data.f_state; 575 const u8 *f_state = f11->data.f_state;
578 u8 finger_state; 576 u8 finger_state;
@@ -581,12 +579,7 @@ static void rmi_f11_finger_handler(struct f11_data *f11,
581 int rel_fingers; 579 int rel_fingers;
582 int abs_size = sensor->nbr_fingers * RMI_F11_ABS_BYTES; 580 int abs_size = sensor->nbr_fingers * RMI_F11_ABS_BYTES;
583 581
584 int abs_bits = bitmap_and(f11->result_bits, irq_bits, f11->abs_mask, 582 if (sensor->report_abs) {
585 num_irq_regs * 8);
586 int rel_bits = bitmap_and(f11->result_bits, irq_bits, f11->rel_mask,
587 num_irq_regs * 8);
588
589 if (abs_bits) {
590 if (abs_size > size) 583 if (abs_size > size)
591 abs_fingers = size / RMI_F11_ABS_BYTES; 584 abs_fingers = size / RMI_F11_ABS_BYTES;
592 else 585 else
@@ -604,19 +597,7 @@ static void rmi_f11_finger_handler(struct f11_data *f11,
604 rmi_f11_abs_pos_process(f11, sensor, &sensor->objs[i], 597 rmi_f11_abs_pos_process(f11, sensor, &sensor->objs[i],
605 finger_state, i); 598 finger_state, i);
606 } 599 }
607 }
608 600
609 if (rel_bits) {
610 if ((abs_size + sensor->nbr_fingers * RMI_F11_REL_BYTES) > size)
611 rel_fingers = (size - abs_size) / RMI_F11_REL_BYTES;
612 else
613 rel_fingers = sensor->nbr_fingers;
614
615 for (i = 0; i < rel_fingers; i++)
616 rmi_f11_rel_pos_report(f11, i);
617 }
618
619 if (abs_bits) {
620 /* 601 /*
621 * the absolute part is made in 2 parts to allow the kernel 602 * the absolute part is made in 2 parts to allow the kernel
622 * tracking to take place. 603 * tracking to take place.
@@ -638,7 +619,16 @@ static void rmi_f11_finger_handler(struct f11_data *f11,
638 } 619 }
639 620
640 input_mt_sync_frame(sensor->input); 621 input_mt_sync_frame(sensor->input);
622 } else if (sensor->report_rel) {
623 if ((abs_size + sensor->nbr_fingers * RMI_F11_REL_BYTES) > size)
624 rel_fingers = (size - abs_size) / RMI_F11_REL_BYTES;
625 else
626 rel_fingers = sensor->nbr_fingers;
627
628 for (i = 0; i < rel_fingers; i++)
629 rmi_f11_rel_pos_report(f11, i);
641 } 630 }
631
642} 632}
643 633
644static int f11_2d_construct_data(struct f11_data *f11) 634static int f11_2d_construct_data(struct f11_data *f11)
@@ -1275,8 +1265,9 @@ static int rmi_f11_config(struct rmi_function *fn)
1275 return 0; 1265 return 0;
1276} 1266}
1277 1267
1278static int rmi_f11_attention(struct rmi_function *fn, unsigned long *irq_bits) 1268static irqreturn_t rmi_f11_attention(int irq, void *ctx)
1279{ 1269{
1270 struct rmi_function *fn = ctx;
1280 struct rmi_device *rmi_dev = fn->rmi_dev; 1271 struct rmi_device *rmi_dev = fn->rmi_dev;
1281 struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); 1272 struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev);
1282 struct f11_data *f11 = dev_get_drvdata(&fn->dev); 1273 struct f11_data *f11 = dev_get_drvdata(&fn->dev);
@@ -1302,13 +1293,12 @@ static int rmi_f11_attention(struct rmi_function *fn, unsigned long *irq_bits)
1302 data_base_addr, f11->sensor.data_pkt, 1293 data_base_addr, f11->sensor.data_pkt,
1303 f11->sensor.pkt_size); 1294 f11->sensor.pkt_size);
1304 if (error < 0) 1295 if (error < 0)
1305 return error; 1296 return IRQ_RETVAL(error);
1306 } 1297 }
1307 1298
1308 rmi_f11_finger_handler(f11, &f11->sensor, irq_bits, 1299 rmi_f11_finger_handler(f11, &f11->sensor, valid_bytes);
1309 drvdata->num_of_irq_regs, valid_bytes);
1310 1300
1311 return 0; 1301 return IRQ_HANDLED;
1312} 1302}
1313 1303
1314static int rmi_f11_resume(struct rmi_function *fn) 1304static int rmi_f11_resume(struct rmi_function *fn)
diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c
index 8b0db086d68a..e226def74d82 100644
--- a/drivers/input/rmi4/rmi_f12.c
+++ b/drivers/input/rmi4/rmi_f12.c
@@ -197,10 +197,10 @@ static void rmi_f12_process_objects(struct f12_data *f12, u8 *data1, int size)
197 rmi_2d_sensor_abs_report(sensor, &sensor->objs[i], i); 197 rmi_2d_sensor_abs_report(sensor, &sensor->objs[i], i);
198} 198}
199 199
200static int rmi_f12_attention(struct rmi_function *fn, 200static irqreturn_t rmi_f12_attention(int irq, void *ctx)
201 unsigned long *irq_nr_regs)
202{ 201{
203 int retval; 202 int retval;
203 struct rmi_function *fn = ctx;
204 struct rmi_device *rmi_dev = fn->rmi_dev; 204 struct rmi_device *rmi_dev = fn->rmi_dev;
205 struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); 205 struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev);
206 struct f12_data *f12 = dev_get_drvdata(&fn->dev); 206 struct f12_data *f12 = dev_get_drvdata(&fn->dev);
@@ -222,7 +222,7 @@ static int rmi_f12_attention(struct rmi_function *fn,
222 if (retval < 0) { 222 if (retval < 0) {
223 dev_err(&fn->dev, "Failed to read object data. Code: %d.\n", 223 dev_err(&fn->dev, "Failed to read object data. Code: %d.\n",
224 retval); 224 retval);
225 return retval; 225 return IRQ_RETVAL(retval);
226 } 226 }
227 } 227 }
228 228
@@ -232,7 +232,7 @@ static int rmi_f12_attention(struct rmi_function *fn,
232 232
233 input_mt_sync_frame(sensor->input); 233 input_mt_sync_frame(sensor->input);
234 234
235 return 0; 235 return IRQ_HANDLED;
236} 236}
237 237
238static int rmi_f12_write_control_regs(struct rmi_function *fn) 238static int rmi_f12_write_control_regs(struct rmi_function *fn)
diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c
index 82e0f0d43d55..5e3ed5ac0c3e 100644
--- a/drivers/input/rmi4/rmi_f30.c
+++ b/drivers/input/rmi4/rmi_f30.c
@@ -122,8 +122,9 @@ static void rmi_f30_report_button(struct rmi_function *fn,
122 } 122 }
123} 123}
124 124
125static int rmi_f30_attention(struct rmi_function *fn, unsigned long *irq_bits) 125static irqreturn_t rmi_f30_attention(int irq, void *ctx)
126{ 126{
127 struct rmi_function *fn = ctx;
127 struct f30_data *f30 = dev_get_drvdata(&fn->dev); 128 struct f30_data *f30 = dev_get_drvdata(&fn->dev);
128 struct rmi_driver_data *drvdata = dev_get_drvdata(&fn->rmi_dev->dev); 129 struct rmi_driver_data *drvdata = dev_get_drvdata(&fn->rmi_dev->dev);
129 int error; 130 int error;
@@ -134,7 +135,7 @@ static int rmi_f30_attention(struct rmi_function *fn, unsigned long *irq_bits)
134 if (drvdata->attn_data.size < f30->register_count) { 135 if (drvdata->attn_data.size < f30->register_count) {
135 dev_warn(&fn->dev, 136 dev_warn(&fn->dev,
136 "F30 interrupted, but data is missing\n"); 137 "F30 interrupted, but data is missing\n");
137 return 0; 138 return IRQ_HANDLED;
138 } 139 }
139 memcpy(f30->data_regs, drvdata->attn_data.data, 140 memcpy(f30->data_regs, drvdata->attn_data.data,
140 f30->register_count); 141 f30->register_count);
@@ -147,7 +148,7 @@ static int rmi_f30_attention(struct rmi_function *fn, unsigned long *irq_bits)
147 dev_err(&fn->dev, 148 dev_err(&fn->dev,
148 "%s: Failed to read F30 data registers: %d\n", 149 "%s: Failed to read F30 data registers: %d\n",
149 __func__, error); 150 __func__, error);
150 return error; 151 return IRQ_RETVAL(error);
151 } 152 }
152 } 153 }
153 154
@@ -159,7 +160,7 @@ static int rmi_f30_attention(struct rmi_function *fn, unsigned long *irq_bits)
159 rmi_f03_commit_buttons(f30->f03); 160 rmi_f03_commit_buttons(f30->f03);
160 } 161 }
161 162
162 return 0; 163 return IRQ_HANDLED;
163} 164}
164 165
165static int rmi_f30_config(struct rmi_function *fn) 166static int rmi_f30_config(struct rmi_function *fn)
diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c
index f1f5ac539d5d..87a7d4ba382d 100644
--- a/drivers/input/rmi4/rmi_f34.c
+++ b/drivers/input/rmi4/rmi_f34.c
@@ -100,8 +100,9 @@ static int rmi_f34_command(struct f34_data *f34, u8 command,
100 return 0; 100 return 0;
101} 101}
102 102
103static int rmi_f34_attention(struct rmi_function *fn, unsigned long *irq_bits) 103static irqreturn_t rmi_f34_attention(int irq, void *ctx)
104{ 104{
105 struct rmi_function *fn = ctx;
105 struct f34_data *f34 = dev_get_drvdata(&fn->dev); 106 struct f34_data *f34 = dev_get_drvdata(&fn->dev);
106 int ret; 107 int ret;
107 u8 status; 108 u8 status;
@@ -126,7 +127,7 @@ static int rmi_f34_attention(struct rmi_function *fn, unsigned long *irq_bits)
126 complete(&f34->v7.cmd_done); 127 complete(&f34->v7.cmd_done);
127 } 128 }
128 129
129 return 0; 130 return IRQ_HANDLED;
130} 131}
131 132
132static int rmi_f34_write_blocks(struct f34_data *f34, const void *data, 133static int rmi_f34_write_blocks(struct f34_data *f34, const void *data,
diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
index 5343f2c08f15..98a935efec8e 100644
--- a/drivers/input/rmi4/rmi_f54.c
+++ b/drivers/input/rmi4/rmi_f54.c
@@ -610,11 +610,6 @@ error:
610 mutex_unlock(&f54->data_mutex); 610 mutex_unlock(&f54->data_mutex);
611} 611}
612 612
613static int rmi_f54_attention(struct rmi_function *fn, unsigned long *irqbits)
614{
615 return 0;
616}
617
618static int rmi_f54_config(struct rmi_function *fn) 613static int rmi_f54_config(struct rmi_function *fn)
619{ 614{
620 struct rmi_driver *drv = fn->rmi_dev->driver; 615 struct rmi_driver *drv = fn->rmi_dev->driver;
@@ -756,6 +751,5 @@ struct rmi_function_handler rmi_f54_handler = {
756 .func = 0x54, 751 .func = 0x54,
757 .probe = rmi_f54_probe, 752 .probe = rmi_f54_probe,
758 .config = rmi_f54_config, 753 .config = rmi_f54_config,
759 .attention = rmi_f54_attention,
760 .remove = rmi_f54_remove, 754 .remove = rmi_f54_remove,
761}; 755};
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index d7188de4db96..3f4bf60b0bb5 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -100,7 +100,7 @@ static inline bool input_is_mt_axis(int axis)
100 return axis == ABS_MT_SLOT || input_is_mt_value(axis); 100 return axis == ABS_MT_SLOT || input_is_mt_value(axis);
101} 101}
102 102
103void input_mt_report_slot_state(struct input_dev *dev, 103bool input_mt_report_slot_state(struct input_dev *dev,
104 unsigned int tool_type, bool active); 104 unsigned int tool_type, bool active);
105 105
106void input_mt_report_finger_count(struct input_dev *dev, int count); 106void input_mt_report_finger_count(struct input_dev *dev, int count);
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
index 64125443f8a6..5ef5c7c412a7 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
@@ -354,6 +354,8 @@ struct rmi_driver_data {
354 struct mutex irq_mutex; 354 struct mutex irq_mutex;
355 struct input_dev *input; 355 struct input_dev *input;
356 356
357 struct irq_domain *irqdomain;
358
357 u8 pdt_props; 359 u8 pdt_props;
358 360
359 u8 num_rx_electrodes; 361 u8 num_rx_electrodes;