Re: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-08-21 Thread Dmitry Torokhov
Hi Manish,

On Tue, Aug 20, 2013 at 12:25:32PM +0530, Manish Badarkhe wrote:
> Hi Prabhakar,
> 
> On Tue, Aug 20, 2013 at 11:44 AM, Prabhakar Lad
> >
> > All the three above properties as per the documentation  above
> > are optional, but the code here makes them required property.
> > May be what you can do is if property is not defined make it as
> > zero as per documentation.
> 
> I already taken care of this as per Dmitry's comment but not yet
> posted patch series as
> there is discussion going on populating child node's properties.

Please post the series using find node properties (as they were). We can
discuss if MFD devices should be automatically attaching parents OF data
to child devices they are creating later.

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 V3 1/2] tps6507x-ts: Add DT support

2013-08-21 Thread Dmitry Torokhov
Hi Manish,

On Tue, Aug 20, 2013 at 12:25:32PM +0530, Manish Badarkhe wrote:
 Hi Prabhakar,
 
 On Tue, Aug 20, 2013 at 11:44 AM, Prabhakar Lad
 
  All the three above properties as per the documentation  above
  are optional, but the code here makes them required property.
  May be what you can do is if property is not defined make it as
  zero as per documentation.
 
 I already taken care of this as per Dmitry's comment but not yet
 posted patch series as
 there is discussion going on populating child node's properties.

Please post the series using find node properties (as they were). We can
discuss if MFD devices should be automatically attaching parents OF data
to child devices they are creating later.

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 V3 1/2] tps6507x-ts: Add DT support

2013-08-20 Thread Manish Badarkhe
Hi Prabhakar,

On Tue, Aug 20, 2013 at 11:44 AM, Prabhakar Lad
 wrote:
