Re: [PATCH 1/6] Core driver for WM97xx touchscreens

2008-02-13 Thread Mark Brown
On Tue, Feb 12, 2008 at 10:58:50PM +, Dmitry Baryshkov wrote:

> You used platform_device_register, but should be using platform_device_add,
> otherwise you get barfs with 2.6.25-rc1 (device is initialized twice). Also

Thanks for that.  I feel like I should knock up a patch to clarify the
platform API documentation here.

> as  got deprecated there is no point including it.

Indeed - this is bit rot due to the age of the driver.  Hopefully it
will make it into at least 2.6.26.

BTW, could you please keep at least me in the CC list when discussing
these patches?  It's easy to miss things on the lists and they're one of
the first things I stop reading when I'm busy.
-
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/6] Core driver for WM97xx touchscreens

2008-02-13 Thread Dmitry
Hi,

2008/2/13, Mark Brown <[EMAIL PROTECTED]>:
> On Tue, Feb 12, 2008 at 10:58:50PM +, Dmitry Baryshkov wrote:
>
> > You used platform_device_register, but should be using platform_device_add,
> > otherwise you get barfs with 2.6.25-rc1 (device is initialized twice). Also
>
> Thanks for that.  I feel like I should knock up a patch to clarify the
> platform API documentation here.

:)

> > as  got deprecated there is no point including it.
>
> Indeed - this is bit rot due to the age of the driver.  Hopefully it
> will make it into at least 2.6.26.

Hope so too. It  should be in the mainline since long ago.

> BTW, could you please keep at least me in the CC list when discussing
> these patches?  It's easy to miss things on the lists and they're one of
> the first things I stop reading when I'm busy.

Sorry. I often reply to the patchserie via gmane and it doesn't honour
non-ml addresses.

-- 
With best wishes
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] hid, 2.6.23 - add support for new macbook and apple aluminum keyboard "fn" key

2008-02-13 Thread Tobias Müller

Jiri Kosina schrieb:
Some part of the patch is already in 2.6.25-rc1 -- please see commit 
a45d82d19a6c2a717bcc33cff243199b77fa0082, which adds support for Apple 
Aluminium keyboards. So the patch would need some changes that it would 
apply on top of current tree.

It seems there is almost everything implemented except for some product ids.

Also, Tobias (added to CC) seems to be currently working on adding support 
for a subset of keyboards that this patch adds. Tobias -- it seems like 
this patch is handling a superset of what your patch does, right?

Yes

It would be great if you could put this all together into one condensated 
patch which I could merge into my tree.

I'm working on that, but I found a problem in the new 2.6.25-rc1 code.

Until 2.6.24 hidinput_apple_event which handles the apple specials was called by
hidinput_hid_event and if hidinput_apple_event changed some code, 
hidinput_hid_event
returned and didn't send any events.

In 2.6.25 hidinput_apple_event is called in hidinput_event_quirks which is called by 
hidinput_hid_event. But if hidinput_event_quirks sent events, hidinput_hid_event doesn't

know of this and send the events too! So if I press some keys on my keyboard, 
there are
2 keycodes sent.

This seems to be a greater change in 2.6.25 and I don't want to change this, 
because I think
someone made this change for some good reason.

Regards
 Tobias


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PATCH] hid, 2.6.23 - add support for new macbook and apple aluminum keyboard "fn" key

2008-02-13 Thread Jiri Kosina
On Wed, 13 Feb 2008, Tobias Müller wrote:

> In 2.6.25 hidinput_apple_event is called in hidinput_event_quirks which 
> is called by hidinput_hid_event. But if hidinput_event_quirks sent 
> events, hidinput_hid_event doesn't know of this and send the events too! 
> So if I press some keys on my keyboard, there are 2 keycodes sent.

Hi Tobias,

yes, this is a bug, for which I already have fix in my tree -- see 
http://git.kernel.org/?p=linux/kernel/git/jikos/hid.git;a=commit;h=68a1f2cc8676f22a6fd49f344f99e326eb7f5117

This restores the previous behavior. I just haven't pushed this to Linus 
yet.

-- 
Jiri Kosina
SUSE Labs

[UPDATED v7] WM97xx touchscreen drivers

2008-02-13 Thread Mark Brown
This patch series adds support for the touchscreen controllers provided
by Wolfson Microelectronics WM97xx series chips in both polled and
streaming modes.  The series can also be pulled via git from:

git://opensource.wolfsonmicro.com/linux-2.6-touch upstream

This version:
 - Has been rebased against v2.6.25-rc1
 - Fixes usage of the platform API to avoid double registration of the
   battery and touch devices.
 - Removes the use of the obsolete sound/driver.h.
-
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] Build system and MAINTAINERS entry for WM97xx touchscreen drivers

2008-02-13 Thread Mark Brown
Signed-off-by: Mark Brown <[EMAIL PROTECTED]>
Signed-off-by: Liam Girdwood <[EMAIL PROTECTED]>
---
 MAINTAINERS|   10 +++
 drivers/input/touchscreen/Kconfig  |   52 
 drivers/input/touchscreen/Makefile |7 +
 3 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index c40f0ae..6799406 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4317,6 +4317,16 @@ L:   [EMAIL PROTECTED]
 W: http://oops.ghostprotocols.net:81/blog
 S: Maintained
 
+WM97XX TOUCHSCREEN DRIVERS
+P: Mark Brown
+M: [EMAIL PROTECTED]
+P: Liam Girdwood
+M: [EMAIL PROTECTED]
+L: linux-input@vger.kernel.org
+T: git git://opensource.wolfsonmicro.com/linux-2.6-touch
+W: http://opensource.wolfsonmicro.com/node/7
+S: Supported
+
 X.25 NETWORK LAYER
 P: Henner Eisen
 M: [EMAIL PROTECTED]
diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index 90e8e92..0be05a2 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -158,6 +158,58 @@ config TOUCHSCREEN_TOUCHRIGHT
  To compile this driver as a module, choose M here: the
  module will be called touchright.
 
+config TOUCHSCREEN_WM97XX
+   tristate "Support for WM97xx AC97 touchscreen controllers"
+   depends on AC97_BUS
+
+config TOUCHSCREEN_WM9705
+   bool "WM9705 Touchscreen interface support"
+   depends on TOUCHSCREEN_WM97XX
+   help
+ Say Y here if you have a Wolfson Microelectronics WM9705 touchscreen
+ controller connected to your system.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called wm9705.
+
+config TOUCHSCREEN_WM9712
+   bool "WM9712 Touchscreen interface support"
+   depends on TOUCHSCREEN_WM97XX
+   help
+ Say Y here if you have a Wolfson Microelectronics WM9712 touchscreen
+ controller connected to your system.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called wm9712.
+
+config TOUCHSCREEN_WM9713
+   bool "WM9713 Touchscreen interface support"
+   depends on TOUCHSCREEN_WM97XX
+   help
+ Say Y here if you have a Wolfson Microelectronics WM9713 touchscreen
+ controller connected to your system.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called wm9713.
+
+config TOUCHSCREEN_WM97XX_MAINSTONE
+   tristate "WM97xx Mainstone accelerated touch"
+   depends on TOUCHSCREEN_WM97XX && ARCH_PXA
+   help
+ Say Y here for support for streaming mode with WM97xx touchscreens
+ on Mainstone systems.
+
+ If unsure, say N
+
+ To compile this driver as a module, choose M here: the
+ module will be called mainstone-wm97xx
+
 config TOUCHSCREEN_TOUCHWIN
tristate "Touchwin serial touchscreen"
select SERIO
diff --git a/drivers/input/touchscreen/Makefile 
b/drivers/input/touchscreen/Makefile
index 35d4097..d38156e 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -4,6 +4,8 @@
 
 # Each configuration option enables a list of files.
 
