Re: [PATCH v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-23 Thread Dmitry Torokhov
On Mon, Mar 23, 2015 at 10:57:05AM -0700, Jonathan Richardson wrote:
> On 15-03-21 09:24 PM, Dmitry Torokhov wrote:
> > Hi Jonathan,
> > 
> > On Fri, Mar 20, 2015 at 05:57:25PM -0700, Jonathan Richardson wrote:
> >> +config TOUCHSCREEN_IPROC
> >> +  tristate "IPROC touch panel driver support"
> > 
> > I think this should depend on ARCH_BCM_IPROC || COMPILE_TEST, right?
> > 
> > (No need to resubmit).
> 
> Hi Dmitry. That is correct - thanks.

Excellent. Queued for 4.1.

-- 
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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-23 Thread Jonathan Richardson
On 15-03-21 09:24 PM, Dmitry Torokhov wrote:
> Hi Jonathan,
> 
> On Fri, Mar 20, 2015 at 05:57:25PM -0700, Jonathan Richardson wrote:
>> +config TOUCHSCREEN_IPROC
>> +tristate "IPROC touch panel driver support"
> 
> I think this should depend on ARCH_BCM_IPROC || COMPILE_TEST, right?
> 
> (No need to resubmit).

Hi Dmitry. That is correct - thanks.
> 
> Thanks.
> 

--
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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-23 Thread Dmitry Torokhov
Hi Bo,

On Mon, Mar 23, 2015 at 06:14:17PM +0800, Bo Shen wrote:
> Hi Jonathan Richardson,
> 
> On 03/21/2015 08:57 AM, Jonathan Richardson wrote:
> >+static struct platform_driver iproc_ts_driver = {
> >+.probe = iproc_ts_probe,
> 
> Just a little curious, is the .remove function missing or it doesn't
> need it.

When all resources used by a driver are managed (i.e. acquired via devm
API) such driver does not need remove() method.

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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-23 Thread Bo Shen

Hi Jonathan Richardson,

On 03/21/2015 08:57 AM, Jonathan Richardson wrote:

+static struct platform_driver iproc_ts_driver = {
+   .probe = iproc_ts_probe,


Just a little curious, is the .remove function missing or it doesn't 
need it.


Thanks.


+   .driver = {
+   .name   = IPROC_TS_NAME,
+   .of_match_table = of_match_ptr(iproc_ts_of_match),
+   },
+};
+
+module_platform_driver(iproc_ts_driver);
+
+MODULE_DESCRIPTION("IPROC Touchscreen driver");
+MODULE_AUTHOR("Broadcom");
+MODULE_LICENSE("GPL v2");


Best Regards,
Bo Shen
--
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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-23 Thread Dmitry Torokhov
Hi Bo,

On Mon, Mar 23, 2015 at 06:14:17PM +0800, Bo Shen wrote:
 Hi Jonathan Richardson,
 
 On 03/21/2015 08:57 AM, Jonathan Richardson wrote:
 +static struct platform_driver iproc_ts_driver = {
 +.probe = iproc_ts_probe,
 
 Just a little curious, is the .remove function missing or it doesn't
 need it.

When all resources used by a driver are managed (i.e. acquired via devm
API) such driver does not need remove() method.

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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-23 Thread Bo Shen

Hi Jonathan Richardson,

On 03/21/2015 08:57 AM, Jonathan Richardson wrote:

+static struct platform_driver iproc_ts_driver = {
+   .probe = iproc_ts_probe,


Just a little curious, is the .remove function missing or it doesn't 
need it.


Thanks.


+   .driver = {
+   .name   = IPROC_TS_NAME,
+   .of_match_table = of_match_ptr(iproc_ts_of_match),
+   },
+};
+
+module_platform_driver(iproc_ts_driver);
+
+MODULE_DESCRIPTION(IPROC Touchscreen driver);
+MODULE_AUTHOR(Broadcom);
+MODULE_LICENSE(GPL v2);


Best Regards,
Bo Shen
--
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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-23 Thread Dmitry Torokhov
On Mon, Mar 23, 2015 at 10:57:05AM -0700, Jonathan Richardson wrote:
 On 15-03-21 09:24 PM, Dmitry Torokhov wrote:
  Hi Jonathan,
  
  On Fri, Mar 20, 2015 at 05:57:25PM -0700, Jonathan Richardson wrote:
  +config TOUCHSCREEN_IPROC
  +  tristate IPROC touch panel driver support
  
  I think this should depend on ARCH_BCM_IPROC || COMPILE_TEST, right?
  
  (No need to resubmit).
 
 Hi Dmitry. That is correct - thanks.

Excellent. Queued for 4.1.

-- 
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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-23 Thread Jonathan Richardson
On 15-03-21 09:24 PM, Dmitry Torokhov wrote:
 Hi Jonathan,
 
 On Fri, Mar 20, 2015 at 05:57:25PM -0700, Jonathan Richardson wrote:
 +config TOUCHSCREEN_IPROC
 +tristate IPROC touch panel driver support
 
 I think this should depend on ARCH_BCM_IPROC || COMPILE_TEST, right?
 
 (No need to resubmit).

Hi Dmitry. That is correct - thanks.
 
 Thanks.
 

--
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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-21 Thread Dmitry Torokhov
Hi Jonathan,

On Fri, Mar 20, 2015 at 05:57:25PM -0700, Jonathan Richardson wrote:
> +config TOUCHSCREEN_IPROC
> + tristate "IPROC touch panel driver support"

I think this should depend on ARCH_BCM_IPROC || COMPILE_TEST, right?

(No need to resubmit).

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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-21 Thread Dmitry Torokhov
Hi Jonathan,

On Fri, Mar 20, 2015 at 05:57:25PM -0700, Jonathan Richardson wrote:
 +config TOUCHSCREEN_IPROC
 + tristate IPROC touch panel driver support

I think this should depend on ARCH_BCM_IPROC || COMPILE_TEST, right?

(No need to resubmit).

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 v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-20 Thread Jonathan Richardson
Add initial version of the Broadcom touchscreen driver.

Reviewed-by: Ray Jui 
Reviewed-by: Scott Branden 
Tested-by: Scott Branden 
Signed-off-by: Jonathan Richardson 
---
 drivers/input/touchscreen/Kconfig |   11 +
 drivers/input/touchscreen/Makefile|1 +
 drivers/input/touchscreen/bcm_iproc_tsc.c |  518 +
 3 files changed, 530 insertions(+)
 create mode 100644 drivers/input/touchscreen/bcm_iproc_tsc.c

diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index 6261fd6..4a8b0e5 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -323,6 +323,17 @@ config TOUCHSCREEN_ILI210X
  To compile this driver as a module, choose M here: the
  module will be called ili210x.
 
+config TOUCHSCREEN_IPROC
+   tristate "IPROC touch panel driver support"
+   help
+ Say Y here if you want to add support for the IPROC touch
+ controller to your system.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called bcm_iproc_tsc.
+
 config TOUCHSCREEN_S3C2410
tristate "Samsung S3C2410/generic touchscreen input driver"
depends on ARCH_S3C24XX || SAMSUNG_DEV_TS
diff --git a/drivers/input/touchscreen/Makefile 
b/drivers/input/touchscreen/Makefile
index 0242fea..68f69bc 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_TOUCHSCREEN_GOODIX)  += goodix.o
 obj-$(CONFIG_TOUCHSCREEN_ILI210X)  += ili210x.o
 obj-$(CONFIG_TOUCHSCREEN_INEXIO)   += inexio.o
 obj-$(CONFIG_TOUCHSCREEN_INTEL_MID)+= intel-mid-touch.o
+obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o
 obj-$(CONFIG_TOUCHSCREEN_LPC32XX)  += lpc32xx_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MC13783)  += mc13783_ts.o
diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c 
b/drivers/input/touchscreen/bcm_iproc_tsc.c
new file mode 100644
index 000..c02a015
--- /dev/null
+++ b/drivers/input/touchscreen/bcm_iproc_tsc.c
@@ -0,0 +1,518 @@
+/*
+* Copyright (C) 2015 Broadcom Corporation
+*
+* 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 version 2.
+*
+* This program is distributed "as is" WITHOUT ANY WARRANTY of any
+* kind, whether express or implied; without even the implied warranty
+* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define IPROC_TS_NAME "iproc-ts"
+
+#define PEN_DOWN_STATUS 1
+#define PEN_UP_STATUS   0
+
+#define X_MIN   0
+#define Y_MIN   0
+#define X_MAX   0xFFF
+#define Y_MAX   0xFFF
+
+/* Value given by controller for invalid coordinate. */
+#define INVALID_COORD   0x
+
+/* Register offsets */
+#define REGCTL1 0x00
+#define REGCTL2 0x04
+#define INTERRUPT_THRES 0x08
+#define INTERRUPT_MASK  0x0c
+
+#define INTERRUPT_STATUS0x10
+#define CONTROLLER_STATUS   0x14
+#define FIFO_DATA   0x18
+#define FIFO_DATA_X_Y_MASK  0x
+#define ANALOG_CONTROL  0x1c
+
+#define AUX_DATA0x20
+#define DEBOUNCE_CNTR_STAT  0x24
+#define SCAN_CNTR_STAT  0x28
+#define REM_CNTR_STAT   0x2c
+
+#define SETTLING_TIMER_STAT 0x30
+#define SPARE_REG   0x34
+#define SOFT_BYPASS_CONTROL 0x38
+#define SOFT_BYPASS_DATA0x3c
+
+
+/* Bit values for INTERRUPT_MASK and INTERRUPT_STATUS regs */
+#define TS_PEN_INTR_MASKBIT(0)
+#define TS_FIFO_INTR_MASK   BIT(2)
+
+/* Bit values for CONTROLLER_STATUS reg1 */
+#define TS_PEN_DOWN BIT(0)
+
+/* Shift values for control reg1 */
+#define SCANNING_PERIOD_SHIFT   24
+#define DEBOUNCE_TIMEOUT_SHIFT  16
+#define SETTLING_TIMEOUT_SHIFT  8
+#define TOUCH_TIMEOUT_SHIFT 0
+
+/* Shift values for coordinates from fifo */
+#define X_COORD_SHIFT  0
+#define Y_COORD_SHIFT  16
+
+/* Bit values for REGCTL2 */
+#define TS_CONTROLLER_EN_BITBIT(16)
+#define TS_CONTROLLER_AVGDATA_SHIFT 8
+#define TS_CONTROLLER_AVGDATA_MASK (0x7 << TS_CONTROLLER_AVGDATA_SHIFT)
+#define TS_CONTROLLER_PWR_LDO   BIT(5)
+#define TS_CONTROLLER_PWR_ADC   BIT(4)
+#define TS_CONTROLLER_PWR_BGP   BIT(3)
+#define TS_CONTROLLER_PWR_TSBIT(2)
+#define TS_WIRE_MODE_BITBIT(1)
+
+#define dbg_reg(dev, priv, reg) \
+   dev_dbg(dev, "%20s= 0x%08x\n", #reg, readl((priv)->regs + reg))
+
+struct tsc_param {
+   /* Each step is 1024 us.  Valid 1-256 */
+   u32 scanning_period;
+
+   /*  Each step is 512 us.  Valid 0-255 */
+   u32 debounce_timeout;
+
+   /*
+* The settling 

[PATCH v5 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-03-20 Thread Jonathan Richardson
Add initial version of the Broadcom touchscreen driver.

Reviewed-by: Ray Jui r...@broadcom.com
Reviewed-by: Scott Branden sbran...@broadcom.com
Tested-by: Scott Branden sbran...@broadcom.com
Signed-off-by: Jonathan Richardson jonat...@broadcom.com
---
 drivers/input/touchscreen/Kconfig |   11 +
 drivers/input/touchscreen/Makefile|1 +
 drivers/input/touchscreen/bcm_iproc_tsc.c |  518 +
 3 files changed, 530 insertions(+)
 create mode 100644 drivers/input/touchscreen/bcm_iproc_tsc.c

diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index 6261fd6..4a8b0e5 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -323,6 +323,17 @@ config TOUCHSCREEN_ILI210X
  To compile this driver as a module, choose M here: the
  module will be called ili210x.
 
+config TOUCHSCREEN_IPROC
+   tristate IPROC touch panel driver support
+   help
+ Say Y here if you want to add support for the IPROC touch
+ controller to your system.
+
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ module will be called bcm_iproc_tsc.
+
 config TOUCHSCREEN_S3C2410
tristate Samsung S3C2410/generic touchscreen input driver
depends on ARCH_S3C24XX || SAMSUNG_DEV_TS
diff --git a/drivers/input/touchscreen/Makefile 
b/drivers/input/touchscreen/Makefile
index 0242fea..68f69bc 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_TOUCHSCREEN_GOODIX)  += goodix.o
 obj-$(CONFIG_TOUCHSCREEN_ILI210X)  += ili210x.o
 obj-$(CONFIG_TOUCHSCREEN_INEXIO)   += inexio.o
 obj-$(CONFIG_TOUCHSCREEN_INTEL_MID)+= intel-mid-touch.o
+obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o
 obj-$(CONFIG_TOUCHSCREEN_LPC32XX)  += lpc32xx_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o
 obj-$(CONFIG_TOUCHSCREEN_MC13783)  += mc13783_ts.o
diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c 
b/drivers/input/touchscreen/bcm_iproc_tsc.c
new file mode 100644
index 000..c02a015
--- /dev/null
+++ b/drivers/input/touchscreen/bcm_iproc_tsc.c
@@ -0,0 +1,518 @@
+/*
+* Copyright (C) 2015 Broadcom Corporation
+*
+* 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 version 2.
+*
+* This program is distributed as is WITHOUT ANY WARRANTY of any
+* kind, whether express or implied; without even the implied warranty
+* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*/
+#include linux/module.h
+#include linux/init.h
+#include linux/input.h
+#include linux/delay.h
+#include linux/interrupt.h
+#include linux/keyboard.h
+#include linux/platform_device.h
+#include linux/slab.h
+#include linux/of.h
+#include asm/irq.h
+#include linux/io.h
+#include linux/clk.h
+#include linux/serio.h
+
+#define IPROC_TS_NAME iproc-ts
+
+#define PEN_DOWN_STATUS 1
+#define PEN_UP_STATUS   0
+
+#define X_MIN   0
+#define Y_MIN   0
+#define X_MAX   0xFFF
+#define Y_MAX   0xFFF
+
+/* Value given by controller for invalid coordinate. */
+#define INVALID_COORD   0x
+
+/* Register offsets */
+#define REGCTL1 0x00
+#define REGCTL2 0x04
+#define INTERRUPT_THRES 0x08
+#define INTERRUPT_MASK  0x0c
+
+#define INTERRUPT_STATUS0x10
+#define CONTROLLER_STATUS   0x14
+#define FIFO_DATA   0x18
+#define FIFO_DATA_X_Y_MASK  0x
+#define ANALOG_CONTROL  0x1c
+
+#define AUX_DATA0x20
+#define DEBOUNCE_CNTR_STAT  0x24
+#define SCAN_CNTR_STAT  0x28
+#define REM_CNTR_STAT   0x2c
+
+#define SETTLING_TIMER_STAT 0x30
+#define SPARE_REG   0x34
+#define SOFT_BYPASS_CONTROL 0x38
+#define SOFT_BYPASS_DATA0x3c
+
+
+/* Bit values for INTERRUPT_MASK and INTERRUPT_STATUS regs */
+#define TS_PEN_INTR_MASKBIT(0)
+#define TS_FIFO_INTR_MASK   BIT(2)
+
+/* Bit values for CONTROLLER_STATUS reg1 */
+#define TS_PEN_DOWN BIT(0)
+
+/* Shift values for control reg1 */
+#define SCANNING_PERIOD_SHIFT   24
+#define DEBOUNCE_TIMEOUT_SHIFT  16
+#define SETTLING_TIMEOUT_SHIFT  8
+#define TOUCH_TIMEOUT_SHIFT 0
+
+/* Shift values for coordinates from fifo */
+#define X_COORD_SHIFT  0
+#define Y_COORD_SHIFT  16
+
+/* Bit values for REGCTL2 */
+#define TS_CONTROLLER_EN_BITBIT(16)
+#define TS_CONTROLLER_AVGDATA_SHIFT 8
+#define TS_CONTROLLER_AVGDATA_MASK (0x7  TS_CONTROLLER_AVGDATA_SHIFT)
+#define TS_CONTROLLER_PWR_LDO   BIT(5)
+#define TS_CONTROLLER_PWR_ADC   BIT(4)
+#define TS_CONTROLLER_PWR_BGP   BIT(3)
+#define TS_CONTROLLER_PWR_TSBIT(2)
+#define TS_WIRE_MODE_BITBIT(1)
+
+#define dbg_reg(dev, priv, reg) \
+   dev_dbg(dev, %20s= 0x%08x\n, #reg,