> Hi Manish,
>
> Thanks for the patch.
>
> On Tue, May 21, 2013 at 2:24 PM, Vishwanathrao Badarkhe, Manish
>  wrote:
>> Add device tree based support for TI's tps6507x touchscreen.
>>
>> Tested on da850-evm.
>>
>> Signed-off-by: Vishwanathrao Badarkhe, Manish 
>> ---
>> Changes since V2:
>>  - Removed unnecessary code.
>>  - Updated Documentation to provide proper names of
>>devicetree properties.
>>
>> Changes since V1:
>>  - Updated documentation to specify tps6507x as multifunctional
>>device.
>>  - return proper error value in absence of platform and DT
>>data for touchscreen.
>>  - Updated commit message.
>>
>> :100755 100755 8fffa3c... 65ee2cd... M  
>> Documentation/devicetree/bindings/mfd/tps6507x.txt
>> :100644 100644 65e0f9a... 89232ee... M  
>> drivers/input/touchscreen/tps6507x-ts.c
>>  Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-
>>  drivers/input/touchscreen/tps6507x-ts.c|   98 
>> ++--
>>  2 files changed, 95 insertions(+), 31 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
>> b/Documentation/devicetree/bindings/mfd/tps6507x.txt
>> index 8fffa3c..65ee2cd 100755
>> --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
>> +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
>> @@ -1,4 +1,8 @@
>> -TPS6507x Power Management Integrated Circuit
>> +TPS6507x Multifunctional Device.
>> +
>> +Features provided by TPS6507x:
>> +1.Power Management Integrated Circuit.
>> +2.Touch-Screen.
>>
>>  Required properties:
>>  - compatible: "ti,tps6507x"
>> @@ -23,6 +27,12 @@ Required properties:
>> vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
>> vindcdc3-supply  : VDCDC3 input.
>> vldo1_2-supply   : VLDO1 and VLDO2 input.
>> +- tsc: This node specifies touch screen data.
>> +   ti,poll-period : Time at which touch input is getting sampled in ms.
>> +   ti,min-pressure: Minimum pressure value to trigger touch.
>> +   ti,vref: voltage reference for ADC.
>> + 0: Reference voltage for ADC is disabled.
>> + 1: Reference voltage for ADC is enabled.
>>
>>  Regulator Optional properties:
>>  - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
>> @@ -30,6 +40,14 @@ Regulator Optional properties:
>> 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
>>If this property is not defined, it defaults to 0 (not enabled).
>>
>> +Touchscreen Optional properties:
>> +- ti,vendor : Touchscreen vendor id to populate
>> + in sysclass interface.
>> +- ti,product: Touchscreen product id to populate
>> + in sysclass interface.
>> +- ti,version: Touchscreen version id to populate
>> + in sysclass interface.
>> +
>>  Example:
>>
>> pmu: tps6507x@48 {
>> @@ -88,4 +106,12 @@ Example:
>> };
>> };
>>
>> +   tsc {
>> +   ti,poll-period = <30>;
>> +   ti,min-pressure = <0x30>;
>> +   ti,vref = <0>;
>> +   ti,vendor = <0>;
>> +   ti,product = <65070>;
>> +   ti,version = <0x100>;
>> +   };
>> };
>> diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
>> b/drivers/input/touchscreen/tps6507x-ts.c
>> index 65e0f9a..89232ee 100644
>> --- a/drivers/input/touchscreen/tps6507x-ts.c
>> +++ b/drivers/input/touchscreen/tps6507x-ts.c
>> @@ -21,6 +21,8 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>>
>>  #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
>>  #define TPS_DEFAULT_MIN_PRESSURE 0x30
>> @@ -231,36 +233,76 @@ done:
>> ret = tps6507x_adc_standby(tsc);
>>  }
>>
>> +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
>> +   struct input_dev *input_dev)
>> +{
>> +   struct device_node *node = tps6507x_dev->dev->of_node;
>> +   struct tps6507x_board *tps_board =
>> +   (struct tps6507x_board *)tps6507x_dev->dev->platform_data;
>> +   struct touchscreen_init_data *init_data = NULL;
>> +   int err;
>> +
>> +   if (node)
>> +   node = of_find_node_by_name(node, "tsc");
>> +   if (tps_board)
>> +   init_data = tps_board->tps6507x_ts_init_data;
>> +
>> +   if (node == NULL || init_data == NULL) {
>> +   err = -EINVAL;
>> +   goto error_ret;
>> +   } else if (init_data) {
>> +   tps6507x_dev->ts->poll_period = init_data->poll_period;
>> +   tps6507x_dev->ts->min_pressure = init_data->min_pressure;
>> +   tps6507x_dev->ts->vref = init_data->vref;
>> +   input_dev->id.vendor = init_data->vendor;
>> +   input_dev->id.product = init_data->product;
>> +   input_dev->id.version = init_data->version;
>> +   } 

Re: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-08-20 Thread Prabhakar Lad
Hi Manish,

Thanks for the patch.

On Tue, May 21, 2013 at 2:24 PM, Vishwanathrao Badarkhe, Manish
 wrote:
> Add device tree based support for TI's tps6507x touchscreen.
>
> Tested on da850-evm.
>
> Signed-off-by: Vishwanathrao Badarkhe, Manish 
> ---
> Changes since V2:
>  - Removed unnecessary code.
>  - Updated Documentation to provide proper names of
>devicetree properties.
>
> Changes since V1:
>  - Updated documentation to specify tps6507x as multifunctional
>device.
>  - return proper error value in absence of platform and DT
>data for touchscreen.
>  - Updated commit message.
>
> :100755 100755 8fffa3c... 65ee2cd... M  
> Documentation/devicetree/bindings/mfd/tps6507x.txt
> :100644 100644 65e0f9a... 89232ee... M  
> drivers/input/touchscreen/tps6507x-ts.c
>  Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-
>  drivers/input/touchscreen/tps6507x-ts.c|   98 
> ++--
>  2 files changed, 95 insertions(+), 31 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
> b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> index 8fffa3c..65ee2cd 100755
> --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
> +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> @@ -1,4 +1,8 @@
> -TPS6507x Power Management Integrated Circuit
> +TPS6507x Multifunctional Device.
> +
> +Features provided by TPS6507x:
> +1.Power Management Integrated Circuit.
> +2.Touch-Screen.
>
>  Required properties:
>  - compatible: "ti,tps6507x"
> @@ -23,6 +27,12 @@ Required properties:
> vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
> vindcdc3-supply  : VDCDC3 input.
> vldo1_2-supply   : VLDO1 and VLDO2 input.
> +- tsc: This node specifies touch screen data.
> +   ti,poll-period : Time at which touch input is getting sampled in ms.
> +   ti,min-pressure: Minimum pressure value to trigger touch.
> +   ti,vref: voltage reference for ADC.
> + 0: Reference voltage for ADC is disabled.
> + 1: Reference voltage for ADC is enabled.
>
>  Regulator Optional properties:
>  - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
> @@ -30,6 +40,14 @@ Regulator Optional properties:
> 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
>If this property is not defined, it defaults to 0 (not enabled).
>
> +Touchscreen Optional properties:
> +- ti,vendor : Touchscreen vendor id to populate
> + in sysclass interface.
> +- ti,product: Touchscreen product id to populate
> + in sysclass interface.
> +- ti,version: Touchscreen version id to populate
> + in sysclass interface.
> +
>  Example:
>
> pmu: tps6507x@48 {
> @@ -88,4 +106,12 @@ Example:
> };
> };
>
> +   tsc {
> +   ti,poll-period = <30>;
> +   ti,min-pressure = <0x30>;
> +   ti,vref = <0>;
> +   ti,vendor = <0>;
> +   ti,product = <65070>;
> +   ti,version = <0x100>;
> +   };
> };
> diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
> b/drivers/input/touchscreen/tps6507x-ts.c
> index 65e0f9a..89232ee 100644
> --- a/drivers/input/touchscreen/tps6507x-ts.c
> +++ b/drivers/input/touchscreen/tps6507x-ts.c
> @@ -21,6 +21,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
>  #define TPS_DEFAULT_MIN_PRESSURE 0x30
> @@ -231,36 +233,76 @@ done:
> ret = tps6507x_adc_standby(tsc);
>  }
>
> +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
> +   struct input_dev *input_dev)
> +{
> +   struct device_node *node = tps6507x_dev->dev->of_node;
> +   struct tps6507x_board *tps_board =
> +   (struct tps6507x_board *)tps6507x_dev->dev->platform_data;
> +   struct touchscreen_init_data *init_data = NULL;
> +   int err;
> +
> +   if (node)
> +   node = of_find_node_by_name(node, "tsc");
> +   if (tps_board)
> +   init_data = tps_board->tps6507x_ts_init_data;
> +
> +   if (node == NULL || init_data == NULL) {
> +   err = -EINVAL;
> +   goto error_ret;
> +   } else if (init_data) {
> +   tps6507x_dev->ts->poll_period = init_data->poll_period;
> +   tps6507x_dev->ts->min_pressure = init_data->min_pressure;
> +   tps6507x_dev->ts->vref = init_data->vref;
> +   input_dev->id.vendor = init_data->vendor;
> +   input_dev->id.product = init_data->product;
> +   input_dev->id.version = init_data->version;
> +   } else if (node) {
> +   err = of_property_read_u32(node, "ti,poll-period",
> +   (u32 
> *)_dev->ts->poll_period);
> +   if (err < 0)
> + 

Re: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-08-20 Thread Prabhakar Lad
Hi Manish,

Thanks for the patch.

On Tue, May 21, 2013 at 2:24 PM, Vishwanathrao Badarkhe, Manish
manish...@ti.com wrote:
 Add device tree based support for TI's tps6507x touchscreen.

 Tested on da850-evm.

 Signed-off-by: Vishwanathrao Badarkhe, Manish manish...@ti.com
 ---
 Changes since V2:
  - Removed unnecessary code.
  - Updated Documentation to provide proper names of
devicetree properties.

 Changes since V1:
  - Updated documentation to specify tps6507x as multifunctional
device.
  - return proper error value in absence of platform and DT
data for touchscreen.
  - Updated commit message.

 :100755 100755 8fffa3c... 65ee2cd... M  
 Documentation/devicetree/bindings/mfd/tps6507x.txt
 :100644 100644 65e0f9a... 89232ee... M  
 drivers/input/touchscreen/tps6507x-ts.c
  Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-
  drivers/input/touchscreen/tps6507x-ts.c|   98 
 ++--
  2 files changed, 95 insertions(+), 31 deletions(-)

 diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
 b/Documentation/devicetree/bindings/mfd/tps6507x.txt
 index 8fffa3c..65ee2cd 100755
 --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
 +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
 @@ -1,4 +1,8 @@
 -TPS6507x Power Management Integrated Circuit
 +TPS6507x Multifunctional Device.
 +
 +Features provided by TPS6507x:
 +1.Power Management Integrated Circuit.
 +2.Touch-Screen.

  Required properties:
  - compatible: ti,tps6507x
 @@ -23,6 +27,12 @@ Required properties:
 vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
 vindcdc3-supply  : VDCDC3 input.
 vldo1_2-supply   : VLDO1 and VLDO2 input.
 +- tsc: This node specifies touch screen data.
 +   ti,poll-period : Time at which touch input is getting sampled in ms.
 +   ti,min-pressure: Minimum pressure value to trigger touch.
 +   ti,vref: voltage reference for ADC.
 + 0: Reference voltage for ADC is disabled.
 + 1: Reference voltage for ADC is enabled.

  Regulator Optional properties:
  - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
 @@ -30,6 +40,14 @@ Regulator Optional properties:
 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
If this property is not defined, it defaults to 0 (not enabled).

 +Touchscreen Optional properties:
 +- ti,vendor : Touchscreen vendor id to populate
 + in sysclass interface.
 +- ti,product: Touchscreen product id to populate
 + in sysclass interface.
 +- ti,version: Touchscreen version id to populate
 + in sysclass interface.
 +
  Example:

 pmu: tps6507x@48 {
 @@ -88,4 +106,12 @@ Example:
 };
 };

 +   tsc {
 +   ti,poll-period = 30;
 +   ti,min-pressure = 0x30;
 +   ti,vref = 0;
 +   ti,vendor = 0;
 +   ti,product = 65070;
 +   ti,version = 0x100;
 +   };
 };
 diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
 b/drivers/input/touchscreen/tps6507x-ts.c
 index 65e0f9a..89232ee 100644
 --- a/drivers/input/touchscreen/tps6507x-ts.c
 +++ b/drivers/input/touchscreen/tps6507x-ts.c
 @@ -21,6 +21,8 @@
  #include linux/mfd/tps6507x.h
  #include linux/input/tps6507x-ts.h
  #include linux/delay.h
 +#include linux/of.h
 +#include linux/of_device.h

  #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
  #define TPS_DEFAULT_MIN_PRESSURE 0x30
 @@ -231,36 +233,76 @@ done:
 ret = tps6507x_adc_standby(tsc);
  }

 +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
 +   struct input_dev *input_dev)
 +{
 +   struct device_node *node = tps6507x_dev-dev-of_node;
 +   struct tps6507x_board *tps_board =
 +   (struct tps6507x_board *)tps6507x_dev-dev-platform_data;
 +   struct touchscreen_init_data *init_data = NULL;
 +   int err;
 +
 +   if (node)
 +   node = of_find_node_by_name(node, tsc);
 +   if (tps_board)
 +   init_data = tps_board-tps6507x_ts_init_data;
 +
 +   if (node == NULL || init_data == NULL) {
 +   err = -EINVAL;
 +   goto error_ret;
 +   } else if (init_data) {
 +   tps6507x_dev-ts-poll_period = init_data-poll_period;
 +   tps6507x_dev-ts-min_pressure = init_data-min_pressure;
 +   tps6507x_dev-ts-vref = init_data-vref;
 +   input_dev-id.vendor = init_data-vendor;
 +   input_dev-id.product = init_data-product;
 +   input_dev-id.version = init_data-version;
 +   } else if (node) {
 +   err = of_property_read_u32(node, ti,poll-period,
 +   (u32 
 *)tps6507x_dev-ts-poll_period);
 +   if (err  0)
 +   goto error_ret;
 +
 +   

Re: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-08-20 Thread Manish Badarkhe
Hi Prabhakar,

On Tue, Aug 20, 2013 at 11:44 AM, Prabhakar Lad
prabhakar.cse...@gmail.com wrote:
 Hi Manish,

 Thanks for the patch.

 On Tue, May 21, 2013 at 2:24 PM, Vishwanathrao Badarkhe, Manish
 manish...@ti.com wrote:
 Add device tree based support for TI's tps6507x touchscreen.

 Tested on da850-evm.

 Signed-off-by: Vishwanathrao Badarkhe, Manish manish...@ti.com
 ---
 Changes since V2:
  - Removed unnecessary code.
  - Updated Documentation to provide proper names of
devicetree properties.

 Changes since V1:
  - Updated documentation to specify tps6507x as multifunctional
device.
  - return proper error value in absence of platform and DT
data for touchscreen.
  - Updated commit message.

 :100755 100755 8fffa3c... 65ee2cd... M  
 Documentation/devicetree/bindings/mfd/tps6507x.txt
 :100644 100644 65e0f9a... 89232ee... M  
 drivers/input/touchscreen/tps6507x-ts.c
  Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-
  drivers/input/touchscreen/tps6507x-ts.c|   98 
 ++--
  2 files changed, 95 insertions(+), 31 deletions(-)

 diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
 b/Documentation/devicetree/bindings/mfd/tps6507x.txt
 index 8fffa3c..65ee2cd 100755
 --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
 +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
 @@ -1,4 +1,8 @@
 -TPS6507x Power Management Integrated Circuit
 +TPS6507x Multifunctional Device.
 +
 +Features provided by TPS6507x:
 +1.Power Management Integrated Circuit.
 +2.Touch-Screen.

  Required properties:
  - compatible: ti,tps6507x
 @@ -23,6 +27,12 @@ Required properties:
 vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
 vindcdc3-supply  : VDCDC3 input.
 vldo1_2-supply   : VLDO1 and VLDO2 input.
 +- tsc: This node specifies touch screen data.
 +   ti,poll-period : Time at which touch input is getting sampled in ms.
 +   ti,min-pressure: Minimum pressure value to trigger touch.
 +   ti,vref: voltage reference for ADC.
 + 0: Reference voltage for ADC is disabled.
 + 1: Reference voltage for ADC is enabled.

  Regulator Optional properties:
  - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
 @@ -30,6 +40,14 @@ Regulator Optional properties:
 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
If this property is not defined, it defaults to 0 (not enabled).

 +Touchscreen Optional properties:
 +- ti,vendor : Touchscreen vendor id to populate
 + in sysclass interface.
 +- ti,product: Touchscreen product id to populate
 + in sysclass interface.
 +- ti,version: Touchscreen version id to populate
 + in sysclass interface.
 +
  Example:

 pmu: tps6507x@48 {
 @@ -88,4 +106,12 @@ Example:
 };
 };

 +   tsc {
 +   ti,poll-period = 30;
 +   ti,min-pressure = 0x30;
 +   ti,vref = 0;
 +   ti,vendor = 0;
 +   ti,product = 65070;
 +   ti,version = 0x100;
 +   };
 };
 diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
 b/drivers/input/touchscreen/tps6507x-ts.c
 index 65e0f9a..89232ee 100644
 --- a/drivers/input/touchscreen/tps6507x-ts.c
 +++ b/drivers/input/touchscreen/tps6507x-ts.c
 @@ -21,6 +21,8 @@
  #include linux/mfd/tps6507x.h
  #include linux/input/tps6507x-ts.h
  #include linux/delay.h
 +#include linux/of.h
 +#include linux/of_device.h

  #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
  #define TPS_DEFAULT_MIN_PRESSURE 0x30
 @@ -231,36 +233,76 @@ done:
 ret = tps6507x_adc_standby(tsc);
  }

 +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
 +   struct input_dev *input_dev)
 +{
 +   struct device_node *node = tps6507x_dev-dev-of_node;
 +   struct tps6507x_board *tps_board =
 +   (struct tps6507x_board *)tps6507x_dev-dev-platform_data;
 +   struct touchscreen_init_data *init_data = NULL;
 +   int err;
 +
 +   if (node)
 +   node = of_find_node_by_name(node, tsc);
 +   if (tps_board)
 +   init_data = tps_board-tps6507x_ts_init_data;
 +
 +   if (node == NULL || init_data == NULL) {
 +   err = -EINVAL;
 +   goto error_ret;
 +   } else if (init_data) {
 +   tps6507x_dev-ts-poll_period = init_data-poll_period;
 +   tps6507x_dev-ts-min_pressure = init_data-min_pressure;
 +   tps6507x_dev-ts-vref = init_data-vref;
 +   input_dev-id.vendor = init_data-vendor;
 +   input_dev-id.product = init_data-product;
 +   input_dev-id.version = init_data-version;
 +   } else if (node) {
 +   err = of_property_read_u32(node, ti,poll-period,
 +   (u32 
 

Re: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-07-29 Thread Manish Badarkhe
Hi Dmitry

On Mon, Jul 1, 2013 at 4:40 PM, Manish Badarkhe
 wrote:
>
> Hi Dmitry
>
>
> On Wed, Jun 12, 2013 at 12:23 PM, Vishwanathrao Badarkhe, Manish
>  wrote:
> > Hi Dmitry,
> >
> > On Mon, Jun 10, 2013 at 23:33:11, Dmitry Torokhov wrote:
> >> Manish,
> >>
> >> On Mon, Jun 10, 2013 at 10:23:16AM +, Vishwanathrao Badarkhe,
> >> Manish wrote:
> >> > Hi Dmitry,
> >> >
> >> > On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote:
> >> > > Hi Manish,
> >> > >
> >> > > On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe,
> >> > > Manish wrote:
> >> > >
> >> > > > +   struct touchscreen_init_data *init_data = NULL;
> >> > > > +   int err;
> >> > > > +
> >> > > > +   if (node)
> >> > > > +   node = of_find_node_by_name(node, "tsc");
> >> > >
> >> > > Why do you have to locate OF node manually instead of already
> >> > > having it attached to the device stucture?
> >> >
> >> > As TPS6507x is mfd device containing two nodes, regulator and
> >> > touchscreen.
> >> > It is necessary to use "of_find_node_by_name" to find child "tsc"
> >> > node
> >> > of TPS6507x MFD device.
> >>
> >> I understand that TPS6507x is a MFD device, However, I still do not
> >> understand why you do not attach OF data to the child platform device
> >> representing touch screen when you create it.
> >
> > I gone through most of MFD devices in mainline kernel where
> > "of_find_node_by_name"
> > function is used in order to populate child node properties.
> > See below example of max8925 MFD device.
> >
> > Max8025 MFD device has following modules
> > 1. Touch screen
> > 2. Charger
> > 3. Backlight
> > 4. regulator
> >
> > In DT case, device node for max8925 MFD device is in
> > "arch/arm/boot/dts/mmp2-brownstone.dts"
> > file having child nodes as regulator, backlight and charger.
> > Respective drivers (regulator, backlight and charger) of max8925 MFD
> > device used
> > "of_find_node_by_name" function in order to populate child node
> > properties.
> >
> > Here, also same case for TPS6507x MFD device
> >
> > TPS6507x MFD device has two childs:
> > 1. regulator
> > 2. touch screen.
> >
> > Regulator driver for TPS6507x is already in mainline and using function
> > "of_find_node_by_name" to populate device tree properties for
> > regulators.
> > On similar lines I used "of_find_node_by_name" to populate device
> > tree properties for touch screen.
> >
> > Still, I agreed that it is possible to attach OF data to child platform
> > device
> > but it requires changes in MFD driver of TPS6507x.
> >
> > Please let me know your opinion about this.
>
> Please let me know so accordingly I will make changes in code.
>

Please provide your comments so accordingly will make changes in code.

Regards
Manish Badarkhe
--
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 V3 1/2] tps6507x-ts: Add DT support

2013-07-29 Thread Manish Badarkhe
Hi Dmitry

On Mon, Jul 1, 2013 at 4:40 PM, Manish Badarkhe
badarkhe.man...@gmail.com wrote:

 Hi Dmitry


 On Wed, Jun 12, 2013 at 12:23 PM, Vishwanathrao Badarkhe, Manish
 manish...@ti.com wrote:
  Hi Dmitry,
 
  On Mon, Jun 10, 2013 at 23:33:11, Dmitry Torokhov wrote:
  Manish,
 
  On Mon, Jun 10, 2013 at 10:23:16AM +, Vishwanathrao Badarkhe,
  Manish wrote:
   Hi Dmitry,
  
   On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote:
Hi Manish,
   
On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe,
Manish wrote:
   
 +   struct touchscreen_init_data *init_data = NULL;
 +   int err;
 +
 +   if (node)
 +   node = of_find_node_by_name(node, tsc);
   
Why do you have to locate OF node manually instead of already
having it attached to the device stucture?
  
   As TPS6507x is mfd device containing two nodes, regulator and
   touchscreen.
   It is necessary to use of_find_node_by_name to find child tsc
   node
   of TPS6507x MFD device.
 
  I understand that TPS6507x is a MFD device, However, I still do not
  understand why you do not attach OF data to the child platform device
  representing touch screen when you create it.
 
  I gone through most of MFD devices in mainline kernel where
  of_find_node_by_name
  function is used in order to populate child node properties.
  See below example of max8925 MFD device.
 
  Max8025 MFD device has following modules
  1. Touch screen
  2. Charger
  3. Backlight
  4. regulator
 
  In DT case, device node for max8925 MFD device is in
  arch/arm/boot/dts/mmp2-brownstone.dts
  file having child nodes as regulator, backlight and charger.
  Respective drivers (regulator, backlight and charger) of max8925 MFD
  device used
  of_find_node_by_name function in order to populate child node
  properties.
 
  Here, also same case for TPS6507x MFD device
 
  TPS6507x MFD device has two childs:
  1. regulator
  2. touch screen.
 
  Regulator driver for TPS6507x is already in mainline and using function
  of_find_node_by_name to populate device tree properties for
  regulators.
  On similar lines I used of_find_node_by_name to populate device
  tree properties for touch screen.
 
  Still, I agreed that it is possible to attach OF data to child platform
  device
  but it requires changes in MFD driver of TPS6507x.
 
  Please let me know your opinion about this.

 Please let me know so accordingly I will make changes in code.


Please provide your comments so accordingly will make changes in code.

Regards
Manish Badarkhe
--
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 V3 1/2] tps6507x-ts: Add DT support

2013-06-12 Thread Grant Likely
On Tue, 21 May 2013 14:24:17 +0530, "Vishwanathrao Badarkhe, Manish" 
 wrote:
> Add device tree based support for TI's tps6507x touchscreen.
> 
> Tested on da850-evm.
> 
> Signed-off-by: Vishwanathrao Badarkhe, Manish 
> ---
> Changes since V2:
>  - Removed unnecessary code.
>  - Updated Documentation to provide proper names of
>devicetree properties.
> 
> Changes since V1:
>  - Updated documentation to specify tps6507x as multifunctional
>device.
>  - return proper error value in absence of platform and DT
>data for touchscreen.
>  - Updated commit message.
> 
> :100755 100755 8fffa3c... 65ee2cd... M
> Documentation/devicetree/bindings/mfd/tps6507x.txt
> :100644 100644 65e0f9a... 89232ee... M
> drivers/input/touchscreen/tps6507x-ts.c
>  Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-

Binding looks fine to me.

Acked-by: Grant Likely 

g.

>  drivers/input/touchscreen/tps6507x-ts.c|   98 
> ++--
>  2 files changed, 95 insertions(+), 31 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
> b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> index 8fffa3c..65ee2cd 100755
> --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
> +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> @@ -1,4 +1,8 @@
> -TPS6507x Power Management Integrated Circuit
> +TPS6507x Multifunctional Device.
> +
> +Features provided by TPS6507x:
> +1.Power Management Integrated Circuit.
> +2.Touch-Screen.
>  
>  Required properties:
>  - compatible: "ti,tps6507x"
> @@ -23,6 +27,12 @@ Required properties:
> vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
> vindcdc3-supply  : VDCDC3 input.
> vldo1_2-supply   : VLDO1 and VLDO2 input.
> +- tsc: This node specifies touch screen data.
> + ti,poll-period : Time at which touch input is getting sampled in ms.
> + ti,min-pressure: Minimum pressure value to trigger touch.
> + ti,vref: voltage reference for ADC.
> +   0: Reference voltage for ADC is disabled.
> +   1: Reference voltage for ADC is enabled.
>  
>  Regulator Optional properties:
>  - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
> @@ -30,6 +40,14 @@ Regulator Optional properties:
>   1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
>If this property is not defined, it defaults to 0 (not enabled).
>  
> +Touchscreen Optional properties:
> +- ti,vendor : Touchscreen vendor id to populate
> +   in sysclass interface.
> +- ti,product: Touchscreen product id to populate
> +   in sysclass interface.
> +- ti,version: Touchscreen version id to populate
> +   in sysclass interface.
> +
>  Example:
>  
>   pmu: tps6507x@48 {
> @@ -88,4 +106,12 @@ Example:
>   };
>   };
>  
> + tsc {
> + ti,poll-period = <30>;
> + ti,min-pressure = <0x30>;
> + ti,vref = <0>;
> + ti,vendor = <0>;
> + ti,product = <65070>;
> + ti,version = <0x100>;
> + };
>   };
> diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
> b/drivers/input/touchscreen/tps6507x-ts.c
> index 65e0f9a..89232ee 100644
> --- a/drivers/input/touchscreen/tps6507x-ts.c
> +++ b/drivers/input/touchscreen/tps6507x-ts.c
> @@ -21,6 +21,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  
>  #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
>  #define TPS_DEFAULT_MIN_PRESSURE 0x30
> @@ -231,36 +233,76 @@ done:
>   ret = tps6507x_adc_standby(tsc);
>  }
>  
> +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
> + struct input_dev *input_dev)
> +{
> + struct device_node *node = tps6507x_dev->dev->of_node;
> + struct tps6507x_board *tps_board =
> + (struct tps6507x_board *)tps6507x_dev->dev->platform_data;
> + struct touchscreen_init_data *init_data = NULL;
> + int err;
> +
> + if (node)
> + node = of_find_node_by_name(node, "tsc");
> + if (tps_board)
> + init_data = tps_board->tps6507x_ts_init_data;
> +
> + if (node == NULL || init_data == NULL) {
> + err = -EINVAL;
> + goto error_ret;
> + } else if (init_data) {
> + tps6507x_dev->ts->poll_period = init_data->poll_period;
> + tps6507x_dev->ts->min_pressure = init_data->min_pressure;
> + tps6507x_dev->ts->vref = init_data->vref;
> + input_dev->id.vendor = init_data->vendor;
> + input_dev->id.product = init_data->product;
> + input_dev->id.version = init_data->version;
> + } else if (node) {
> + err = of_property_read_u32(node, "ti,poll-period",
> + (u32 *)_dev->ts->poll_period);
> + if (err < 0)
> + goto error_ret;
> +
> + 

RE: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-06-12 Thread Vishwanathrao Badarkhe, Manish
Hi Dmitry,

On Mon, Jun 10, 2013 at 23:33:11, Dmitry Torokhov wrote:
> Manish,
> 
> On Mon, Jun 10, 2013 at 10:23:16AM +, Vishwanathrao Badarkhe, Manish 
> wrote:
> > Hi Dmitry,
> > 
> > On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote:
> > > Hi Manish,
> > > 
> > > On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish 
> > > wrote:
> > > 
> > > > +   struct touchscreen_init_data *init_data = NULL;
> > > > +   int err;
> > > > +
> > > > +   if (node)
> > > > +   node = of_find_node_by_name(node, "tsc");
> > > 
> > > Why do you have to locate OF node manually instead of already having it 
> > > attached to the device stucture?
> > 
> > As TPS6507x is mfd device containing two nodes, regulator and touchscreen.
> > It is necessary to use "of_find_node_by_name" to find child "tsc" node 
> > of TPS6507x MFD device.
> 
> I understand that TPS6507x is a MFD device, However, I still do not 
> understand why you do not attach OF data to the child platform device 
> representing touch screen when you create it.

I gone through most of MFD devices in mainline kernel where 
"of_find_node_by_name" 
function is used in order to populate child node properties. 
See below example of max8925 MFD device. 

Max8025 MFD device has following modules
1. Touch screen
2. Charger
3. Backlight
4. regulator

In DT case, device node for max8925 MFD device is in 
"arch/arm/boot/dts/mmp2-brownstone.dts" 
file having child nodes as regulator, backlight and charger.
Respective drivers (regulator, backlight and charger) of max8925 MFD device 
used 
"of_find_node_by_name" function in order to populate child node properties.

Here, also same case for TPS6507x MFD device

TPS6507x MFD device has two childs:
1. regulator
2. touch screen.

Regulator driver for TPS6507x is already in mainline and using function 
"of_find_node_by_name" to populate device tree properties for regulators.
On similar lines I used "of_find_node_by_name" to populate device
tree properties for touch screen.

Still, I agreed that it is possible to attach OF data to child platform device
but it requires changes in MFD driver of TPS6507x.

Please let me know your opinion about this.


Thanks, 
Manish
--
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 V3 1/2] tps6507x-ts: Add DT support

2013-06-12 Thread Vishwanathrao Badarkhe, Manish
Hi Dmitry,

On Mon, Jun 10, 2013 at 23:33:11, Dmitry Torokhov wrote:
 Manish,
 
 On Mon, Jun 10, 2013 at 10:23:16AM +, Vishwanathrao Badarkhe, Manish 
 wrote:
  Hi Dmitry,
  
  On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote:
   Hi Manish,
   
   On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish 
   wrote:
   
+   struct touchscreen_init_data *init_data = NULL;
+   int err;
+
+   if (node)
+   node = of_find_node_by_name(node, tsc);
   
   Why do you have to locate OF node manually instead of already having it 
   attached to the device stucture?
  
  As TPS6507x is mfd device containing two nodes, regulator and touchscreen.
  It is necessary to use of_find_node_by_name to find child tsc node 
  of TPS6507x MFD device.
 
 I understand that TPS6507x is a MFD device, However, I still do not 
 understand why you do not attach OF data to the child platform device 
 representing touch screen when you create it.

I gone through most of MFD devices in mainline kernel where 
of_find_node_by_name 
function is used in order to populate child node properties. 
See below example of max8925 MFD device. 

Max8025 MFD device has following modules
1. Touch screen
2. Charger
3. Backlight
4. regulator

In DT case, device node for max8925 MFD device is in 
arch/arm/boot/dts/mmp2-brownstone.dts 
file having child nodes as regulator, backlight and charger.
Respective drivers (regulator, backlight and charger) of max8925 MFD device 
used 
of_find_node_by_name function in order to populate child node properties.

Here, also same case for TPS6507x MFD device

TPS6507x MFD device has two childs:
1. regulator
2. touch screen.

Regulator driver for TPS6507x is already in mainline and using function 
of_find_node_by_name to populate device tree properties for regulators.
On similar lines I used of_find_node_by_name to populate device
tree properties for touch screen.

Still, I agreed that it is possible to attach OF data to child platform device
but it requires changes in MFD driver of TPS6507x.

Please let me know your opinion about this.


Thanks, 
Manish
--
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 V3 1/2] tps6507x-ts: Add DT support