+wm97xx-ts-y := wm97xx-core.o
+
 obj-$(CONFIG_TOUCHSCREEN_ADS7846)  += ads7846.o
 obj-$(CONFIG_TOUCHSCREEN_BITSY)+= h3600_ts_input.o
 obj-$(CONFIG_TOUCHSCREEN_CORGI)+= corgi_ts.o
@@ -19,3 +21,8 @@ obj-$(CONFIG_TOUCHSCREEN_PENMOUNT)+= penmount.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT)   += touchright.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
 obj-$(CONFIG_TOUCHSCREEN_UCB1400)  += ucb1400_ts.o
+obj-$(CONFIG_TOUCHSCREEN_WM97XX)   += wm97xx-ts.o
+obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o
+wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705)  += wm9705.o
+wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712)  += wm9712.o
+wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713)  += wm9713.o
-- 
1.5.4.1

-
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] Add chip driver for WM9705 touchscreen

2008-02-13 Thread Mark Brown
Signed-off-by: Liam Girdwood <[EMAIL PROTECTED]>
Signed-off-by: Graeme Gregory <[EMAIL PROTECTED]>
Signed-off-by: Mike Arthur <[EMAIL PROTECTED]>
Signed-off-by: Mark Brown <[EMAIL PROTECTED]>
Cc: Dmitry Baryshkov <[EMAIL PROTECTED]>
Cc: Stanley Cai <[EMAIL PROTECTED]>
Cc: Rodolfo Giometti <[EMAIL PROTECTED]>
Cc: Russell King <[EMAIL PROTECTED]>
Cc: Marc Kleine-Budde <[EMAIL PROTECTED]>
Cc: Pete MacKay <[EMAIL PROTECTED]>
Cc: Ian Molton <[EMAIL PROTECTED]>
Cc: Vince Sanders <[EMAIL PROTECTED]>
Cc: Andrew Zabolotny <[EMAIL PROTECTED]>
---
 drivers/input/touchscreen/wm9705.c |  352 
 1 files changed, 352 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/wm9705.c

