summaryrefslogtreecommitdiffstats
path: root/input-rmi4-remove-the-need-for-artifical-IRQ.patch
diff options
context:
space:
mode:
authorJustin M. Forbes <jforbes@fedoraproject.org>2020-06-03 09:24:05 -0500
committerJustin M. Forbes <jforbes@fedoraproject.org>2020-06-03 09:24:05 -0500
commitf3c97b210459be0178586445ea7762ca1e7da09a (patch)
tree040bb9415923e19e5d264dd007f5146d8353e0cc /input-rmi4-remove-the-need-for-artifical-IRQ.patch
parent60b20c0db85edba7fc19f811d19fd287219d941b (diff)
downloadkernel-f3c97b210459be0178586445ea7762ca1e7da09a.tar.gz
kernel-f3c97b210459be0178586445ea7762ca1e7da09a.tar.xz
kernel-f3c97b210459be0178586445ea7762ca1e7da09a.zip
Linux v5.6.16
Signed-off-by: Justin M. Forbes <jforbes@fedoraproject.org>
Diffstat (limited to 'input-rmi4-remove-the-need-for-artifical-IRQ.patch')
-rw-r--r--input-rmi4-remove-the-need-for-artifical-IRQ.patch96
1 files changed, 48 insertions, 48 deletions
diff --git a/input-rmi4-remove-the-need-for-artifical-IRQ.patch b/input-rmi4-remove-the-need-for-artifical-IRQ.patch
index 9a1794558..4d7bef554 100644
--- a/input-rmi4-remove-the-need-for-artifical-IRQ.patch
+++ b/input-rmi4-remove-the-need-for-artifical-IRQ.patch
@@ -1,4 +1,4 @@
-From 0a74d0f27e8d60e427b447a041bc061917d85fac Mon Sep 17 00:00:00 2001
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Date: Mon, 3 Apr 2017 18:18:21 +0200
Subject: [PATCH] Input: rmi4 - remove the need for artificial IRQ in case of
@@ -22,33 +22,33 @@ Signed-off-by: Lyude <lyude@redhat.com>
3 files changed, 75 insertions(+), 114 deletions(-)
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
-index 9e33165250a3..e7e33a160b47 100644
+index 8cffa84c9650..6c4e3675601a 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
-@@ -316,19 +316,12 @@ static int rmi_input_event(struct hid_device *hdev, u8 *data, int size)
+@@ -322,19 +322,12 @@ static int rmi_input_event(struct hid_device *hdev, u8 *data, int size)
{
struct rmi_data *hdata = hid_get_drvdata(hdev);
struct rmi_device *rmi_dev = hdata->xport.rmi_dev;
- unsigned long flags;
-
+
if (!(test_bit(RMI_STARTED, &hdata->flags)))
return 0;
-
+
- local_irq_save(flags);
-
rmi_set_attn_data(rmi_dev, data[1], &data[2], size - 2);
-
+
- generic_handle_irq(hdata->rmi_irq);
-
- local_irq_restore(flags);
-
return 1;
}
-
-@@ -586,56 +579,6 @@ static const struct rmi_transport_ops hid_rmi_ops = {
+
+@@ -592,56 +585,6 @@ static const struct rmi_transport_ops hid_rmi_ops = {
.reset = rmi_hid_reset,
};
-
+
-static void rmi_irq_teardown(void *data)
-{
- struct rmi_data *hdata = data;
@@ -102,10 +102,10 @@ index 9e33165250a3..e7e33a160b47 100644
static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
struct rmi_data *data = NULL;
-@@ -708,18 +651,11 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
-
+@@ -714,18 +657,11 @@ static int rmi_probe(struct hid_device *hdev, const struct hid_device_id *id)
+
mutex_init(&data->page_mutex);
-
+
- ret = rmi_setup_irq_domain(hdev);
- if (ret) {
- hid_err(hdev, "failed to allocate IRQ domain\n");
@@ -114,26 +114,26 @@ index 9e33165250a3..e7e33a160b47 100644
-
if (data->device_flags & RMI_DEVICE_HAS_PHYS_BUTTONS)
rmi_hid_pdata.f30_data.disable = true;
-
+
data->xport.dev = hdev->dev.parent;
data->xport.pdata = rmi_hid_pdata;
- data->xport.pdata.irq = data->rmi_irq;
data->xport.proto_name = "hid";
data->xport.ops = &hid_rmi_ops;
-
+
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
-index fc3ab93b7aea..35bc90141db8 100644
+index 258d5fe3d395..f7298e3dc8f3 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
-@@ -185,34 +185,47 @@ void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status,
+@@ -182,34 +182,47 @@ void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status,
attn_data.data = fifo_data;
-
+
kfifo_put(&drvdata->attn_fifo, attn_data);
+
+ schedule_work(&drvdata->attn_work);
}
EXPORT_SYMBOL_GPL(rmi_set_attn_data);
-
+
-static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
+static void attn_callback(struct work_struct *work)
{
@@ -144,7 +144,7 @@ index fc3ab93b7aea..35bc90141db8 100644
+ attn_work);
struct rmi4_attn_data attn_data = {0};
int ret, count;
-
+
count = kfifo_get(&drvdata->attn_fifo, &attn_data);
- if (count) {
- *(drvdata->irq_status) = attn_data.irq_status;
@@ -152,7 +152,7 @@ index fc3ab93b7aea..35bc90141db8 100644
- }
+ if (!count)
+ return;
-
+
- ret = rmi_process_interrupt_requests(rmi_dev);
+ *(drvdata->irq_status) = attn_data.irq_status;
+ drvdata->attn_data = attn_data;
@@ -162,14 +162,14 @@ index fc3ab93b7aea..35bc90141db8 100644
- rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
+ rmi_dbg(RMI_DEBUG_CORE, &drvdata->rmi_dev->dev,
"Failed to process interrupt request: %d\n", ret);
-
+
- if (count) {
- kfree(attn_data.data);
-- attn_data.data = NULL;
+- drvdata->attn_data.data = NULL;
- }
+ kfree(attn_data.data);
-+ attn_data.data = NULL;
-
++ drvdata->attn_data.data = NULL;
+
if (!kfifo_is_empty(&drvdata->attn_fifo))
- return rmi_irq_fn(irq, dev_id);
+ schedule_work(&drvdata->attn_work);
@@ -184,30 +184,30 @@ index fc3ab93b7aea..35bc90141db8 100644
+ if (ret)
+ rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
+ "Failed to process interrupt request: %d\n", ret);
-
+
return IRQ_HANDLED;
}
-@@ -220,7 +233,6 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
+@@ -217,7 +230,6 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
static int rmi_irq_init(struct rmi_device *rmi_dev)
{
struct rmi_device_platform_data *pdata = rmi_get_platform_data(rmi_dev);
- struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
int irq_flags = irq_get_trigger_type(pdata->irq);
int ret;
-
-@@ -238,8 +250,6 @@ static int rmi_irq_init(struct rmi_device *rmi_dev)
+
+@@ -235,8 +247,6 @@ static int rmi_irq_init(struct rmi_device *rmi_dev)
return ret;
}
-
+
- data->enabled = true;
-
return 0;
}
-
-@@ -889,23 +899,27 @@ void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake)
+
+@@ -886,23 +896,27 @@ void rmi_enable_irq(struct rmi_device *rmi_dev, bool clear_wake)
if (data->enabled)
goto out;
-
+
- enable_irq(irq);
- data->enabled = true;
- if (clear_wake && device_may_wakeup(rmi_dev->xport->dev)) {
@@ -227,7 +227,7 @@ index fc3ab93b7aea..35bc90141db8 100644
+ "Failed to disable irq for wake: %d\n",
+ retval);
+ }
-
+
- /*
- * Call rmi_process_interrupt_requests() after enabling irq,
- * otherwise we may lose interrupt on edge-triggered systems.
@@ -245,12 +245,12 @@ index fc3ab93b7aea..35bc90141db8 100644
+ } else {
+ data->enabled = true;
+ }
-
+
out:
mutex_unlock(&data->enabled_mutex);
-@@ -925,20 +939,22 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake)
+@@ -922,20 +936,22 @@ void rmi_disable_irq(struct rmi_device *rmi_dev, bool enable_wake)
goto out;
-
+
data->enabled = false;
- disable_irq(irq);
- if (enable_wake && device_may_wakeup(rmi_dev->xport->dev)) {
@@ -283,21 +283,21 @@ index fc3ab93b7aea..35bc90141db8 100644
+ kfree(attn_data.data);
+ }
}
-
+
out:
-@@ -984,6 +1000,8 @@ static int rmi_driver_remove(struct device *dev)
+@@ -981,6 +997,8 @@ static int rmi_driver_remove(struct device *dev)
irq_domain_remove(data->irqdomain);
data->irqdomain = NULL;
-
+
+ cancel_work_sync(&data->attn_work);
+
rmi_f34_remove_sysfs(rmi_dev);
rmi_free_function_list(rmi_dev);
-
-@@ -1221,9 +1239,15 @@ static int rmi_driver_probe(struct device *dev)
+
+@@ -1219,9 +1237,15 @@ static int rmi_driver_probe(struct device *dev)
}
}
-
+
- retval = rmi_irq_init(rmi_dev);
- if (retval < 0)
- goto err_destroy_functions;
@@ -310,21 +310,21 @@ index fc3ab93b7aea..35bc90141db8 100644
+ data->enabled = true;
+
+ INIT_WORK(&data->attn_work, attn_callback);
-
+
if (data->f01_container->dev.driver) {
/* Driver already bound, so enable ATTN now. */
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
-index 5ef5c7c412a7..21f48f2807de 100644
+index 7b22366d0065..307a651b2755 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
-@@ -366,6 +366,7 @@ struct rmi_driver_data {
-
+@@ -363,6 +363,7 @@ struct rmi_driver_data {
+
struct rmi4_attn_data attn_data;
DECLARE_KFIFO(attn_fifo, struct rmi4_attn_data, 16);
+ struct work_struct attn_work;
};
-
+
int rmi_register_transport_device(struct rmi_transport_dev *xport);
--
-2.17.1
+2.26.2