input: touchscreen: mainstone: sync with zylonite driver

The two drivers are almost identical and can work on a variety
of hardware in principle. The mainstone driver supports additional
hardware, and the zylonite driver has a few cleanup patches.

Sync the two by adding the zylonite changes into the mainstone
one, and checking for the zylonite board to order to keep the
default behavior (interrupt enabled) there.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2019-09-12 10:57:54 +02:00
parent bb628a6eb1
commit 7b8a0b90b6

View File

@ -24,9 +24,9 @@
#include <linux/gpio/consumer.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/wm97xx.h>
#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/soc/pxa/cpu.h>
#include <linux/wm97xx.h>
#include <mach/regs-ac97.h>
@ -42,23 +42,22 @@ struct continuous {
#define WM_READS(sp) ((sp / HZ) + 1)
static const struct continuous cinfo[] = {
{WM9705_ID2, 0, WM_READS(94), 94},
{WM9705_ID2, 1, WM_READS(188), 188},
{WM9705_ID2, 2, WM_READS(375), 375},
{WM9705_ID2, 3, WM_READS(750), 750},
{WM9712_ID2, 0, WM_READS(94), 94},
{WM9712_ID2, 1, WM_READS(188), 188},
{WM9712_ID2, 2, WM_READS(375), 375},
{WM9712_ID2, 3, WM_READS(750), 750},
{WM9713_ID2, 0, WM_READS(94), 94},
{WM9713_ID2, 1, WM_READS(120), 120},
{WM9713_ID2, 2, WM_READS(154), 154},
{WM9713_ID2, 3, WM_READS(188), 188},
{ WM9705_ID2, 0, WM_READS(94), 94 },
{ WM9705_ID2, 1, WM_READS(188), 188 },
{ WM9705_ID2, 2, WM_READS(375), 375 },
{ WM9705_ID2, 3, WM_READS(750), 750 },
{ WM9712_ID2, 0, WM_READS(94), 94 },
{ WM9712_ID2, 1, WM_READS(188), 188 },
{ WM9712_ID2, 2, WM_READS(375), 375 },
{ WM9712_ID2, 3, WM_READS(750), 750 },
{ WM9713_ID2, 0, WM_READS(94), 94 },
{ WM9713_ID2, 1, WM_READS(120), 120 },
{ WM9713_ID2, 2, WM_READS(154), 154 },
{ WM9713_ID2, 3, WM_READS(188), 188 },
};
/* continuous speed index */
static int sp_idx;
static u16 last, tries;
static struct gpio_desc *gpiod_irq;
/*
@ -102,7 +101,7 @@ static void wm97xx_acc_pen_up(struct wm97xx *wm)
{
unsigned int count;
schedule_timeout_uninterruptible(1);
msleep(1);
if (cpu_is_pxa27x()) {
while (MISR & (1 << 2))
@ -117,13 +116,14 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm)
{
u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES;
int reads = 0;
static u16 last, tries;
/* When the AC97 queue has been drained we need to allow time
* to buffer up samples otherwise we end up spinning polling
* for samples. The controller can't have a suitably low
* threshold set to use the notifications it gives.
*/
schedule_timeout_uninterruptible(1);
msleep(1);
if (tries > 5) {
tries = 0;
@ -193,6 +193,8 @@ static int wm97xx_acc_startup(struct wm97xx *wm)
/* There is some obscure mutant of WM9712 interbred with WM9713
* used on Palm HW */
wm->variant = WM97xx_WM1613;
} else if (machine_is_zylonite()) {
pen_int = 1;
}
if (pen_int) {
@ -274,6 +276,7 @@ static int mainstone_wm97xx_remove(struct platform_device *pdev)
struct wm97xx *wm = platform_get_drvdata(pdev);
wm97xx_unregister_mach_ops(wm);
return 0;
}