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

2015-03-02 Thread Jonathan Richardson
Hi Dmitry,

Thanks for the review. I'll fix everything as suggested. One comment
below. New patchset coming once I can test the latest DT bindings in
Hans de Goede's patch.

Thanks,
Jon

On 15-02-24 03:29 PM, Dmitry Torokhov wrote:
> Hi Jonathan,
> 
> On Fri, Dec 19, 2014 at 02:17:49PM -0800, Jonathan Richardson wrote:
>> 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 |  535 
>> +
>>  3 files changed, 547 insertions(+)
>>  create mode 100644 drivers/input/touchscreen/bcm_iproc_tsc.c
>>
>> diff --git a/drivers/input/touchscreen/Kconfig 
>> b/drivers/input/touchscreen/Kconfig
>> index e1d8003..77ff531 100644
>> --- a/drivers/input/touchscreen/Kconfig
>> +++ b/drivers/input/touchscreen/Kconfig
>> @@ -310,6 +310,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 iproc-ts.
>> +
>>  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 090e61c..f7e6de9 100644
>> --- a/drivers/input/touchscreen/Makefile
>> +++ b/drivers/input/touchscreen/Makefile
>> @@ -37,6 +37,7 @@ obj-$(CONFIG_TOUCHSCREEN_FUJITSU)  += fujitsu_ts.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..bf6eb7f
>> --- /dev/null
>> +++ b/drivers/input/touchscreen/bcm_iproc_tsc.c
>> @@ -0,0 +1,535 @@
>> +/*
>> +* Copyright (C) 2014 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 */
>> +#de

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

2015-02-26 Thread Jonathan Richardson
Hi Dmitry,

Thanks. I'll go through his patch and make the appropriate changes to
our driver.

Jon

On 15-02-24 03:18 PM, Dmitry Torokhov wrote:
> Jonathan,
> 
> 
> On Wed, Feb 11, 2015 at 10:45:34AM -0800, Jonathan Richardson wrote:
>> Pinging maintainers... Am I ok to go ahead with the current rotation
>> implementation? I haven't heard anything further. Any feedback on naming
>> conventions from DT people?
>>
> 
> I believe we should go with touchscreen-inverted-x,
> touchscreen-inverted-y and touchscreen-swapped-x-y properties since
> rotation can't really describe all permutations of potential
> connections.
> 
> I'll be taking Hans de Goede's patch adding this new property to the
> bindings (adjusting the name slightly).
> 
> Thanks.
> 
>> Thanks!
>>
>> On 15-01-15 11:51 AM, Jonathan Richardson wrote:
>>> Hi Dmitry,
>>>
>>> On 15-01-14 10:07 PM, Dmitry Torokhov wrote:
 On Wed, Jan 14, 2015 at 09:44:39PM -0800, Scott Branden wrote:
> On 15-01-14 05:02 PM, Dmitry Torokhov wrote:
>> Hi Jonathan,
>>
>> On Fri, Dec 19, 2014 at 02:17:49PM -0800, Jonathan Richardson wrote:
>>> +   if (of_property_read_u32(np, "scanning_period", &val) >= 0) {
>>> +   if (val < 1 || val > 256) {
>>> +   dev_err(dev, "scanning_period must be 
>>> [1-256]\n");
>>> +   return -EINVAL;
>>> +   }
>>> +   priv->cfg_params.scanning_period = val;
>>> +   }
>>> +
>>> +   if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
>>> +   if (val < 0 || val > 255) {
>>> +   dev_err(dev, "debounce_timeout must be 
>>> [0-255]\n");
>>> +   return -EINVAL;
>>> +   }
>>> +   priv->cfg_params.debounce_timeout = val;
>>> +   }
>>> +
>>> +   if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
>>> +   if (val < 0 || val > 11) {
>>> +   dev_err(dev, "settling_timeout must be 
>>> [0-11]\n");
>>> +   return -EINVAL;
>>> +   }
>>> +   priv->cfg_params.settling_timeout = val;
>>> +   }
>>> +
>>> +   if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
>>> +   if (val < 0 || val > 255) {
>>> +   dev_err(dev, "touch_timeout must be [0-255]\n");
>>> +   return -EINVAL;
>>> +   }
>>> +   priv->cfg_params.touch_timeout = val;
>>> +   }
>>> +
>>> +   if (of_property_read_u32(np, "average_data", &val) >= 0) {
>>> +   if (val < 0 || val > 8) {
>>> +   dev_err(dev, "average_data must be [0-8]\n");
>>> +   return -EINVAL;
>>> +   }
>>> +   priv->cfg_params.average_data = val;
>>> +   }
>>> +
>>> +   if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
>>> +   if (val < 0 || val > 31) {
>>> +   dev_err(dev, "fifo_threshold must be [0-31]\n");
>>> +   return -EINVAL;
>>> +   }
>>> +   priv->cfg_params.fifo_threshold = val;
>>> +   }
>>
>> I think these are dveice specific and thus should have "brcm," prefix.
> I'm confused as to why we need the brcm prefix?  Other device tree
> bindings we have for other drivers do not need such prefix.

 Properties that are not standard on the system (reg, interrupts,
 clkocks, etc) or subsystem level customarily carry the vendor prefix so
 that they do not clash with newly added global or subsystem properties.

