devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] dt-bindings: bindings for zforce touchscreens
       [not found] <2587208.XYbbI8xJiH@phil>
@ 2014-01-09 21:21 ` Heiko Stübner
  2014-04-22 19:19 ` [PATCH] input: zforce: add regulator handling Heiko Stübner
  2014-07-21 15:20 ` [PATCH RESEND] " Heiko Stübner
  2 siblings, 0 replies; 5+ messages in thread
From: Heiko Stübner @ 2014-01-09 21:21 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Henrik Rydberg, linux-input, Rob Herring, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell, devicetree

Binding documentation for Neonode zForce infrared touchscreens.

Signed-off-by: Heiko Stuebner <heiko.stuebner@bqreaders.com>
---
 .../bindings/input/touchscreen/zforce_ts.txt       |   30 ++++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 2 files changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt

diff --git a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
new file mode 100644
index 0000000..2f25cd2
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
@@ -0,0 +1,30 @@
+* Neonode infrared touchscreen controller
+
+Required properties:
+- compatible: must be "neonode,zforce"
+- reg: I2C address of the chip
+- interrupts: interrupt to which the chip is connected
+- gpios: gpios the chip is connected to
+  first one is the interrupt gpio and second one the reset gpio
+- x-size: horizontal resolution of touchscreen
+- y-size: vertical resolution of touchscreen
+
+Example:
+
+	i2c@00000000 {
+		/* ... */
+
+		zforce_ts@50 {
+			compatible = "neonode,zforce";
+			reg = <0x50>;
+			interrupts = <2 0>;
+
+			gpios = <&gpio5 6 0>, /* INT */
+				<&gpio5 9 0>; /* RST */
+
+			x-size = <800>;
+			y-size = <600>;
+		};
+
+		/* ... */
+	};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index b458760..e0b15b4 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -53,6 +53,7 @@ maxim	Maxim Integrated Products
 microchip	Microchip Technology Inc.
 mosaixtech	Mosaix Technologies, Inc.
 national	National Semiconductor
+neonode		Neonode Inc.
 nintendo	Nintendo
 nvidia	NVIDIA
 nxp	NXP Semiconductors
-- 
1.7.10.4



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

* [PATCH] input: zforce: add regulator handling
       [not found] <2587208.XYbbI8xJiH@phil>
  2014-01-09 21:21 ` [PATCH 1/3] dt-bindings: bindings for zforce touchscreens Heiko Stübner
@ 2014-04-22 19:19 ` Heiko Stübner
  2014-05-23  7:51   ` Heiko Stübner
  2014-07-21 15:20 ` [PATCH RESEND] " Heiko Stübner
  2 siblings, 1 reply; 5+ messages in thread
From: Heiko Stübner @ 2014-04-22 19:19 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Henrik Rydberg, linux-input, Rob Herring, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell, devicetree

From: Heiko Stuebner <heiko.stuebner@bq.com>

It's possible that the controller has an individually switchable power supply.
Therefore add support to control a supplying regulator.

As this is not always the case, the regulator is requested as optional.

Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
---
 .../bindings/input/touchscreen/zforce_ts.txt       |  4 +++
 drivers/input/touchscreen/zforce_ts.c              | 30 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
index 2faf1f1..80c37df 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
@@ -9,6 +9,9 @@ Required properties:
 - x-size: horizontal resolution of touchscreen
 - y-size: vertical resolution of touchscreen
 
+Optional properties:
+- vdd-supply: Regulator controlling the controller supply
+
 Example:
 
 	i2c@00000000 {
@@ -18,6 +21,7 @@ Example:
 			compatible = "neonode,zforce";
 			reg = <0x50>;
 			interrupts = <2 0>;
+			vdd-supply = <&reg_zforce_vdd>;
 
 			gpios = <&gpio5 6 0>, /* INT */
 				<&gpio5 9 0>; /* RST */
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index 01d30ce..39ca962 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -29,6 +29,8 @@
 #include <linux/sysfs.h>
 #include <linux/input/mt.h>
 #include <linux/platform_data/zforce_ts.h>
+#include <linux/regulator/consumer.h>
+#include <linux/delay.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 
@@ -117,6 +119,8 @@ struct zforce_ts {
 	const struct zforce_ts_platdata *pdata;
 	char			phys[32];
 
+	struct regulator	*reg_vdd;
+
 	bool			suspending;
 	bool			suspended;
 	bool			boot_complete;
@@ -690,6 +694,11 @@ static void zforce_reset(void *data)
 	struct zforce_ts *ts = data;
 
 	gpio_set_value(ts->pdata->gpio_rst, 0);
+
+	udelay(10);
+
+	if (!IS_ERR(ts->reg_vdd))
+		regulator_disable(ts->reg_vdd);
 }
 
 static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev)
@@ -765,10 +774,31 @@ static int zforce_probe(struct i2c_client *client,
 		return ret;
 	}
 
+	ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd");
+	if (IS_ERR(ts->reg_vdd) && PTR_ERR(ts->reg_vdd) == -EPROBE_DEFER)
+		return PTR_ERR(ts->reg_vdd);
+
+	if (!IS_ERR(ts->reg_vdd)) {
+		ret = regulator_enable(ts->reg_vdd);
+		if (ret)
+			return ret;
+
+		/*
+		 * according to datasheet add 100us grace time after regular
+		 * regulator enable delay.
+		 */
+		udelay(100);
+	}
+
 	ret = devm_add_action(&client->dev, zforce_reset, ts);
 	if (ret) {
 		dev_err(&client->dev, "failed to register reset action, %d\n",
 			ret);
+
+		/* hereafter the regulator will be disabled by the action */
+		if (!IS_ERR(ts->reg_vdd))
+			regulator_disable(ts->reg_vdd);
+
 		return ret;
 	}
 
-- 
1.9.0



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

* Re: [PATCH] input: zforce: add regulator handling
  2014-04-22 19:19 ` [PATCH] input: zforce: add regulator handling Heiko Stübner