2013-06-12 Thread Grant Likely
On Tue, 21 May 2013 14:24:17 +0530, Vishwanathrao Badarkhe, Manish 
manish...@ti.com wrote:
 Add device tree based support for TI's tps6507x touchscreen.
 
 Tested on da850-evm.
 
 Signed-off-by: Vishwanathrao Badarkhe, Manish manish...@ti.com
 ---
 Changes since V2:
  - Removed unnecessary code.
  - Updated Documentation to provide proper names of
devicetree properties.
 
 Changes since V1:
  - Updated documentation to specify tps6507x as multifunctional
device.
  - return proper error value in absence of platform and DT
data for touchscreen.
  - Updated commit message.
 
 :100755 100755 8fffa3c... 65ee2cd... M
 Documentation/devicetree/bindings/mfd/tps6507x.txt
 :100644 100644 65e0f9a... 89232ee... M
 drivers/input/touchscreen/tps6507x-ts.c
  Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-

Binding looks fine to me.

Acked-by: Grant Likely grant.lik...@secretlab.ca

g.

  drivers/input/touchscreen/tps6507x-ts.c|   98 
 ++--
  2 files changed, 95 insertions(+), 31 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
 b/Documentation/devicetree/bindings/mfd/tps6507x.txt
 index 8fffa3c..65ee2cd 100755
 --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
 +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
 @@ -1,4 +1,8 @@
 -TPS6507x Power Management Integrated Circuit
 +TPS6507x Multifunctional Device.
 +
 +Features provided by TPS6507x:
 +1.Power Management Integrated Circuit.
 +2.Touch-Screen.
  
  Required properties:
  - compatible: ti,tps6507x
 @@ -23,6 +27,12 @@ Required properties:
 vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
 vindcdc3-supply  : VDCDC3 input.
 vldo1_2-supply   : VLDO1 and VLDO2 input.
 +- tsc: This node specifies touch screen data.
 + ti,poll-period : Time at which touch input is getting sampled in ms.
 + ti,min-pressure: Minimum pressure value to trigger touch.
 + ti,vref: voltage reference for ADC.
 +   0: Reference voltage for ADC is disabled.
 +   1: Reference voltage for ADC is enabled.
  
  Regulator Optional properties:
  - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
 @@ -30,6 +40,14 @@ Regulator Optional properties:
   1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