>  Is this
> convention documented somewhere?

 Not sure. I glanced through Documentation/devicetree and do not see it
 spelled out. Device tree overlords, what say you?
>>>
>>> Let me know. I haven't seen this before either. I will change the
>>> entries to use dashes though instead of underscores but will wait until
>>> these other issues are decided on before sending out another patch.
>>>

>>
>>> +
>>> +   priv->ts_rotation = TS_ROTATION_0;
>>> +   if (of_property_read_u32(np, "ts-rotation", &val) >= 0) {
>>> +   priv->ts_rotation = val;
>>> +   dev_dbg(dev, "ts rotation [%d] degrees\n",
>>> +   90 * priv->ts_rotation);
>>> +   }
>>
>> This I am not quite sure about - if we want rotation or swap+invert. You
>> are CCed on another email (tsc2007) that talks about need of generic
>> touchscreen transforms in input core/of bindings.
> Does such generic binding exist today?  If not, I would like to go
> with this implementation and update to the new binding if/when it
> exists?

 Not yet but there 

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

2015-02-24 Thread Dmitry Torokhov
Hi Jonathan,

On Fri, Dec 19, 2014 at 02:17:49PM -0800, Jonathan Richardson wrote:
> 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 |  535 
> +
>  3 files changed, 547 insertions(+)
>  create mode 100644 drivers/input/touchscreen/bcm_iproc_tsc.c
> 
> diff --git a/drivers/input/touchscreen/Kconfig 
> b/drivers/input/touchscreen/Kconfig
> index e1d8003..77ff531 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -310,6 +310,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 iproc-ts.
> +
>  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 090e61c..f7e6de9 100644
> --- a/drivers/input/touchscreen/Makefile
> +++ b/drivers/input/touchscreen/Makefile
> @@ -37,6 +37,7 @@ obj-$(CONFIG_TOUCHSCREEN_FUJITSU)   += fujitsu_ts.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..bf6eb7f
> --- /dev/null
> +++ b/drivers/input/touchscreen/bcm_iproc_tsc.c
> @@ -0,0 +1,535 @@
> +/*
> +* Copyright (C) 2014 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_BIT   

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

2015-02-24 Thread Dmitry Torokhov
Jonathan,


On Wed, Feb 11, 2015 at 10:45:34AM -0800, Jonathan Richardson wrote:
> Pinging maintainers... Am I ok to go ahead with the current rotation
> implementation? I haven't heard anything further. Any feedback on naming
> conventions from DT people?
>

I believe we should go with touchscreen-inverted-x,
touchscreen-inverted-y and touchscreen-swapped-x-y properties since
rotation can't really describe all permutations of potential
connections.

I'll be taking Hans de Goede's patch adding this new property to the
bindings (adjusting the name slightly).

Thanks.

> Thanks!
> 
> On 15-01-15 11:51 AM, Jonathan Richardson wrote:
> > Hi Dmitry,
> > 
> > On 15-01-14 10:07 PM, Dmitry Torokhov wrote:
> >> On Wed, Jan 14, 2015 at 09:44:39PM -0800, Scott Branden wrote:
> >>> On 15-01-14 05:02 PM, Dmitry Torokhov wrote:
>  Hi Jonathan,
> 
>  On Fri, Dec 19, 2014 at 02:17:49PM -0800, Jonathan Richardson wrote:
> > +   if (of_property_read_u32(np, "scanning_period", &val) >= 0) {
> > +   if (val < 1 || val > 256) {
> > +   dev_err(dev, "scanning_period must be 
> > [1-256]\n");
> > +   return -EINVAL;
> > +   }
> > +   priv->cfg_params.scanning_period = val;
> > +   }
> > +
> > +   if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
> > +   if (val < 0 || val > 255) {
> > +   dev_err(dev, "debounce_timeout must be 
> > [0-255]\n");
> > +   return -EINVAL;
> > +   }
> > +   priv->cfg_params.debounce_timeout = val;
> > +   }
> > +
> > +   if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
> > +   if (val < 0 || val > 11) {
> > +   dev_err(dev, "settling_timeout must be 
> > [0-11]\n");
> > +   return -EINVAL;
> > +   }
> > +   priv->cfg_params.settling_timeout = val;
> > +   }
> > +
> > +   if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
> > +   if (val < 0 || val > 255) {
> > +   dev_err(dev, "touch_timeout must be [0-255]\n");
> > +   return -EINVAL;
> > +   }
> > +   priv->cfg_params.touch_timeout = val;
> > +   }
> > +
> > +   if (of_property_read_u32(np, "average_data", &val) >= 0) {
> > +   if (val < 0 || val > 8) {
> > +   dev_err(dev, "average_data must be [0-8]\n");
> > +   return -EINVAL;
> > +   }
> > +   priv->cfg_params.average_data = val;
> > +   }
> > +
> > +   if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
> > +   if (val < 0 || val > 31) {
> > +   dev_err(dev, "fifo_threshold must be [0-31]\n");
> > +   return -EINVAL;
> > +   }
> > +   priv->cfg_params.fifo_threshold = val;
> > +   }
> 
>  I think these are dveice specific and thus should have "brcm," prefix.
> >>> I'm confused as to why we need the brcm prefix?  Other device tree
> >>> bindings we have for other drivers do not need such prefix.
> >>
> >> Properties that are not standard on the system (reg, interrupts,
> >> clkocks, etc) or subsystem level customarily carry the vendor prefix so
> >> that they do not clash with newly added global or subsystem properties.
> >>
> >>>  Is this
> >>> convention documented somewhere?
> >>
> >> Not sure. I glanced through Documentation/devicetree and do not see it
> >> spelled out. Device tree overlords, what say you?
> > 
> > Let me know. I haven't seen this before either. I will change the
> > entries to use dashes though instead of underscores but will wait until
> > these other issues are decided on before sending out another patch.
> > 
> >>
> 
> > +
> > +   priv->ts_rotation = TS_ROTATION_0;
> > +   if (of_property_read_u32(np, "ts-rotation", &val) >= 0) {
> > +   priv->ts_rotation = val;
> > +   dev_dbg(dev, "ts rotation [%d] degrees\n",
> > +   90 * priv->ts_rotation);
> > +   }
> 
>  This I am not quite sure about - if we want rotation or swap+invert. You
>  are CCed on another email (tsc2007) that talks about need of generic
>  touchscreen transforms in input core/of bindings.
> >>> Does such generic binding exist today?  If not, I would like to go
> >>> with this implementation and update to the new binding if/when it
> >>> exists?
> >>
> >> Not yet but there several people interested. I think we have enough time
> >> till 3.20 to hash it out properly.
> > 
> > I think the rotation is simpler personally. Everyone would understand
> > 

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

2015-02-11 Thread Jonathan Richardson
Pinging maintainers... Am I ok to go ahead with the current rotation
implementation? I haven't heard anything further. Any feedback on naming
conventions from DT people?

Thanks!

On 15-01-15 11:51 AM, Jonathan Richardson wrote:
> Hi Dmitry,
> 
> On 15-01-14 10:07 PM, Dmitry Torokhov wrote:
>> On Wed, Jan 14, 2015 at 09:44:39PM -0800, Scott Branden wrote:
>>> On 15-01-14 05:02 PM, Dmitry Torokhov wrote:
 Hi Jonathan,

 On Fri, Dec 19, 2014 at 02:17:49PM -0800, Jonathan Richardson wrote:
> + if (of_property_read_u32(np, "scanning_period", &val) >= 0) {
> + if (val < 1 || val > 256) {
> + dev_err(dev, "scanning_period must be [1-256]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.scanning_period = val;
> + }
> +
> + if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
> + if (val < 0 || val > 255) {
> + dev_err(dev, "debounce_timeout must be [0-255]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.debounce_timeout = val;
> + }
> +
> + if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
> + if (val < 0 || val > 11) {
> + dev_err(dev, "settling_timeout must be [0-11]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.settling_timeout = val;
> + }
> +
> + if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
> + if (val < 0 || val > 255) {
> + dev_err(dev, "touch_timeout must be [0-255]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.touch_timeout = val;
> + }
> +
> + if (of_property_read_u32(np, "average_data", &val) >= 0) {
> + if (val < 0 || val > 8) {
> + dev_err(dev, "average_data must be [0-8]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.average_data = val;
> + }
> +
> + if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
> + if (val < 0 || val > 31) {
> + dev_err(dev, "fifo_threshold must be [0-31]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.fifo_threshold = val;
> + }

 I think these are dveice specific and thus should have "brcm," prefix.
>>> I'm confused as to why we need the brcm prefix?  Other device tree
>>> bindings we have for other drivers do not need such prefix.
>>
>> Properties that are not standard on the system (reg, interrupts,
>> clkocks, etc) or subsystem level customarily carry the vendor prefix so
>> that they do not clash with newly added global or subsystem properties.
>>
>>>  Is this
>>> convention documented somewhere?
>>
>> Not sure. I glanced through Documentation/devicetree and do not see it
>> spelled out. Device tree overlords, what say you?
> 
> Let me know. I haven't seen this before either. I will change the
> entries to use dashes though instead of underscores but will wait until
> these other issues are decided on before sending out another patch.
> 
>>

> +
> + priv->ts_rotation = TS_ROTATION_0;
> + if (of_property_read_u32(np, "ts-rotation", &val) >= 0) {
> + priv->ts_rotation = val;
> + dev_dbg(dev, "ts rotation [%d] degrees\n",
> + 90 * priv->ts_rotation);
> + }

 This I am not quite sure about - if we want rotation or swap+invert. You
 are CCed on another email (tsc2007) that talks about need of generic
 touchscreen transforms in input core/of bindings.
>>> Does such generic binding exist today?  If not, I would like to go
>>> with this implementation and update to the new binding if/when it
>>> exists?
>>
>> Not yet but there several people interested. I think we have enough time
>> till 3.20 to hash it out properly.
> 
> I think the rotation is simpler personally. Everyone would understand
> rotation refers to how it's oriented but I'm not sure everyone would
> immediately know how it is wired. Let me know what is decided and I'll
> make any changes required.
> 
> Thanks,
> Jon
> 
> 
>>
>> 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 v2 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver

2015-01-15 Thread Jonathan Richardson
Hi Dmitry,

On 15-01-14 10:07 PM, Dmitry Torokhov wrote:
> On Wed, Jan 14, 2015 at 09:44:39PM -0800, Scott Branden wrote:
>> On 15-01-14 05:02 PM, Dmitry Torokhov wrote:
>>> Hi Jonathan,
>>>
>>> On Fri, Dec 19, 2014 at 02:17:49PM -0800, Jonathan Richardson wrote:
 +  if (of_property_read_u32(np, "scanning_period", &val) >= 0) {
 +  if (val < 1 || val > 256) {
 +  dev_err(dev, "scanning_period must be [1-256]\n");
 +  return -EINVAL;
 +  }
 +  priv->cfg_params.scanning_period = val;
 +  }
 +
 +  if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
 +  if (val < 0 || val > 255) {
 +  dev_err(dev, "debounce_timeout must be [0-255]\n");
 +  return -EINVAL;
 +  }
 +  priv->cfg_params.debounce_timeout = val;
 +  }
 +
 +  if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
 +  if (val < 0 || val > 11) {
 +  dev_err(dev, "settling_timeout must be [0-11]\n");
 +  return -EINVAL;
 +  }
 +  priv->cfg_params.settling_timeout = val;
 +  }
 +
 +  if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
 +  if (val < 0 || val > 255) {
 +  dev_err(dev, "touch_timeout must be [0-255]\n");
 +  return -EINVAL;
 +  }
 +  priv->cfg_params.touch_timeout = val;
 +  }
 +
 +  if (of_property_read_u32(np, "average_data", &val) >= 0) {
 +  if (val < 0 || val > 8) {
 +  dev_err(dev, "average_data must be [0-8]\n");
 +  return -EINVAL;
 +  }
 +  priv->cfg_params.average_data = val;
 +  }
 +
 +  if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
 +  if (val < 0 || val > 31) {
 +  dev_err(dev, "fifo_threshold must be [0-31]\n");
 +  return -EINVAL;
 +  }
 +  priv->cfg_params.fifo_threshold = val;
 +  }
>>>
>>> I think these are dveice specific and thus should have "brcm," prefix.
>> I'm confused as to why we need the brcm prefix?  Other device tree
>> bindings we have for other drivers do not need such prefix.
> 
> Properties that are not standard on the system (reg, interrupts,
> clkocks, etc) or subsystem level customarily carry the vendor prefix so
> that they do not clash with newly added global or subsystem properties.
> 
>>  Is this
>> convention documented somewhere?
> 
> Not sure. I glanced through Documentation/devicetree and do not see it
> spelled out. Device tree overlords, what say you?

Let me know. I haven't seen this before either. I will change the
entries to use dashes though instead of underscores but will wait until
these other issues are decided on before sending out another patch.

> 
>>>
 +
 +  priv->ts_rotation = TS_ROTATION_0;
 +  if (of_property_read_u32(np, "ts-rotation", &val) >= 0) {
 +  priv->ts_rotation = val;
 +  dev_dbg(dev, "ts rotation [%d] degrees\n",
 +  90 * priv->ts_rotation);
 +  }
>>>
>>> This I am not quite sure about - if we want rotation or swap+invert. You
>>> are CCed on another email (tsc2007) that talks about need of generic
>>> touchscreen transforms in input core/of bindings.
>> Does such generic binding exist today?  If not, I would like to go
>> with this implementation and update to the new binding if/when it
>> exists?
> 
> Not yet but there several people interested. I think we have enough time
> till 3.20 to hash it out properly.

I think the rotation is simpler personally. Everyone would understand
rotation refers to how it's oriented but I'm not sure everyone would
immediately know how it is wired. Let me know what is decided and I'll
make any changes required.

Thanks,
Jon


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

2015-01-15 Thread Jonathan Richardson
On 15-01-14 05:08 PM, Florian Fainelli wrote:
> On 19/12/14 15:03, Jonathan Richardson wrote:
>> On 14-12-19 02:26 PM, Joe Perches wrote:
>>> On Fri, 2014-12-19 at 14:17 -0800, Jonathan Richardson wrote:
 Add initial version of the Broadcom touchscreen driver.
>>>
>>> more trivia:
>>>
 diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c 
 b/drivers/input/touchscreen/bcm_iproc_tsc.c
>>> []
 +static int get_tsc_config(struct device_node *np, struct iproc_ts_priv 
 *priv)
 +{
 +  u32 val;
>>> []
 +  if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
 +  if (val < 0 || val > 255) {
 +  dev_err(dev, "debounce_timeout must be [0-255]\n");
 +  return -EINVAL;
 +  }
 +  priv->cfg_params.debounce_timeout = val;
> 
> BTW, common practice for DT properties is to use a dash instead of an
> underscore for multi-worded properties.

ts-rotation is done that way already so I'll change the others to be
consistent. Thanks.

> 
>>>
>>> Doesn't the compiler generate a warning message
>>> about an impossible "unsigned < 0" test for all
>>> of these "val < 0" uses?
>>>
>>
>> Actually no it doesn't. The gcc output shows that neither -Wtype-limits
>> nor -Wextra are used to compile that file. I assume this is because
>> there would be just too many warnings.
>>
>>
 +  }
 +
 +  if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
 +  if (val < 0 || val > 11) {
>>> []
 +  if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
 +  if (val < 0 || val > 255) {
>>> []
 +  if (of_property_read_u32(np, "average_data", &val) >= 0) {
 +  if (val < 0 || val > 8) {
>>> []
 +  if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
 +  if (val < 0 || val > 31) {
>>>
>>>
>>
>>
>> ___
>> linux-arm-kernel mailing list
>> linux-arm-ker...@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>
> 
> 

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

2015-01-14 Thread Dmitry Torokhov
On Wed, Jan 14, 2015 at 09:44:39PM -0800, Scott Branden wrote:
> On 15-01-14 05:02 PM, Dmitry Torokhov wrote:
> >Hi Jonathan,
> >
> >On Fri, Dec 19, 2014 at 02:17:49PM -0800, Jonathan Richardson wrote:
> >>+   if (of_property_read_u32(np, "scanning_period", &val) >= 0) {
> >>+   if (val < 1 || val > 256) {
> >>+   dev_err(dev, "scanning_period must be [1-256]\n");
> >>+   return -EINVAL;
> >>+   }
> >>+   priv->cfg_params.scanning_period = val;
> >>+   }
> >>+
> >>+   if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
> >>+   if (val < 0 || val > 255) {
> >>+   dev_err(dev, "debounce_timeout must be [0-255]\n");
> >>+   return -EINVAL;
> >>+   }
> >>+   priv->cfg_params.debounce_timeout = val;
> >>+   }
> >>+
> >>+   if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
> >>+   if (val < 0 || val > 11) {
> >>+   dev_err(dev, "settling_timeout must be [0-11]\n");
> >>+   return -EINVAL;
> >>+   }
> >>+   priv->cfg_params.settling_timeout = val;
> >>+   }
> >>+
> >>+   if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
> >>+   if (val < 0 || val > 255) {
> >>+   dev_err(dev, "touch_timeout must be [0-255]\n");
> >>+   return -EINVAL;
> >>+   }
> >>+   priv->cfg_params.touch_timeout = val;
> >>+   }
> >>+
> >>+   if (of_property_read_u32(np, "average_data", &val) >= 0) {
> >>+   if (val < 0 || val > 8) {
> >>+   dev_err(dev, "average_data must be [0-8]\n");
> >>+   return -EINVAL;
> >>+   }
> >>+   priv->cfg_params.average_data = val;
> >>+   }
> >>+
> >>+   if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
> >>+   if (val < 0 || val > 31) {
> >>+   dev_err(dev, "fifo_threshold must be [0-31]\n");
> >>+   return -EINVAL;
> >>+   }
> >>+   priv->cfg_params.fifo_threshold = val;
> >>+   }
> >
> >I think these are dveice specific and thus should have "brcm," prefix.
> I'm confused as to why we need the brcm prefix?  Other device tree
> bindings we have for other drivers do not need such prefix.

Properties that are not standard on the system (reg, interrupts,
clkocks, etc) or subsystem level customarily carry the vendor prefix so
that they do not clash with newly added global or subsystem properties.

>  Is this
> convention documented somewhere?

Not sure. I glanced through Documentation/devicetree and do not see it
spelled out. Device tree overlords, what say you?

> >
> >>+
> >>+   priv->ts_rotation = TS_ROTATION_0;
> >>+   if (of_property_read_u32(np, "ts-rotation", &val) >= 0) {
> >>+   priv->ts_rotation = val;
> >>+   dev_dbg(dev, "ts rotation [%d] degrees\n",
> >>+   90 * priv->ts_rotation);
> >>+   }
> >
> >This I am not quite sure about - if we want rotation or swap+invert. You
> >are CCed on another email (tsc2007) that talks about need of generic
> >touchscreen transforms in input core/of bindings.
> Does such generic binding exist today?  If not, I would like to go
> with this implementation and update to the new binding if/when it
> exists?

Not yet but there several people interested. I think we have enough time
till 3.20 to hash it out properly.

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

2015-01-14 Thread Scott Branden

On 15-01-14 05:02 PM, Dmitry Torokhov wrote:

Hi Jonathan,

On Fri, Dec 19, 2014 at 02:17:49PM -0800, Jonathan Richardson wrote:

+   if (of_property_read_u32(np, "scanning_period", &val) >= 0) {
+   if (val < 1 || val > 256) {
+   dev_err(dev, "scanning_period must be [1-256]\n");
+   return -EINVAL;
+   }
+   priv->cfg_params.scanning_period = val;
+   }
+
+   if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
+   if (val < 0 || val > 255) {
+   dev_err(dev, "debounce_timeout must be [0-255]\n");
+   return -EINVAL;
+   }
+   priv->cfg_params.debounce_timeout = val;
+   }
+
+   if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
+   if (val < 0 || val > 11) {
+   dev_err(dev, "settling_timeout must be [0-11]\n");
+   return -EINVAL;
+   }
+   priv->cfg_params.settling_timeout = val;
+   }
+
+   if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
+   if (val < 0 || val > 255) {
+   dev_err(dev, "touch_timeout must be [0-255]\n");
+   return -EINVAL;
+   }
+   priv->cfg_params.touch_timeout = val;
+   }
+
+   if (of_property_read_u32(np, "average_data", &val) >= 0) {
+   if (val < 0 || val > 8) {
+   dev_err(dev, "average_data must be [0-8]\n");
+   return -EINVAL;
+   }
+   priv->cfg_params.average_data = val;
+   }
+
+   if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
+   if (val < 0 || val > 31) {
+   dev_err(dev, "fifo_threshold must be [0-31]\n");
+   return -EINVAL;
+   }
+   priv->cfg_params.fifo_threshold = val;
+   }


I think these are dveice specific and thus should have "brcm," prefix.
I'm confused as to why we need the brcm prefix?  Other device tree 
bindings we have for other drivers do not need such prefix.  Is this 
convention documented somewhere?



+
+   priv->ts_rotation = TS_ROTATION_0;
+   if (of_property_read_u32(np, "ts-rotation", &val) >= 0) {
+   priv->ts_rotation = val;
+   dev_dbg(dev, "ts rotation [%d] degrees\n",
+   90 * priv->ts_rotation);
+   }


This I am not quite sure about - if we want rotation or swap+invert. You
are CCed on another email (tsc2007) that talks about need of generic
touchscreen transforms in input core/of bindings.
Does such generic binding exist today?  If not, I would like to go with 
this implementation and update to the new binding if/when it exists?


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

2015-01-14 Thread Florian Fainelli
On 19/12/14 15:03, Jonathan Richardson wrote:
> On 14-12-19 02:26 PM, Joe Perches wrote:
>> On Fri, 2014-12-19 at 14:17 -0800, Jonathan Richardson wrote:
>>> Add initial version of the Broadcom touchscreen driver.
>>
>> more trivia:
>>
>>> diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c 
>>> b/drivers/input/touchscreen/bcm_iproc_tsc.c
>> []
>>> +static int get_tsc_config(struct device_node *np, struct iproc_ts_priv 
>>> *priv)
>>> +{
>>> +   u32 val;
>> []
>>> +   if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
>>> +   if (val < 0 || val > 255) {
>>> +   dev_err(dev, "debounce_timeout must be [0-255]\n");
>>> +   return -EINVAL;
>>> +   }
>>> +   priv->cfg_params.debounce_timeout = val;

BTW, common practice for DT properties is to use a dash instead of an
underscore for multi-worded properties.

>>
>> Doesn't the compiler generate a warning message
>> about an impossible "unsigned < 0" test for all
>> of these "val < 0" uses?
>>
> 
> Actually no it doesn't. The gcc output shows that neither -Wtype-limits
> nor -Wextra are used to compile that file. I assume this is because
> there would be just too many warnings.
> 
> 
>>> +   }
>>> +
>>> +   if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
>>> +   if (val < 0 || val > 11) {
>> []
>>> +   if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
>>> +   if (val < 0 || val > 255) {
>> []
>>> +   if (of_property_read_u32(np, "average_data", &val) >= 0) {
>>> +   if (val < 0 || val > 8) {
>> []
>>> +   if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
>>> +   if (val < 0 || val > 31) {
>>
>>
> 
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


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

2015-01-14 Thread Dmitry Torokhov
Hi Jonathan,

On Fri, Dec 19, 2014 at 02:17:49PM -0800, Jonathan Richardson wrote:
> + if (of_property_read_u32(np, "scanning_period", &val) >= 0) {
> + if (val < 1 || val > 256) {
> + dev_err(dev, "scanning_period must be [1-256]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.scanning_period = val;
> + }
> +
> + if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
> + if (val < 0 || val > 255) {
> + dev_err(dev, "debounce_timeout must be [0-255]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.debounce_timeout = val;
> + }
> +
> + if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
> + if (val < 0 || val > 11) {
> + dev_err(dev, "settling_timeout must be [0-11]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.settling_timeout = val;
> + }
> +
> + if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
> + if (val < 0 || val > 255) {
> + dev_err(dev, "touch_timeout must be [0-255]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.touch_timeout = val;
> + }
> +
> + if (of_property_read_u32(np, "average_data", &val) >= 0) {
> + if (val < 0 || val > 8) {
> + dev_err(dev, "average_data must be [0-8]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.average_data = val;
> + }
> +
> + if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
> + if (val < 0 || val > 31) {
> + dev_err(dev, "fifo_threshold must be [0-31]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.fifo_threshold = val;
> + }

I think these are dveice specific and thus should have "brcm," prefix.

> +
> + priv->ts_rotation = TS_ROTATION_0;
> + if (of_property_read_u32(np, "ts-rotation", &val) >= 0) {
> + priv->ts_rotation = val;
> + dev_dbg(dev, "ts rotation [%d] degrees\n",
> + 90 * priv->ts_rotation);
> + }

This I am not quite sure about - if we want rotation or swap+invert. You
are CCed on another email (tsc2007) that talks about need of generic
touchscreen transforms in input core/of bindings.

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

2014-12-31 Thread Jonathan Richardson
Hi,

Would anyone be able to look at this to help us move forward? Thanks.

On 14-12-19 03:03 PM, Jonathan Richardson wrote:
> On 14-12-19 02:26 PM, Joe Perches wrote:
>> On Fri, 2014-12-19 at 14:17 -0800, Jonathan Richardson wrote:
>>> Add initial version of the Broadcom touchscreen driver.
>>
>> more trivia:
>>
>>> diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c 
>>> b/drivers/input/touchscreen/bcm_iproc_tsc.c
>> []
>>> +static int get_tsc_config(struct device_node *np, struct iproc_ts_priv 
>>> *priv)
>>> +{
>>> +   u32 val;
>> []
>>> +   if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
>>> +   if (val < 0 || val > 255) {
>>> +   dev_err(dev, "debounce_timeout must be [0-255]\n");
>>> +   return -EINVAL;
>>> +   }
>>> +   priv->cfg_params.debounce_timeout = val;
>>
>> Doesn't the compiler generate a warning message
>> about an impossible "unsigned < 0" test for all
>> of these "val < 0" uses?
>>
> 
> Actually no it doesn't. The gcc output shows that neither -Wtype-limits
> nor -Wextra are used to compile that file. I assume this is because
> there would be just too many warnings.
> 
> 
>>> +   }
>>> +
>>> +   if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
>>> +   if (val < 0 || val > 11) {
>> []
>>> +   if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
>>> +   if (val < 0 || val > 255) {
>> []
>>> +   if (of_property_read_u32(np, "average_data", &val) >= 0) {
>>> +   if (val < 0 || val > 8) {
>> []
>>> +   if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
>>> +   if (val < 0 || val > 31) {
>>
>>
> 

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

2014-12-19 Thread Jonathan Richardson
On 14-12-19 02:26 PM, Joe Perches wrote:
> On Fri, 2014-12-19 at 14:17 -0800, Jonathan Richardson wrote:
>> Add initial version of the Broadcom touchscreen driver.
> 
> more trivia:
> 
>> diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c 
>> b/drivers/input/touchscreen/bcm_iproc_tsc.c
> []
>> +static int get_tsc_config(struct device_node *np, struct iproc_ts_priv 
>> *priv)
>> +{
>> +u32 val;
> []
>> +if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
>> +if (val < 0 || val > 255) {
>> +dev_err(dev, "debounce_timeout must be [0-255]\n");
>> +return -EINVAL;
>> +}
>> +priv->cfg_params.debounce_timeout = val;
> 
> Doesn't the compiler generate a warning message
> about an impossible "unsigned < 0" test for all
> of these "val < 0" uses?
> 

Actually no it doesn't. The gcc output shows that neither -Wtype-limits
nor -Wextra are used to compile that file. I assume this is because
there would be just too many warnings.


>> +}
>> +
>> +if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
>> +if (val < 0 || val > 11) {
> []
>> +if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
>> +if (val < 0 || val > 255) {
> []
>> +if (of_property_read_u32(np, "average_data", &val) >= 0) {
>> +if (val < 0 || val > 8) {
> []
>> +if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
>> +if (val < 0 || val > 31) {
> 
> 

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

2014-12-19 Thread Joe Perches
On Fri, 2014-12-19 at 14:17 -0800, Jonathan Richardson wrote:
> Add initial version of the Broadcom touchscreen driver.

more trivia:

> diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c 
> b/drivers/input/touchscreen/bcm_iproc_tsc.c
[]
> +static int get_tsc_config(struct device_node *np, struct iproc_ts_priv *priv)
> +{
> + u32 val;
[]
> + if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) {
> + if (val < 0 || val > 255) {
> + dev_err(dev, "debounce_timeout must be [0-255]\n");
> + return -EINVAL;
> + }
> + priv->cfg_params.debounce_timeout = val;

Doesn't the compiler generate a warning message
about an impossible "unsigned < 0" test for all
of these "val < 0" uses?

> + }
> +
> + if (of_property_read_u32(np, "settling_timeout", &val) >= 0) {
> + if (val < 0 || val > 11) {
[]
> + if (of_property_read_u32(np, "touch_timeout", &val) >= 0) {
> + if (val < 0 || val > 255) {
[]
> + if (of_property_read_u32(np, "average_data", &val) >= 0) {
> + if (val < 0 || val > 8) {
[]
> + if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) {
> + if (val < 0 || val > 31) {


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

2014-12-19 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 |  535 +
 3 files changed, 547 insertions(+)
 create mode 100644 drivers/input/touchscreen/bcm_iproc_tsc.c

diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index e1d8003..77ff531 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -310,6 +310,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 iproc-ts.
+
 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 090e61c..f7e6de9 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.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..bf6eb7f
--- /dev/null
+++ b/drivers/input/touchscreen/bcm_iproc_tsc.c
@@ -0,0 +1,535 @@
+/*
+* Copyright (C) 2014 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)
+
+/*
+ * Touch screen mount angles w.r.t LCD panel left side top corner
+ * TS (x_min,y_min) placed at LCD (x_min,y_min) rotation angle is 0
+ * TS (x_min,y_max) placed at LCD (x_min,y_min) rotation angle is 90
+ * TS (x_max,y_max) placed at LCD (x_min,y_min) rotation angle is 180
+ * TS (x_max,y_min) placed at LCD (x_min,y_m