* [PATCH] Input: da9052_tsi: remove unnecessary worker @ 2015-01-18 15:36 Michael Grzeschik 2015-01-20 7:21 ` Dmitry Torokhov 2015-02-06 11:05 ` [PATCH v2] " Michael Grzeschik 0 siblings, 2 replies; 7+ messages in thread From: Michael Grzeschik @ 2015-01-18 15:36 UTC (permalink / raw) To: linux-input; +Cc: dmitry.torokhov, support.opensource, kernel With the datardy irq we get the information if the pen got pulled from the screen. This patch changes the irq by checking this condition every time instead of triggering the worker. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> --- drivers/input/touchscreen/da9052_tsi.c | 68 ++++++++++++++-------------------- 1 file changed, 27 insertions(+), 41 deletions(-) diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c index 5a013bb..e6019dd 100644 --- a/drivers/input/touchscreen/da9052_tsi.c +++ b/drivers/input/touchscreen/da9052_tsi.c @@ -25,7 +25,6 @@ struct da9052_tsi { struct da9052 *da9052; struct input_dev *dev; - struct delayed_work ts_pen_work; struct mutex mutex; bool stopped; bool adc_on; @@ -47,8 +46,6 @@ static irqreturn_t da9052_ts_pendwn_irq(int irq, void *data) da9052_enable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); da9052_ts_adc_toggle(tsi, true); - - schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); } return IRQ_HANDLED; @@ -89,6 +86,33 @@ static void da9052_ts_read(struct da9052_tsi *tsi) y = ((y << 2) & 0x3fc) | ((v & 0xc) >> 2); z = ((z << 2) & 0x3fc) | ((v & 0x30) >> 4); + /* Check for last TSI_READY irq */ + if (!(ret & TSI_PEN_DOWN_STATUS)) { + + /* Pen UP */ + da9052_ts_adc_toggle(tsi, false); + + /* Report Pen UP */ + input_report_key(input, BTN_TOUCH, 0); + input_report_abs(input, ABS_PRESSURE, 0); + input_sync(input); + + /* + * FIXME: Fixes the unhandled irq issue when quick + * pen down and pen up events occurs + */ + ret = da9052_reg_update(tsi->da9052, + DA9052_EVENT_B_REG, 0xC0, 0xC0); + if (ret < 0) + return; + + /* Mask TSI_READY event and unmask PEN_DOWN event */ + da9052_disable_irq_nosync(tsi->da9052, DA9052_IRQ_TSIREADY); + da9052_enable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); + + return; + } + input_report_key(input, BTN_TOUCH, 1); input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); @@ -105,42 +129,6 @@ static irqreturn_t da9052_ts_datardy_irq(int irq, void *data) return IRQ_HANDLED; } -static void da9052_ts_pen_work(struct work_struct *work) -{ - struct da9052_tsi *tsi = container_of(work, struct da9052_tsi, - ts_pen_work.work); - if (!tsi->stopped) { - int ret = da9052_reg_read(tsi->da9052, DA9052_TSI_LSB_REG); - if (ret < 0 || (ret & TSI_PEN_DOWN_STATUS)) { - /* Pen is still DOWN (or read error) */ - schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); - } else { - struct input_dev *input = tsi->dev; - - /* Pen UP */ - da9052_ts_adc_toggle(tsi, false); - - /* Report Pen UP */ - input_report_key(input, BTN_TOUCH, 0); - input_report_abs(input, ABS_PRESSURE, 0); - input_sync(input); - - /* - * FIXME: Fixes the unhandled irq issue when quick - * pen down and pen up events occurs - */ - ret = da9052_reg_update(tsi->da9052, - DA9052_EVENT_B_REG, 0xC0, 0xC0); - if (ret < 0) - return; - - /* Mask TSI_READY event and unmask PEN_DOWN event */ - da9052_disable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); - da9052_enable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); - } - } -} - static int da9052_ts_configure_gpio(struct da9052 *da9052) { int error; @@ -209,7 +197,6 @@ static void da9052_ts_input_close(struct input_dev *input_dev) tsi->stopped = true; mb(); da9052_disable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); - cancel_delayed_work_sync(&tsi->ts_pen_work); if (tsi->adc_on) { da9052_disable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); @@ -248,7 +235,6 @@ static int da9052_ts_probe(struct platform_device *pdev) tsi->da9052 = da9052; tsi->dev = input_dev; tsi->stopped = true; - INIT_DELAYED_WORK(&tsi->ts_pen_work, da9052_ts_pen_work); input_dev->id.version = 0x0101; input_dev->id.vendor = 0x15B6; -- 2.1.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Input: da9052_tsi: remove unnecessary worker 2015-01-18 15:36 [PATCH] Input: da9052_tsi: remove unnecessary worker Michael Grzeschik @ 2015-01-20 7:21 ` Dmitry Torokhov 2015-01-20 11:04 ` Michael Grzeschik 2015-02-06 11:05 ` [PATCH v2] " Michael Grzeschik 1 sibling, 1 reply; 7+ messages in thread From: Dmitry Torokhov @ 2015-01-20 7:21 UTC (permalink / raw) To: Michael Grzeschik; +Cc: linux-input, support.opensource, kernel Hi Michael, On Sun, Jan 18, 2015 at 04:36:08PM +0100, Michael Grzeschik wrote: > With the datardy irq we get the information if the > pen got pulled from the screen. This patch changes > the irq by checking this condition every time instead > of triggering the worker. > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> > --- > drivers/input/touchscreen/da9052_tsi.c | 68 ++++++++++++++-------------------- > 1 file changed, 27 insertions(+), 41 deletions(-) > > diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c > index 5a013bb..e6019dd 100644 > --- a/drivers/input/touchscreen/da9052_tsi.c > +++ b/drivers/input/touchscreen/da9052_tsi.c > @@ -25,7 +25,6 @@ > struct da9052_tsi { > struct da9052 *da9052; > struct input_dev *dev; > - struct delayed_work ts_pen_work; > struct mutex mutex; > bool stopped; > bool adc_on; > @@ -47,8 +46,6 @@ static irqreturn_t da9052_ts_pendwn_irq(int irq, void *data) > da9052_enable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); > > da9052_ts_adc_toggle(tsi, true); > - > - schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); > } > > return IRQ_HANDLED; > @@ -89,6 +86,33 @@ static void da9052_ts_read(struct da9052_tsi *tsi) > y = ((y << 2) & 0x3fc) | ((v & 0xc) >> 2); > z = ((z << 2) & 0x3fc) | ((v & 0x30) >> 4); > > + /* Check for last TSI_READY irq */ > + if (!(ret & TSI_PEN_DOWN_STATUS)) { > + > + /* Pen UP */ > + da9052_ts_adc_toggle(tsi, false); Now it is racy WRT tsi->adc_on checks in da9052_ts_input_close(); previously we'd disable pendown IRQ and cancel the work, so no one would be touching tsi->adc_on. Also I'd rather we did event reporting in this function, but do IRQ switchover in da9052_ts_datardy_irq(). Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Input: da9052_tsi: remove unnecessary worker 2015-01-20 7:21 ` Dmitry Torokhov @ 2015-01-20 11:04 ` Michael Grzeschik 0 siblings, 0 replies; 7+ messages in thread From: Michael Grzeschik @ 2015-01-20 11:04 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input, support.opensource, kernel On Mon, Jan 19, 2015 at 11:21:00PM -0800, Dmitry Torokhov wrote: > Hi Michael, > > On Sun, Jan 18, 2015 at 04:36:08PM +0100, Michael Grzeschik wrote: > > With the datardy irq we get the information if the > > pen got pulled from the screen. This patch changes > > the irq by checking this condition every time instead > > of triggering the worker. > > > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> > > --- > > drivers/input/touchscreen/da9052_tsi.c | 68 ++++++++++++++-------------------- > > 1 file changed, 27 insertions(+), 41 deletions(-) > > > > diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c > > index 5a013bb..e6019dd 100644 > > --- a/drivers/input/touchscreen/da9052_tsi.c > > +++ b/drivers/input/touchscreen/da9052_tsi.c > > @@ -25,7 +25,6 @@ > > struct da9052_tsi { > > struct da9052 *da9052; > > struct input_dev *dev; > > - struct delayed_work ts_pen_work; > > struct mutex mutex; > > bool stopped; > > bool adc_on; > > @@ -47,8 +46,6 @@ static irqreturn_t da9052_ts_pendwn_irq(int irq, void *data) > > da9052_enable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); > > > > da9052_ts_adc_toggle(tsi, true); > > - > > - schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); > > } > > > > return IRQ_HANDLED; > > @@ -89,6 +86,33 @@ static void da9052_ts_read(struct da9052_tsi *tsi) > > y = ((y << 2) & 0x3fc) | ((v & 0xc) >> 2); > > z = ((z << 2) & 0x3fc) | ((v & 0x30) >> 4); > > > > + /* Check for last TSI_READY irq */ > > + if (!(ret & TSI_PEN_DOWN_STATUS)) { > > + > > + /* Pen UP */ > > + da9052_ts_adc_toggle(tsi, false); > > Now it is racy WRT tsi->adc_on checks in da9052_ts_input_close(); > previously we'd disable pendown IRQ and cancel the work, so no one > would be touching tsi->adc_on. I have been testing this and did not run into any race. But ok, that resource should probably be surrounded by some locking. I will give it a try. > Also I'd rather we did event reporting in this function, but do IRQ > switchover in da9052_ts_datardy_irq(). Sounds good in aspect of code structure. Thanks, Michael -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] Input: da9052_tsi: remove unnecessary worker 2015-01-18 15:36 [PATCH] Input: da9052_tsi: remove unnecessary worker Michael Grzeschik 2015-01-20 7:21 ` Dmitry Torokhov @ 2015-02-06 11:05 ` Michael Grzeschik 2015-02-06 23:24 ` Dmitry Torokhov 1 sibling, 1 reply; 7+ messages in thread From: Michael Grzeschik @ 2015-02-06 11:05 UTC (permalink / raw) To: linux-input; +Cc: dmitry.torokhov, support.opensource, kernel With the datardy irq we get the information if the pen got pulled from the screen. This patch changes the irq by checking this condition every time instead of triggering the worker. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> --- v1 -> v2: - removed adc_on variable - added locking for irq switch - event reporting in ts_read and irq switchover in datardy_irq drivers/input/touchscreen/da9052_tsi.c | 119 +++++++++++++++++---------------- 1 file changed, 62 insertions(+), 57 deletions(-) diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c index 5a013bb..c28cfee 100644 --- a/drivers/input/touchscreen/da9052_tsi.c +++ b/drivers/input/touchscreen/da9052_tsi.c @@ -22,19 +22,24 @@ #define TSI_PEN_DOWN_STATUS 0x40 +#define TSI_PEN_UP 1 + struct da9052_tsi { struct da9052 *da9052; struct input_dev *dev; - struct delayed_work ts_pen_work; struct mutex mutex; + spinlock_t *lock; bool stopped; - bool adc_on; }; static void da9052_ts_adc_toggle(struct da9052_tsi *tsi, bool on) { da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 0, on); - tsi->adc_on = on; +} + +static bool da9052_ts_adc_get_state(struct da9052_tsi *tsi) +{ + return da9052_reg_read(tsi->da9052, DA9052_TSI_CONT_A_REG) & (1 < 0); } static irqreturn_t da9052_ts_pendwn_irq(int irq, void *data) @@ -42,19 +47,23 @@ static irqreturn_t da9052_ts_pendwn_irq(int irq, void *data) struct da9052_tsi *tsi = data; if (!tsi->stopped) { + unsigned long flags; + + spin_lock_irqsave(tsi->lock, flags); + /* Mask PEN_DOWN event and unmask TSI_READY event */ da9052_disable_irq_nosync(tsi->da9052, DA9052_IRQ_PENDOWN); da9052_enable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); da9052_ts_adc_toggle(tsi, true); - schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); + spin_unlock_irqrestore(tsi->lock, flags); } return IRQ_HANDLED; } -static void da9052_ts_read(struct da9052_tsi *tsi) +static int da9052_ts_read(struct da9052_tsi *tsi) { struct input_dev *input = tsi->dev; int ret; @@ -63,25 +72,25 @@ static void da9052_ts_read(struct da9052_tsi *tsi) ret = da9052_reg_read(tsi->da9052, DA9052_TSI_X_MSB_REG); if (ret < 0) - return; + return ret; x = (u16) ret; ret = da9052_reg_read(tsi->da9052, DA9052_TSI_Y_MSB_REG); if (ret < 0) - return; + return ret; y = (u16) ret; ret = da9052_reg_read(tsi->da9052, DA9052_TSI_Z_MSB_REG); if (ret < 0) - return; + return ret; z = (u16) ret; ret = da9052_reg_read(tsi->da9052, DA9052_TSI_LSB_REG); if (ret < 0) - return; + return ret; v = (u8) ret; @@ -89,56 +98,53 @@ static void da9052_ts_read(struct da9052_tsi *tsi) y = ((y << 2) & 0x3fc) | ((v & 0xc) >> 2); z = ((z << 2) & 0x3fc) | ((v & 0x30) >> 4); + /* Check for last TSI_READY irq */ + if (!(ret & TSI_PEN_DOWN_STATUS)) { + /* Report Pen UP */ + input_report_key(input, BTN_TOUCH, 0); + input_report_abs(input, ABS_PRESSURE, 0); + input_sync(input); + + return TSI_PEN_UP; + } + input_report_key(input, BTN_TOUCH, 1); input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); input_report_abs(input, ABS_PRESSURE, z); input_sync(input); + + return 0; } static irqreturn_t da9052_ts_datardy_irq(int irq, void *data) { struct da9052_tsi *tsi = data; + unsigned long flags; + int ret; - da9052_ts_read(tsi); + spin_lock_irqsave(tsi->lock, flags); + ret = da9052_ts_read(tsi); + if (ret == TSI_PEN_UP) { + /* Pen UP */ + da9052_ts_adc_toggle(tsi, false); - return IRQ_HANDLED; -} + /* Mask TSI_READY event and unmask PEN_DOWN event */ + da9052_disable_irq_nosync(tsi->da9052, DA9052_IRQ_TSIREADY); + da9052_enable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); -static void da9052_ts_pen_work(struct work_struct *work) -{ - struct da9052_tsi *tsi = container_of(work, struct da9052_tsi, - ts_pen_work.work); - if (!tsi->stopped) { - int ret = da9052_reg_read(tsi->da9052, DA9052_TSI_LSB_REG); - if (ret < 0 || (ret & TSI_PEN_DOWN_STATUS)) { - /* Pen is still DOWN (or read error) */ - schedule_delayed_work(&tsi->ts_pen_work, HZ / 50); - } else { - struct input_dev *input = tsi->dev; - - /* Pen UP */ - da9052_ts_adc_toggle(tsi, false); - - /* Report Pen UP */ - input_report_key(input, BTN_TOUCH, 0); - input_report_abs(input, ABS_PRESSURE, 0); - input_sync(input); - - /* - * FIXME: Fixes the unhandled irq issue when quick - * pen down and pen up events occurs - */ - ret = da9052_reg_update(tsi->da9052, - DA9052_EVENT_B_REG, 0xC0, 0xC0); - if (ret < 0) - return; - - /* Mask TSI_READY event and unmask PEN_DOWN event */ - da9052_disable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); - da9052_enable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); - } + /* + * FIXME: Fixes the unhandled irq issue when quick + * pen down and pen up events occurs + */ + ret = da9052_reg_update(tsi->da9052, + DA9052_EVENT_B_REG, 0xC0, 0xC0); + if (ret < 0) + return ret; } + spin_unlock_irqrestore(tsi->lock, flags); + + return IRQ_HANDLED; } static int da9052_ts_configure_gpio(struct da9052 *da9052) @@ -190,7 +196,9 @@ static int da9052_configure_tsi(struct da9052_tsi *tsi) static int da9052_ts_input_open(struct input_dev *input_dev) { struct da9052_tsi *tsi = input_get_drvdata(input_dev); + unsigned long flags; + spin_lock_irqsave(tsi->lock, flags); tsi->stopped = false; mb(); @@ -200,31 +208,28 @@ static int da9052_ts_input_open(struct input_dev *input_dev) /* Enable Pen Detect Circuit */ return da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 1, 1 << 1); + spin_unlock_irqrestore(tsi->lock, flags); } static void da9052_ts_input_close(struct input_dev *input_dev) { struct da9052_tsi *tsi = input_get_drvdata(input_dev); + unsigned long flags; tsi->stopped = true; mb(); - da9052_disable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); - cancel_delayed_work_sync(&tsi->ts_pen_work); - if (tsi->adc_on) { + spin_lock_irqsave(tsi->lock, flags); + if (da9052_ts_adc_get_state(tsi)) da9052_disable_irq(tsi->da9052, DA9052_IRQ_TSIREADY); - da9052_ts_adc_toggle(tsi, false); + else + da9052_disable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); - /* - * If ADC was on that means that pendwn IRQ was disabled - * twice and we need to enable it to keep enable/disable - * counter balanced. IRQ is still off though. - */ - da9052_enable_irq(tsi->da9052, DA9052_IRQ_PENDOWN); - } + da9052_ts_adc_toggle(tsi, false); /* Disable Pen Detect Circuit */ da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 1, 0); + spin_unlock_irqrestore(tsi->lock, flags); } static int da9052_ts_probe(struct platform_device *pdev) @@ -245,10 +250,10 @@ static int da9052_ts_probe(struct platform_device *pdev) goto err_free_mem; } + spin_lock_init(tsi->lock); tsi->da9052 = da9052; tsi->dev = input_dev; tsi->stopped = true; - INIT_DELAYED_WORK(&tsi->ts_pen_work, da9052_ts_pen_work); input_dev->id.version = 0x0101; input_dev->id.vendor = 0x15B6; -- 2.1.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Input: da9052_tsi: remove unnecessary worker 2015-02-06 11:05 ` [PATCH v2] " Michael Grzeschik @ 2015-02-06 23:24 ` Dmitry Torokhov 2015-02-06 23:41 ` Michael Grzeschik 0 siblings, 1 reply; 7+ messages in thread From: Dmitry Torokhov @ 2015-02-06 23:24 UTC (permalink / raw) To: Michael Grzeschik; +Cc: linux-input, support.opensource, kernel On Fri, Feb 06, 2015 at 12:05:48PM +0100, Michael Grzeschik wrote: > With the datardy irq we get the information if the > pen got pulled from the screen. This patch changes > the irq by checking this condition every time instead > of triggering the worker. > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> > --- > v1 -> v2: - removed adc_on variable > - added locking for irq switch > - event reporting in ts_read and irq switchover in datardy_irq > drivers/input/touchscreen/da9052_tsi.c | 119 +++++++++++++++++---------------- > 1 file changed, 62 insertions(+), 57 deletions(-) > > diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c > index 5a013bb..c28cfee 100644 > --- a/drivers/input/touchscreen/da9052_tsi.c > +++ b/drivers/input/touchscreen/da9052_tsi.c > @@ -22,19 +22,24 @@ > > #define TSI_PEN_DOWN_STATUS 0x40 > > +#define TSI_PEN_UP 1 > + > struct da9052_tsi { > struct da9052 *da9052; > struct input_dev *dev; > - struct delayed_work ts_pen_work; > struct mutex mutex; > + spinlock_t *lock; I am gonna go out on a limb and say that you did not test it. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Input: da9052_tsi: remove unnecessary worker 2015-02-06 23:24 ` Dmitry Torokhov @ 2015-02-06 23:41 ` Michael Grzeschik 2015-02-06 23:54 ` Dmitry Torokhov 0 siblings, 1 reply; 7+ messages in thread From: Michael Grzeschik @ 2015-02-06 23:41 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: support.opensource, kernel, linux-input On Fri, Feb 06, 2015 at 03:24:48PM -0800, Dmitry Torokhov wrote: > On Fri, Feb 06, 2015 at 12:05:48PM +0100, Michael Grzeschik wrote: > > With the datardy irq we get the information if the > > pen got pulled from the screen. This patch changes > > the irq by checking this condition every time instead > > of triggering the worker. > > > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> > > --- > > v1 -> v2: - removed adc_on variable > > - added locking for irq switch > > - event reporting in ts_read and irq switchover in datardy_irq > > drivers/input/touchscreen/da9052_tsi.c | 119 +++++++++++++++++---------------- > > 1 file changed, 62 insertions(+), 57 deletions(-) > > > > diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c > > index 5a013bb..c28cfee 100644 > > --- a/drivers/input/touchscreen/da9052_tsi.c > > +++ b/drivers/input/touchscreen/da9052_tsi.c > > @@ -22,19 +22,24 @@ > > > > #define TSI_PEN_DOWN_STATUS 0x40 > > > > +#define TSI_PEN_UP 1 > > + > > struct da9052_tsi { > > struct da9052 *da9052; > > struct input_dev *dev; > > - struct delayed_work ts_pen_work; > > struct mutex mutex; > > + spinlock_t *lock; > > I am gonna go out on a limb and say that you did not test it. I was testing exactly this. It seems i did miss that pointer and it still worked. Beside that, do you think it would be better to split the patch up? Regards, Michael -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] Input: da9052_tsi: remove unnecessary worker 2015-02-06 23:41 ` Michael Grzeschik @ 2015-02-06 23:54 ` Dmitry Torokhov 0 siblings, 0 replies; 7+ messages in thread From: Dmitry Torokhov @ 2015-02-06 23:54 UTC (permalink / raw) To: Michael Grzeschik; +Cc: support.opensource, kernel, linux-input On Sat, Feb 07, 2015 at 12:41:24AM +0100, Michael Grzeschik wrote: > On Fri, Feb 06, 2015 at 03:24:48PM -0800, Dmitry Torokhov wrote: > > On Fri, Feb 06, 2015 at 12:05:48PM +0100, Michael Grzeschik wrote: > > > With the datardy irq we get the information if the > > > pen got pulled from the screen. This patch changes > > > the irq by checking this condition every time instead > > > of triggering the worker. > > > > > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> > > > --- > > > v1 -> v2: - removed adc_on variable > > > - added locking for irq switch > > > - event reporting in ts_read and irq switchover in datardy_irq > > > drivers/input/touchscreen/da9052_tsi.c | 119 +++++++++++++++++---------------- > > > 1 file changed, 62 insertions(+), 57 deletions(-) > > > > > > diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c > > > index 5a013bb..c28cfee 100644 > > > --- a/drivers/input/touchscreen/da9052_tsi.c > > > +++ b/drivers/input/touchscreen/da9052_tsi.c > > > @@ -22,19 +22,24 @@ > > > > > > #define TSI_PEN_DOWN_STATUS 0x40 > > > > > > +#define TSI_PEN_UP 1 > > > + > > > struct da9052_tsi { > > > struct da9052 *da9052; > > > struct input_dev *dev; > > > - struct delayed_work ts_pen_work; > > > struct mutex mutex; > > > + spinlock_t *lock; > > > > I am gonna go out on a limb and say that you did not test it. > > I was testing exactly this. It seems i did miss that pointer and it > still worked. That makes me worried even more - that pointer should have been NULL and you should have been getting very low address fault when you try to spin_lock_init(NULL) - so what exactly have you tested? Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-02-06 23:55 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-01-18 15:36 [PATCH] Input: da9052_tsi: remove unnecessary worker Michael Grzeschik 2015-01-20 7:21 ` Dmitry Torokhov 2015-01-20 11:04 ` Michael Grzeschik 2015-02-06 11:05 ` [PATCH v2] " Michael Grzeschik 2015-02-06 23:24 ` Dmitry Torokhov 2015-02-06 23:41 ` Michael Grzeschik 2015-02-06 23:54 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).