All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] Add DT support for tps6507x touchscreen
@ 2013-05-04 11:12 ` Vishwanathrao Badarkhe, Manish
  0 siblings, 0 replies; 9+ messages in thread
From: Vishwanathrao Badarkhe, Manish @ 2013-05-04 11:12 UTC (permalink / raw)
  To: devicetree-discuss, linux-input, linux-doc, linux-kernel,
	davinci-linux-open-source
  Cc: grant.likely, dmitry.torokhov, rob.herring, rob, manishv.b

Patch set adds DT support for tps6507x based touchscreen
Also, add DT data for tps6507x touchscreen in da850-evm by
providing touchscreen node inside tps6507x mfd device.

This patch series applies on top of linux-next tree
and depends on [1].

[1]tps6507x-ts: update to devm_* API
   https://patchwork.kernel.org/patch/2324441/

Tested on da850-evm board.

Changes since V1:
 - Updated tps6507x documentation.
 - Updated commit message.
 - return proper error value in absence platform and DT data
   for touchscreen.

Vishwanathrao Badarkhe, Manish (2):
  tps6507x-ts: Add DT support
  ARM: davinci: da850: add tps6507x touchscreen DT data

 Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 +++++-
 arch/arm/boot/dts/da850-evm.dts                    |    9 ++
 drivers/input/touchscreen/tps6507x-ts.c            |  105 ++++++++++++++------
 3 files changed, 111 insertions(+), 31 deletions(-)

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 0/2] Add DT support for tps6507x touchscreen
@ 2013-05-04 11:12 ` Vishwanathrao Badarkhe, Manish
  0 siblings, 0 replies; 9+ messages in thread
From: Vishwanathrao Badarkhe, Manish @ 2013-05-04 11:12 UTC (permalink / raw)
  To: devicetree-discuss, linux-input, linux-doc, linux-kernel,
	davinci-linux-open-source
  Cc: grant.likely, dmitry.torokhov, rob.herring, rob, manishv.b

Patch set adds DT support for tps6507x based touchscreen
Also, add DT data for tps6507x touchscreen in da850-evm by
providing touchscreen node inside tps6507x mfd device.

This patch series applies on top of linux-next tree
and depends on [1].

[1]tps6507x-ts: update to devm_* API
   https://patchwork.kernel.org/patch/2324441/

Tested on da850-evm board.

Changes since V1:
 - Updated tps6507x documentation.
 - Updated commit message.
 - return proper error value in absence platform and DT data
   for touchscreen.

Vishwanathrao Badarkhe, Manish (2):
  tps6507x-ts: Add DT support
  ARM: davinci: da850: add tps6507x touchscreen DT data

 Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 +++++-
 arch/arm/boot/dts/da850-evm.dts                    |    9 ++
 drivers/input/touchscreen/tps6507x-ts.c            |  105 ++++++++++++++------
 3 files changed, 111 insertions(+), 31 deletions(-)

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 1/2] tps6507x-ts: Add DT support
  2013-05-04 11:12 ` Vishwanathrao Badarkhe, Manish
@ 2013-05-04 11:12   ` Vishwanathrao Badarkhe, Manish
  -1 siblings, 0 replies; 9+ messages in thread
From: Vishwanathrao Badarkhe, Manish @ 2013-05-04 11:12 UTC (permalink / raw)
  To: devicetree-discuss, linux-input, linux-doc, linux-kernel,
	davinci-linux-open-source
  Cc: grant.likely, dmitry.torokhov, rob.herring, rob, manishv.b

Add device tree based support for TI's tps6507x touchscreen.

Tested on da850-evm.

Signed-off-by: Vishwanathrao Badarkhe, Manish <manishv.b@ti.com>
---
Changes since V1:
	- Updated documetation 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... cf8960c... M	Documentation/devicetree/bindings/mfd/tps6507x.txt
