Re: [PATCH 1/4] Input: tsc2005 - Separate SPI and core functions

2015-11-03 Thread Michael Welling
On Mon, Nov 02, 2015 at 05:49:46PM -0800, Dmitry Torokhov wrote:
> On Fri, Oct 30, 2015 at 07:41:23PM -0500, Michael Welling wrote:
> > This patch separates the SPI functionality from core functionality
> > that overlaps with the tsc2004.
> > 
> > Prepares kernel for new tsc2004 driver without much redundant code.
> > 
> > Signed-off-by: Michael Welling 
> > ---
> >  drivers/input/touchscreen/Kconfig  |   4 +
> >  drivers/input/touchscreen/Makefile |   1 +
> >  drivers/input/touchscreen/tsc2005.c| 709 
> > +
> >  .../touchscreen/{tsc2005.c => tsc200x-core.c}  | 226 ++-
> >  drivers/input/touchscreen/tsc200x-core.h   |  78 +++
> >  5 files changed, 162 insertions(+), 856 deletions(-)
> >  copy drivers/input/touchscreen/{tsc2005.c => tsc200x-core.c} (72%)
> >  create mode 100644 drivers/input/touchscreen/tsc200x-core.h
> 
> This was giving me:
> 
> Kernel: arch/x86/boot/bzImage is ready  (#1451)
>   MODPOST 1447 modules
> ERROR: "tsc200x_regmap_config" [drivers/input/touchscreen/tsc2005.ko] 
> undefined!
> make[1]: *** [__modpost] Error 1
> make: *** [modules] Error 2
> 
> I'll fix it up locally by exporting the symbol.
> 
> Thanks.

Ooops. I guess that I need to check more thoroughly the different configs.

Thanks for your help.

> 
> -- 
> Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Input: tsc2005 - Separate SPI and core functions

2015-11-03 Thread Michael Welling
On Mon, Nov 02, 2015 at 05:49:46PM -0800, Dmitry Torokhov wrote:
> On Fri, Oct 30, 2015 at 07:41:23PM -0500, Michael Welling wrote:
> > This patch separates the SPI functionality from core functionality
> > that overlaps with the tsc2004.
> > 
> > Prepares kernel for new tsc2004 driver without much redundant code.
> > 
> > Signed-off-by: Michael Welling 
> > ---
> >  drivers/input/touchscreen/Kconfig  |   4 +
> >  drivers/input/touchscreen/Makefile |   1 +
> >  drivers/input/touchscreen/tsc2005.c| 709 
> > +
> >  .../touchscreen/{tsc2005.c => tsc200x-core.c}  | 226 ++-
> >  drivers/input/touchscreen/tsc200x-core.h   |  78 +++
> >  5 files changed, 162 insertions(+), 856 deletions(-)
> >  copy drivers/input/touchscreen/{tsc2005.c => tsc200x-core.c} (72%)
> >  create mode 100644 drivers/input/touchscreen/tsc200x-core.h
> 
> This was giving me:
> 
> Kernel: arch/x86/boot/bzImage is ready  (#1451)
>   MODPOST 1447 modules
> ERROR: "tsc200x_regmap_config" [drivers/input/touchscreen/tsc2005.ko] 
> undefined!
> make[1]: *** [__modpost] Error 1
> make: *** [modules] Error 2
> 
> I'll fix it up locally by exporting the symbol.
> 
> Thanks.

Ooops. I guess that I need to check more thoroughly the different configs.

Thanks for your help.

> 
> -- 
> Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Input: tsc2005 - Separate SPI and core functions

2015-11-02 Thread Dmitry Torokhov
On Fri, Oct 30, 2015 at 07:41:23PM -0500, Michael Welling wrote:
> This patch separates the SPI functionality from core functionality
> that overlaps with the tsc2004.
> 
> Prepares kernel for new tsc2004 driver without much redundant code.
> 
> Signed-off-by: Michael Welling 
> ---
>  drivers/input/touchscreen/Kconfig  |   4 +
>  drivers/input/touchscreen/Makefile |   1 +
>  drivers/input/touchscreen/tsc2005.c| 709 
> +
>  .../touchscreen/{tsc2005.c => tsc200x-core.c}  | 226 ++-
>  drivers/input/touchscreen/tsc200x-core.h   |  78 +++
>  5 files changed, 162 insertions(+), 856 deletions(-)
>  copy drivers/input/touchscreen/{tsc2005.c => tsc200x-core.c} (72%)
>  create mode 100644 drivers/input/touchscreen/tsc200x-core.h

This was giving me:

Kernel: arch/x86/boot/bzImage is ready  (#1451)
  MODPOST 1447 modules
ERROR: "tsc200x_regmap_config" [drivers/input/touchscreen/tsc2005.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

I'll fix it up locally by exporting the symbol.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] Input: tsc2005 - Separate SPI and core functions

2015-11-02 Thread Dmitry Torokhov
On Fri, Oct 30, 2015 at 07:41:23PM -0500, Michael Welling wrote:
> This patch separates the SPI functionality from core functionality
> that overlaps with the tsc2004.
> 
> Prepares kernel for new tsc2004 driver without much redundant code.
> 
> Signed-off-by: Michael Welling 
> ---
>  drivers/input/touchscreen/Kconfig  |   4 +
>  drivers/input/touchscreen/Makefile |   1 +
>  drivers/input/touchscreen/tsc2005.c| 709 
> +
>  .../touchscreen/{tsc2005.c => tsc200x-core.c}  | 226 ++-
>  drivers/input/touchscreen/tsc200x-core.h   |  78 +++
>  5 files changed, 162 insertions(+), 856 deletions(-)
>  copy drivers/input/touchscreen/{tsc2005.c => tsc200x-core.c} (72%)
>  create mode 100644 drivers/input/touchscreen/tsc200x-core.h

This was giving me:

Kernel: arch/x86/boot/bzImage is ready  (#1451)
  MODPOST 1447 modules
ERROR: "tsc200x_regmap_config" [drivers/input/touchscreen/tsc2005.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

I'll fix it up locally by exporting the symbol.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] Input: tsc2005 - Separate SPI and core functions

2015-10-30 Thread Michael Welling
This patch separates the SPI functionality from core functionality
that overlaps with the tsc2004.

Prepares kernel for new tsc2004 driver without much redundant code.

Signed-off-by: Michael Welling 
---
 drivers/input/touchscreen/Kconfig  |   4 +
 drivers/input/touchscreen/Makefile |   1 +
 drivers/input/touchscreen/tsc2005.c| 709 +
 .../touchscreen/{tsc2005.c => tsc200x-core.c}  | 226 ++-
 drivers/input/touchscreen/tsc200x-core.h   |  78 +++
 5 files changed, 162 insertions(+), 856 deletions(-)
 copy drivers/input/touchscreen/{tsc2005.c => tsc200x-core.c} (72%)
 create mode 100644 drivers/input/touchscreen/tsc200x-core.h

diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index 80cc698..6a5878b 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -939,10 +939,14 @@ config TOUCHSCREEN_TSC_SERIO
  To compile this driver as a module, choose M here: the
  module will be called tsc40.
 
+config TOUCHSCREEN_TSC200X_CORE
+   tristate
+
 config TOUCHSCREEN_TSC2005
tristate "TSC2005 based touchscreens"
depends on SPI_MASTER
select REGMAP_SPI
+   select TOUCHSCREEN_TSC200X_CORE
help
  Say Y here if you have a TSC2005 based touchscreen.
 
diff --git a/drivers/input/touchscreen/Makefile 
b/drivers/input/touchscreen/Makefile
index 17435c7..03179f2 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -69,6 +69,7 @@ obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213)  += touchit213.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT)   += touchright.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
 obj-$(CONFIG_TOUCHSCREEN_TSC_SERIO)+= tsc40.o
+obj-$(CONFIG_TOUCHSCREEN_TSC200X_CORE) += tsc200x-core.o
 obj-$(CONFIG_TOUCHSCREEN_TSC2005)  += tsc2005.o
 obj-$(CONFIG_TOUCHSCREEN_TSC2007)  += tsc2007.o
 obj-$(CONFIG_TOUCHSCREEN_UCB1400)  += ucb1400_ts.o
diff --git a/drivers/input/touchscreen/tsc2005.c 
b/drivers/input/touchscreen/tsc2005.c
index 0f65d02..fc879cf 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -2,9 +2,10 @@
  * TSC2005 touchscreen driver
  *
  * Copyright (C) 2006-2010 Nokia Corporation
+ * Copyright (C) 2015 QWERTY Embedded Design
+ * Copyright (C) 2015 EMAC Inc.
  *
- * Author: Lauri Leukkunen 
- * based on TSC2301 driver by Klaus K. Pedersen 
+ * Based on original tsc2005.c by Lauri Leukkunen 
  *
  * 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
@@ -15,192 +16,34 @@
  * 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 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
-
-/*
- * The touchscreen interface operates as follows:
- *
- * 1) Pen is pressed against the touchscreen.
- * 2) TSC2005 performs AD conversion.
- * 3) After the conversion is done TSC2005 drives DAV line down.
- * 4) GPIO IRQ is received and tsc2005_irq_thread() is scheduled.
- * 5) tsc2005_irq_thread() queues up an spi transfer to fetch the x, y, z1, z2
- *values.
- * 6) tsc2005_irq_thread() reports coordinates to input layer and sets up
- *tsc2005_penup_timer() to be called after TSC2005_PENUP_TIME_MS (40ms).
- * 7) When the penup timer expires, there have not been touch or DAV interrupts
- *during the last 40ms which means the pen has been lifted.
- *
- * ESD recovery via a hardware reset is done if the TSC2005 doesn't respond
- * after a configurable period (in ms) of activity. If esd_timeout is 0, the
- * watchdog is disabled.
- */
-
-/* control byte 1 */
-#define TSC2005_CMD0x80
-#define TSC2005_CMD_NORMAL 0x00
-#define TSC2005_CMD_STOP   0x01
-#define TSC2005_CMD_12BIT  0x04
-
-/* control byte 0 */
-#define TSC2005_REG_READ   0x01 /* R/W access */
-#define TSC2005_REG_PND0   0x02 /* Power Not Down Control */
-#define TSC2005_REG_X  (0x0 << 3)
-#define TSC2005_REG_Y  (0x1 << 3)
-#define TSC2005_REG_Z1 (0x2 << 3)
-#define TSC2005_REG_Z2 (0x3 << 3)
-#define TSC2005_REG_AUX(0x4 << 3)
-#define TSC2005_REG_TEMP1  (0x5 << 3)
-#define TSC2005_REG_TEMP2  (0x6 << 3)
-#define TSC2005_REG_STATUS (0x7 << 3)
-#define TSC2005_REG_AUX_HIGH   (0x8 << 3)
-#define TSC2005_REG_AUX_LOW(0x9 << 3)

[PATCH 1/4] Input: tsc2005 - Separate SPI and core functions

2015-10-30 Thread Michael Welling
This patch separates the SPI functionality from core functionality
that overlaps with the tsc2004.

Prepares kernel for new tsc2004 driver without much redundant code.

Signed-off-by: Michael Welling 
---
 drivers/input/touchscreen/Kconfig  |   4 +
 drivers/input/touchscreen/Makefile |   1 +
 drivers/input/touchscreen/tsc2005.c| 709 +
 .../touchscreen/{tsc2005.c => tsc200x-core.c}  | 226 ++-
 drivers/input/touchscreen/tsc200x-core.h   |  78 +++
 5 files changed, 162 insertions(+), 856 deletions(-)
 copy drivers/input/touchscreen/{tsc2005.c => tsc200x-core.c} (72%)
 create mode 100644 drivers/input/touchscreen/tsc200x-core.h

diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index 80cc698..6a5878b 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -939,10 +939,14 @@ config TOUCHSCREEN_TSC_SERIO
  To compile this driver as a module, choose M here: the
  module will be called tsc40.
 
+config TOUCHSCREEN_TSC200X_CORE
+   tristate
+
 config TOUCHSCREEN_TSC2005
tristate "TSC2005 based touchscreens"
depends on SPI_MASTER
select REGMAP_SPI
+   select TOUCHSCREEN_TSC200X_CORE
help
  Say Y here if you have a TSC2005 based touchscreen.
 
diff --git a/drivers/input/touchscreen/Makefile 
b/drivers/input/touchscreen/Makefile
index 17435c7..03179f2 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -69,6 +69,7 @@ obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213)  += touchit213.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT)   += touchright.o
 obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
 obj-$(CONFIG_TOUCHSCREEN_TSC_SERIO)+= tsc40.o
+obj-$(CONFIG_TOUCHSCREEN_TSC200X_CORE) += tsc200x-core.o
 obj-$(CONFIG_TOUCHSCREEN_TSC2005)  += tsc2005.o
 obj-$(CONFIG_TOUCHSCREEN_TSC2007)  += tsc2007.o
 obj-$(CONFIG_TOUCHSCREEN_UCB1400)  += ucb1400_ts.o
diff --git a/drivers/input/touchscreen/tsc2005.c 
b/drivers/input/touchscreen/tsc2005.c
index 0f65d02..fc879cf 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -2,9 +2,10 @@
  * TSC2005 touchscreen driver
  *
  * Copyright (C) 2006-2010 Nokia Corporation
+ * Copyright (C) 2015 QWERTY Embedded Design
+ * Copyright (C) 2015 EMAC Inc.
  *
- * Author: Lauri Leukkunen 
- * based on TSC2301 driver by Klaus K. Pedersen 
+ * Based on original tsc2005.c by Lauri Leukkunen 
  *
  * 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
@@ -15,192 +16,34 @@
  * 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 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
-
-/*
- * The touchscreen interface operates as follows:
- *
- * 1) Pen is pressed against the touchscreen.
- * 2) TSC2005 performs AD conversion.
- * 3) After the conversion is done TSC2005 drives DAV line down.
- * 4) GPIO IRQ is received and tsc2005_irq_thread() is scheduled.
- * 5) tsc2005_irq_thread() queues up an spi transfer to fetch the x, y, z1, z2
- *values.
- * 6) tsc2005_irq_thread() reports coordinates to input layer and sets up
- *tsc2005_penup_timer() to be called after TSC2005_PENUP_TIME_MS (40ms).
- * 7) When the penup timer expires, there have not been touch or DAV interrupts
- *during the last 40ms which means the pen has been lifted.
- *
- * ESD recovery via a hardware reset is done if the TSC2005 doesn't respond
- * after a configurable period (in ms) of activity. If esd_timeout is 0, the
- * watchdog is disabled.
- */
-
-/* control byte 1 */
-#define TSC2005_CMD0x80
-#define TSC2005_CMD_NORMAL 0x00
-#define TSC2005_CMD_STOP   0x01
-#define TSC2005_CMD_12BIT  0x04
-
-/* control byte 0 */
-#define TSC2005_REG_READ   0x01 /* R/W access */
-#define TSC2005_REG_PND0   0x02 /* Power Not Down Control */
-#define TSC2005_REG_X  (0x0 << 3)
-#define TSC2005_REG_Y  (0x1 << 3)
-#define TSC2005_REG_Z1 (0x2 << 3)
-#define TSC2005_REG_Z2 (0x3 << 3)
-#define TSC2005_REG_AUX(0x4 << 3)
-#define TSC2005_REG_TEMP1  (0x5 << 3)
-#define TSC2005_REG_TEMP2  (0x6 << 3)
-#define TSC2005_REG_STATUS (0x7 << 3)