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

2008-02-26 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 3/6] Add chip driver for WM9712 touchscreen

2008-02-26 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 linux/module.h
+#include linux/moduleparam.h
+#include linux/version.h
+#include linux/kernel.h
+#include linux/input.h
+#include linux/delay.h
+#include linux/bitops.h
+#include linux/wm97xx.h
+
+#define TS_NAMEwm97xx
+#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 */
+   

[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 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 linux/module.h
+#include linux/moduleparam.h
+#include linux/version.h
+#include linux/kernel.h
+#include linux/input.h
+#include linux/delay.h
+#include linux/bitops.h
+#include linux/wm97xx.h
+
+#define TS_NAMEwm97xx
+#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 */
+   

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

2008-02-12 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 3/6] Add chip driver for WM9712 touchscreen

2008-01-26 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: 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 */
+   5333,  /* 256 */
+   

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

2008-01-26 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: 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 linux/module.h
+#include linux/moduleparam.h
+#include linux/version.h
+#include linux/kernel.h
+#include linux/input.h
+#include linux/delay.h
+#include linux/bitops.h
+#include linux/wm97xx.h
+
+#define TS_NAMEwm97xx
+#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,  

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

2008-01-21 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: Stanley Cai <[EMAIL PROTECTED]>
Cc: Rodolfo Giometti <[EMAIL PROTECTED]>
Cc: Russell King <[EMAIL PROTECTED]>
Cc: Marc Kleine-Budde <[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 */
+   5333,  /* 256 */
+   6000,  /* 288 */
+   0  /* No 

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

2008-01-21 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: Stanley Cai [EMAIL PROTECTED]
Cc: Rodolfo Giometti [EMAIL PROTECTED]
Cc: Russell King [EMAIL PROTECTED]
Cc: Marc Kleine-Budde [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 linux/module.h
+#include linux/moduleparam.h
+#include linux/version.h
+#include linux/kernel.h
+#include linux/input.h
+#include linux/delay.h
+#include linux/bitops.h
+#include linux/wm97xx.h
+
+#define TS_NAMEwm97xx
+#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 3/6] Add chip driver for WM9712 touchscreen

2008-01-10 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: Stanley Cai <[EMAIL PROTECTED]>
Cc: Rodolfo Giometti <[EMAIL PROTECTED]>
Cc: Russell King <[EMAIL PROTECTED]>
Cc: Marc Kleine-Budde <[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..3517600
--- /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 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 */
+   5333,  /* 256 */
+   6000,  /* 288 */
+   0  /* No delay, 

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

2008-01-10 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: Stanley Cai [EMAIL PROTECTED]
Cc: Rodolfo Giometti [EMAIL PROTECTED]
Cc: Russell King [EMAIL PROTECTED]
Cc: Marc Kleine-Budde [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..3517600
--- /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 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 linux/module.h
+#include linux/moduleparam.h
+#include linux/version.h
+#include linux/kernel.h
+#include linux/input.h
+#include linux/delay.h
+#include linux/bitops.h
+#include linux/wm97xx.h
+
+#define TS_NAMEwm97xx
+#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 */
+