@ 2014-05-23  7:51   ` Heiko Stübner
  0 siblings, 0 replies; 5+ messages in thread
From: Heiko Stübner @ 2014-05-23  7:51 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Henrik Rydberg, linux-input, Rob Herring, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell, devicetree

Hi Dmitry,

Am Dienstag, 22. April 2014, 21:19:57 schrieb Heiko Stübner:
> From: Heiko Stuebner <heiko.stuebner@bq.com>
> 
> It's possible that the controller has an individually switchable power
> supply. Therefore add support to control a supplying regulator.
> 
> As this is not always the case, the regulator is requested as optional.
> 
> Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>

ping?


Thanks
Heiko

> ---
>  .../bindings/input/touchscreen/zforce_ts.txt       |  4 +++
>  drivers/input/touchscreen/zforce_ts.c              | 30
> ++++++++++++++++++++++ 2 files changed, 34 insertions(+)
> 
> diff --git
> a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
> b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt index
> 2faf1f1..80c37df 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
> @@ -9,6 +9,9 @@ Required properties:
>  - x-size: horizontal resolution of touchscreen
>  - y-size: vertical resolution of touchscreen
> 
> +Optional properties:
> +- vdd-supply: Regulator controlling the controller supply
> +
>  Example:
> 
>  	i2c@00000000 {
> @@ -18,6 +21,7 @@ Example:
>  			compatible = "neonode,zforce";
>  			reg = <0x50>;
>  			interrupts = <2 0>;
> +			vdd-supply = <&reg_zforce_vdd>;
> 
>  			gpios = <&gpio5 6 0>, /* INT */
>  				<&gpio5 9 0>; /* RST */
> diff --git a/drivers/input/touchscreen/zforce_ts.c
> b/drivers/input/touchscreen/zforce_ts.c index 01d30ce..39ca962 100644
> --- a/drivers/input/touchscreen/zforce_ts.c
> +++ b/drivers/input/touchscreen/zforce_ts.c
> @@ -29,6 +29,8 @@
>  #include <linux/sysfs.h>
>  #include <linux/input/mt.h>
>  #include <linux/platform_data/zforce_ts.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/delay.h>
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
> 
> @@ -117,6 +119,8 @@ struct zforce_ts {
>  	const struct zforce_ts_platdata *pdata;
>  	char			phys[32];
> 
> +	struct regulator	*reg_vdd;
> +
>  	bool			suspending;
>  	bool			suspended;
>  	bool			boot_complete;
> @@ -690,6 +694,11 @@ static void zforce_reset(void *data)
>  	struct zforce_ts *ts = data;
> 
>  	gpio_set_value(ts->pdata->gpio_rst, 0);
> +
> +	udelay(10);
> +
> +	if (!IS_ERR(ts->reg_vdd))
> +		regulator_disable(ts->reg_vdd);
>  }
> 
>  static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev)
> @@ -765,10 +774,31 @@ static int zforce_probe(struct i2c_client *client,
>  		return ret;
>  	}
> 
> +	ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd");
> +	if (IS_ERR(ts->reg_vdd) && PTR_ERR(ts->reg_vdd) == -EPROBE_DEFER)
> +		return PTR_ERR(ts->reg_vdd);
> +
> +	if (!IS_ERR(ts->reg_vdd)) {
> +		ret = regulator_enable(ts->reg_vdd);
> +		if (ret)
> +			return ret;
> +
> +		/*
> +		 * according to datasheet add 100us grace time after regular
> +		 * regulator enable delay.
> +		 */
> +		udelay(100);
> +	}
> +
>  	ret = devm_add_action(&client->dev, zforce_reset, ts);
>  	if (ret) {
>  		dev_err(&client->dev, "failed to register reset action, %d\n",
>  			ret);
> +
> +		/* hereafter the regulator will be disabled by the action */
> +		if (!IS_ERR(ts->reg_vdd))
> +			regulator_disable(ts->reg_vdd);
> +
>  		return ret;
>  	}

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH RESEND] input: zforce: add regulator handling
       [not found] <2587208.XYbbI8xJiH@phil>
  2014-01-09 21:21 ` [PATCH 1/3] dt-bindings: bindings for zforce touchscreens Heiko Stübner
  2014-04-22 19:19 ` [PATCH] input: zforce: add regulator handling Heiko Stübner
@ 2014-07-21 15:20 ` Heiko Stübner
  2014-07-21 17:42   ` Dmitry Torokhov
  2 siblings, 1 reply; 5+ messages in thread
From: Heiko Stübner @ 2014-07-21 15:20 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Henrik Rydberg, linux-input, Rob Herring, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell, devicetree

From: Heiko Stuebner <heiko.stuebner@bq.com>

It's possible that the controller has an individually switchable power supply.
Therefore add support to control a supplying regulator.

As this is not always the case, the regulator is requested as optional.

Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
---
 .../bindings/input/touchscreen/zforce_ts.txt       |  4 +++
 drivers/input/touchscreen/zforce_ts.c              | 30 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
index 2faf1f1..80c37df 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
@@ -9,6 +9,9 @@ Required properties:
 - x-size: horizontal resolution of touchscreen
 - y-size: vertical resolution of touchscreen
 
+Optional properties:
+- vdd-supply: Regulator controlling the controller supply
+
 Example:
 
 	i2c@00000000 {
@@ -18,6 +21,7 @@ Example:
 			compatible = "neonode,zforce";
 			reg = <0x50>;
 			interrupts = <2 0>;
+			vdd-supply = <&reg_zforce_vdd>;
 
 			gpios = <&gpio5 6 0>, /* INT */
 				<&gpio5 9 0>; /* RST */
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index 01d30ce..39ca962 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -29,6 +29,8 @@
 #include <linux/sysfs.h>
 #include <linux/input/mt.h>
 #include <linux/platform_data/zforce_ts.h>
+#include <linux/regulator/consumer.h>
+#include <linux/delay.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 
@@ -117,6 +119,8 @@ struct zforce_ts {
 	const struct zforce_ts_platdata *pdata;
 	char			phys[32];
 
+	struct regulator	*reg_vdd;
+
 	bool			suspending;
 	bool			suspended;
 	bool			boot_complete;
@@ -690,6 +694,11 @@ static void zforce_reset(void *data)
 	struct zforce_ts *ts = data;
 
 	gpio_set_value(ts->pdata->gpio_rst, 0);
+
+	udelay(10);
+
+	if (!IS_ERR(ts->reg_vdd))
+		regulator_disable(ts->reg_vdd);
 }
 
 static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev)
@@ -765,10 +774,31 @@ static int zforce_probe(struct i2c_client *client,
 		return ret;
 	}
 
+	ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd");
+	if (IS_ERR(ts->reg_vdd) && PTR_ERR(ts->reg_vdd) == -EPROBE_DEFER)
+		return PTR_ERR(ts->reg_vdd);
+
+	if (!IS_ERR(ts->reg_vdd)) {
+		ret = regulator_enable(ts->reg_vdd);
+		if (ret)
+			return ret;
+
+		/*
+		 * according to datasheet add 100us grace time after regular
+		 * regulator enable delay.
+		 */
+		udelay(100);
+	}
+
 	ret = devm_add_action(&client->dev, zforce_reset, ts);
 	if (ret) {
 		dev_err(&client->dev, "failed to register reset action, %d\n",
 			ret);
+
+		/* hereafter the regulator will be disabled by the action */
+		if (!IS_ERR(ts->reg_vdd))
+			regulator_disable(ts->reg_vdd);
+
 		return ret;
 	}
 
-- 
1.9.0


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

* Re: [PATCH RESEND] input: zforce: add regulator handling
  2014-07-21 15:20 ` [PATCH RESEND] " Heiko Stübner