:100644 100644 65e0f9a... d5433d0... M	drivers/input/touchscreen/tps6507x-ts.c
 Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 +++++-
 drivers/input/touchscreen/tps6507x-ts.c            |  105 ++++++++++++++------
 2 files changed, 102 insertions(+), 31 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt b/Documentation/devicetree/bindings/mfd/tps6507x.txt
index 8fffa3c..cf8960c 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 poppulate
+	      in sysclass interface.
+- ti,product: Touchscreen product id to poppulate
+	      in sysclass interface.
+- ti,version: Touchscreen version id to poppulate
+	      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..d5433d0 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,83 @@ 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;
+	u32 val32;
+	int err;
+
+	if (node)
+		node = of_find_node_by_name(node, "tsc");
+	if (tps_board)
+		init_data = tps_board->tps6507x_ts_init_data;
+
+	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", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			tps6507x_dev->ts->poll_period = val32;
+
+		err = of_property_read_u32(node, "ti,min_pressure", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			tps6507x_dev->ts->min_pressure = val32;
+
+		err = of_property_read_u32(node, "ti,vref", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			tps6507x_dev->ts->vref = val32;
+
+		err = of_property_read_u32(node, "ti,vendor", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			input_dev->id.vendor = val32;
+
+		err = of_property_read_u32(node, "ti,product", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			input_dev->id.product = val32;
+
+		err = of_property_read_u32(node, "ti,version", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			input_dev->id.version = val32;
+	} else {
+		err = -EINVAL;
+		goto error_ret;
+	}
+
+	return 0;
+
+error_ret:
+	return err;
+}
+
 static int tps6507x_ts_probe(struct platform_device *pdev)
 {
 	int error;
 	struct tps6507x_ts *tsc;
 	struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
-	struct touchscreen_init_data *init_data;
 	struct input_dev *input_dev;
-	struct tps6507x_board *tps_board;
 	int schd;
 
-	/**
-	 * tps_board points to pmic related constants
-	 * coming from the board-evm file.
-	 */
-
-	tps_board = (struct tps6507x_board *)tps6507x_dev->dev->platform_data;
-
-	if (!tps_board) {
-		dev_err(tps6507x_dev->dev,
-			"Could not find tps6507x platform data\n");
-		return -EIO;
-	}
-
-	/**
-	 * init_data points to array of regulator_init structures
-	 * coming from the board-evm file.
-	 */
-
-	init_data = tps_board->tps6507x_ts_init_data;
-
 	tsc = devm_kzalloc(&pdev->dev, sizeof(struct tps6507x_ts), GFP_KERNEL);
 	if (!tsc) {
 		dev_err(tps6507x_dev->dev, "failed to allocate driver data\n");
@@ -301,14 +350,10 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
 
 	INIT_DELAYED_WORK(&tsc->work, tps6507x_ts_handler);
 
-	if (init_data) {
-		tsc->poll_period = init_data->poll_period;
-		tsc->vref = init_data->vref;
-		tsc->min_pressure = init_data->min_pressure;
-		input_dev->id.vendor = init_data->vendor;
-		input_dev->id.product = init_data->product;
-		input_dev->id.version = init_data->version;
-	} else {
+	error = tsc_init_data(tps6507x_dev, input_dev);
+
+	if (error) {
+		dev_warn(&pdev->dev, "Use default platform data\n");
 		tsc->poll_period = TSC_DEFAULT_POLL_PERIOD;
 		tsc->min_pressure = TPS_DEFAULT_MIN_PRESSURE;
 	}
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V2 1/2] tps6507x-ts: Add DT support
@ 2013-05-04 11:12   ` Vishwanathrao Badarkhe, Manish
  0 siblings, 0 replies; 9+ messages in thread
From: Vishwanathrao Badarkhe, Manish @ 2013-05-04 11:12 UTC (permalink / raw)
  To: devicetree-discuss, linux-input, linux-doc, linux-kernel,
	davinci-linux-open-source
  Cc: grant.likely, dmitry.torokhov, rob.herring, rob, manishv.b

Add device tree based support for TI's tps6507x touchscreen.

Tested on da850-evm.

Signed-off-by: Vishwanathrao Badarkhe, Manish <manishv.b@ti.com>
---
Changes since V1:
	- Updated documetation 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... cf8960c... M	Documentation/devicetree/bindings/mfd/tps6507x.txt
:100644 100644 65e0f9a... d5433d0... M	drivers/input/touchscreen/tps6507x-ts.c
 Documentation/devicetree/bindings/mfd/tps6507x.txt |   28 +++++-
 drivers/input/touchscreen/tps6507x-ts.c            |  105 ++++++++++++++------
 2 files changed, 102 insertions(+), 31 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/tps6507x.txt b/Documentation/devicetree/bindings/mfd/tps6507x.txt
index 8fffa3c..cf8960c 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 poppulate
+	      in sysclass interface.
+- ti,product: Touchscreen product id to poppulate
+	      in sysclass interface.
+- ti,version: Touchscreen version id to poppulate
+	      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..d5433d0 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,83 @@ 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;
+	u32 val32;
+	int err;
+
+	if (node)
+		node = of_find_node_by_name(node, "tsc");
+	if (tps_board)
+		init_data = tps_board->tps6507x_ts_init_data;
+
+	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", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			tps6507x_dev->ts->poll_period = val32;
+
+		err = of_property_read_u32(node, "ti,min_pressure", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			tps6507x_dev->ts->min_pressure = val32;
+
+		err = of_property_read_u32(node, "ti,vref", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			tps6507x_dev->ts->vref = val32;
+
+		err = of_property_read_u32(node, "ti,vendor", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			input_dev->id.vendor = val32;
+
+		err = of_property_read_u32(node, "ti,product", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			input_dev->id.product = val32;
+
+		err = of_property_read_u32(node, "ti,version", &val32);
+		if (err < 0)
+			goto error_ret;
+		else
+			input_dev->id.version = val32;
+	} else {
+		err = -EINVAL;
+		goto error_ret;
+	}
+
+	return 0;
+
+error_ret:
+	return err;
+}
+
 static int tps6507x_ts_probe(struct platform_device *pdev)
 {
 	int error;
 	struct tps6507x_ts *tsc;
 	struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
-	struct touchscreen_init_data *init_data;
 	struct input_dev *input_dev;
-	struct tps6507x_board *tps_board;
 	int schd;
 
-	/**
-	 * tps_board points to pmic related constants
-	 * coming from the board-evm file.
-	 */
-
-	tps_board = (struct tps6507x_board *)tps6507x_dev->dev->platform_data;
-
-	if (!tps_board) {
-		dev_err(tps6507x_dev->dev,
-			"Could not find tps6507x platform data\n");
-		return -EIO;
-	}
-
-	/**
-	 * init_data points to array of regulator_init structures
-	 * coming from the board-evm file.
-	 */
-
-	init_data = tps_board->tps6507x_ts_init_data;
-
 	tsc = devm_kzalloc(&pdev->dev, sizeof(struct tps6507x_ts), GFP_KERNEL);
 	if (!tsc) {
 		dev_err(tps6507x_dev->dev, "failed to allocate driver data\n");
@@ -301,14 +350,10 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
 
 	INIT_DELAYED_WORK(&tsc->work, tps6507x_ts_handler);
 
-	if (init_data) {
-		tsc->poll_period = init_data->poll_period;
-		tsc->vref = init_data->vref;
-		tsc->min_pressure = init_data->min_pressure;
-		input_dev->id.vendor = init_data->vendor;
-		input_dev->id.product = init_data->product;
-		input_dev->id.version = init_data->version;
-	} else {
+	error = tsc_init_data(tps6507x_dev, input_dev);
+
+	if (error) {
+		dev_warn(&pdev->dev, "Use default platform data\n");
 		tsc->poll_period = TSC_DEFAULT_POLL_PERIOD;
 		tsc->min_pressure = TPS_DEFAULT_MIN_PRESSURE;
 	}
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V2 2/2] ARM: davinci: da850: add tps6507x touchscreen DT data
  2013-05-04 11:12 ` Vishwanathrao Badarkhe, Manish
@ 2013-05-04 11:12   ` Vishwanathrao Badarkhe, Manish
  -1 siblings, 0 replies; 9+ messages in thread
From: Vishwanathrao Badarkhe, Manish @ 2013-05-04 11:12 UTC (permalink / raw)
  To: devicetree-discuss, linux-input, linux-doc, linux-kernel,
	davinci-linux-open-source
  Cc: grant.likely, dmitry.torokhov, rob.herring, rob, manishv.b

Add tps6507x touchscreen DT node to da850-evm.
Touchscreen DT data is added as per da850 board file.

Tested on da850-evm.

Signed-off-by: Vishwanathrao Badarkhe, Manish <manishv.b@ti.com>
---
Changes since V1:
	- Updated commit message.

:100644 100644 c914357... 9c136d1... M	arch/arm/boot/dts/da850-evm.dts
 arch/arm/boot/dts/da850-evm.dts |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index c914357..9c136d1 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -155,4 +155,13 @@
 			regulator-boot-on;
 		};
 	};
+
+	tsc {
+		ti,poll_period = <30>;
+		ti,min_pressure = <0x30>;
+		ti,vref = <0>;
+		ti,vendor = <0>;
+		ti,product = <65070>;
+		ti,version = <0x100>;
+	};
 };
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V2 2/2] ARM: davinci: da850: add tps6507x touchscreen DT data
@ 2013-05-04 11:12   ` Vishwanathrao Badarkhe, Manish
  0 siblings, 0 replies; 9+ messages in thread
From: Vishwanathrao Badarkhe, Manish @ 2013-05-04 11:12 UTC (permalink / raw)
  To: devicetree-discuss, linux-input, linux-doc, linux-kernel,
	davinci-linux-open-source
  Cc: grant.likely, dmitry.torokhov, rob.herring, rob, manishv.b

Add tps6507x touchscreen DT node to da850-evm.
Touchscreen DT data is added as per da850 board file.

Tested on da850-evm.

Signed-off-by: Vishwanathrao Badarkhe, Manish <manishv.b@ti.com>
---
Changes since V1:
	- Updated commit message.

:100644 100644 c914357... 9c136d1... M	arch/arm/boot/dts/da850-evm.dts
 arch/arm/boot/dts/da850-evm.dts |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index c914357..9c136d1 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -155,4 +155,13 @@
 			regulator-boot-on;
 		};
 	};
+
+	tsc {
+		ti,poll_period = <30>;
+		ti,min_pressure = <0x30>;
+		ti,vref = <0>;
+		ti,vendor = <0>;
+		ti,product = <65070>;
+		ti,version = <0x100>;
+	};
 };
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 1/2] tps6507x-ts: Add DT support
  2013-05-04 11:12   ` Vishwanathrao Badarkhe, Manish
  (?)
@ 2013-05-07  5:41   ` Prabhakar Lad
  2013-05-09  7:38       ` Vishwanathrao Badarkhe, Manish
  -1 siblings, 1 reply; 9+ messages in thread
From: Prabhakar Lad @ 2013-05-07  5:41 UTC (permalink / raw)
  To: Vishwanathrao Badarkhe, Manish
  Cc: devicetree-discuss, linux-input, linux-doc, linux-kernel,
	davinci-linux-open-source, grant.likely, dmitry.torokhov, rob,
	rob.herring

Hi Manish,

Thanks for the patch, below are few nits.

On Sat, May 4, 2013 at 4:42 PM, Vishwanathrao Badarkhe, Manish
<manishv.b@ti.com> wrote:
> Add device tree based support for TI's tps6507x touchscreen.
[Snip]

> +- 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.
For devicetree properties '-' is preferred over '_'.

> +       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 poppulate
> +             in sysclass interface.
> +- ti,product: Touchscreen product id to poppulate
> +             in sysclass interface.
> +- ti,version: Touchscreen version id to poppulate
> +             in sysclass interface.
> +
s/poppulate/populate

>  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..d5433d0 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,83 @@ 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;
> +       u32 val32;
> +       int err;
> +
> +       if (node)
> +               node = of_find_node_by_name(node, "tsc");
> +       if (tps_board)
> +               init_data = tps_board->tps6507x_ts_init_data;
> +
> +       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", &val32);
why not pass tps6507x_dev->ts->poll_period instead of val32 and similarly
below that would avoid else case.

> +               if (err < 0)
> +                       goto error_ret;
> +               else
> +                       tps6507x_dev->ts->poll_period = val32;
> +
> +               err = of_property_read_u32(node, "ti,min_pressure", &val32);
> +               if (err < 0)
> +                       goto error_ret;
> +               else
> +                       tps6507x_dev->ts->min_pressure = val32;
> +
> +               err = of_property_read_u32(node, "ti,vref", &val32);
> +               if (err < 0)
> +                       goto error_ret;
> +               else
> +                       tps6507x_dev->ts->vref = val32;
> +
> +               err = of_property_read_u32(node, "ti,vendor", &val32);
> +               if (err < 0)
> +                       goto error_ret;
> +               else
> +                       input_dev->id.vendor = val32;
> +
> +               err = of_property_read_u32(node, "ti,product", &val32);
> +               if (err < 0)
> +                       goto error_ret;
> +               else
> +                       input_dev->id.product = val32;
> +
> +               err = of_property_read_u32(node, "ti,version", &val32);
> +               if (err < 0)
> +                       goto error_ret;
> +               else
> +                       input_dev->id.version = val32;
> +       } else {
> +               err = -EINVAL;
> +               goto error_ret;
> +       }
you can move this check at the top when both are NULL.

Regards,
--Prabhakar Lad

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH V2 1/2] tps6507x-ts: Add DT support
  2013-05-07  5:41   ` Prabhakar Lad
@ 2013-05-09  7:38       ` Vishwanathrao Badarkhe, Manish
  0 siblings, 0 replies; 9+ messages in thread
From: Vishwanathrao Badarkhe, Manish @ 2013-05-09  7:38 UTC (permalink / raw)
  To: Prabhakar Lad
  Cc: devicetree-discuss, linux-input, linux-doc, linux-kernel,
	davinci-linux-open-source, grant.likely, dmitry.torokhov, rob,
	rob.herring

Hi Prabhakar,

On Tue, May 07, 2013 at 11:11:21, Prabhakar Lad wrote:
> Hi Manish,
> 
> Thanks for the patch, below are few nits.
> 
> On Sat, May 4, 2013 at 4:42 PM, Vishwanathrao Badarkhe, Manish <manishv.b@ti.com> wrote:
> > Add device tree based support for TI's tps6507x touchscreen.
> [Snip]
> 
> > +- 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.
> For devicetree properties '-' is preferred over '_'.

Ok, I will use '-' hence forward for device tree properties.
> 
> > +       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 poppulate
> > +             in sysclass interface.
> > +- ti,product: Touchscreen product id to poppulate
> > +             in sysclass interface.
> > +- ti,version: Touchscreen version id to poppulate
> > +             in sysclass interface.
> > +
> s/poppulate/populate

Ok, I will correct this.
> 
> >  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..d5433d0 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,83 @@ 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;
> > +       u32 val32;
> > +       int err;
> > +
> > +       if (node)
> > +               node = of_find_node_by_name(node, "tsc");
> > +       if (tps_board)
> > +               init_data = tps_board->tps6507x_ts_init_data;
> > +
> > +       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", 
> > + &val32);
> why not pass tps6507x_dev->ts->poll_period instead of val32 and similarly below that would avoid else case.

Agreed, that will reduce some code.
> 
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       tps6507x_dev->ts->poll_period = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,min_pressure", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       tps6507x_dev->ts->min_pressure = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,vref", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       tps6507x_dev->ts->vref = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,vendor", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       input_dev->id.vendor = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,product", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       input_dev->id.product = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,version", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       input_dev->id.version = val32;
> > +       } else {
> > +               err = -EINVAL;
> > +               goto error_ret;
> > +       }
> you can move this check at the top when both are NULL.

Ok, I will move this check at the top.
> 
> Regards,
> --Prabhakar Lad
> 


Regards, 
Manish

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH V2 1/2] tps6507x-ts: Add DT support
@ 2013-05-09  7:38       ` Vishwanathrao Badarkhe, Manish
  0 siblings, 0 replies; 9+ messages in thread
From: Vishwanathrao Badarkhe, Manish @ 2013-05-09  7:38 UTC (permalink / raw)
  To: Prabhakar Lad
  Cc: devicetree-discuss, linux-input, linux-doc, linux-kernel,
	davinci-linux-open-source, grant.likely, dmitry.torokhov, rob,
	rob.herring

Hi Prabhakar,

On Tue, May 07, 2013 at 11:11:21, Prabhakar Lad wrote:
> Hi Manish,
> 
> Thanks for the patch, below are few nits.
> 
> On Sat, May 4, 2013 at 4:42 PM, Vishwanathrao Badarkhe, Manish <manishv.b@ti.com> wrote:
> > Add device tree based support for TI's tps6507x touchscreen.
> [Snip]
> 
> > +- 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.
> For devicetree properties '-' is preferred over '_'.

Ok, I will use '-' hence forward for device tree properties.
> 
> > +       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 poppulate
> > +             in sysclass interface.
> > +- ti,product: Touchscreen product id to poppulate
> > +             in sysclass interface.
> > +- ti,version: Touchscreen version id to poppulate
> > +             in sysclass interface.
> > +
> s/poppulate/populate

Ok, I will correct this.
> 
> >  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..d5433d0 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,83 @@ 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;
> > +       u32 val32;
> > +       int err;
> > +
> > +       if (node)
> > +               node = of_find_node_by_name(node, "tsc");
> > +       if (tps_board)
> > +               init_data = tps_board->tps6507x_ts_init_data;
> > +
> > +       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", 
> > + &val32);
> why not pass tps6507x_dev->ts->poll_period instead of val32 and similarly below that would avoid else case.

