Commit 99fde513 authored by Marek Vasut's avatar Marek Vasut Committed by Dmitry Torokhov

Input: wm97xx - add possibility to control the GPIO_STATUS shift

This patch allows tweaking the behaviour of GPIO_STATUS register
shift quirk that's in wm97xx-core. The problem with GPIO_STATUS
register being shifted by one doesn't appear on all hardware it
seems and causes problems with accelerated touchscreen drivers on
Palm hardware. Therefore an accelerated touchscreen driver can select
if the shift is/isn't happening on the hardware.
Signed-off-by: default avatarMarek Vasut <marek.vasut@gmail.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent b833306f
...@@ -198,6 +198,9 @@ static int wm97xx_acc_startup(struct wm97xx *wm) ...@@ -198,6 +198,9 @@ static int wm97xx_acc_startup(struct wm97xx *wm)
if (machine_is_palmt5() || machine_is_palmtx() || machine_is_palmld()) { if (machine_is_palmt5() || machine_is_palmtx() || machine_is_palmld()) {
pen_int = 1; pen_int = 1;
irq = 27; irq = 27;
/* There is some obscure mutant of WM9712 interbred with WM9713
* used on Palm HW */
wm->variant = WM97xx_WM1613;
} else if (machine_is_mainstone() && pen_int) } else if (machine_is_mainstone() && pen_int)
irq = 4; irq = 4;
......
...@@ -204,7 +204,7 @@ void wm97xx_set_gpio(struct wm97xx *wm, u32 gpio, ...@@ -204,7 +204,7 @@ void wm97xx_set_gpio(struct wm97xx *wm, u32 gpio,
else else
reg &= ~gpio; reg &= ~gpio;
if (wm->id == WM9712_ID2) if (wm->id == WM9712_ID2 && wm->variant != WM97xx_WM1613)
wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg << 1); wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg << 1);
else else
wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg); wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg);
...@@ -307,7 +307,7 @@ static void wm97xx_pen_irq_worker(struct work_struct *work) ...@@ -307,7 +307,7 @@ static void wm97xx_pen_irq_worker(struct work_struct *work)
WM97XX_GPIO_13); WM97XX_GPIO_13);
} }
if (wm->id == WM9712_ID2) if (wm->id == WM9712_ID2 && wm->variant != WM97xx_WM1613)
wm97xx_reg_write(wm, AC97_GPIO_STATUS, (status & wm97xx_reg_write(wm, AC97_GPIO_STATUS, (status &
~WM97XX_GPIO_13) << 1); ~WM97XX_GPIO_13) << 1);
else else
...@@ -582,6 +582,8 @@ static int wm97xx_probe(struct device *dev) ...@@ -582,6 +582,8 @@ static int wm97xx_probe(struct device *dev)
wm->id = wm97xx_reg_read(wm, AC97_VENDOR_ID2); wm->id = wm97xx_reg_read(wm, AC97_VENDOR_ID2);
wm->variant = WM97xx_GENERIC;
dev_info(wm->dev, "detected a wm97%02x codec\n", wm->id & 0xff); dev_info(wm->dev, "detected a wm97%02x codec\n", wm->id & 0xff);
switch (wm->id & 0xff) { switch (wm->id & 0xff) {
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
#include <linux/input.h> /* Input device layer */ #include <linux/input.h> /* Input device layer */
#include <linux/platform_device.h> #include <linux/platform_device.h>
/*
* WM97xx variants
*/
#define WM97xx_GENERIC 0x0000
#define WM97xx_WM1613 0x1613
/* /*
* WM97xx AC97 Touchscreen registers * WM97xx AC97 Touchscreen registers
*/ */
...@@ -283,6 +289,7 @@ struct wm97xx { ...@@ -283,6 +289,7 @@ struct wm97xx {
unsigned pen_is_down:1; /* Pen is down */ unsigned pen_is_down:1; /* Pen is down */
unsigned aux_waiting:1; /* aux measurement waiting */ unsigned aux_waiting:1; /* aux measurement waiting */
unsigned pen_probably_down:1; /* used in polling mode */ unsigned pen_probably_down:1; /* used in polling mode */
u16 variant; /* WM97xx chip variant */
u16 suspend_mode; /* PRP in suspend mode */ u16 suspend_mode; /* PRP in suspend mode */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment