@@ -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>;+ };++ /* ... */+ };
@@ -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
When the device is initialized from devicetree the platformdata is created
locally making dev_get_platdata return NULL.
Therefore directly use the internal pointer to the pdata instead.
Signed-off-by: Heiko Stuebner <redacted>
---
drivers/input/touchscreen/zforce_ts.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
@@ -684,6 +686,45 @@ static void zforce_reset(void *data)gpio_set_value(ts->pdata->gpio_rst,0);}+staticstructzforce_ts_platdata*zforce_parse_dt(structdevice*dev)+{+structzforce_ts_platdata*pdata;+structdevice_node*np=dev->of_node;++if(!np)+returnERR_PTR(-ENOENT);++pdata=devm_kzalloc(dev,sizeof(*pdata),GFP_KERNEL);+if(!pdata){+dev_err(dev,"failed to allocate platform data\n");+returnERR_PTR(-ENOMEM);+}++pdata->gpio_int=of_get_gpio(np,0);+if(!gpio_is_valid(pdata->gpio_int)){+dev_err(dev,"failed to get interrupt gpio\n");+returnERR_PTR(-EINVAL);+}++pdata->gpio_rst=of_get_gpio(np,1);+if(!gpio_is_valid(pdata->gpio_rst)){+dev_err(dev,"failed to get reset gpio\n");+returnERR_PTR(-EINVAL);+}++if(of_property_read_u32(np,"x-size",&pdata->x_max)){+dev_err(dev,"failed to get x-size property\n");+returnERR_PTR(-EINVAL);+}++if(of_property_read_u32(np,"y-size",&pdata->y_max)){+dev_err(dev,"failed to get y-size property\n");+returnERR_PTR(-EINVAL);+}++returnpdata;+}+staticintzforce_probe(structi2c_client*client,conststructi2c_device_id*id){
@@ -692,8 +733,11 @@ static int zforce_probe(struct i2c_client *client,structinput_dev*input_dev;intret;-if(!pdata)-return-EINVAL;+if(!pdata){+pdata=zforce_parse_dt(&client->dev);+if(IS_ERR(pdata))+returnPTR_ERR(pdata);+}ts=devm_kzalloc(&client->dev,sizeof(structzforce_ts),GFP_KERNEL);if(!ts)
Hi Heiko,
On Thu, Jan 09, 2014 at 10:19:15PM +0100, Heiko Stübner wrote:
This adds the binding documentation and necessary parsing code to make
zforce based touchscreen usable on devicetree platforms.
Heiko Stuebner (3):
dt-bindings: bindings for zforce touchscreens
Input: zforce: Use internal pdata pointer instead of dev_get_platdata
Input: zforce: add devicetree support
.../bindings/input/touchscreen/zforce_ts.txt | 30 ++++++++++
.../devicetree/bindings/vendor-prefixes.txt | 1 +
drivers/input/touchscreen/zforce_ts.c | 63 ++++++++++++++++++--
3 files changed, 89 insertions(+), 5 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
I applied the 2nd one and then folded parts of 1st into the 3rd, leaving
changes to devicetree/bindings/vendor-prefixes.txt out. Please resubmit
them to DT maintainers.
Thanks.
--
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
From: Heiko Stuebner <redacted>
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 <redacted>
---
.../bindings/input/touchscreen/zforce_ts.txt | 4 +++
drivers/input/touchscreen/zforce_ts.c | 30 ++++++++++++++++++++++
2 files changed, 34 insertions(+)
@@ -765,10 +774,31 @@ static int zforce_probe(struct i2c_client *client,returnret;}+ts->reg_vdd=devm_regulator_get_optional(&client->dev,"vdd");+if(IS_ERR(ts->reg_vdd)&&PTR_ERR(ts->reg_vdd)==-EPROBE_DEFER)+returnPTR_ERR(ts->reg_vdd);++if(!IS_ERR(ts->reg_vdd)){+ret=regulator_enable(ts->reg_vdd);+if(ret)+returnret;++/*+*accordingtodatasheetadd100usgracetimeafterregular+*regulatorenabledelay.+*/+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);+returnret;}
Hi Dmitry,
Am Dienstag, 22. April 2014, 21:19:57 schrieb Heiko Stübner:
From: Heiko Stuebner <redacted>
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 <redacted>
@@ -765,10 +774,31 @@ static int zforce_probe(struct i2c_client *client,returnret;}+ts->reg_vdd=devm_regulator_get_optional(&client->dev,"vdd");+if(IS_ERR(ts->reg_vdd)&&PTR_ERR(ts->reg_vdd)==-EPROBE_DEFER)+returnPTR_ERR(ts->reg_vdd);++if(!IS_ERR(ts->reg_vdd)){+ret=regulator_enable(ts->reg_vdd);+if(ret)+returnret;++/*+*accordingtodatasheetadd100usgracetimeafterregular+*regulatorenabledelay.+*/+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);+returnret;}
--
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
From: Heiko Stuebner <redacted>
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 <redacted>
---
.../bindings/input/touchscreen/zforce_ts.txt | 4 +++
drivers/input/touchscreen/zforce_ts.c | 30 ++++++++++++++++++++++
2 files changed, 34 insertions(+)
@@ -765,10 +774,31 @@ static int zforce_probe(struct i2c_client *client,returnret;}+ts->reg_vdd=devm_regulator_get_optional(&client->dev,"vdd");+if(IS_ERR(ts->reg_vdd)&&PTR_ERR(ts->reg_vdd)==-EPROBE_DEFER)+returnPTR_ERR(ts->reg_vdd);++if(!IS_ERR(ts->reg_vdd)){+ret=regulator_enable(ts->reg_vdd);+if(ret)+returnret;++/*+*accordingtodatasheetadd100usgracetimeafterregular+*regulatorenabledelay.+*/+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);+returnret;}
On Mon, Jul 21, 2014 at 05:20:11PM +0200, Heiko Stübner wrote:
From: Heiko Stuebner <redacted>
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 <redacted>
Applied (with minimal edits to avoid repeated IS_ERR/PTR_ERR), thank
you.
@@ -765,10 +774,31 @@ static int zforce_probe(struct i2c_client *client,returnret;}+ts->reg_vdd=devm_regulator_get_optional(&client->dev,"vdd");+if(IS_ERR(ts->reg_vdd)&&PTR_ERR(ts->reg_vdd)==-EPROBE_DEFER)+returnPTR_ERR(ts->reg_vdd);++if(!IS_ERR(ts->reg_vdd)){+ret=regulator_enable(ts->reg_vdd);+if(ret)+returnret;++/*+*accordingtodatasheetadd100usgracetimeafterregular+*regulatorenabledelay.+*/+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);+returnret;}
--
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