Agreed, that will reduce some code.
> 
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       tps6507x_dev->ts->poll_period = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,min_pressure", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       tps6507x_dev->ts->min_pressure = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,vref", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       tps6507x_dev->ts->vref = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,vendor", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       input_dev->id.vendor = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,product", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       input_dev->id.product = val32;
> > +
> > +               err = of_property_read_u32(node, "ti,version", &val32);
> > +               if (err < 0)
> > +                       goto error_ret;
> > +               else
> > +                       input_dev->id.version = val32;
> > +       } else {
> > +               err = -EINVAL;
> > +               goto error_ret;
> > +       }
> you can move this check at the top when both are NULL.

Ok, I will move this check at the top.
> 
> Regards,
> --Prabhakar Lad
> 


Regards, 
Manish

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-05-09  7:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-04 11:12 [PATCH V2 0/2] Add DT support for tps6507x touchscreen Vishwanathrao Badarkhe, Manish
2013-05-04 11:12 ` Vishwanathrao Badarkhe, Manish
2013-05-04 11:12 ` [PATCH V2 1/2] tps6507x-ts: Add DT support Vishwanathrao Badarkhe, Manish
2013-05-04 11:12   ` Vishwanathrao Badarkhe, Manish
2013-05-07  5:41   ` Prabhakar Lad
2013-05-09  7:38     ` Vishwanathrao Badarkhe, Manish
2013-05-09  7:38       ` Vishwanathrao Badarkhe, Manish
2013-05-04 11:12 ` [PATCH V2 2/2] ARM: davinci: da850: add tps6507x touchscreen DT data Vishwanathrao Badarkhe, Manish
2013-05-04 11:12   ` Vishwanathrao Badarkhe, Manish

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.