All of lore.kernel.org
 help / color / mirror / Atom feed
From: "fugang.duan@freescale.com" <fugang.duan@freescale.com>
To: "Lothar Waßmann" <LW@KARO-electronics.de>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Grant Likely" <grant.likely@linaro.org>,
	"Henrik Rydberg" <rydberg@euromail.se>,
	"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
	"Jingoo Han" <jg1.han@samsung.com>,
	"Kumar Gala" <galak@codeaurora.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Pawel Moll" <pawel.moll@arm.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Rob Landley" <rob@landley.net>,
	"Sachin Kamat" <sachin.kamat@linaro.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Simon Budig" <simon.budig@kernelconcepts.de>
Subject: RE: [PATCHv4 2/5] Input: edt-ft5x06: Add DT support
Date: Thu, 20 Mar 2014 05:19:03 +0000	[thread overview]
Message-ID: <c9718f7215eb41439606b0107a8e2a02@BLUPR03MB373.namprd03.prod.outlook.com> (raw)
In-Reply-To: <1395234563-11034-3-git-send-email-LW@KARO-electronics.de>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 4743 bytes --]

From: Lothar Waßmann <LW@KARO-electronics.de>
Data: Wednesday, March 19, 2014 9:09 PM

>To: Dmitry Torokhov; Duan Fugang-B38611; Grant Likely; Henrik Rydberg; Ian
>Campbell; Jingoo Han; Kumar Gala; Mark Rutland; Pawel Moll; Rob Herring; Rob
>Landley; Sachin Kamat; devicetree@vger.kernel.org; linux-doc@vger.kernel.org;
>linux-input@vger.kernel.org; linux-kernel@vger.kernel.org; Simon Budig; Lothar
>Waßmann
>Subject: [PATCHv4 2/5] Input: edt-ft5x06: Add DT support
>
>
>Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
>---
> .../bindings/input/touchscreen/edt-ft5x06.txt      |   41 ++++++
> drivers/input/touchscreen/edt-ft5x06.c             |  144 +++++++++++++++-----
> 2 files changed, 154 insertions(+), 31 deletions(-)  create mode 100644
>Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
>
>diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
>b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
>new file mode 100644
>index 0000000..e5adc76
>--- /dev/null
>+++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
>@@ -0,0 +1,41 @@
>+FocalTech EDT-FT5x06 Polytouch driver
>+=====================================
>+
>+Required properties:
>+ - compatible:  "edt,edt-ft5x06"
>+ - reg:         I2C slave address of the chip (0x38)
>+ - interrupt-parent: a phandle pointing to the interrupt controller
>+                     serving the interrupt for this chip
>+ - interrupts:       interrupt specification for this chip
>+
>+Optional properties:
>+ - reset-gpios: GPIO specification for the RESET input
>+ - wake-gpios:  GPIO specification for the WAKE input
>+
>+ - pinctrl-names: should be "default"
>+ - pinctrl-0:   a phandle pointing to the pin settings for the
>+                control gpios
>+
>+ - threshold:   allows setting the "click"-threshold in the range
>+                from 20 to 80.
>+
>+ - gain:        allows setting the sensitivity in the range from 0 to
>+                31. Note that lower values indicate higher
>+                sensitivity.
>+
>+ - offset:      allows setting the edge compensation in the range from
>+                0 to 31.
>+ - report_rate: allows setting the report rate in the range from 3 to
>+                14.
>+
>+Example:
>+	polytouch: edt-ft5x06@38 {
>+		compatible = "edt,edt-ft5x06";
>+		reg = <0x38>;
>+		pinctrl-names = "default";
>+		pinctrl-0 = <&edt_ft5x06_pins>;
>+		interrupt-parent = <&gpio2>;
>+		interrupts = <5 0>;
>+		reset-gpios = <&gpio2 6 1>;
>+		wake-gpios = <&gpio4 9 0>;
>+	};
>diff --git a/drivers/input/touchscreen/edt-ft5x06.c
>b/drivers/input/touchscreen/edt-ft5x06.c
>index 7b4470d..257a1c8 100644
>--- a/drivers/input/touchscreen/edt-ft5x06.c
>+++ b/drivers/input/touchscreen/edt-ft5x06.c
>@@ -33,6 +33,7 @@
> #include <linux/debugfs.h>
> #include <linux/slab.h>
> #include <linux/gpio.h>
>+#include <linux/of_gpio.h>
> #include <linux/input/mt.h>
> #include <linux/input/edt-ft5x06.h>
>
[...]
>+#ifdef CONFIG_OF
>+static int edt_ft5x06_i2c_ts_probe_dt(struct device *dev,
>+				struct edt_ft5x06_ts_data *tsdata)
>+{
>+	struct device_node *np = dev->of_node;
>+
>+	if (!np)
>+		return -ENODEV;
Don't need to check the device node valid. If the device node is not existed, the driver don't run probe.

>+
>+	/*
>+	 * irq_pin is not needed for DT setup.
>+	 * irq is associated via 'interrupts' property in DT
>+	 */
>+	tsdata->irq_pin = -EINVAL;
>+	tsdata->reset_pin = of_get_named_gpio(np, "reset-gpios", 0);
>+	tsdata->wake_pin = of_get_named_gpio(np, "wake-gpios", 0);
>+
>+	return 0;
>+}
>+#else
>+static inline int edt_ft5x06_i2c_ts_probe_dt(struct device *dev,
>+					struct edt_ft5x06_i2c_ts_data *tsdata) {
>+	return -ENODEV;
>+}
>+#endif
>+
> static int edt_ft5x06_ts_probe(struct i2c_client *client,
> 					 const struct i2c_device_id *id)
> {
>@@ -714,32 +775,40 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
>
> 	dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n");
>
>+	tsdata = devm_kzalloc(&client->dev, sizeof(*tsdata), GFP_KERNEL);
>+	if (!tsdata) {
>+		dev_err(&client->dev, "failed to allocate driver data.\n");
>+		return -ENOMEM;
>+	}
>+
> 	if (!pdata) {
>-		dev_err(&client->dev, "no platform data?\n");
>-		return -EINVAL;
>+		error = edt_ft5x06_i2c_ts_probe_dt(&client->dev, tsdata);
>+		if (error) {
>+			dev_err(&client->dev,
>+				"DT probe failed and no platform data present\n");
>+			return error;
>+		}
>+	} else {
>+		tsdata->reset_pin = pdata->reset_pin;
>+		tsdata->irq_pin = pdata->irq_pin;
>+		tsdata->wake_pin = -EINVAL;
> 	}
[...]

Thanks,
Andy
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

WARNING: multiple messages have this Message-ID (diff)
From: "fugang.duan@freescale.com" <fugang.duan@freescale.com>
To: "Lothar Waßmann" <LW@KARO-electronics.de>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Grant Likely" <grant.likely@linaro.org>,
	"Henrik Rydberg" <rydberg@euromail.se>,
	"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
	"Jingoo Han" <jg1.han@samsung.com>,
	"Kumar Gala" <galak@codeaurora.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Pawel Moll" <pawel.moll@arm.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Rob Landley" <rob@landley.net>,
	"Sachin Kamat" <sachin.kamat@linaro.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Simon Budig" <simon.budig@kernelconcepts.de>
Subject: RE: [PATCHv4 2/5] Input: edt-ft5x06: Add DT support
Date: Thu, 20 Mar 2014 05:19:03 +0000	[thread overview]
Message-ID: <c9718f7215eb41439606b0107a8e2a02@BLUPR03MB373.namprd03.prod.outlook.com> (raw)
In-Reply-To: <1395234563-11034-3-git-send-email-LW@KARO-electronics.de>

From: Lothar Waßmann <LW@KARO-electronics.de>
Data: Wednesday, March 19, 2014 9:09 PM

>To: Dmitry Torokhov; Duan Fugang-B38611; Grant Likely; Henrik Rydberg; Ian
>Campbell; Jingoo Han; Kumar Gala; Mark Rutland; Pawel Moll; Rob Herring; Rob
>Landley; Sachin Kamat; devicetree@vger.kernel.org; linux-doc@vger.kernel.org;
>linux-input@vger.kernel.org; linux-kernel@vger.kernel.org; Simon Budig; Lothar
>Waßmann
>Subject: [PATCHv4 2/5] Input: edt-ft5x06: Add DT support
>
>
>Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
>---
> .../bindings/input/touchscreen/edt-ft5x06.txt      |   41 ++++++
> drivers/input/touchscreen/edt-ft5x06.c             |  144 +++++++++++++++-----
> 2 files changed, 154 insertions(+), 31 deletions(-)  create mode 100644
>Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
>
>diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
>b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
>new file mode 100644
>index 0000000..e5adc76
>--- /dev/null
>+++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
>@@ -0,0 +1,41 @@
>+FocalTech EDT-FT5x06 Polytouch driver
>+=====================================
>+
>+Required properties:
>+ - compatible:  "edt,edt-ft5x06"
>+ - reg:         I2C slave address of the chip (0x38)
>+ - interrupt-parent: a phandle pointing to the interrupt controller
>+                     serving the interrupt for this chip
>+ - interrupts:       interrupt specification for this chip
>+
>+Optional properties:
>+ - reset-gpios: GPIO specification for the RESET input
>+ - wake-gpios:  GPIO specification for the WAKE input
>+
>+ - pinctrl-names: should be "default"
>+ - pinctrl-0:   a phandle pointing to the pin settings for the
>+                control gpios
>+
>+ - threshold:   allows setting the "click"-threshold in the range
>+                from 20 to 80.
>+
>+ - gain:        allows setting the sensitivity in the range from 0 to
>+                31. Note that lower values indicate higher
>+                sensitivity.
>+
>+ - offset:      allows setting the edge compensation in the range from
>+                0 to 31.
>+ - report_rate: allows setting the report rate in the range from 3 to
>+                14.
>+
>+Example:
>+	polytouch: edt-ft5x06@38 {
>+		compatible = "edt,edt-ft5x06";
>+		reg = <0x38>;
>+		pinctrl-names = "default";
>+		pinctrl-0 = <&edt_ft5x06_pins>;
>+		interrupt-parent = <&gpio2>;
>+		interrupts = <5 0>;
>+		reset-gpios = <&gpio2 6 1>;
>+		wake-gpios = <&gpio4 9 0>;
>+	};
>diff --git a/drivers/input/touchscreen/edt-ft5x06.c
>b/drivers/input/touchscreen/edt-ft5x06.c
>index 7b4470d..257a1c8 100644
>--- a/drivers/input/touchscreen/edt-ft5x06.c
>+++ b/drivers/input/touchscreen/edt-ft5x06.c
>@@ -33,6 +33,7 @@
> #include <linux/debugfs.h>
> #include <linux/slab.h>
> #include <linux/gpio.h>
>+#include <linux/of_gpio.h>
> #include <linux/input/mt.h>
> #include <linux/input/edt-ft5x06.h>
>
[...]
>+#ifdef CONFIG_OF
>+static int edt_ft5x06_i2c_ts_probe_dt(struct device *dev,
>+				struct edt_ft5x06_ts_data *tsdata)
>+{
>+	struct device_node *np = dev->of_node;
>+
>+	if (!np)
>+		return -ENODEV;
Don't need to check the device node valid. If the device node is not existed, the driver don't run probe.

>+
>+	/*
>+	 * irq_pin is not needed for DT setup.
>+	 * irq is associated via 'interrupts' property in DT
>+	 */
>+	tsdata->irq_pin = -EINVAL;
>+	tsdata->reset_pin = of_get_named_gpio(np, "reset-gpios", 0);
>+	tsdata->wake_pin = of_get_named_gpio(np, "wake-gpios", 0);
>+
>+	return 0;
>+}
>+#else
>+static inline int edt_ft5x06_i2c_ts_probe_dt(struct device *dev,
>+					struct edt_ft5x06_i2c_ts_data *tsdata) {
>+	return -ENODEV;
>+}
>+#endif
>+
> static int edt_ft5x06_ts_probe(struct i2c_client *client,
> 					 const struct i2c_device_id *id)
> {
>@@ -714,32 +775,40 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
>
> 	dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n");
>
>+	tsdata = devm_kzalloc(&client->dev, sizeof(*tsdata), GFP_KERNEL);
>+	if (!tsdata) {
>+		dev_err(&client->dev, "failed to allocate driver data.\n");
>+		return -ENOMEM;
>+	}
>+
> 	if (!pdata) {
>-		dev_err(&client->dev, "no platform data?\n");
>-		return -EINVAL;
>+		error = edt_ft5x06_i2c_ts_probe_dt(&client->dev, tsdata);
>+		if (error) {
>+			dev_err(&client->dev,
>+				"DT probe failed and no platform data present\n");
>+			return error;
>+		}
>+	} else {
>+		tsdata->reset_pin = pdata->reset_pin;
>+		tsdata->irq_pin = pdata->irq_pin;
>+		tsdata->wake_pin = -EINVAL;
> 	}
[...]

Thanks,
Andy

  reply	other threads:[~2014-03-20  5:19 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 13:09 Input: edt-ft5x06: Add DT support Lothar Waßmann
2014-03-19 13:09 ` [PATCHv4 1/5] Input: edt-ft5x06: several cleanups; no functional change Lothar Waßmann
2014-03-20  2:42   ` fugang.duan
2014-03-20  2:42     ` fugang.duan-KZfg59tc24xl57MIdRCFDg
2014-03-19 13:09 ` [PATCHv4 2/5] Input: edt-ft5x06: Add DT support Lothar Waßmann
2014-03-20  5:19   ` fugang.duan [this message]
2014-03-20  5:19     ` fugang.duan
2014-03-20 11:44     ` Lothar Waßmann
2014-03-20  9:37   ` Mark Rutland
2014-03-20  9:37     ` Mark Rutland
2014-03-20 11:18     ` Simon Budig
2014-03-20 11:18       ` Simon Budig
2014-03-20 13:19       ` Mark Rutland
2014-03-20 11:40     ` Lothar Waßmann
2014-03-20 11:48       ` Simon Budig
2014-03-20 12:05         ` Lothar Waßmann
2014-03-20 13:21       ` Mark Rutland
2014-03-19 13:09 ` [PATCHv4 3/5] Input: edt-ft5x06: Adjust delays to conform datasheet Lothar Waßmann
2014-03-19 13:09 ` [PATCHv4 4/5] Input: edt-ft5x06: Ignore touchdown events Lothar Waßmann
2014-03-20  5:22   ` fugang.duan
2014-03-20  5:22     ` fugang.duan
2014-03-19 13:09 ` [PATCHv4 5/5] Input: edt-ft5x06: Add support for M09 firmware version Lothar Waßmann
2014-03-19 13:09   ` Lothar Waßmann
2014-03-20 13:44 ` [PATCHv5 0/5] Input: edt-ft5x06: Add DT support Lothar Waßmann
2014-03-20 13:44   ` [PATCHv5 1/5] Input: edt-ft5x06: several cleanups; no functional change Lothar Waßmann
2014-03-20 13:44   ` [PATCHv5 2/5] Input: edt-ft5x06: Add DT support Lothar Waßmann
2014-03-20 13:44     ` Lothar Waßmann
2014-03-20 13:44   ` [PATCHv5 3/5] Input: edt-ft5x06: Adjust delays to conform datasheet Lothar Waßmann
2014-03-20 13:44     ` Lothar Waßmann
2014-03-20 13:44   ` [PATCHv5 4/5] Input: edt-ft5x06: Ignore touchdown events Lothar Waßmann
2014-03-20 13:44   ` [PATCHv5 5/5] Input: edt-ft5x06: Add support for M09 firmware version Lothar Waßmann
2014-03-20 14:15     ` Daniel Wagener
2014-03-24 15:11   ` [PATCHv6 0/5] Input: edt-ft5x06: Add DT support Lothar Waßmann
2014-03-24 15:11     ` [PATCHv6 1/5] Input: edt-ft5x06: several cleanups; no functional change Lothar Waßmann
2014-03-24 15:11     ` [PATCHv6 2/5] Input: edt-ft5x06: Add DT support Lothar Waßmann
2014-03-28 16:26       ` Dmitry Torokhov
2014-03-24 15:11     ` [PATCHv6 3/5] Input: edt-ft5x06: Adjust delays to conform datasheet Lothar Waßmann
2014-03-24 15:11       ` Lothar Waßmann
2014-03-24 15:11     ` [PATCHv6 4/5] Input: edt-ft5x06: Ignore touchdown events Lothar Waßmann
2014-03-24 15:11       ` Lothar Waßmann
2014-03-24 15:11     ` [PATCHv6 5/5] Input: edt-ft5x06: Add support for M09 firmware version Lothar Waßmann
2014-03-28 16:31     ` [PATCHv6 0/5] Input: edt-ft5x06: Add DT support Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9718f7215eb41439606b0107a8e2a02@BLUPR03MB373.namprd03.prod.outlook.com \
    --to=fugang.duan@freescale.com \
    --cc=LW@KARO-electronics.de \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jg1.han@samsung.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=rob@landley.net \
    --cc=robh+dt@kernel.org \
    --cc=rydberg@euromail.se \
    --cc=sachin.kamat@linaro.org \
    --cc=simon.budig@kernelconcepts.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.