If this property is not defined, it defaults to 0 (not enabled).
  
 +Touchscreen Optional properties:
 +- ti,vendor : Touchscreen vendor id to populate
 +   in sysclass interface.
 +- ti,product: Touchscreen product id to populate
 +   in sysclass interface.
 +- ti,version: Touchscreen version id to populate
 +   in sysclass interface.
 +
  Example:
  
   pmu: tps6507x@48 {
 @@ -88,4 +106,12 @@ Example:
   };
   };
  
 + tsc {
 + ti,poll-period = 30;
 + ti,min-pressure = 0x30;
 + ti,vref = 0;
 + ti,vendor = 0;
 + ti,product = 65070;
 + ti,version = 0x100;
 + };
   };
 diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
 b/drivers/input/touchscreen/tps6507x-ts.c
 index 65e0f9a..89232ee 100644
 --- a/drivers/input/touchscreen/tps6507x-ts.c
 +++ b/drivers/input/touchscreen/tps6507x-ts.c
 @@ -21,6 +21,8 @@
  #include linux/mfd/tps6507x.h
  #include linux/input/tps6507x-ts.h
  #include linux/delay.h
 +#include linux/of.h
 +#include linux/of_device.h
  
  #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
  #define TPS_DEFAULT_MIN_PRESSURE 0x30
 @@ -231,36 +233,76 @@ done:
   ret = tps6507x_adc_standby(tsc);
  }
  
 +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
 + struct input_dev *input_dev)
 +{
 + struct device_node *node = tps6507x_dev-dev-of_node;
 + struct tps6507x_board *tps_board =
 + (struct tps6507x_board *)tps6507x_dev-dev-platform_data;
 + struct touchscreen_init_data *init_data = NULL;
 + int err;
 +
 + if (node)
 + node = of_find_node_by_name(node, tsc);
 + if (tps_board)
 + init_data = tps_board-tps6507x_ts_init_data;
 +
 + if (node == NULL || init_data == NULL) {
 + err = -EINVAL;
 + goto error_ret;
 + } else if (init_data) {
 + tps6507x_dev-ts-poll_period = init_data-poll_period;
 + tps6507x_dev-ts-min_pressure = init_data-min_pressure;
 + tps6507x_dev-ts-vref = init_data-vref;
 + input_dev-id.vendor = init_data-vendor;
 + input_dev-id.product = init_data-product;
 + input_dev-id.version = init_data-version;
 + } else if (node) {
 + err = of_property_read_u32(node, ti,poll-period,
 + (u32 *)tps6507x_dev-ts-poll_period);
 + if (err  0)
 + goto error_ret;
 +
 + err = 

Re: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-06-10 Thread Dmitry Torokhov
Manish,

On Mon, Jun 10, 2013 at 10:23:16AM +, Vishwanathrao Badarkhe, Manish wrote:
> Hi Dmitry,
> 
> On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote:
> > Hi Manish,
> > 
> > On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish 
> > wrote:
> > 
> > > + struct touchscreen_init_data *init_data = NULL;
> > > + int err;
> > > +
> > > + if (node)
> > > + node = of_find_node_by_name(node, "tsc");
> > 
> > Why do you have to locate OF node manually instead of already having it 
> > attached to the device stucture?
> 
> As TPS6507x is mfd device containing two nodes, regulator and touchscreen.
> It is necessary to use "of_find_node_by_name" to find child "tsc" node of 
> TPS6507x MFD device.

I understand that TPS6507x is a MFD device, However, I still do not
understand why you do not attach OF data to the child platform device
representing touchscreen when you create it.

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 V3 1/2] tps6507x-ts: Add DT support

2013-06-10 Thread Vishwanathrao Badarkhe, Manish
Hi Dmitry,

On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote:
> Hi Manish,
> 
> On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish 
> wrote:
> > Add device tree based support for TI's tps6507x touchscreen.
> > 
> > Tested on da850-evm.
> > 
> > Signed-off-by: Vishwanathrao Badarkhe, Manish 
> > ---
> > Changes since V2:
> >  - Removed unnecessary code.
> >  - Updated Documentation to provide proper names of
> >devicetree properties.
> > 
> > Changes since V1:
> >  - Updated documentation to specify tps6507x as multifunctional
> >device.
> >  - return proper error value in absence of platform and DT
> >data for touchscreen.
> >  - Updated commit message.
> > 
> > :100755 100755 8fffa3c... 65ee2cd... M  
> > Documentation/devicetree/bindings/mfd/tps6507x.txt
> > :100644 100644 65e0f9a... 89232ee... M  
> > drivers/input/touchscreen/tps6507x-ts.c
> >  Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-
> >  drivers/input/touchscreen/tps6507x-ts.c|   98 
> > ++--
> >  2 files changed, 95 insertions(+), 31 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
> > b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> > index 8fffa3c..65ee2cd 100755
> > --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
> > +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> > @@ -1,4 +1,8 @@
> > -TPS6507x Power Management Integrated Circuit
> > +TPS6507x Multifunctional Device.
> > +
> > +Features provided by TPS6507x:
> > +1.Power Management Integrated Circuit.
> > +2.Touch-Screen.
> >  
> >  Required properties:
> >  - compatible: "ti,tps6507x"
> > @@ -23,6 +27,12 @@ Required properties:
> > vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
> > vindcdc3-supply  : VDCDC3 input.
> > vldo1_2-supply   : VLDO1 and VLDO2 input.
> > +- tsc: This node specifies touch screen data.
> > +   ti,poll-period : Time at which touch input is getting sampled in ms.
> > +   ti,min-pressure: Minimum pressure value to trigger touch.
> > +   ti,vref: voltage reference for ADC.
> > + 0: Reference voltage for ADC is disabled.
> > + 1: Reference voltage for ADC is enabled.
> >  
> >  Regulator Optional properties:
> >  - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
> > @@ -30,6 +40,14 @@ Regulator Optional properties:
> > 1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
> >If this property is not defined, it defaults to 0 (not enabled).
> >  
> > +Touchscreen Optional properties:
> > +- ti,vendor : Touchscreen vendor id to populate
> > + in sysclass interface.
> > +- ti,product: Touchscreen product id to populate
> > + in sysclass interface.
> > +- ti,version: Touchscreen version id to populate
> > + in sysclass interface.
> > +
> >  Example:
> >  
> > pmu: tps6507x@48 {
> > @@ -88,4 +106,12 @@ Example:
> > };
> > };
> >  
> > +   tsc {
> > +   ti,poll-period = <30>;
> > +   ti,min-pressure = <0x30>;
> > +   ti,vref = <0>;
> > +   ti,vendor = <0>;
> > +   ti,product = <65070>;
> > +   ti,version = <0x100>;
> > +   };
> > };
> > diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
> > b/drivers/input/touchscreen/tps6507x-ts.c
> > index 65e0f9a..89232ee 100644
> > --- a/drivers/input/touchscreen/tps6507x-ts.c
> > +++ b/drivers/input/touchscreen/tps6507x-ts.c
> > @@ -21,6 +21,8 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> >  
> >  #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */  #define 
> > TPS_DEFAULT_MIN_PRESSURE 0x30 @@ -231,36 +233,76 @@ done:
> > ret = tps6507x_adc_standby(tsc);
> >  }
> >  
> > +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
> > +   struct input_dev *input_dev)
> > +{
> > +   struct device_node *node = tps6507x_dev->dev->of_node;
> > +   struct tps6507x_board *tps_board =
> > +   (struct tps6507x_board *)tps6507x_dev->dev->platform_data;
> 
> 
> Please make tps_board const pointer and use dev_get_platdata() to fetch it.

Ok, I will make "tps_board" as a const pointer and fetch it using 
dev_get_platdata().

> 
> > +   struct touchscreen_init_data *init_data = NULL;
> > +   int err;
> > +
> > +   if (node)
> > +   node = of_find_node_by_name(node, "tsc");
> 
> Why do you have to locate OF node manually instead of already having it 
> attached to the device stucture?

As TPS6507x is mfd device containing two nodes, regulator and touchscreen.
It is necessary to use "of_find_node_by_name" to find child "tsc" node of 
TPS6507x MFD device.

> 
> > +   if (tps_board)
> > +   init_data = tps_board->tps6507x_ts_init_data;
> > +
> > +   if (node == NULL || init_data == NULL) {
> > +   err = -EINVAL;
> > +   goto error_ret;

Re: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-06-10 Thread Dmitry Torokhov
Hi Manish,

On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish wrote:
> Add device tree based support for TI's tps6507x touchscreen.
> 
> Tested on da850-evm.
> 
> Signed-off-by: Vishwanathrao Badarkhe, Manish 
> ---
> Changes since V2:
>  - Removed unnecessary code.
>  - Updated Documentation to provide proper names of
>devicetree properties.
> 
> Changes since V1:
>  - Updated documentation to specify tps6507x as multifunctional
>device.
>  - return proper error value in absence of platform and DT
>data for touchscreen.
>  - Updated commit message.
> 
> :100755 100755 8fffa3c... 65ee2cd... M
> Documentation/devicetree/bindings/mfd/tps6507x.txt
> :100644 100644 65e0f9a... 89232ee... M
> drivers/input/touchscreen/tps6507x-ts.c
>  Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-
>  drivers/input/touchscreen/tps6507x-ts.c|   98 
> ++--
>  2 files changed, 95 insertions(+), 31 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
> b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> index 8fffa3c..65ee2cd 100755
> --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
> +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
> @@ -1,4 +1,8 @@
> -TPS6507x Power Management Integrated Circuit
> +TPS6507x Multifunctional Device.
> +
> +Features provided by TPS6507x:
> +1.Power Management Integrated Circuit.
> +2.Touch-Screen.
>  
>  Required properties:
>  - compatible: "ti,tps6507x"
> @@ -23,6 +27,12 @@ Required properties:
> vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
> vindcdc3-supply  : VDCDC3 input.
> vldo1_2-supply   : VLDO1 and VLDO2 input.
> +- tsc: This node specifies touch screen data.
> + ti,poll-period : Time at which touch input is getting sampled in ms.
> + ti,min-pressure: Minimum pressure value to trigger touch.
> + ti,vref: voltage reference for ADC.
> +   0: Reference voltage for ADC is disabled.
> +   1: Reference voltage for ADC is enabled.
>  
>  Regulator Optional properties:
>  - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
> @@ -30,6 +40,14 @@ Regulator Optional properties:
>   1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
>If this property is not defined, it defaults to 0 (not enabled).
>  
> +Touchscreen Optional properties:
> +- ti,vendor : Touchscreen vendor id to populate
> +   in sysclass interface.
> +- ti,product: Touchscreen product id to populate
> +   in sysclass interface.
> +- ti,version: Touchscreen version id to populate
> +   in sysclass interface.
> +
>  Example:
>  
>   pmu: tps6507x@48 {
> @@ -88,4 +106,12 @@ Example:
>   };
>   };
>  
> + tsc {
> + ti,poll-period = <30>;
> + ti,min-pressure = <0x30>;
> + ti,vref = <0>;
> + ti,vendor = <0>;
> + ti,product = <65070>;
> + ti,version = <0x100>;
> + };
>   };
> diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
> b/drivers/input/touchscreen/tps6507x-ts.c
> index 65e0f9a..89232ee 100644
> --- a/drivers/input/touchscreen/tps6507x-ts.c
> +++ b/drivers/input/touchscreen/tps6507x-ts.c
> @@ -21,6 +21,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  
>  #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
>  #define TPS_DEFAULT_MIN_PRESSURE 0x30
> @@ -231,36 +233,76 @@ done:
>   ret = tps6507x_adc_standby(tsc);
>  }
>  
> +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
> + struct input_dev *input_dev)
> +{
> + struct device_node *node = tps6507x_dev->dev->of_node;
> + struct tps6507x_board *tps_board =
> + (struct tps6507x_board *)tps6507x_dev->dev->platform_data;


Please make tps_board const pointer and use dev_get_platdata() to fetch
it.

> + struct touchscreen_init_data *init_data = NULL;
> + int err;
> +
> + if (node)
> + node = of_find_node_by_name(node, "tsc");

Why do you have to locate OF node manually instead of already having it
attached to the device stucture?

> + if (tps_board)
> + init_data = tps_board->tps6507x_ts_init_data;
> +
> + if (node == NULL || init_data == NULL) {
> + err = -EINVAL;
> + goto error_ret;
> + } else if (init_data) {
> + tps6507x_dev->ts->poll_period = init_data->poll_period;
> + tps6507x_dev->ts->min_pressure = init_data->min_pressure;
> + tps6507x_dev->ts->vref = init_data->vref;
> + input_dev->id.vendor = init_data->vendor;
> + input_dev->id.product = init_data->product;
> + input_dev->id.version = init_data->version;
> + } else if (node) {
> + err = of_property_read_u32(node, "ti,poll-period",
> +  

Re: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-06-10 Thread Dmitry Torokhov
Hi Manish,

On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish wrote:
 Add device tree based support for TI's tps6507x touchscreen.
 
 Tested on da850-evm.
 
 Signed-off-by: Vishwanathrao Badarkhe, Manish manish...@ti.com
 ---
 Changes since V2:
  - Removed unnecessary code.
  - Updated Documentation to provide proper names of
devicetree properties.
 
 Changes since V1:
  - Updated documentation to specify tps6507x as multifunctional
device.
  - return proper error value in absence of platform and DT
data for touchscreen.
  - Updated commit message.
 
 :100755 100755 8fffa3c... 65ee2cd... M
 Documentation/devicetree/bindings/mfd/tps6507x.txt
 :100644 100644 65e0f9a... 89232ee... M
 drivers/input/touchscreen/tps6507x-ts.c
  Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-
  drivers/input/touchscreen/tps6507x-ts.c|   98 
 ++--
  2 files changed, 95 insertions(+), 31 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
 b/Documentation/devicetree/bindings/mfd/tps6507x.txt
 index 8fffa3c..65ee2cd 100755
 --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
 +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
 @@ -1,4 +1,8 @@
 -TPS6507x Power Management Integrated Circuit
 +TPS6507x Multifunctional Device.
 +
 +Features provided by TPS6507x:
 +1.Power Management Integrated Circuit.
 +2.Touch-Screen.
  
  Required properties:
  - compatible: ti,tps6507x
 @@ -23,6 +27,12 @@ Required properties:
 vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
 vindcdc3-supply  : VDCDC3 input.
 vldo1_2-supply   : VLDO1 and VLDO2 input.
 +- tsc: This node specifies touch screen data.
 + ti,poll-period : Time at which touch input is getting sampled in ms.
 + ti,min-pressure: Minimum pressure value to trigger touch.
 + ti,vref: voltage reference for ADC.
 +   0: Reference voltage for ADC is disabled.
 +   1: Reference voltage for ADC is enabled.
  
  Regulator Optional properties:
  - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
 @@ -30,6 +40,14 @@ Regulator Optional properties:
   1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
If this property is not defined, it defaults to 0 (not enabled).
  
 +Touchscreen Optional properties:
 +- ti,vendor : Touchscreen vendor id to populate
 +   in sysclass interface.
 +- ti,product: Touchscreen product id to populate
 +   in sysclass interface.
 +- ti,version: Touchscreen version id to populate
 +   in sysclass interface.
 +
  Example:
  
   pmu: tps6507x@48 {
 @@ -88,4 +106,12 @@ Example:
   };
   };
  
 + tsc {
 + ti,poll-period = 30;
 + ti,min-pressure = 0x30;
 + ti,vref = 0;
 + ti,vendor = 0;
 + ti,product = 65070;
 + ti,version = 0x100;
 + };
   };
 diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
 b/drivers/input/touchscreen/tps6507x-ts.c
 index 65e0f9a..89232ee 100644
 --- a/drivers/input/touchscreen/tps6507x-ts.c
 +++ b/drivers/input/touchscreen/tps6507x-ts.c
 @@ -21,6 +21,8 @@
  #include linux/mfd/tps6507x.h
  #include linux/input/tps6507x-ts.h
  #include linux/delay.h
 +#include linux/of.h
 +#include linux/of_device.h
  
  #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */
  #define TPS_DEFAULT_MIN_PRESSURE 0x30
 @@ -231,36 +233,76 @@ done:
   ret = tps6507x_adc_standby(tsc);
  }
  
 +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
 + struct input_dev *input_dev)
 +{
 + struct device_node *node = tps6507x_dev-dev-of_node;
 + struct tps6507x_board *tps_board =
 + (struct tps6507x_board *)tps6507x_dev-dev-platform_data;


Please make tps_board const pointer and use dev_get_platdata() to fetch
it.

 + struct touchscreen_init_data *init_data = NULL;
 + int err;
 +
 + if (node)
 + node = of_find_node_by_name(node, tsc);

Why do you have to locate OF node manually instead of already having it
attached to the device stucture?

 + if (tps_board)
 + init_data = tps_board-tps6507x_ts_init_data;
 +
 + if (node == NULL || init_data == NULL) {
 + err = -EINVAL;
 + goto error_ret;
 + } else if (init_data) {
 + tps6507x_dev-ts-poll_period = init_data-poll_period;
 + tps6507x_dev-ts-min_pressure = init_data-min_pressure;
 + tps6507x_dev-ts-vref = init_data-vref;
 + input_dev-id.vendor = init_data-vendor;
 + input_dev-id.product = init_data-product;
 + input_dev-id.version = init_data-version;
 + } else if (node) {
 + err = of_property_read_u32(node, ti,poll-period,
 + (u32 

RE: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-06-10 Thread Vishwanathrao Badarkhe, Manish
Hi Dmitry,

On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote:
 Hi Manish,
 
 On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish 
 wrote:
  Add device tree based support for TI's tps6507x touchscreen.
  
  Tested on da850-evm.
  
  Signed-off-by: Vishwanathrao Badarkhe, Manish manish...@ti.com
  ---
  Changes since V2:
   - Removed unnecessary code.
   - Updated Documentation to provide proper names of
 devicetree properties.
  
  Changes since V1:
   - Updated documentation to specify tps6507x as multifunctional
 device.
   - return proper error value in absence of platform and DT
 data for touchscreen.
   - Updated commit message.
  
  :100755 100755 8fffa3c... 65ee2cd... M  
  Documentation/devicetree/bindings/mfd/tps6507x.txt
  :100644 100644 65e0f9a... 89232ee... M  
  drivers/input/touchscreen/tps6507x-ts.c
   Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 ++-
   drivers/input/touchscreen/tps6507x-ts.c|   98 
  ++--
   2 files changed, 95 insertions(+), 31 deletions(-)
  
  diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt 
  b/Documentation/devicetree/bindings/mfd/tps6507x.txt
  index 8fffa3c..65ee2cd 100755
  --- a/Documentation/devicetree/bindings/mfd/tps6507x.txt
  +++ b/Documentation/devicetree/bindings/mfd/tps6507x.txt
  @@ -1,4 +1,8 @@
  -TPS6507x Power Management Integrated Circuit
  +TPS6507x Multifunctional Device.
  +
  +Features provided by TPS6507x:
  +1.Power Management Integrated Circuit.
  +2.Touch-Screen.
   
   Required properties:
   - compatible: ti,tps6507x
  @@ -23,6 +27,12 @@ Required properties:
  vindcdc1_2-supply: VDCDC1 and VDCDC2 input.
  vindcdc3-supply  : VDCDC3 input.
  vldo1_2-supply   : VLDO1 and VLDO2 input.
  +- tsc: This node specifies touch screen data.
  +   ti,poll-period : Time at which touch input is getting sampled in ms.
  +   ti,min-pressure: Minimum pressure value to trigger touch.
  +   ti,vref: voltage reference for ADC.
  + 0: Reference voltage for ADC is disabled.
  + 1: Reference voltage for ADC is enabled.
   
   Regulator Optional properties:
   - defdcdc_default: It's property of DCDC2 and DCDC3 regulators.
  @@ -30,6 +40,14 @@ Regulator Optional properties:
  1: If defdcdc pin of DCDC2/DCDC3 is driven HIGH.
 If this property is not defined, it defaults to 0 (not enabled).
   
  +Touchscreen Optional properties:
  +- ti,vendor : Touchscreen vendor id to populate
  + in sysclass interface.
  +- ti,product: Touchscreen product id to populate
  + in sysclass interface.
  +- ti,version: Touchscreen version id to populate
  + in sysclass interface.
  +
   Example:
   
  pmu: tps6507x@48 {
  @@ -88,4 +106,12 @@ Example:
  };
  };
   
  +   tsc {
  +   ti,poll-period = 30;
  +   ti,min-pressure = 0x30;
  +   ti,vref = 0;
  +   ti,vendor = 0;
  +   ti,product = 65070;
  +   ti,version = 0x100;
  +   };
  };
  diff --git a/drivers/input/touchscreen/tps6507x-ts.c 
  b/drivers/input/touchscreen/tps6507x-ts.c
  index 65e0f9a..89232ee 100644
  --- a/drivers/input/touchscreen/tps6507x-ts.c
  +++ b/drivers/input/touchscreen/tps6507x-ts.c
  @@ -21,6 +21,8 @@
   #include linux/mfd/tps6507x.h
   #include linux/input/tps6507x-ts.h
   #include linux/delay.h
  +#include linux/of.h
  +#include linux/of_device.h
   
   #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */  #define 
  TPS_DEFAULT_MIN_PRESSURE 0x30 @@ -231,36 +233,76 @@ done:
  ret = tps6507x_adc_standby(tsc);
   }
   
  +static int tsc_init_data(struct tps6507x_dev *tps6507x_dev,
  +   struct input_dev *input_dev)
  +{
  +   struct device_node *node = tps6507x_dev-dev-of_node;
  +   struct tps6507x_board *tps_board =
  +   (struct tps6507x_board *)tps6507x_dev-dev-platform_data;
 
 
 Please make tps_board const pointer and use dev_get_platdata() to fetch it.

Ok, I will make tps_board as a const pointer and fetch it using 
dev_get_platdata().

 
  +   struct touchscreen_init_data *init_data = NULL;
  +   int err;
  +
  +   if (node)
  +   node = of_find_node_by_name(node, tsc);
 
 Why do you have to locate OF node manually instead of already having it 
 attached to the device stucture?

As TPS6507x is mfd device containing two nodes, regulator and touchscreen.
It is necessary to use of_find_node_by_name to find child tsc node of 
TPS6507x MFD device.

 
  +   if (tps_board)
  +   init_data = tps_board-tps6507x_ts_init_data;
  +
  +   if (node == NULL || init_data == NULL) {
  +   err = -EINVAL;
  +   goto error_ret;
  +   } else if (init_data) {
  +   tps6507x_dev-ts-poll_period = init_data-poll_period;
  +   tps6507x_dev-ts-min_pressure = init_data-min_pressure;
  +

Re: [PATCH V3 1/2] tps6507x-ts: Add DT support

2013-06-10 Thread Dmitry Torokhov
Manish,

On Mon, Jun 10, 2013 at 10:23:16AM +, Vishwanathrao Badarkhe, Manish wrote:
 Hi Dmitry,
 
 On Mon, Jun 10, 2013 at 11:34:42, Dmitry Torokhov wrote:
  Hi Manish,
  
  On Tue, May 21, 2013 at 02:24:17PM +0530, Vishwanathrao Badarkhe, Manish 
  wrote:
  
   + struct touchscreen_init_data *init_data = NULL;
   + int err;
   +
   + if (node)
   + node = of_find_node_by_name(node, tsc);
  
  Why do you have to locate OF node manually instead of already having it 
  attached to the device stucture?
 
 As TPS6507x is mfd device containing two nodes, regulator and touchscreen.
 It is necessary to use of_find_node_by_name to find child tsc node of 
 TPS6507x MFD device.

I understand that TPS6507x is a MFD device, However, I still do not
understand why you do not attach OF data to the child platform device
representing touchscreen when you create it.

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/