@ 2014-07-21 17:42   ` Dmitry Torokhov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2014-07-21 17:42 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Henrik Rydberg, linux-input, Rob Herring, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell, devicetree

On Mon, Jul 21, 2014 at 05:20:11PM +0200, Heiko Stübner wrote:
> From: Heiko Stuebner <heiko.stuebner@bq.com>
> 
> It's possible that the controller has an individually switchable power supply.
> Therefore add support to control a supplying regulator.
> 
> As this is not always the case, the regulator is requested as optional.
> 
> Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>

Applied (with minimal edits to avoid repeated IS_ERR/PTR_ERR), thank
you.

> ---
>  .../bindings/input/touchscreen/zforce_ts.txt       |  4 +++
>  drivers/input/touchscreen/zforce_ts.c              | 30 ++++++++++++++++++++++
>  2 files changed, 34 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
> index 2faf1f1..80c37df 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
> @@ -9,6 +9,9 @@ Required properties:
>  - x-size: horizontal resolution of touchscreen
>  - y-size: vertical resolution of touchscreen
>  
> +Optional properties:
> +- vdd-supply: Regulator controlling the controller supply
> +
>  Example:
>  
>  	i2c@00000000 {
> @@ -18,6 +21,7 @@ Example:
>  			compatible = "neonode,zforce";
>  			reg = <0x50>;
>  			interrupts = <2 0>;
> +			vdd-supply = <&reg_zforce_vdd>;
>  
>  			gpios = <&gpio5 6 0>, /* INT */
>  				<&gpio5 9 0>; /* RST */
> diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
> index 01d30ce..39ca962 100644
> --- a/drivers/input/touchscreen/zforce_ts.c
> +++ b/drivers/input/touchscreen/zforce_ts.c
> @@ -29,6 +29,8 @@
>  #include <linux/sysfs.h>
>  #include <linux/input/mt.h>
>  #include <linux/platform_data/zforce_ts.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/delay.h>
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
>  
> @@ -117,6 +119,8 @@ struct zforce_ts {
>  	const struct zforce_ts_platdata *pdata;
>  	char			phys[32];
>  
> +	struct regulator	*reg_vdd;
> +
>  	bool			suspending;
>  	bool			suspended;
>  	bool			boot_complete;
> @@ -690,6 +694,11 @@ static void zforce_reset(void *data)
>  	struct zforce_ts *ts = data;
>  
>  	gpio_set_value(ts->pdata->gpio_rst, 0);
> +
> +	udelay(10);
> +
> +	if (!IS_ERR(ts->reg_vdd))
> +		regulator_disable(ts->reg_vdd);
>  }
>  
>  static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev)
> @@ -765,10 +774,31 @@ static int zforce_probe(struct i2c_client *client,
>  		return ret;
>  	}
>  
> +	ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd");
> +	if (IS_ERR(ts->reg_vdd) && PTR_ERR(ts->reg_vdd) == -EPROBE_DEFER)
> +		return PTR_ERR(ts->reg_vdd);
> +
> +	if (!IS_ERR(ts->reg_vdd)) {
> +		ret = regulator_enable(ts->reg_vdd);
> +		if (ret)
> +			return ret;
> +
> +		/*
> +		 * according to datasheet add 100us grace time after regular
> +		 * regulator enable delay.
> +		 */
> +		udelay(100);
> +	}
> +
>  	ret = devm_add_action(&client->dev, zforce_reset, ts);
>  	if (ret) {
>  		dev_err(&client->dev, "failed to register reset action, %d\n",
>  			ret);
> +
> +		/* hereafter the regulator will be disabled by the action */
> +		if (!IS_ERR(ts->reg_vdd))
> +			regulator_disable(ts->reg_vdd);
> +
>  		return ret;
>  	}
>  
> -- 
> 1.9.0
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2014-07-21 17:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <2587208.XYbbI8xJiH@phil>
2014-01-09 21:21 ` [PATCH 1/3] dt-bindings: bindings for zforce touchscreens Heiko Stübner
2014-04-22 19:19 ` [PATCH] input: zforce: add regulator handling Heiko Stübner
2014-05-23  7:51   ` Heiko Stübner
2014-07-21 15:20 ` [PATCH RESEND] " Heiko Stübner
2014-07-21 17:42   ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).