WM97xx updates
cover WM97xx updates
This patch series updates the review feedback from the first round and rolls in the additional patches from Mike Rapoport. I've not addressed any of the comments for the at32 driver since I have no ability to test any changes to that driver but repost it for completeness.
Hans-Christian Egtvedt (1):
Input: add wm97xx accelerated driver for AVR32 AT32AP700X microprocessors
Mark Brown (2):
Input: Use disable_irq_nosync() for Mainstone
Input: Accelerated touchscreen support for Marvell Zylonite
Mike Rapoport (2):
Input: wm97xx: add BTN_TOUCH event to wm97xx to use it with Android
Input: add BTN_TOUCH event
drivers/input/touchscreen/Kconfig | 28 ++ drivers/input/touchscreen/Makefile | 2 + drivers/input/touchscreen/at32-wm97xx.c | 416 ++++++++++++++++++++++++++ drivers/input/touchscreen/at32-wm97xx.h | 48 +++ drivers/input/touchscreen/mainstone-wm97xx.c | 3 +- drivers/input/touchscreen/ucb1400_ts.c | 5 +- drivers/input/touchscreen/wm97xx-core.c | 4 + drivers/input/touchscreen/zylonite-wm97xx.c | 239 +++++++++++++++ 8 files changed, 743 insertions(+), 2 deletions(-) create mode 100644 drivers/input/touchscreen/at32-wm97xx.c create mode 100644 drivers/input/touchscreen/at32-wm97xx.h create mode 100644 drivers/input/touchscreen/zylonite-wm97xx.c
PATCH 1/5 Input: wm97xx: add BTN_TOUCH event to wm97xx to use it with Android
From: Mike Rapoport <[email protected]>
Please CC me, I'm not subscribed to linux-input
Android expects BTN_TOUCH events when pen state changes. Add BTN_TOUCH event reporting to allow use of wm97xx touchscreen controller wiht Android devices.
--- drivers/input/touchscreen/wm97xx-core.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/input/touchscreen/wm97xx-core.c +4 -0
@@ -409,6 +409,7 @@ static int wm97xx_read_samples(struct wm97xx *wm) wm->pen_is_down =0 ;dev_dbg (wm->dev,"pen up\n" );input_report_abs (wm->input_dev,ABS_PRESSURE ,0 ); +input_report_key (wm->input_dev,BTN_TOUCH ,0 );input_sync (wm->input_dev); }else if (!(rc &RC_AGAIN )) {/* We need high frequency updates only while
@@ -433,6 +434,7 @@ static int wm97xx_read_samples(struct wm97xx *wm)input_report_abs (wm->input_dev,ABS_X , data.x &0xfff );input_report_abs (wm->input_dev,ABS_Y , data.y &0xfff );input_report_abs (wm->input_dev,ABS_PRESSURE , data.p &0xfff ); +input_report_key (wm->input_dev,BTN_TOUCH ,1 );input_sync (wm->input_dev); wm->pen_is_down =1 ; wm->ts_reader_interval = wm->ts_reader_min_interval;
@@ -629,9 +631,11 @@ static int wm97xx_probe(struct device *dev) wm->input_dev->open = wm97xx_ts_input_open; wm->input_dev->close = wm97xx_ts_input_close;set_bit (EV_ABS , wm->input_dev->evbit); +set_bit (EV_KEY , wm->input_dev->evbit);set_bit (ABS_X , wm->input_dev->absbit);set_bit (ABS_Y , wm->input_dev->absbit);set_bit (ABS_PRESSURE , wm->input_dev->absbit); +set_bit (BTN_TOUCH , wm->input_dev->keybit);input_set_abs_params (wm->input_dev,ABS_X , abs_x[0 ], abs_x[1 ], abs_x[2 ],0 ); input_set_abs_params(wm->input_dev, ABS_Y, abs_y[0], abs_y[1],
Signature · 1 line
1.6.1.3
PATCH 2/5 Input: add BTN_TOUCH event
From: Mike Rapoport <[email protected]>
Add BTN_TOUCH event reporting to ucb1400_ts and accelerated mainstone-wm97xx touchscreen drivers. Together with previously posted similar patch for wm97xx-core this will make all touchscreen drivers behave consistently wrt. BTN_TOUCH.
--- drivers/input/touchscreen/mainstone-wm97xx.c | 1 + drivers/input/touchscreen/ucb1400_ts.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletions(-)
drivers/input/touchscreen/mainstone-wm97xx.c +1 -0
@@ -162,6 +162,7 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)input_report_abs (wm->input_dev,ABS_X , x &0xfff );input_report_abs (wm->input_dev,ABS_Y , y &0xfff );input_report_abs (wm->input_dev,ABS_PRESSURE , p &0xfff ); +input_report_key (wm->input_dev,BTN_TOUCH , (p !=0 ));input_sync (wm->input_dev); reads++; }while (reads < cinfo[sp_idx].reads);
drivers/input/touchscreen/ucb1400_ts.c +4 -1
@@ -151,12 +151,14 @@ static void ucb1400_ts_evt_add(struct input_dev *idev, u16 pressure, u16 x, u16input_report_abs (idev,ABS_X , x);input_report_abs (idev,ABS_Y , y);input_report_abs (idev,ABS_PRESSURE , pressure); +input_report_key (idev,BTN_TOUCH ,1 );input_sync (idev); }static void ucb1400_ts_event_release (struct input_dev *idev) {input_report_abs (idev,ABS_PRESSURE ,0 ); +input_report_key (idev,BTN_TOUCH ,0 );input_sync (idev); }
@@ -377,7 +379,8 @@ static int ucb1400_ts_probe(struct platform_device *dev) ucb->ts_idev->id.product = ucb->id; ucb->ts_idev->open = ucb1400_ts_open; ucb->ts_idev->close = ucb1400_ts_close; - ucb->ts_idev->evbit[0 ] =BIT_MASK (EV_ABS ); + ucb->ts_idev->evbit[0 ] =BIT_MASK (EV_ABS ) |BIT_MASK (EV_KEY ); + ucb->ts_idev->keybit[BIT_WORD (BTN_TOUCH )] =BIT_MASK (BTN_TOUCH );ucb1400_adc_enable (ucb->ac97); x_res =ucb1400_ts_read_xres (ucb);
Signature · 1 line
1.6.1.3
PATCH 3/5 Input: Use disable_irq_nosync() for Mainstone
This should make no practical difference since the Mainstone can't be SMP but it is more correct.
--- drivers/input/touchscreen/mainstone-wm97xx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/input/touchscreen/mainstone-wm97xx.c +1 -1
@@ -246,7 +246,7 @@ static void wm97xx_irq_enable(struct wm97xx *wm, int enable)if (enable)enable_irq (wm->pen_irq);else -disable_irq (wm->pen_irq); +disable_irq_nosync (wm->pen_irq); }static struct wm97xx_mach_ops mainstone_mach_ops = {
Signature · 1 line
1.6.1.3
PATCH 4/5 Input: Accelerated touchscreen support for Marvell Zylonite
This patch implements accelerated touchscreen support for the Marvell Zylonite development platform, supporting pen down interrupts and continuous mode data transfers.
---
Changes since last posting to correct code review issues, primarily:
- Use disable_irq_nosync().
- Rewrite pen up MODR drain loop for clarity & correctness.
- Fixed permissions for pressure module parameter.
- Don't use schedule_timeout_uninterruptilbe()
drivers/input/touchscreen/Kconfig | 13 ++ drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/zylonite-wm97xx.c | 239 +++++++++++++++++++++++++++ 3 files changed, 253 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/zylonite-wm97xx.c
drivers/input/touchscreen/Kconfig +13 -0
@@ -308,6 +308,19 @@ config TOUCHSCREEN_WM97XX_MAINSTONE To compile this driver as a module, choose M here: the module will be called mainstone-wm97xx. +config TOUCHSCREEN_WM97XX_ZYLONITE + tristate "Zylonite accelerated touch" + depends on TOUCHSCREEN_WM97XX && MACH_ZYLONITE + select TOUCHSCREEN_WM9713 + help + Say Y here for support for streaming mode with the touchscreen + on Zylonite systems. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called zylonite-wm97xx. + config TOUCHSCREEN_USB_COMPOSITE tristate "USB Touchscreen Driver" depends on USB_ARCH_HAS_HCD
drivers/input/touchscreen/Makefile +1 -0
@@ -34,3 +34,4 @@ wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o +obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o
drivers/input/touchscreen/zylonite-wm97xx.c new file +239 -0
239 lines not on this page · raw message
Signature · 1 line
1.6.1.3
PATCH 5/5 Input: add wm97xx accelerated driver for AVR32 AT32AP700X microprocessors
From: Hans-Christian Egtvedt <[email protected]>
This patch adds an accelerated driver for Atmel AVR32 AT32AP700X microprocessors. It uses interrupts on the channel B in the AC97 controller. Thus, offloading the work queue in the wm97xx-ts driver.
The driver has been tested with Atmel AVR32 AT32AP7000 and Wolfson WM9712 codec.
--- drivers/input/touchscreen/Kconfig | 15 ++ drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/at32-wm97xx.c | 416 +++++++++++++++++++++++++++++++ drivers/input/touchscreen/at32-wm97xx.h | 48 ++++ 4 files changed, 480 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/at32-wm97xx.c create mode 100644 drivers/input/touchscreen/at32-wm97xx.h
drivers/input/touchscreen/Kconfig +15 -0
@@ -296,6 +296,21 @@ config TOUCHSCREEN_WM9713 Say Y here to enable support for the Wolfson Microelectronics WM9713 touchscreen controller. +config TOUCHSCREEN_WM97XX_AT32 + tristate "WM97xx Atmel AVR32 accelerated touch" + depends on TOUCHSCREEN_WM97XX && AVR32 + help + Say Y here for support for streaming mode with WM97xx touchscreens on + Atmel AVR32 systems with an AC97 controller. + + Be aware that this will use channel B in the controller for streaming + data, this must not conflict with other AC97 drivers. + + If unsure, say N. + + To compile this driver as a module, choose M here: the module will be + called at32-wm97xx. + config TOUCHSCREEN_WM97XX_MAINSTONE tristate "WM97xx Mainstone accelerated touch" depends on TOUCHSCREEN_WM97XX && ARCH_PXA
drivers/input/touchscreen/Makefile +1 -0
@@ -33,5 +33,6 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o +obj-$(CONFIG_TOUCHSCREEN_WM97XX_AT32) += at32-wm97xx.o obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o
drivers/input/touchscreen/at32-wm97xx.c new file +416 -0
416 lines not on this page · raw message
drivers/input/touchscreen/at32-wm97xx.h new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
1.6.1.3
Re: [PATCH 5/5] Input: add wm97xx accelerated driver for AVR32 AT32AP700X microprocessors
drivers/input/touchscreen/at32-wm97xx.c line 122
Quoted 6 lines · Mark Brown
drivers/input/touchscreen/at32-wm97xx.c new file +6
-0+static irqreturn_t at32_wm97xx_channel_b_interrupt (int irq,void *dev_id) +{ +struct at32_wm97xx *at32_wm97xx = dev_id; +struct wm97xx *wm = at32_wm97xx->wm; +int status =ac97c_readl (at32_wm97xx,CBSR ); +int retval =IRQ_NONE ;
Just a nit, irqreturn_t will become enum one day AFAIK. Use irqreturn_t which is guaranteed to be the proper type instead. This rather a suggestion for followup fixup.
Quoted 16 lines
drivers/input/touchscreen/at32-wm97xx.c new file +16
-0+static int __init at32_wm97xx_probe (struct platform_device *pdev) +{ +struct wm97xx *wm =platform_get_drvdata (pdev); +struct at32_wm97xx *at32_wm97xx; +int ret; + + at32_wm97xx =kzalloc (sizeof (struct at32_wm97xx ),GFP_KERNEL ); +if (!at32_wm97xx) { +dev_dbg (&pdev->dev,"out of memory\n" ); +return -ENOMEM ; + } + + at32_wm97xx->wm = wm; + at32_wm97xx->regs = (void *)AT32_WM97XX_AC97C_IOMEM ; + at32_wm97xx->ac97c_irq =AT32_WM97XX_AC97C_IRQ ; + at32_wm97xx->gpio_pen = at32_gpio_line;
drivers/input/touchscreen/at32-wm97xx.c line 341
Quoted 10 lines
drivers/input/touchscreen/at32-wm97xx.c new file +10
-0+ at32_wm97xx->gpio_irq =gpio_to_irq (at32_wm97xx->gpio_pen); + +setup_timer (&at32_wm97xx->pen_timer, at32_wm97xx_pen_timer, + (unsigned long )at32_wm97xx); + + ret =request_irq (at32_wm97xx->ac97c_irq, + at32_wm97xx_channel_b_interrupt, +IRQF_SHARED ,"at32-wm97xx-ch-b" , at32_wm97xx); +if (ret) { +dev_dbg (&pdev->dev,"could not request ac97c irq\n" );
at32_wm97xx leak. I didn't notice last time.
drivers/input/touchscreen/at32-wm97xx.c
Quoted 6 lines
drivers/input/touchscreen/at32-wm97xx.c new file +6
-0+return ret; + } + +platform_set_drvdata (pdev, at32_wm97xx); + +return wm97xx_register_mach_ops (wm,&at32_mach_ops);
On failure, this will still "leak" irq, I suppose this is what you referred as "fix later" in 0/5.
Dmitry Torokhov
maintainerHi Mark,
Quoted 5 lines · Mark Brown
This patch series updates the review feedback from the first round and rolls in the additional patches from Mike Rapoport. I've not addressed any of the comments for the at32 driver since I have no ability to test any changes to that driver but repost it for completeness.
I applied first 4 patches to 'next' and will wait for Hans-Christian comments on the at32 driver.
Thanks!
Signature · 1 line
Dmitry
Quoted 10 lines · Dmitry Torokhov
Quoted 5 lines · Mark Brown
This patch series updates the review feedback from the first round and rolls in the additional patches from Mike Rapoport. I've not addressed any of the comments for the at32 driver since I have no ability to test any changes to that driver but repost it for completeness.
I applied first 4 patches to 'next' and will wait for Hans-Christian comments on the at32 driver.
The only thing catched by review was a leaking irq line, do you plan to fixup that Mark?
I also think the header file could go into the source code, to make it one file less.
Also, please note that I've gotten a new email address. The old one is quite annoying since it sends email back about my new address...
I'll not be able to test the driver immediately, my hardware is out at customers and the eight new prototypes needs some resoldering before I can work with them. Nothing has changed in hardware though, so it should fly out of the box.
Signature · 2 lines
Best regards, Hans-Christian Egtvedt
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Mark Brown
Quoted 1 line · Hans-Christian Egtvedt
The only thing catched by review was a leaking irq line, do you plan to fixup that Mark?
Jiri also had some further comments from the initial posting (mail attached). I can probably try to fix up most things blind but I'll need to at least set up an at32 toolchain to build test. The workqueue thing might be better to test on hardware, though, just in case there's some noticable performance impact. I wouldn't expect so but it'd be safer.
I'll see what I can manage to squeeze in of testing, there is always the in-between-time.
What is this patch based against? Linus tree, master branch?
Signature · 2 lines
Best regards, Hans-Christian Egtvedt
Quoted 1 line · Hans-Christian Egtvedt
What is this patch based against? Linus tree, master branch?
This branch:
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
(though the noticable differences should be Makefile and Kconfig ones).
Quoted 7 lines · On Wed, 04 Mar 2009 12:29:03 +0100 Hans-Christian Egtvedt…
Quoted 6 lines · Mark Brown
Quoted 2 lines · Hans-Christian Egtvedt
The only thing catched by review was a leaking irq line, do you plan to fixup that Mark?
I fixed that in the attached patch, along with using an irqreturn_t instead of an int for the return value from the interrupt handler.
Quoted 11 lines
Quoted 7 lines
Jiri also had some further comments from the initial posting (mail attached). I can probably try to fix up most things blind but I'll need to at least set up an at32 toolchain to build test. The workqueue thing might be better to test on hardware, though, just in case there's some noticable performance impact. I wouldn't expect so but it'd be safer.
I'll see what I can manage to squeeze in of testing, there is always the in-between-time.
Please see attached patch. A bit unsure if I should have done an incremental instead. Mark?
I also made the driver more generic, as it should work fine on AT91 devices as well. AT91 and AVR32 share the same AC97C module.
Quoted 2 lines
What is this patch based against? Linus tree, master branch?
This is against my master branch, but it managed to accept the original patch so I guess it should go okay the other way as well. Sorry for the inconvenience.
Signature · 2 lines
Best regards, Hans-Christian Egtvedt
Quoted 1 line
From
ff36d7c4ed71901b745eaf8b104c59a13a00374fMon Sep 17 00:00:00 2001
From: Hans-Christian Egtvedt <[email protected]>
Date: Mon, 9 Mar 2009 16:39:42 +0100
Subject: [PATCH v2 1/1] Input: add wm97xx accelerated driver for Atmel microprocessors
This patch adds an accelerated driver for Atmel AVR32 AT32AP700X microprocessors. It uses interrupts on the channel B in the AC97 controller. Thus, offloading the work queue in the wm97xx-ts driver.
The driver has been tested with Atmel AVR32 AT32AP7000 and Wolfson WM9712 codec.
The driver can also be easily modified to support Atmel AT91 devices, as AT91 and AVR32 share the same AC97C module.
--- drivers/input/touchscreen/Kconfig | 15 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/atmel-wm97xx.c | 450 ++++++++++++++++++++++++++++++ 3 files changed, 466 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/atmel-wm97xx.c
drivers/input/touchscreen/Kconfig +15 -0
@@ -296,6 +296,21 @@ config TOUCHSCREEN_WM9713 Say Y here to enable support for the Wolfson Microelectronics WM9713 touchscreen controller. +config TOUCHSCREEN_WM97XX_ATMEL + tristate "WM97xx Atmel accelerated touch" + depends on TOUCHSCREEN_WM97XX && (AVR32 || ARCH_AT91) + help + Say Y here for support for streaming mode with WM97xx touchscreens + on Atmel AT91 or AVR32 systems with an AC97C module. + + Be aware that this will use channel B in the controller for + streaming data, this must not conflict with other AC97C drivers. + + If unsure, say N. + + To compile this driver as a module, choose M here: the module will + be called atmel-wm97xx. + config TOUCHSCREEN_WM97XX_MAINSTONE tristate "WM97xx Mainstone accelerated touch" depends on TOUCHSCREEN_WM97XX && ARCH_PXA
drivers/input/touchscreen/Makefile +1 -0
@@ -33,4 +33,5 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o +obj-$(CONFIG_TOUCHSCREEN_WM97XX_ATMEL) += atmel-wm97xx.o obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o
drivers/input/touchscreen/atmel-wm97xx.c new file +450 -0
450 lines not on this page · raw message
Signature · 1 line
1.5.6.3
Quoted 1 line · Hans-Christian Egtvedt
Please see attached patch.
Note that atmel_wm97xx struct still leaks on atmel_wm97xx_probe fail paths.