diff --git a/drivers/input/touchscreen/wm9705.c 
b/drivers/input/touchscreen/wm9705.c
new file mode 100644
index 000..f185104
--- /dev/null
+++ b/drivers/input/touchscreen/wm9705.c
@@ -0,0 +1,352 @@
+/*
+ * wm9705.c  --  Codec driver for Wolfson WM9705 AC97 Codec.
+ *
+ * Copyright 2003, 2004, 2005, 2006, 2007 Wolfson Microelectronics PLC.
+ * Author: Liam Girdwood
+ * [EMAIL PROTECTED] or [EMAIL PROTECTED]
+ * Parts Copyright : Ian Molton <[EMAIL PROTECTED]>
+ *   Andrew Zabolotny <[EMAIL PROTECTED]>
+ *   Russell King <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define TS_NAME"wm97xx"
+#define WM9705_VERSION "0.62"
+#define DEFAULT_PRESSURE   0xb0c0
+
+/*
+ * Module parameters
+ */
+
+/*
+ * Set current used for pressure measurement.
+ *
+ * Set pil = 2 to use 400uA
+ * pil = 1 to use 200uA and
+ * pil = 0 to disable pressure measurement.
+ *
+ * This is used to increase the range of values returned by the adc
+ * when measureing touchpanel pressure.
+ */
+static int pil;
+module_param(pil, int, 0);
+MODULE_PARM_DESC(pil, "Set current used for pressure measurement.");
+
+/*
+ * Set threshold for pressure measurement.
+ *
+ * Pen down pressure below threshold is ignored.
+ */
+static int pressure = DEFAULT_PRESSURE & 0xfff;
+module_param(pressure, int, 0);
+MODULE_PARM_DESC(pressure, "Set threshold for pressure measurement.");
+
+/*
+ * Set adc sample delay.
+ *
+ * For accurate touchpanel measurements, some settling time may be
+ * required between the switch matrix applying a voltage across the
+ * touchpanel plate and the ADC sampling the signal.
+ *
+ * This delay can be set by setting delay = n, where n is the array
+ * position of the delay in the array delay_table below.
+ * Long delays > 1ms are supported for completeness, but are not
+ * recommended.
+ */
+static int delay = 4;
+module_param(delay, int, 0);
+MODULE_PARM_DESC(delay, "Set adc sample delay.");
+
+/*
+ * Pen detect comparator threshold.
+ *
+ * 0 to Vmid in 15 steps, 0 = use zero power comparator with Vmid threshold
+ * i.e. 1 =  Vmid/15 threshold
+ *  15 =  Vmid/1 threshold
+ *
+ * Adjust this value if you are having problems with pen detect not
+ * detecting any down events.
+ */
+static int pdd = 8;
+module_param(pdd, int, 0);
+MODULE_PARM_DESC(pdd, "Set pen detect comparator threshold");
+
+/*
+ * Set adc mask function.
+ *
+ * Sources of glitch noise, such as signals driving an LCD display, may feed
+ * through to the touch screen plates and affect measurement accuracy. In
+ * order to minimise this, a signal may be applied to the MASK pin to delay or
+ * synchronise the sampling.
+ *
+ * 0 = No delay or sync
+ * 1 = High on pin stops conversions
+ * 2 = Edge triggered, edge on pin delays conversion by delay param (above)
+ * 3 = Edge triggered, edge on pin starts conversion after delay param
+ */
+static int mask;
+module_param(mask, int, 0);
+MODULE_PARM_DESC(mask, "Set adc mask function.");
+
+/*
+ * ADC sample delay times in uS
+ */
+static const int delay_table[] = {
+   21,/* 1 AC97 Link frames */
+   42,/* 2  */
+   84,/* 4  */
+   167,   /* 8  */
+   333,   /* 16 */
+   667,   /* 32 */
+   1000,  /* 48 */
+   1333,  /* 64 */
+   2000,  /* 96 */
+   2667,  /* 128*/
+   ,  /* 160*/
+   4000,  /* 192*/
+   4667,  /* 224*/
+   5333,  /* 256*/
+   6000,  /* 288*/
+   0  /* No delay, switch matrix always on */
+};
+
+/*
+ * Delay after issuing a POLL command.
+ *
+ * The delay is 3 AC97 link frames + the touchpanel settling delay
+ */
+static inline void poll_delay(int d)
+{
+

[PATCH 5/6] Driver for WM97xx touchscreens in streaming mode on Mainstone

2008-02-13 Thread Mark Brown
Signed-off-by: Liam Girdwood <[EMAIL PROTECTED]>
Signed-off-by: Graeme Gregory <[EMAIL PROTECTED]>
Signed-off-by: Mike Arthur <[EMAIL PROTECTED]>
Signed-off-by: Mark Brown <[EMAIL PROTECTED]>
Cc: Dmitry Baryshkov <[EMAIL PROTECTED]>
Cc: Stanley Cai <[EMAIL PROTECTED]>
Cc: Rodolfo Giometti <[EMAIL PROTECTED]>
Cc: Russell King <[EMAIL PROTECTED]>
Cc: Marc Kleine-Budde <[EMAIL PROTECTED]>
Cc: Pete MacKay <[EMAIL PROTECTED]>
Cc: Ian Molton <[EMAIL PROTECTED]>
Cc: Vince Sanders <[EMAIL PROTECTED]>
Cc: Andrew Zabolotny <[EMAIL PROTECTED]>
---
 drivers/input/touchscreen/mainstone-wm97xx.c |  298 ++
 1 files changed, 298 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/mainstone-wm97xx.c

diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c 
b/drivers/input/touchscreen/mainstone-wm97xx.c
new file mode 100644
index 000..8e1c35d
--- /dev/null
+++ b/drivers/input/touchscreen/mainstone-wm97xx.c
@@ -0,0 +1,298 @@
+/*
+ * mainstone-wm97xx.c  --  Mainstone Continuous Touch screen driver for
+ * Wolfson WM97xx AC97 Codecs.
+ *
+ * Copyright 2004, 2007 Wolfson Microelectronics PLC.
+ * Author: Liam Girdwood
+ * [EMAIL PROTECTED] or [EMAIL PROTECTED]
+ * Parts Copyright : Ian Molton <[EMAIL PROTECTED]>
+ *   Andrew Zabolotny <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ *
+ * Notes:
+ * This is a wm97xx extended touch driver to capture touch
+ * data in a continuous manner on the Intel XScale archictecture
+ *
+ *  Features:
+ *   - codecs supported:- WM9705, WM9712, WM9713
+ *   - processors supported:- Intel XScale PXA25x, PXA26x, PXA27x
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define VERSION"0.13"
+
+struct continuous {
+   u16 id;/* codec id */
+   u8 code;   /* continuous code */
+   u8 reads;  /* number of coord reads per read cycle */
+   u32 speed; /* number of coords per second */
+};
+
+#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},
+};
+
+/* continuous speed index */
+static int sp_idx;
+static u16 last, tries;
+
+/*
+ * Pen sampling frequency (Hz) in continuous mode.
+ */
+static int cont_rate = 200;
+module_param(cont_rate, int, 0);
+MODULE_PARM_DESC(cont_rate, "Sampling rate in continuous mode (Hz)");
+
+/*
+ * Pen down detection.
+ *
+ * This driver can either poll or use an interrupt to indicate a pen down
+ * event. If the irq request fails then it will fall back to polling mode.
+ */
+static int pen_int;
+module_param(pen_int, int, 0);
+MODULE_PARM_DESC(pen_int, "Pen down detection (1 = interrupt, 0 = polling)");
+
+/*
+ * Pressure readback.
+ *
+ * Set to 1 to read back pen down pressure
+ */
+static int pressure;
+module_param(pressure, int, 0);
+MODULE_PARM_DESC(pressure, "Pressure readback (1 = pressure, 0 = no 
pressure)");
+
+/*
+ * AC97 touch data slot.
+ *
+ * Touch screen readback data ac97 slot
+ */
+static int ac97_touch_slot = 5;
+module_param(ac97_touch_slot, int, 0);
+MODULE_PARM_DESC(ac97_touch_slot, "Touch screen data slot AC97 number");
+
+
+/* flush AC97 slot 5 FIFO on pxa machines */
+#ifdef CONFIG_PXA27x
+static void wm97xx_acc_pen_up(struct wm97xx *wm)
+{
+   set_current_state(TASK_INTERRUPTIBLE);
+   schedule_timeout(1);
+
+   while (MISR & (1 << 2))
+   MODR;
+}
+#else
+static void wm97xx_acc_pen_up(struct wm97xx *wm)
+{
+   int count = 16;
+   set_current_state(TASK_INTERRUPTIBLE);
+   schedule_timeout(1);
+
+   while (count < 16) {
+   MODR;
+   count--;
+   }
+}
+#endif
+
+static int wm97xx_acc_pen_down(struct wm97xx *wm)
+{
+   u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES;
+   int reads = 0;
+
+   /* data is never immediately available after pen down irq */
+   set_current_state(TASK_INTERRUPTIBLE);
+   schedule_timeout(1);
+
+   if (tries > 5) {
+   tries = 0;
+   return RC_PENUP;
+   }
+
+   x = MODR;
+   if (x == last) {
+   tries++;
+   return RC_AGAIN;
+   }
+   last = x;

[PATCH 4/6] Add chip driver for WM9713 touchscreen

2008-02-13 Thread Mark Brown
Signed-off-by: Liam Girdwood <[EMAIL PROTECTED]>
Signed-off-by: Graeme Gregory <[EMAIL PROTECTED]>
Signed-off-by: Mike Arthur <[EMAIL PROTECTED]>
Signed-off-by: Mark Brown <[EMAIL PROTECTED]>
Cc: Dmitry Baryshkov <[EMAIL PROTECTED]>
Cc: Stanley Cai <[EMAIL PROTECTED]>
Cc: Rodolfo Giometti <[EMAIL PROTECTED]>
Cc: Russell King <[EMAIL PROTECTED]>
Cc: Marc Kleine-Budde <[EMAIL PROTECTED]>
Cc: Pete MacKay <[EMAIL PROTECTED]>
Cc: Ian Molton <[EMAIL PROTECTED]>
Cc: Vince Sanders <[EMAIL PROTECTED]>
Cc: Andrew Zabolotny <[EMAIL PROTECTED]>
---
 drivers/input/touchscreen/wm9713.c |  459 
 1 files changed, 459 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/wm9713.c

diff --git a/drivers/input/touchscreen/wm9713.c 
b/drivers/input/touchscreen/wm9713.c
new file mode 100644
index 000..5067e59
--- /dev/null
+++ b/drivers/input/touchscreen/wm9713.c
@@ -0,0 +1,459 @@
+/*
+ * wm9713.c  --  Codec touch driver for Wolfson WM9713 AC97 Codec.
+ *
+ * Copyright 2003, 2004, 2005, 2006, 2007, 2008 Wolfson Microelectronics PLC.
+ * Author: Liam Girdwood
+ * [EMAIL PROTECTED] or [EMAIL PROTECTED]
+ * Parts Copyright : Ian Molton <[EMAIL PROTECTED]>
+ *   Andrew Zabolotny <[EMAIL PROTECTED]>
+ *   Russell King <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define TS_NAME"wm97xx"
+#define WM9713_VERSION "0.53"
+#define DEFAULT_PRESSURE   0xb0c0
+
+/*
+ * Module parameters
+ */
+
+/*
+ * Set internal pull up for pen detect.
+ *
+ * Pull up is in the range 1.02k (least sensitive) to 64k (most sensitive)
+ * i.e. pull up resistance = 64k Ohms / rpu.
+ *
+ * Adjust this value if you are having problems with pen detect not
+ * detecting any down event.
+ */
+static int rpu = 8;
+module_param(rpu, int, 0);
+MODULE_PARM_DESC(rpu, "Set internal pull up resitor for pen detect.");
+
+/*
+ * Set current used for pressure measurement.
+ *
+ * Set pil = 2 to use 400uA
+ * pil = 1 to use 200uA and
+ * pil = 0 to disable pressure measurement.
+ *
+ * This is used to increase the range of values returned by the adc
+ * when measureing touchpanel pressure.
+ */
+static int pil;
+module_param(pil, int, 0);
+MODULE_PARM_DESC(pil, "Set current used for pressure measurement.");
+
+/*
+ * Set threshold for pressure measurement.
+ *
+ * Pen down pressure below threshold is ignored.
+ */
+static int pressure = DEFAULT_PRESSURE & 0xfff;
+module_param(pressure, int, 0);
+MODULE_PARM_DESC(pressure, "Set threshold for pressure measurement.");
+
+/*
+ * Set adc sample delay.
+ *
+ * For accurate touchpanel measurements, some settling time may be
+ * required between the switch matrix applying a voltage across the
+ * touchpanel plate and the ADC sampling the signal.
+ *
+ * This delay can be set by setting delay = n, where n is the array
+ * position of the delay in the array delay_table below.
+ * Long delays > 1ms are supported for completeness, but are not
+ * recommended.
+ */
+static int delay = 4;
+module_param(delay, int, 0);
+MODULE_PARM_DESC(delay, "Set adc sample delay.");
+
+/*
+ * Set adc mask function.
+ *
+ * Sources of glitch noise, such as signals driving an LCD display, may feed
+ * through to the touch screen plates and affect measurement accuracy. In
+ * order to minimise this, a signal may be applied to the MASK pin to delay or
+ * synchronise the sampling.
+ *
+ * 0 = No delay or sync
+ * 1 = High on pin stops conversions
+ * 2 = Edge triggered, edge on pin delays conversion by delay param (above)
+ * 3 = Edge triggered, edge on pin starts conversion after delay param
+ */
+static int mask;
+module_param(mask, int, 0);
+MODULE_PARM_DESC(mask, "Set adc mask function.");
+
+/*
+ * Coordinate Polling Enable.
+ *
+ * Set to 1 to enable coordinate polling. e.g. x,y[,p] is sampled together
+ * for every poll.
+ */
+static int coord;
+module_param(coord, int, 0);
+MODULE_PARM_DESC(coord, "Polling coordinate mode");
+
+/*
+ * ADC sample delay times in uS
+ */
+static const int delay_table[] = {
+   21,/* 1 AC97 Link frames */
+   42,/* 2 */
+   84,/* 4 */
+   167,   /* 8 */
+   333,   /* 16 */
+   667,   /* 32 */
+   1000,  /* 48 */
+   1333,  /* 64 */
+   2000,  /* 96 */
+   2667,  /* 128 */
+   ,  /* 160 */
+   4000,  /* 192 */
+   4667,  /* 224 */
+   5333,  /* 256 */
+   6000,  /* 288 */
+   0  /* No delay, switch matrix always on */
+};
+
+/*
+ * Delay after issuing a POLL command.
+ *
+ * The delay is 3 AC97 link frames + the touchpanel settling delay
+ */
+static inline

[PATCH 3/6] Add chip driver for WM9712 touchscreen

2008-02-13 Thread Mark Brown
Signed-off-by: Liam Girdwood <[EMAIL PROTECTED]>
Signed-off-by: Graeme Gregory <[EMAIL PROTECTED]>
Signed-off-by: Mike Arthur <[EMAIL PROTECTED]>
Signed-off-by: Mark Brown <[EMAIL PROTECTED]>
Cc: Dmitry Baryshkov <[EMAIL PROTECTED]>
Cc: Stanley Cai <[EMAIL PROTECTED]>
Cc: Rodolfo Giometti <[EMAIL PROTECTED]>
Cc: Russell King <[EMAIL PROTECTED]>
Cc: Marc Kleine-Budde <[EMAIL PROTECTED]>
Cc: Pete MacKay <[EMAIL PROTECTED]>
Cc: Ian Molton <[EMAIL PROTECTED]>
Cc: Vince Sanders <[EMAIL PROTECTED]>
Cc: Andrew Zabolotny <[EMAIL PROTECTED]>
---
 drivers/input/touchscreen/wm9712.c |  461 
 1 files changed, 461 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/wm9712.c

diff --git a/drivers/input/touchscreen/wm9712.c 
b/drivers/input/touchscreen/wm9712.c
new file mode 100644
index 000..eaab326
--- /dev/null
+++ b/drivers/input/touchscreen/wm9712.c
@@ -0,0 +1,461 @@
+/*
+ * wm9712.c  --  Codec driver for Wolfson WM9712 AC97 Codecs.
+ *
+ * Copyright 2003, 2004, 2005, 2006, 2007 Wolfson Microelectronics PLC.
+ * Author: Liam Girdwood
+ * [EMAIL PROTECTED] or [EMAIL PROTECTED]
+ * Parts Copyright : Ian Molton <[EMAIL PROTECTED]>
+ *   Andrew Zabolotny <[EMAIL PROTECTED]>
+ *   Russell King <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define TS_NAME"wm97xx"
+#define WM9712_VERSION "0.61"
+#define DEFAULT_PRESSURE   0xb0c0
+
+/*
+ * Module parameters
+ */
+
+/*
+ * Set internal pull up for pen detect.
+ *
+ * Pull up is in the range 1.02k (least sensitive) to 64k (most sensitive)
+ * i.e. pull up resistance = 64k Ohms / rpu.
+ *
+ * Adjust this value if you are having problems with pen detect not
+ * detecting any down event.
+ */
+static int rpu = 8;
+module_param(rpu, int, 0);
+MODULE_PARM_DESC(rpu, "Set internal pull up resitor for pen detect.");
+
+/*
+ * Set current used for pressure measurement.
+ *
+ * Set pil = 2 to use 400uA
+ * pil = 1 to use 200uA and
+ * pil = 0 to disable pressure measurement.
+ *
+ * This is used to increase the range of values returned by the adc
+ * when measureing touchpanel pressure.
+ */
+static int pil;
+module_param(pil, int, 0);
+MODULE_PARM_DESC(pil, "Set current used for pressure measurement.");
+
+/*
+ * Set threshold for pressure measurement.
+ *
+ * Pen down pressure below threshold is ignored.
+ */
+static int pressure = DEFAULT_PRESSURE & 0xfff;
+module_param(pressure, int, 0);
+MODULE_PARM_DESC(pressure, "Set threshold for pressure measurement.");
+
+/*
+ * Set adc sample delay.
+ *
+ * For accurate touchpanel measurements, some settling time may be
+ * required between the switch matrix applying a voltage across the
+ * touchpanel plate and the ADC sampling the signal.
+ *
+ * This delay can be set by setting delay = n, where n is the array
+ * position of the delay in the array delay_table below.
+ * Long delays > 1ms are supported for completeness, but are not
+ * recommended.
+ */
+static int delay = 3;
+module_param(delay, int, 0);
+MODULE_PARM_DESC(delay, "Set adc sample delay.");
+
+/*
+ * Set five_wire = 1 to use a 5 wire touchscreen.
+ *
+ * NOTE: Five wire mode does not allow for readback of pressure.
+ */
+static int five_wire;
+module_param(five_wire, int, 0);
+MODULE_PARM_DESC(five_wire, "Set to '1' to use 5-wire touchscreen.");
+
+/*
+ * Set adc mask function.
+ *
+ * Sources of glitch noise, such as signals driving an LCD display, may feed
+ * through to the touch screen plates and affect measurement accuracy. In
+ * order to minimise this, a signal may be applied to the MASK pin to delay or
+ * synchronise the sampling.
+ *
+ * 0 = No delay or sync
+ * 1 = High on pin stops conversions
+ * 2 = Edge triggered, edge on pin delays conversion by delay param (above)
+ * 3 = Edge triggered, edge on pin starts conversion after delay param
+ */
+static int mask;
+module_param(mask, int, 0);
+MODULE_PARM_DESC(mask, "Set adc mask function.");
+
+/*
+ * Coordinate Polling Enable.
+ *
+ * Set to 1 to enable coordinate polling. e.g. x,y[,p] is sampled together
+ * for every poll.
+ */
+static int coord;
+module_param(coord, int, 0);
+MODULE_PARM_DESC(coord, "Polling coordinate mode");
+
+/*
+ * ADC sample delay times in uS
+ */
+static const int delay_table[] = {
+   21,/* 1 AC97 Link frames */
+   42,/* 2 */
+   84,/* 4 */
+   167,   /* 8 */
+   333,   /* 16 */
+   667,   /* 32 */
+   1000,  /* 48 */
+   1333,  /* 64 */
+   2000,  /* 96 */
+   2667,  /* 128 */
+   ,  /* 160 */
+   4000,  /* 192 */
+   4667,  /* 224 

[PATCH 1/6] Core driver for WM97xx touchscreens

2008-02-13 Thread Mark Brown
This patch series adds support for the touchscreen controllers provided
by Wolfson Microelectronics WM97xx series chips in both polled and
streaming modes.

These drivers have been maintained out of tree since 2003.  During that
time the driver the primary maintainer was Liam Girdwood and a number of
people have made contributions including Dmitry Baryshkov, Stanley Cai,
Rodolfo Giometti, Russell King, Marc Kleine-Budde, Ian Molton, Vincent
Sanders, Andrew Zabolotny, Graeme Gregory, Mike Arthur and myself.
Apologies to anyone I have omitted.

Signed-off-by: Liam Girdwood <[EMAIL PROTECTED]>
Signed-off-by: Graeme Gregory <[EMAIL PROTECTED]>
Signed-off-by: Mike Arthur <[EMAIL PROTECTED]>
Signed-off-by: Mark Brown <[EMAIL PROTECTED]>
Cc: Dmitry Baryshkov <[EMAIL PROTECTED]>
Cc: Stanley Cai <[EMAIL PROTECTED]>
Cc: Rodolfo Giometti <[EMAIL PROTECTED]>
Cc: Russell King <[EMAIL PROTECTED]>
Cc: Pete MacKay <[EMAIL PROTECTED]>
Cc: Marc Kleine-Budde <[EMAIL PROTECTED]>
Cc: Ian Molton <[EMAIL PROTECTED]>
Cc: Vincent Sanders <[EMAIL PROTECTED]>
Cc: Andrew Zabolotny <[EMAIL PROTECTED]>
---
 drivers/input/touchscreen/wm97xx-core.c |  731 +++
 include/linux/wm97xx.h  |  308 +
 2 files changed, 1039 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/wm97xx-core.c
 create mode 100644 include/linux/wm97xx.h

diff --git a/drivers/input/touchscreen/wm97xx-core.c 
b/drivers/input/touchscreen/wm97xx-core.c
new file mode 100644
index 000..84d9dc5
--- /dev/null
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -0,0 +1,731 @@
+/*
+ * wm97xx-core.c  --  Touch screen driver core for Wolfson WM9705, WM9712
+ *and WM9713 AC97 Codecs.
+ *
+ * Copyright 2003, 2004, 2005, 2006, 2007, 2008 Wolfson Microelectronics PLC.
+ * Author: Liam Girdwood
+ * [EMAIL PROTECTED] or [EMAIL PROTECTED]
+ * Parts Copyright : Ian Molton <[EMAIL PROTECTED]>
+ *   Andrew Zabolotny <[EMAIL PROTECTED]>
+ *   Russell King <[EMAIL PROTECTED]>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ *
+ * Notes:
+ *
+ *  Features:
+ *   - supports WM9705, WM9712, WM9713
+ *   - polling mode
+ *   - continuous mode (arch-dependent)
+ *   - adjustable rpu/dpp settings
+ *   - adjustable pressure current
+ *   - adjustable sample settle delay
+ *   - 4 and 5 wire touchscreens (5 wire is WM9712 only)
+ *   - pen down detection
+ *   - battery monitor
+ *   - sample AUX adcs
+ *   - power management
+ *   - codec GPIO
+ *   - codec event notification
+ * Todo
+ *   - Support for async sampling control for noisy LCDs.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define TS_NAME"wm97xx"
+#define WM_CORE_VERSION"1.00"
+#define DEFAULT_PRESSURE   0xb0c0
+
+
+/*
+ * Touchscreen absolute values
+ *
+ * These parameters are used to help the input layer discard out of
+ * range readings and reduce jitter etc.
+ *
+ *   o min, max:- indicate the min and max values your touch screen returns
+ *   o fuzz:- use a higher number to reduce jitter
+ *
+ * The default values correspond to Mainstone II in QVGA mode
+ *
+ * Please read
+ * Documentation/input/input-programming.txt for more details.
+ */
+
+static int abs_x[3] = {350, 3900, 5};
+module_param_array(abs_x, int, NULL, 0);
+MODULE_PARM_DESC(abs_x, "Touchscreen absolute X min, max, fuzz");
+
+static int abs_y[3] = {320, 3750, 40};
+module_param_array(abs_y, int, NULL, 0);
+MODULE_PARM_DESC(abs_y, "Touchscreen absolute Y min, max, fuzz");
+
+static int abs_p[3] = {0, 150, 4};
+module_param_array(abs_p, int, NULL, 0);
+MODULE_PARM_DESC(abs_p, "Touchscreen absolute Pressure min, max, fuzz");
+
+/*
+ * wm97xx IO access, all IO locking done by AC97 layer
+ */
+int wm97xx_reg_read(struct wm97xx *wm, u16 reg)
+{
+   if (wm->ac97)
+   return wm->ac97->bus->ops->read(wm->ac97, reg);
+   else
+   return -1;
+}
+EXPORT_SYMBOL_GPL(wm97xx_reg_read);
+
+void wm97xx_reg_write(struct wm97xx *wm, u16 reg, u16 val)
+{
+   /* cache digitiser registers */
+   if (reg >= AC97_WM9713_DIG1 && reg <= AC97_WM9713_DIG3)
+   wm->dig[(reg - AC97_WM9713_DIG1) >> 1] = val;
+
+   /* cache gpio regs */
+   if (reg >= AC97_GPIO_CFG && reg <= AC97_MISC_AFE)
+   wm->gpio[(reg - AC97_GPIO_CFG) >> 1] = val;
+
+   /* wm9713 irq reg */
+   if (reg == 0x5a)
+   wm->misc = val;
+
+   if (wm->ac97)
+   wm->ac97->bus->ops->write(wm->ac97, reg, val);
+}
+EXPORT_SYMBOL_GPL(wm97xx_re

[PATCH 1/2] driver for Zhen Hua PCM-4CH RC transmitter

2008-02-13 Thread Kmarty
Hi,
this is a driver for Zhen Hua PCM-4CH RC transmitter (commonly used in
cheap Ready To Fly RC helicopters) which using "Zhen Hua 5-byte
protocol" for using them as a four axis joystick via serial port.

Transmitter connected to serial port (19200 8N1) sending periodically
5 bytes where first byte is for synchronization and next four bytes
are values of axis.

Signed-off-by: Martin Kebert <[EMAIL PROTECTED]>
---
 drivers/input/joystick/Kconfig   |   12 +
 drivers/input/joystick/Makefile  |1
 drivers/input/joystick/zhenhua.c |  243 +++
 include/linux/serio.h|1
 4 files changed, 257 insertions(+)

diff -uprN -X linux-2.6.24-vanilla/Documentation/dontdiff
linux-2.6.24-vanilla/drivers/input/joystick/Kconfig
linux-2.6.24-zhenhua/drivers/input/joystick/Kconfig
--- linux-2.6.24-vanilla/drivers/input/joystick/Kconfig 2008-01-24
23:58:37.0 +0100
+++ linux-2.6.24-zhenhua/drivers/input/joystick/Kconfig 2008-02-08
22:48:34.0 +0100
@@ -193,6 +193,18 @@ config JOYSTICK_TWIDJOY
  To compile this driver as a module, choose M here: the
  module will be called twidjoy.

+config JOYSTICK_ZHENHUA
+   tristate "5-byte Zhenhua RC transmitter"
+   select SERIO
+   help
+ Say Y here if you have a Zhen Hua PCM-4CH transmitter which is
+ supplied with a ready to fly micro electric indoor helicopters
+ such as EasyCopter, Lama, MiniCopter, DragonFly or Jabo and want
+ to use it via serial cable as a joystick.
+
+ To compile this driver as a module, choose M here: the
+ module will be called zhenhua.
+
 config JOYSTICK_DB9
tristate "Multisystem, Sega Genesis, Saturn joysticks and gamepads"
depends on PARPORT
diff -uprN -X linux-2.6.24-vanilla/Documentation/dontdiff
linux-2.6.24-vanilla/drivers/input/joystick/Makefile
linux-2.6.24-zhenhua/drivers/input/joystick/Makefile
--- linux-2.6.24-vanilla/drivers/input/joystick/Makefile
2008-01-24 23:58:37.0 +0100
+++ linux-2.6.24-zhenhua/drivers/input/joystick/Makefile
2008-02-08 19:45:36.0 +0100
@@ -27,5 +27,6 @@ obj-$(CONFIG_JOYSTICK_TURBOGRAFX) += tur
 obj-$(CONFIG_JOYSTICK_TWIDJOY) += twidjoy.o
 obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o
 obj-$(CONFIG_JOYSTICK_XPAD)+= xpad.o
+obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o

 obj-$(CONFIG_JOYSTICK_IFORCE)  += iforce/
diff -uprN -X linux-2.6.24-vanilla/Documentation/dontdiff
linux-2.6.24-vanilla/drivers/input/joystick/zhenhua.c
linux-2.6.24-zhenhua/drivers/input/joystick/zhenhua.c
--- linux-2.6.24-vanilla/drivers/input/joystick/zhenhua.c
1970-01-01 01:00:00.0 +0100
+++ linux-2.6.24-zhenhua/drivers/input/joystick/zhenhua.c
2008-02-08 19:27:40.0 +0100
@@ -0,0 +1,243 @@
+/*
+ *  derived from "twidjoy.c"
+ *
+ *  Copyright (c) 2008 Martin Kebert
+ *  Copyright (c) 2001 Arndt Schoenewald
+ *  Copyright (c) 2000-2001 Vojtech Pavlik
+ *  Copyright (c) 2000 Mark Fletcher
+ *
+ */
+
+/*
+ * Driver to use 4CH RC transmitter using Zhen Hua 5-byte protocol
(Walkera Lama,
+ * EasyCopter etc.) as a joystick under Linux.
+ *
+ * RC transmitters using Zhen Hua 5-byte protocol are cheap four channels
+ * transmitters for control a RC planes or RC helicopters with possibility to
+ * connect on a serial port.
+ * Data coming from transmitter is in this order:
+ * 1. byte = synchronisation byte
+ * 2. byte = X axis
+ * 3. byte = Y axis
+ * 4. byte = RZ axis
+ * 5. byte = Z axis
+ * (and this is repeated)
+ *
+ * For questions or feedback regarding this driver module please contact:
+ * Martin Kebert <[EMAIL PROTECTED]> - but I am not a C-programmer nor kernel
+ * coder :-(
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_DESC"RC transmitter with 5-byte Zhen Hua protocol
joystick driver"
+
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
+
+/*
+ * Constants.
+ */
+
+#define ZHENHUA_MAX_LENGTH 5
+
+/*
+ * Zhen Hua data.
+ */
+
+struct zhenhua {
+   struct input_dev *dev;
+   int idx;
+   unsigned char data[ZHENHUA_MAX_LENGTH];
+   char phys[32];
+};
+
+
+/* bits in all incoming bytes needs to be "reversed" */
+static int zhenhua_bitrev

[PATCH 1/2] driver for Zhen Hua PCM-4CH RC transmitter v2

2008-02-13 Thread Kmarty
(again, now as attachments)

Hi,
this is a driver for Zhen Hua PCM-4CH RC transmitter (commonly used in
cheap Ready To Fly RC helicopters) which using "Zhen Hua 5-byte
protocol" for using them as a four axis joystick via serial port.

Transmitter connected to serial port (19200 8N1) sending periodically
5 bytes where first byte is for synchronization and next four bytes
are values of axis.


linux-2.6.24-zhenhua.diffstat
Description: Binary data
Signed-off-by: Martin Kebert <[EMAIL PROTECTED]>

diff -uprN -X linux-2.6.24-vanilla/Documentation/dontdiff linux-2.6.24-vanilla/drivers/input/joystick/Kconfig linux-2.6.24-zhenhua/drivers/input/joystick/Kconfig
--- linux-2.6.24-vanilla/drivers/input/joystick/Kconfig	2008-01-24 23:58:37.0 +0100
+++ linux-2.6.24-zhenhua/drivers/input/joystick/Kconfig	2008-02-08 22:48:34.0 +0100
@@ -193,6 +193,18 @@ config JOYSTICK_TWIDJOY
 	  To compile this driver as a module, choose M here: the
 	  module will be called twidjoy.
 
+config JOYSTICK_ZHENHUA
+	tristate "5-byte Zhenhua RC transmitter"
+	select SERIO
+	help
+	  Say Y here if you have a Zhen Hua PCM-4CH transmitter which is
+	  supplied with a ready to fly micro electric indoor helicopters
+	  such as EasyCopter, Lama, MiniCopter, DragonFly or Jabo and want
+	  to use it via serial cable as a joystick.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called zhenhua.
+
 config JOYSTICK_DB9
 	tristate "Multisystem, Sega Genesis, Saturn joysticks and gamepads"
 	depends on PARPORT
diff -uprN -X linux-2.6.24-vanilla/Documentation/dontdiff linux-2.6.24-vanilla/drivers/input/joystick/Makefile linux-2.6.24-zhenhua/drivers/input/joystick/Makefile
--- linux-2.6.24-vanilla/drivers/input/joystick/Makefile	2008-01-24 23:58:37.0 +0100
+++ linux-2.6.24-zhenhua/drivers/input/joystick/Makefile	2008-02-08 19:45:36.0 +0100
@@ -27,5 +27,6 @@ obj-$(CONFIG_JOYSTICK_TURBOGRAFX)	+= tur
 obj-$(CONFIG_JOYSTICK_TWIDJOY)		+= twidjoy.o
 obj-$(CONFIG_JOYSTICK_WARRIOR)		+= warrior.o
 obj-$(CONFIG_JOYSTICK_XPAD)		+= xpad.o
+obj-$(CONFIG_JOYSTICK_ZHENHUA)		+= zhenhua.o
 
 obj-$(CONFIG_JOYSTICK_IFORCE)		+= iforce/
diff -uprN -X linux-2.6.24-vanilla/Documentation/dontdiff linux-2.6.24-vanilla/drivers/input/joystick/zhenhua.c linux-2.6.24-zhenhua/drivers/input/joystick/zhenhua.c
--- linux-2.6.24-vanilla/drivers/input/joystick/zhenhua.c	1970-01-01 01:00:00.0 +0100
+++ linux-2.6.24-zhenhua/drivers/input/joystick/zhenhua.c	2008-02-08 19:27:40.0 +0100
@@ -0,0 +1,243 @@
+/*
+ *  derived from "twidjoy.c"
+ *
+ *  Copyright (c) 2008 Martin Kebert
+ *  Copyright (c) 2001 Arndt Schoenewald
+ *  Copyright (c) 2000-2001 Vojtech Pavlik
+ *  Copyright (c) 2000 Mark Fletcher
+ *
+ */
+
+/*
+ * Driver to use 4CH RC transmitter using Zhen Hua 5-byte protocol (Walkera Lama,
+ * EasyCopter etc.) as a joystick under Linux.
+ *
+ * RC transmitters using Zhen Hua 5-byte protocol are cheap four channels
+ * transmitters for control a RC planes or RC helicopters with possibility to
+ * connect on a serial port.
+ * Data coming from transmitter is in this order:
+ * 1. byte = synchronisation byte
+ * 2. byte = X axis
+ * 3. byte = Y axis
+ * 4. byte = RZ axis
+ * 5. byte = Z axis
+ * (and this is repeated)
+ *
+ * For questions or feedback regarding this driver module please contact:
+ * Martin Kebert <[EMAIL PROTECTED]> - but I am not a C-programmer nor kernel
+ * coder :-(
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_DESC	"RC transmitter with 5-byte Zhen Hua protocol joystick driver"
+
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
+
+/*
+ * Constants.
+ */
+
+#define ZHENHUA_MAX_LENGTH 5
+
+/*
+ * Zhen Hua data.
+ */
+
+struct zhenhua {
+	struct input_dev *dev;
+	int idx;
+	unsigned char data[ZHENHUA_MAX_LENGTH];
+	char phys[32];
+};
+
+
+/* bits in all incoming bytes needs to be "reversed" */
+static int zhenhua_bitreverse(int x)
+{
+	x = ((x & 0xaa) >> 1) | ((x & 0x55) << 1);
+	x = ((x & 0xcc) >> 2) | ((x & 0x33) << 2);
+	x = ((x & 0xf0) >> 4) | ((x & 0x0f) << 4);
+	return x;
+}
+
+/*
+ * zhenhua_process_packet() decodes packets the driver receives from the
+ * RC transmitter. It updates the data accordingly.
+ */
+
+s

Re: [PATCH] hid, 2.6.23 - add support for new macbook and apple aluminum keyboard "fn" key

2008-02-13 Thread Tobias Müller

Jiri Kosina schrieb:
> On Tue, 12 Fe
> It would be great if you could put this all together into one
> condensated patch which I could merge into my tree.

So, this is the updated version. It only adds some product-ids and
some keyboards mappings.

Regards
  Tobias
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 5325d98..6a100e2 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -97,10 +97,11 @@ struct hidinput_key_translation {
 #define APPLE_FLAG_FKEY 0x01

 static struct hidinput_key_translation apple_fn_keys[] = {
+   { KEY_BACKSPACE, KEY_DELETE },  /* 
Needed for MacBook keyboards without delete */
{ KEY_F1,   KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
{ KEY_F2,   KEY_BRIGHTNESSUP,   APPLE_FLAG_FKEY },
-   { KEY_F3,   KEY_CYCLEWINDOWS,   APPLE_FLAG_FKEY }, /* Exposé */
-   { KEY_F4,   KEY_FN_F4,  APPLE_FLAG_FKEY }, /* Dashboard 
*/
+   { KEY_F3,   KEY_CYCLEWINDOWS,   APPLE_FLAG_FKEY },  /* 
Exposé */
+   { KEY_F4,   KEY_FN_F4,  APPLE_FLAG_FKEY },  /* 
Dashboard */
{ KEY_F5,   KEY_FN_F5 },
{ KEY_F6,   KEY_FN_F6 },
{ KEY_F7,   KEY_BACK,   APPLE_FLAG_FKEY },
@@ -109,6 +110,10 @@ static struct hidinput_key_translation apple_fn_keys[] = {
{ KEY_F10,  KEY_MUTE,   APPLE_FLAG_FKEY },
{ KEY_F11,  KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
{ KEY_F12,  KEY_VOLUMEUP,   APPLE_FLAG_FKEY },
+   { KEY_UP,   KEY_PAGEUP },   /* 
Needed for MacBook keyboards without page-up */
+   { KEY_DOWN, KEY_PAGEDOWN }, /* 
Needed for MacBook keyboards without page-down */
+   { KEY_LEFT, KEY_HOME }, /* 
Needed for MacBook keyboards without home */
+   { KEY_RIGHT,KEY_END },  /* 
Needed for MacBook keyboards without end */
{ }
 };

diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index b77b61e..73a5aca 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -66,6 +66,12 @@
 #define USB_DEVICE_ID_APPLE_ALU_ANSI   0x0220
 #define USB_DEVICE_ID_APPLE_ALU_ISO0x0221
 #define USB_DEVICE_ID_APPLE_ALU_JIS0x0222
+#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI0x0229
+#define USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO 0x022a
+#define USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS 0x022b
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI  0x022c
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO   0x022d
+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS   0x022e
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY   0x030a
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY0x030b
 #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
@@ -593,6 +599,12 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, 
HID_QUIRK_APPLE_HAS_FN },
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, 
HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, 
HID_QUIRK_APPLE_HAS_FN },
+   { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, 
HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+   { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, 
HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
+   { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, 
HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+   { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, 
HID_QUIRK_APPLE_HAS_FN},
+   { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, 
HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD},
+   { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, 
HID_QUIRK_APPLE_HAS_FN},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, 
HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, 
HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },


smime.p7s
Description: S/MIME Cryptographic Signature


[PATCH 2/2] driver for Zhen Hua PCM-4CH RC transmitter v2

2008-02-13 Thread Kmarty
(again, now as attachments)

Patch for inputattach from joystick-utils.


inputattach.c.diffstat
Description: Binary data
--- inputattach.c.orig	2008-02-06 10:35:22.0 +0100
+++ inputattach.c	2008-02-13 15:49:48.0 +0100
@@ -1,5 +1,4 @@
 /*
- * $Id: inputattach.c 2352 2006-02-08 12:19:31Z vojtech $
  *
  *  Copyright (c) 1999-2000 Vojtech Pavlik
  *
@@ -315,6 +314,42 @@
 	return 0;
 }
 
+int zhenhua_init(int fd, long *id, long *extra)
+{
+	/* Zhen Hua 5 byte protokol: prvni (synchronizacni) byte obsahuje vzdy 0xF7,
+	 * nasledujici ctyri pak jednotlive osy ovladace v intervalu 50-200.
+	 * Pozor, nacitana data (jednotlive bajty) jsou bitove prevracene (nejnizsi
+	 * bit je nejvyssim bitem) - neco jako little-endian na bitove urovni.
+	 * Synchronizacni byte ma tedy bez prevraceni hodnotu 0xEF
+	 *
+	 * Inicializace je temer shodna s twiddlerem */
+
+	unsigned char c[10];
+	int count;
+
+	for (count=0 ; count < 5 ; count++) {
+		if(readchar(fd, c+0, 500)) return -1;
+		if(c[0] == 0xef) break;
+	}
+
+	if (count == 5) {
+		/* Could not find header byte in data stream */
+		return -1;
+	}
+
+	/* Read remaining 4 bytes plus the full next data packet */
+	for (count = 1; count < 10; count++) {
+		if (readchar(fd, c+count, 500)) return -1;
+	}
+
+	/* check if next sync byte exists */
+	if (c[5] != 0xef)
+		return -1;
+
+	return 0;
+		
+}
+
 int dump_init(int fd, long *id, long *extra)
 {
 	unsigned char c, o = 0;
@@ -376,6 +411,7 @@
 { "--elo4002",		"-elo6b",	B9600, CS8 | CRTSCTS,		SERIO_ELO,	1,	0,	0,	NULL },
 { "--elo271-140",	"-elo4b",	B9600, CS8 | CRTSCTS,		SERIO_ELO,	2,	0,	0,	NULL },
 { "--elo261-280",	"-elo3b",	B9600, CS8 | CRTSCTS,		SERIO_ELO,	3,	0,	0,	NULL },
+{ "--zhen-hua",		"-zhen",	B19200, CS8, 			SERIO_ZHENHUA,	0,	0,	0,	zhenhua_init },
 { "--dump",		"-dump",	B2400, CS8, 			0,		0,	0,	0,	dump_init },
 { "", "", 0, 0 }
 
@@ -416,6 +452,7 @@
 		puts("  --ps2serkbd -ps2ser PS/2 via serial keyboard");
 		puts("  --twiddler  -twid   Handykey Twiddler chording keyboard");
 		puts("  --twiddler-joy  -twidjoy  Handykey Twiddler used as a joystick");
+		puts("  --zhen-hua  -zhen  Zhen Hua 5-byte protocol");
 		puts("");
 return 1;
 }


[PATCH 2/2] driver for Zhen Hua PCM-4CH RC transmitter

2008-02-13 Thread Kmarty
Patch for inputattach from joystick-utils:
---
 inputattach.c |   39 ++-
 1 file changed, 38 insertions(+), 1 deletion(-)

--- inputattach.c.orig  2008-02-06 10:35:22.0 +0100
+++ inputattach.c   2008-02-13 15:49:48.0 +0100
@@ -1,5 +1,4 @@
 /*
- * $Id: inputattach.c 2352 2006-02-08 12:19:31Z vojtech $
  *
  *  Copyright (c) 1999-2000 Vojtech Pavlik
  *
@@ -315,6 +314,42 @@
return 0;
 }

+int zhenhua_init(int fd, long *id, long *extra)
+{
+   /* Zhen Hua 5 byte protokol: prvni (synchronizacni) byte
obsahuje vzdy 0xF7,
+* nasledujici ctyri pak jednotlive osy ovladace v intervalu 50-200.
+* Pozor, nacitana data (jednotlive bajty) jsou bitove
prevracene (nejnizsi
+* bit je nejvyssim bitem) - neco jako little-endian na bitove urovni.
+* Synchronizacni byte ma tedy bez prevraceni hodnotu 0xEF
+*
+* Inicializace je temer shodna s twiddlerem */
+
+   unsigned char c[10];
+   int count;
+
+   for (count=0 ; count < 5 ; count++) {
+   if(readchar(fd, c+0, 500)) return -1;
+   if(c[0] == 0xef) break;
+   }
+
+   if (count == 5) {
+   /* Could not find header byte in data stream */
+   return -1;
+   }
+
+   /* Read remaining 4 bytes plus the full next data packet */
+   for (count = 1; count < 10; count++) {
+   if (readchar(fd, c+count, 500)) return -1;
+   }
+
+   /* check if next sync byte exists */
+   if (c[5] != 0xef)
+   return -1;
+
+   return 0;
+
+}
+
 int dump_init(int fd, long *id, long *extra)
 {
unsigned char c, o = 0;
@@ -376,6 +411,7 @@
 { "--elo4002", "-elo6b",   B9600, CS8 | CRTSCTS,
 SERIO_ELO,  1,  0,  0,  NULL },
 { "--elo271-140",  "-elo4b",   B9600, CS8 | CRTSCTS,
 SERIO_ELO,  2,  0,  0,  NULL },
 { "--elo261-280",  "-elo3b",   B9600, CS8 | CRTSCTS,
 SERIO_ELO,  3,  0,  0,  NULL },
+{ "--zhen-hua","-zhen",B19200, CS8,
 SERIO_ZHENHUA,  0,  0,  0,  zhenhua_init },
 { "--dump","-dump",B2400, CS8,
 0,  0,  0,  0,  dump_init },
 { "", "", 0, 0 }

@@ -416,6 +452,7 @@
puts("  --ps2serkbd -ps2ser PS/2 via serial keyboard");
puts("  --twiddler  -twid   Handykey Twiddler
chording keyboard");
puts("  --twiddler-joy  -twidjoy  Handykey Twiddler
used as a joystick");
+   puts("  --zhen-hua  -zhen  Zhen Hua 5-byte protocol");
puts("");
 return 1;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] hid, 2.6.23 - add support for new macbook and apple aluminum keyboard "fn" key

2008-02-13 Thread Jiri Kosina
On Wed, 13 Feb 2008, Tobias Müller wrote:

> > It would be great if you could put this all together into one
> > condensated patch which I could merge into my tree.
> So, this is the updated version. It only adds some product-ids and
> some keyboards mappings.

The patch had mangled whitespaces again, but I have cleaned that up 
manually and applied to my tree.

Thanks,

-- 
Jiri Kosina
SUSE Labs

Re: [PATCH 2/2] driver for Zhen Hua PCM-4CH RC transmitter v2

2008-02-13 Thread Kmarty
2008/2/13, Dmitry Torokhov:
> Hi,
>
> On Wed, Feb 13, 2008 at 04:51:50PM +0100, Kmarty wrote:
> >
> > +int zhenhua_init(int fd, long *id, long *extra)
> > +{
> > + /* Zhen Hua 5 byte protokol: prvni (synchronizacni) byte obsahuje 
> > vzdy 0xF7,
> > +  * nasledujici ctyri pak jednotlive osy ovladace v intervalu 50-200.
> > +  * Pozor, nacitana data (jednotlive bajty) jsou bitove prevracene 
> > (nejnizsi
> > +  * bit je nejvyssim bitem) - neco jako little-endian na bitove urovni.
> > +  * Synchronizacni byte ma tedy bez prevraceni hodnotu 0xEF
> > +  *
> > +  * Inicializace je temer shodna s twiddlerem */
> > +
>
> Could you please change this comment to english since this way most
> people can read it? Other than that it all looks good, thanks.
>
> --
> Dmitry
>
Ok, translated.


inputattach.c.diffstat
Description: Binary data
--- inputattach.c.orig	2008-02-06 10:35:22.0 +0100
+++ inputattach.c	2008-02-13 17:48:29.0 +0100
@@ -1,5 +1,4 @@
 /*
- * $Id: inputattach.c 2352 2006-02-08 12:19:31Z vojtech $
  *
  *  Copyright (c) 1999-2000 Vojtech Pavlik
  *
@@ -315,6 +314,44 @@
 	return 0;
 }
 
+int zhenhua_init(int fd, long *id, long *extra)
+{
+	/* Zhen Hua 5 byte protocol: first (synchronization) byte allways
+	 * contain 0xF7, next four bytes are axis of controller with values
+	 * between 50-200.
+	 * Incoming data (each byte) have reversed bits (lowest bit is
+	 * highest bit) - something like little-endian but on bit level.
+	 * Synchronization byte without reversing bits have (raw) value:
+	 * 0xEF
+	 *
+	 * Initialization is almost same as twiddler_init */
+
+	unsigned char c[10];
+	int count;
+
+	for (count=0 ; count < 5 ; count++) {
+		if(readchar(fd, c+0, 500)) return -1;
+		if(c[0] == 0xef) break;
+	}
+
+	if (count == 5) {
+		/* Could not find header byte in data stream */
+		return -1;
+	}
+
+	/* Read remaining 4 bytes plus the full next data packet */
+	for (count = 1; count < 10; count++) {
+		if (readchar(fd, c+count, 500)) return -1;
+	}
+
+	/* check if next sync byte exists */
+	if (c[5] != 0xef)
+		return -1;
+
+	return 0;
+		
+}
+
 int dump_init(int fd, long *id, long *extra)
 {
 	unsigned char c, o = 0;
@@ -376,6 +413,7 @@
 { "--elo4002",		"-elo6b",	B9600, CS8 | CRTSCTS,		SERIO_ELO,	1,	0,	0,	NULL },
 { "--elo271-140",	"-elo4b",	B9600, CS8 | CRTSCTS,		SERIO_ELO,	2,	0,	0,	NULL },
 { "--elo261-280",	"-elo3b",	B9600, CS8 | CRTSCTS,		SERIO_ELO,	3,	0,	0,	NULL },
+{ "--zhen-hua",		"-zhen",	B19200, CS8, 			SERIO_ZHENHUA,	0,	0,	0,	zhenhua_init },
 { "--dump",		"-dump",	B2400, CS8, 			0,		0,	0,	0,	dump_init },
 { "", "", 0, 0 }
 
@@ -416,6 +454,7 @@
 		puts("  --ps2serkbd -ps2ser PS/2 via serial keyboard");
 		puts("  --twiddler  -twid   Handykey Twiddler chording keyboard");
 		puts("  --twiddler-joy  -twidjoy  Handykey Twiddler used as a joystick");
+		puts("  --zhen-hua  -zhen  Zhen Hua 5-byte protocol");
 		puts("");
 return 1;
 }