diff for duplicates of <20131023082123.GC7404@ulmo.nvidia.com> diff --git a/a/1.1.hdr b/a/1.1.hdr deleted file mode 100644 index 149ab5e..0000000 --- a/a/1.1.hdr +++ /dev/null @@ -1,3 +0,0 @@ -Content-Type: text/plain; charset=utf-8 -Content-Disposition: inline -Content-Transfer-Encoding: quoted-printable diff --git a/a/1.2.hdr b/a/1.2.hdr deleted file mode 100644 index d3f3dc5..0000000 --- a/a/1.2.hdr +++ /dev/null @@ -1,3 +0,0 @@ -Content-Type: text/x-diff; charset=us-ascii -Content-Disposition: inline; filename="tsc2007.patch" -Content-Transfer-Encoding: quoted-printable diff --git a/a/1.2.txt b/a/1.2.txt deleted file mode 100644 index 43ffe6a..0000000 --- a/a/1.2.txt +++ /dev/null @@ -1,353 +0,0 @@ -diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c -index d49b0ec..0dd8381 100644 ---- a/arch/arm/mach-imx/mach-cpuimx35.c -+++ b/arch/arm/mach-imx/mach-cpuimx35.c -@@ -62,6 +62,7 @@ static int tsc2007_get_pendown_state(void) - static struct tsc2007_platform_data tsc2007_info = { - .model = 2007, - .x_plate_ohms = 180, -+ .pendown_gpio = -1, - .get_pendown_state = tsc2007_get_pendown_state, - }; - -diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c -index b87cc49..ef2a7e6 100644 ---- a/arch/arm/mach-imx/mach-cpuimx51sd.c -+++ b/arch/arm/mach-imx/mach-cpuimx51sd.c -@@ -134,6 +134,7 @@ static int tsc2007_get_pendown_state(void) - static struct tsc2007_platform_data tsc2007_info = { - .model = 2007, - .x_plate_ohms = 180, -+ .pendown_gpio = -1, - .get_pendown_state = tsc2007_get_pendown_state, - }; - -diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c -index b85957a..69abf30 100644 ---- a/arch/arm/mach-shmobile/board-ap4evb.c -+++ b/arch/arm/mach-shmobile/board-ap4evb.c -@@ -1199,6 +1199,7 @@ static int ts_init(void) - static struct tsc2007_platform_data tsc2007_info = { - .model = 2007, - .x_plate_ohms = 180, -+ .pendown_gpio = -1, - .get_pendown_state = ts_get_pendown_state, - .init_platform_hw = ts_init, - }; -diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c -index 64559e8a..6cfd0ef 100644 ---- a/arch/sh/boards/mach-ecovec24/setup.c -+++ b/arch/sh/boards/mach-ecovec24/setup.c -@@ -517,6 +517,7 @@ static int ts_init(void) - static struct tsc2007_platform_data tsc2007_info = { - .model = 2007, - .x_plate_ohms = 180, -+ .pendown_gpio = -1, - .get_pendown_state = ts_get_pendown_state, - .init_platform_hw = ts_init, - }; -diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c -index 1473d23..c87fdac 100644 ---- a/drivers/input/touchscreen/tsc2007.c -+++ b/drivers/input/touchscreen/tsc2007.c -@@ -20,10 +20,15 @@ - * published by the Free Software Foundation. - */ - -+#define pr_fmt(fmt) "tsc2007: " fmt -+ - #include <linux/module.h> - #include <linux/slab.h> - #include <linux/input.h> - #include <linux/interrupt.h> -+#include <linux/delay.h> -+#include <linux/of_gpio.h> -+#include <linux/of_irq.h> - #include <linux/i2c.h> - #include <linux/i2c/tsc2007.h> - -@@ -75,13 +80,16 @@ struct tsc2007 { - unsigned long poll_delay; - unsigned long poll_period; - -+ int pendown_gpio; -+ int active_low; - int irq; - - wait_queue_head_t wait; - bool stopped; - -- int (*get_pendown_state)(void); -- void (*clear_penirq)(void); -+ void *callback_data; -+ int (*get_pendown_state)(void *data); -+ void (*clear_penirq)(void *data); - }; - - static inline int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd) -@@ -161,7 +169,7 @@ static bool tsc2007_is_pen_down(struct tsc2007 *ts) - if (!ts->get_pendown_state) - return true; - -- return ts->get_pendown_state(); -+ return ts->get_pendown_state(ts->callback_data); - } - - static irqreturn_t tsc2007_soft_irq(int irq, void *handle) -@@ -171,6 +179,13 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle) - struct ts_event tc; - u32 rt; - -+ /* -+ * With some panels we need to wait a bit otherwise the first value -+ * is often wrong. -+ */ -+ if (ts->poll_delay > 0) -+ msleep(ts->poll_delay); -+ - while (!ts->stopped && tsc2007_is_pen_down(ts)) { - - /* pen is down, continue with the measurement */ -@@ -219,7 +234,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle) - input_sync(input); - - if (ts->clear_penirq) -- ts->clear_penirq(); -+ ts->clear_penirq(ts->callback_data); - - return IRQ_HANDLED; - } -@@ -228,11 +243,11 @@ static irqreturn_t tsc2007_hard_irq(int irq, void *handle) - { - struct tsc2007 *ts = handle; - -- if (!ts->get_pendown_state || likely(ts->get_pendown_state())) -+ if (!ts->get_pendown_state || likely(ts->get_pendown_state(ts->callback_data))) - return IRQ_WAKE_THREAD; - - if (ts->clear_penirq) -- ts->clear_penirq(); -+ ts->clear_penirq(ts->callback_data); - - return IRQ_HANDLED; - } -@@ -273,6 +288,75 @@ static void tsc2007_close(struct input_dev *input_dev) - tsc2007_stop(ts); - } - -+static int tsc2007_get_pendown_state(void *data) -+{ -+ struct tsc2007 *ts = data; -+ int ret = 0; -+ -+ ret = !!gpio_get_value(ts->pendown_gpio); -+ if (ts->active_low) -+ ret = !ret; -+ -+ return ret; -+} -+ -+static struct tsc2007_platform_data *tsc2007_parse_dt(struct device *dev) -+{ -+ struct tsc2007_platform_data *pdata; -+ enum of_gpio_flags flags; -+ u32 value, values[3]; -+ int err; -+ -+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); -+ if (!pdata) -+ return ERR_PTR(-ENOMEM); -+ -+ err = of_get_named_gpio_flags(dev->of_node, "pendown-gpios", 0, -+ &flags); -+ if (err < 0) -+ return ERR_PTR(err); -+ -+ pdata->pendown_gpio = err; -+ -+ if (flags & OF_GPIO_ACTIVE_LOW) -+ pdata->active_low = true; -+ -+ err = of_property_read_u32(dev->of_node, "x-plate-ohms", &value); -+ if (err < 0) -+ return ERR_PTR(err); -+ -+ pdata->x_plate_ohms = value; -+ -+ err = of_property_read_u32(dev->of_node, "max-rt", &value); -+ if (err < 0) -+ return ERR_PTR(err); -+ -+ pdata->max_rt = value; -+ -+ err = of_property_read_u32(dev->of_node, "poll-delay", &value); -+ if (err < 0) -+ return ERR_PTR(err); -+ -+ pdata->poll_delay = value; -+ -+ err = of_property_read_u32(dev->of_node, "poll-period", &value); -+ if (err < 0) -+ return ERR_PTR(err); -+ -+ pdata->poll_period = value; -+ -+ err = of_property_read_u32_array(dev->of_node, "fuzz", values, -+ ARRAY_SIZE(values)); -+ if (err < 0) -+ return ERR_PTR(err); -+ -+ pdata->fuzzx = values[0]; -+ pdata->fuzzy = values[1]; -+ pdata->fuzzz = values[2]; -+ -+ return pdata; -+} -+ - static int __devinit tsc2007_probe(struct i2c_client *client, - const struct i2c_device_id *id) - { -@@ -281,18 +365,42 @@ static int __devinit tsc2007_probe(struct i2c_client *client, - struct input_dev *input_dev; - int err; - -+ ts = kzalloc(sizeof(struct tsc2007), GFP_KERNEL); -+ if (!ts) -+ return -ENOMEM; -+ -+ if (IS_ENABLED(CONFIG_OF) && client->dev.of_node) { -+ client->irq = irq_of_parse_and_map(client->dev.of_node, 0); -+ if (!client->irq) { -+ err = -EPROBE_DEFER; -+ goto err_free_mem; -+ } -+ } -+ - if (!pdata) { -- dev_err(&client->dev, "platform data is required!\n"); -- return -EINVAL; -+ if (IS_ENABLED(CONFIG_OF) && client->dev.of_node) { -+ pdata = tsc2007_parse_dt(&client->dev); -+ if (IS_ERR(pdata)) { -+ err = PTR_ERR(pdata); -+ goto err_free_mem; -+ } -+ -+ pdata->callback_data = ts; -+ } else { -+ dev_err(&client->dev, "platform data is required!\n"); -+ err = -EINVAL; -+ goto err_free_mem; -+ } - } - - if (!i2c_check_functionality(client->adapter, -- I2C_FUNC_SMBUS_READ_WORD_DATA)) -- return -EIO; -+ I2C_FUNC_SMBUS_READ_WORD_DATA)) { -+ err = -EIO; -+ goto err_free_mem; -+ } - -- ts = kzalloc(sizeof(struct tsc2007), GFP_KERNEL); - input_dev = input_allocate_device(); -- if (!ts || !input_dev) { -+ if (!input_dev) { - err = -ENOMEM; - goto err_free_mem; - } -@@ -307,13 +415,27 @@ static int __devinit tsc2007_probe(struct i2c_client *client, - ts->max_rt = pdata->max_rt ? : MAX_12BIT; - ts->poll_delay = pdata->poll_delay ? : 1; - ts->poll_period = pdata->poll_period ? : 1; -+ ts->callback_data = pdata->callback_data; - ts->get_pendown_state = pdata->get_pendown_state; - ts->clear_penirq = pdata->clear_penirq; - - if (pdata->x_plate_ohms == 0) { - dev_err(&client->dev, "x_plate_ohms is not set up in platform data"); - err = -EINVAL; -- goto err_free_mem; -+ goto err_free_dev; -+ } -+ -+ if (gpio_is_valid(pdata->pendown_gpio)) { -+ err = gpio_request_one(pdata->pendown_gpio, GPIOF_IN, -+ "tsc2007"); -+ if (err < 0) -+ goto err_free_dev; -+ -+ ts->get_pendown_state = tsc2007_get_pendown_state; -+ ts->pendown_gpio = pdata->pendown_gpio; -+ ts->active_low = pdata->active_low; -+ } else { -+ ts->pendown_gpio = -EINVAL; - } - - snprintf(ts->phys, sizeof(ts->phys), -@@ -343,7 +465,7 @@ static int __devinit tsc2007_probe(struct i2c_client *client, - IRQF_ONESHOT, client->dev.driver->name, ts); - if (err < 0) { - dev_err(&client->dev, "irq %d busy?\n", ts->irq); -- goto err_free_mem; -+ goto err_free_gpio; - } - - tsc2007_stop(ts); -@@ -360,8 +482,12 @@ static int __devinit tsc2007_probe(struct i2c_client *client, - free_irq(ts->irq, ts); - if (pdata->exit_platform_hw) - pdata->exit_platform_hw(); -- err_free_mem: -+ err_free_gpio: -+ if (gpio_is_valid(pdata->pendown_gpio)) -+ gpio_free(pdata->pendown_gpio); -+ err_free_dev: - input_free_device(input_dev); -+ err_free_mem: - kfree(ts); - return err; - } -@@ -373,6 +499,9 @@ static int __devexit tsc2007_remove(struct i2c_client *client) - - free_irq(ts->irq, ts); - -+ if (gpio_is_valid(ts->pendown_gpio)) -+ gpio_free(ts->pendown_gpio); -+ - if (pdata->exit_platform_hw) - pdata->exit_platform_hw(); - -diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c -index a447f4e..249d307 100644 ---- a/drivers/mfd/timberdale.c -+++ b/drivers/mfd/timberdale.c -@@ -64,7 +64,8 @@ struct timberdale_device { - - static struct tsc2007_platform_data timberdale_tsc2007_platform_data = { - .model = 2003, -- .x_plate_ohms = 100 -+ .x_plate_ohms = 100, -+ .pendown_gpio = -1, - }; - - static struct i2c_board_info timberdale_i2c_board_info[] = { -diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h -index 506a9f7..8d72771 100644 ---- a/include/linux/i2c/tsc2007.h -+++ b/include/linux/i2c/tsc2007.h -@@ -14,8 +14,12 @@ struct tsc2007_platform_data { - int fuzzy; - int fuzzz; - -- int (*get_pendown_state)(void); -- void (*clear_penirq)(void); /* If needed, clear 2nd level -+ int pendown_gpio; -+ bool active_low; -+ -+ void *callback_data; -+ int (*get_pendown_state)(void *data); -+ void (*clear_penirq)(void *data); /* If needed, clear 2nd level - interrupt source */ - int (*init_platform_hw)(void); - void (*exit_platform_hw)(void); diff --git a/a/1.1.txt b/N1/1.txt similarity index 70% rename from a/1.1.txt rename to N1/1.txt index 52a3616..f8e0d06 100644 --- a/a/1.1.txt +++ b/N1/1.txt @@ -1,5 +1,5 @@ On Tue, Oct 22, 2013 at 03:35:05PM -0700, Dmitry Torokhov wrote: -> On Tue, Oct 22, 2013 at 11:49:47AM +0200, Lothar Waßmann wrote: +> On Tue, Oct 22, 2013 at 11:49:47AM +0200, Lothar Wa?mann wrote: > > Hi, > > > > > On Mon, Oct 21, 2013 at 03:54:24PM +0200, Denis Carikli wrote: @@ -38,3 +38,17 @@ an example of how this could work. Sorry this isn't in the form of a proper patch. Thierry +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: tsc2007.patch +Type: text/x-diff +Size: 9863 bytes +Desc: not available +URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131023/771afff9/attachment-0001.bin> +-------------- next part -------------- +A non-text attachment was scrubbed... +Name: not available +Type: application/pgp-signature +Size: 836 bytes +Desc: not available +URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131023/771afff9/attachment-0001.sig> diff --git a/a/2.bin b/a/2.bin deleted file mode 100644 index d79e76b..0000000 --- a/a/2.bin +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.22 (GNU/Linux) - -iQIcBAEBAgAGBQJSZ4cDAAoJEN0jrNd/PrOhkTsP/1oWovDOS6cgGeKdEPYc3byt -FD/V88qxw/6nnzjFdVGT0Qbcwa306HiYi96j7wD46apyLsIflU3K89TmkfRwWd5I -6/AqoiFtAKlEjZ9RTVHhrX0AhZldHqXeA2XaAttTGLlz2dQJayMagcc1+Xa1USfU -dhydtfnInq+YguYHa8eIAmoQKCr0iGwZwbL6k1r7P4WDb4SWpyVixu2f+CD+dBss -Pk22AHKqVt8BniU3XrdZIh5lEgoqilX5bizJA8B3EdsT1C6v+JL4gvbuYtipv9FP -fb0GkDu0AbsnC8nYWTl5IfqS+wCsWqQ3TK2Mrd0kTNdEd35oPiLp2mtmzC9um1LE -AH0Y/SHbWFe8gRed1PXrxmgHBf4fsxfE+QHfOU45KnJ+WZgLAjZhyfNqM08F02si -WxIk8T9CdVAHSSZ9G3ztkBU5YwLJTMn3ShXeGU7M+oxp1cVaExr9UnNdIYg/wWnV -O0c5xlUpc2/q8kHK837WPTHMHyq2audWdm6cYMYScLgTRzEVqYCfC9ewvJIvQnnV -j3hw13dKJCmhYpjn39Di01TwB4TyH6YCi5jI2dJEB8qZyRa/AnmT14coWnsmlc6d -0I2FF3crF1SlxoFCinudj4nu59lM50CT5n6AT7Oeah/qcHr1PRcLnGDEMbfHVXQY -ExlLrMhOfo3yA+wUe+xF -=n0pj ------END PGP SIGNATURE----- diff --git a/a/2.hdr b/a/2.hdr deleted file mode 100644 index a09cc95..0000000 --- a/a/2.hdr +++ /dev/null @@ -1 +0,0 @@ -Content-Type: application/pgp-signature diff --git a/a/content_digest b/N1/content_digest index a584fad..f673550 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -2,26 +2,14 @@ "ref\020131021155927.GB4255@core.coreip.homeip.net\0" "ref\020131022114947.30dc9c07@ipc1.ka-ro\0" "ref\020131022223504.GA19819@core.coreip.homeip.net\0" - "From\0Thierry Reding <thierry.reding@gmail.com>\0" - "Subject\0Re: [PATCHv4][ 1/4] Input: tsc2007: Add device tree support.\0" + "From\0thierry.reding@gmail.com (Thierry Reding)\0" + "Subject\0[PATCHv4][ 1/4] Input: tsc2007: Add device tree support.\0" "Date\0Wed, 23 Oct 2013 10:21:23 +0200\0" - "To\0Dmitry Torokhov <dmitry.torokhov@gmail.com>\0" - "Cc\0Lothar Wa\303\237mann <LW@karo-electronics.de>" - Mark Rutland <mark.rutland@arm.com> - devicetree@vger.kernel.org - Sascha Hauer <kernel@pengutronix.de> - Pawel Moll <pawel.moll@arm.com> - Stephen Warren <swarren@wwwdotorg.org> - Ian Campbell <ijc+devicetree@hellion.org.uk> - Rob Herring <rob.herring@calxeda.com> - Denis Carikli <denis@eukrea.com> - " Eric B\303\251nard <eric@eukrea.com>" - linux-input@vger.kernel.org - " linux-arm-kernel@lists.infradead.org\0" - "\02:1.1\0" + "To\0linux-arm-kernel@lists.infradead.org\0" + "\00:1\0" "b\0" "On Tue, Oct 22, 2013 at 03:35:05PM -0700, Dmitry Torokhov wrote:\n" - "> On Tue, Oct 22, 2013 at 11:49:47AM +0200, Lothar Wa\303\237mann wrote:\n" + "> On Tue, Oct 22, 2013 at 11:49:47AM +0200, Lothar Wa?mann wrote:\n" "> > Hi,\n" "> > \n" "> > > On Mon, Oct 21, 2013 at 03:54:24PM +0200, Denis Carikli wrote:\n" @@ -59,381 +47,20 @@ "an example of how this could work. Sorry this isn't in the form of a\n" "proper patch.\n" "\n" - Thierry - "\02:1.2\0" - "fn\0tsc2007.patch\0" - "b\0" - "diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c\n" - "index d49b0ec..0dd8381 100644\n" - "--- a/arch/arm/mach-imx/mach-cpuimx35.c\n" - "+++ b/arch/arm/mach-imx/mach-cpuimx35.c\n" - "@@ -62,6 +62,7 @@ static int tsc2007_get_pendown_state(void)\n" - " static struct tsc2007_platform_data tsc2007_info = {\n" - " \t.model\t\t\t= 2007,\n" - " \t.x_plate_ohms\t\t= 180,\n" - "+\t.pendown_gpio\t\t= -1,\n" - " \t.get_pendown_state = tsc2007_get_pendown_state,\n" - " };\n" - " \n" - "diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c\n" - "index b87cc49..ef2a7e6 100644\n" - "--- a/arch/arm/mach-imx/mach-cpuimx51sd.c\n" - "+++ b/arch/arm/mach-imx/mach-cpuimx51sd.c\n" - "@@ -134,6 +134,7 @@ static int tsc2007_get_pendown_state(void)\n" - " static struct tsc2007_platform_data tsc2007_info = {\n" - " \t.model\t\t\t= 2007,\n" - " \t.x_plate_ohms\t\t= 180,\n" - "+\t.pendown_gpio\t\t= -1,\n" - " \t.get_pendown_state\t= tsc2007_get_pendown_state,\n" - " };\n" - " \n" - "diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c\n" - "index b85957a..69abf30 100644\n" - "--- a/arch/arm/mach-shmobile/board-ap4evb.c\n" - "+++ b/arch/arm/mach-shmobile/board-ap4evb.c\n" - "@@ -1199,6 +1199,7 @@ static int ts_init(void)\n" - " static struct tsc2007_platform_data tsc2007_info = {\n" - " \t.model\t\t\t= 2007,\n" - " \t.x_plate_ohms\t\t= 180,\n" - "+\t.pendown_gpio\t\t= -1,\n" - " \t.get_pendown_state\t= ts_get_pendown_state,\n" - " \t.init_platform_hw\t= ts_init,\n" - " };\n" - "diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c\n" - "index 64559e8a..6cfd0ef 100644\n" - "--- a/arch/sh/boards/mach-ecovec24/setup.c\n" - "+++ b/arch/sh/boards/mach-ecovec24/setup.c\n" - "@@ -517,6 +517,7 @@ static int ts_init(void)\n" - " static struct tsc2007_platform_data tsc2007_info = {\n" - " \t.model\t\t\t= 2007,\n" - " \t.x_plate_ohms\t\t= 180,\n" - "+\t.pendown_gpio\t\t= -1,\n" - " \t.get_pendown_state\t= ts_get_pendown_state,\n" - " \t.init_platform_hw\t= ts_init,\n" - " };\n" - "diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c\n" - "index 1473d23..c87fdac 100644\n" - "--- a/drivers/input/touchscreen/tsc2007.c\n" - "+++ b/drivers/input/touchscreen/tsc2007.c\n" - "@@ -20,10 +20,15 @@\n" - " * published by the Free Software Foundation.\n" - " */\n" - " \n" - "+#define pr_fmt(fmt) \"tsc2007: \" fmt\n" - "+\n" - " #include <linux/module.h>\n" - " #include <linux/slab.h>\n" - " #include <linux/input.h>\n" - " #include <linux/interrupt.h>\n" - "+#include <linux/delay.h>\n" - "+#include <linux/of_gpio.h>\n" - "+#include <linux/of_irq.h>\n" - " #include <linux/i2c.h>\n" - " #include <linux/i2c/tsc2007.h>\n" - " \n" - "@@ -75,13 +80,16 @@ struct tsc2007 {\n" - " \tunsigned long\t\tpoll_delay;\n" - " \tunsigned long\t\tpoll_period;\n" - " \n" - "+\tint\t\t\tpendown_gpio;\n" - "+\tint\t\t\tactive_low;\n" - " \tint\t\t\tirq;\n" - " \n" - " \twait_queue_head_t\twait;\n" - " \tbool\t\t\tstopped;\n" - " \n" - "-\tint\t\t\t(*get_pendown_state)(void);\n" - "-\tvoid\t\t\t(*clear_penirq)(void);\n" - "+\tvoid\t\t\t*callback_data;\n" - "+\tint\t\t\t(*get_pendown_state)(void *data);\n" - "+\tvoid\t\t\t(*clear_penirq)(void *data);\n" - " };\n" - " \n" - " static inline int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd)\n" - "@@ -161,7 +169,7 @@ static bool tsc2007_is_pen_down(struct tsc2007 *ts)\n" - " \tif (!ts->get_pendown_state)\n" - " \t\treturn true;\n" - " \n" - "-\treturn ts->get_pendown_state();\n" - "+\treturn ts->get_pendown_state(ts->callback_data);\n" - " }\n" - " \n" - " static irqreturn_t tsc2007_soft_irq(int irq, void *handle)\n" - "@@ -171,6 +179,13 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)\n" - " \tstruct ts_event tc;\n" - " \tu32 rt;\n" - " \n" - "+\t/*\n" - "+\t * With some panels we need to wait a bit otherwise the first value\n" - "+\t * is often wrong.\n" - "+\t */\n" - "+\tif (ts->poll_delay > 0)\n" - "+\t\tmsleep(ts->poll_delay);\n" - "+\n" - " \twhile (!ts->stopped && tsc2007_is_pen_down(ts)) {\n" - " \n" - " \t\t/* pen is down, continue with the measurement */\n" - "@@ -219,7 +234,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)\n" - " \tinput_sync(input);\n" - " \n" - " \tif (ts->clear_penirq)\n" - "-\t\tts->clear_penirq();\n" - "+\t\tts->clear_penirq(ts->callback_data);\n" - " \n" - " \treturn IRQ_HANDLED;\n" - " }\n" - "@@ -228,11 +243,11 @@ static irqreturn_t tsc2007_hard_irq(int irq, void *handle)\n" - " {\n" - " \tstruct tsc2007 *ts = handle;\n" - " \n" - "-\tif (!ts->get_pendown_state || likely(ts->get_pendown_state()))\n" - "+\tif (!ts->get_pendown_state || likely(ts->get_pendown_state(ts->callback_data)))\n" - " \t\treturn IRQ_WAKE_THREAD;\n" - " \n" - " \tif (ts->clear_penirq)\n" - "-\t\tts->clear_penirq();\n" - "+\t\tts->clear_penirq(ts->callback_data);\n" - " \n" - " \treturn IRQ_HANDLED;\n" - " }\n" - "@@ -273,6 +288,75 @@ static void tsc2007_close(struct input_dev *input_dev)\n" - " \ttsc2007_stop(ts);\n" - " }\n" - " \n" - "+static int tsc2007_get_pendown_state(void *data)\n" - "+{\n" - "+\tstruct tsc2007 *ts = data;\n" - "+\tint ret = 0;\n" - "+\n" - "+\tret = !!gpio_get_value(ts->pendown_gpio);\n" - "+\tif (ts->active_low)\n" - "+\t\tret = !ret;\n" - "+\n" - "+\treturn ret;\n" - "+}\n" - "+\n" - "+static struct tsc2007_platform_data *tsc2007_parse_dt(struct device *dev)\n" - "+{\n" - "+\tstruct tsc2007_platform_data *pdata;\n" - "+\tenum of_gpio_flags flags;\n" - "+\tu32 value, values[3];\n" - "+\tint err;\n" - "+\n" - "+\tpdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);\n" - "+\tif (!pdata)\n" - "+\t\treturn ERR_PTR(-ENOMEM);\n" - "+\n" - "+\terr = of_get_named_gpio_flags(dev->of_node, \"pendown-gpios\", 0,\n" - "+\t\t\t\t &flags);\n" - "+\tif (err < 0)\n" - "+\t\treturn ERR_PTR(err);\n" - "+\n" - "+\tpdata->pendown_gpio = err;\n" - "+\n" - "+\tif (flags & OF_GPIO_ACTIVE_LOW)\n" - "+\t\tpdata->active_low = true;\n" - "+\n" - "+\terr = of_property_read_u32(dev->of_node, \"x-plate-ohms\", &value);\n" - "+\tif (err < 0)\n" - "+\t\treturn ERR_PTR(err);\n" - "+\n" - "+\tpdata->x_plate_ohms = value;\n" - "+\n" - "+\terr = of_property_read_u32(dev->of_node, \"max-rt\", &value);\n" - "+\tif (err < 0)\n" - "+\t\treturn ERR_PTR(err);\n" - "+\n" - "+\tpdata->max_rt = value;\n" - "+\n" - "+\terr = of_property_read_u32(dev->of_node, \"poll-delay\", &value);\n" - "+\tif (err < 0)\n" - "+\t\treturn ERR_PTR(err);\n" - "+\n" - "+\tpdata->poll_delay = value;\n" - "+\n" - "+\terr = of_property_read_u32(dev->of_node, \"poll-period\", &value);\n" - "+\tif (err < 0)\n" - "+\t\treturn ERR_PTR(err);\n" - "+\n" - "+\tpdata->poll_period = value;\n" - "+\n" - "+\terr = of_property_read_u32_array(dev->of_node, \"fuzz\", values,\n" - "+\t\t\t\t\t ARRAY_SIZE(values));\n" - "+\tif (err < 0)\n" - "+\t\treturn ERR_PTR(err);\n" - "+\n" - "+\tpdata->fuzzx = values[0];\n" - "+\tpdata->fuzzy = values[1];\n" - "+\tpdata->fuzzz = values[2];\n" - "+\n" - "+\treturn pdata;\n" - "+}\n" - "+\n" - " static int __devinit tsc2007_probe(struct i2c_client *client,\n" - " \t\t\t\t const struct i2c_device_id *id)\n" - " {\n" - "@@ -281,18 +365,42 @@ static int __devinit tsc2007_probe(struct i2c_client *client,\n" - " \tstruct input_dev *input_dev;\n" - " \tint err;\n" - " \n" - "+\tts = kzalloc(sizeof(struct tsc2007), GFP_KERNEL);\n" - "+\tif (!ts)\n" - "+\t\treturn -ENOMEM;\n" - "+\n" - "+\tif (IS_ENABLED(CONFIG_OF) && client->dev.of_node) {\n" - "+\t\tclient->irq = irq_of_parse_and_map(client->dev.of_node, 0);\n" - "+\t\tif (!client->irq) {\n" - "+\t\t\terr = -EPROBE_DEFER;\n" - "+\t\t\tgoto err_free_mem;\n" - "+\t\t}\n" - "+\t}\n" - "+\n" - " \tif (!pdata) {\n" - "-\t\tdev_err(&client->dev, \"platform data is required!\\n\");\n" - "-\t\treturn -EINVAL;\n" - "+\t\tif (IS_ENABLED(CONFIG_OF) && client->dev.of_node) {\n" - "+\t\t\tpdata = tsc2007_parse_dt(&client->dev);\n" - "+\t\t\tif (IS_ERR(pdata)) {\n" - "+\t\t\t\terr = PTR_ERR(pdata);\n" - "+\t\t\t\tgoto err_free_mem;\n" - "+\t\t\t}\n" - "+\n" - "+\t\t\tpdata->callback_data = ts;\n" - "+\t\t} else {\n" - "+\t\t\tdev_err(&client->dev, \"platform data is required!\\n\");\n" - "+\t\t\terr = -EINVAL;\n" - "+\t\t\tgoto err_free_mem;\n" - "+\t\t}\n" - " \t}\n" - " \n" - " \tif (!i2c_check_functionality(client->adapter,\n" - "-\t\t\t\t I2C_FUNC_SMBUS_READ_WORD_DATA))\n" - "-\t\treturn -EIO;\n" - "+\t\t\t\t I2C_FUNC_SMBUS_READ_WORD_DATA)) {\n" - "+\t\terr = -EIO;\n" - "+\t\tgoto err_free_mem;\n" - "+\t}\n" - " \n" - "-\tts = kzalloc(sizeof(struct tsc2007), GFP_KERNEL);\n" - " \tinput_dev = input_allocate_device();\n" - "-\tif (!ts || !input_dev) {\n" - "+\tif (!input_dev) {\n" - " \t\terr = -ENOMEM;\n" - " \t\tgoto err_free_mem;\n" - " \t}\n" - "@@ -307,13 +415,27 @@ static int __devinit tsc2007_probe(struct i2c_client *client,\n" - " \tts->max_rt = pdata->max_rt ? : MAX_12BIT;\n" - " \tts->poll_delay = pdata->poll_delay ? : 1;\n" - " \tts->poll_period = pdata->poll_period ? : 1;\n" - "+\tts->callback_data = pdata->callback_data;\n" - " \tts->get_pendown_state = pdata->get_pendown_state;\n" - " \tts->clear_penirq = pdata->clear_penirq;\n" - " \n" - " \tif (pdata->x_plate_ohms == 0) {\n" - " \t\tdev_err(&client->dev, \"x_plate_ohms is not set up in platform data\");\n" - " \t\terr = -EINVAL;\n" - "-\t\tgoto err_free_mem;\n" - "+\t\tgoto err_free_dev;\n" - "+\t}\n" - "+\n" - "+\tif (gpio_is_valid(pdata->pendown_gpio)) {\n" - "+\t\terr = gpio_request_one(pdata->pendown_gpio, GPIOF_IN,\n" - "+\t\t\t\t \"tsc2007\");\n" - "+\t\tif (err < 0)\n" - "+\t\t\tgoto err_free_dev;\n" - "+\n" - "+\t\tts->get_pendown_state = tsc2007_get_pendown_state;\n" - "+\t\tts->pendown_gpio = pdata->pendown_gpio;\n" - "+\t\tts->active_low = pdata->active_low;\n" - "+\t} else {\n" - "+\t\tts->pendown_gpio = -EINVAL;\n" - " \t}\n" - " \n" - " \tsnprintf(ts->phys, sizeof(ts->phys),\n" - "@@ -343,7 +465,7 @@ static int __devinit tsc2007_probe(struct i2c_client *client,\n" - " \t\t\t\t IRQF_ONESHOT, client->dev.driver->name, ts);\n" - " \tif (err < 0) {\n" - " \t\tdev_err(&client->dev, \"irq %d busy?\\n\", ts->irq);\n" - "-\t\tgoto err_free_mem;\n" - "+\t\tgoto err_free_gpio;\n" - " \t}\n" - " \n" - " \ttsc2007_stop(ts);\n" - "@@ -360,8 +482,12 @@ static int __devinit tsc2007_probe(struct i2c_client *client,\n" - " \tfree_irq(ts->irq, ts);\n" - " \tif (pdata->exit_platform_hw)\n" - " \t\tpdata->exit_platform_hw();\n" - "- err_free_mem:\n" - "+ err_free_gpio:\n" - "+\tif (gpio_is_valid(pdata->pendown_gpio))\n" - "+\t\tgpio_free(pdata->pendown_gpio);\n" - "+ err_free_dev:\n" - " \tinput_free_device(input_dev);\n" - "+ err_free_mem:\n" - " \tkfree(ts);\n" - " \treturn err;\n" - " }\n" - "@@ -373,6 +499,9 @@ static int __devexit tsc2007_remove(struct i2c_client *client)\n" - " \n" - " \tfree_irq(ts->irq, ts);\n" - " \n" - "+\tif (gpio_is_valid(ts->pendown_gpio))\n" - "+\t\tgpio_free(ts->pendown_gpio);\n" - "+\n" - " \tif (pdata->exit_platform_hw)\n" - " \t\tpdata->exit_platform_hw();\n" - " \n" - "diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c\n" - "index a447f4e..249d307 100644\n" - "--- a/drivers/mfd/timberdale.c\n" - "+++ b/drivers/mfd/timberdale.c\n" - "@@ -64,7 +64,8 @@ struct timberdale_device {\n" - " \n" - " static struct tsc2007_platform_data timberdale_tsc2007_platform_data = {\n" - " \t.model = 2003,\n" - "-\t.x_plate_ohms = 100\n" - "+\t.x_plate_ohms = 100,\n" - "+\t.pendown_gpio = -1,\n" - " };\n" - " \n" - " static struct i2c_board_info timberdale_i2c_board_info[] = {\n" - "diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h\n" - "index 506a9f7..8d72771 100644\n" - "--- a/include/linux/i2c/tsc2007.h\n" - "+++ b/include/linux/i2c/tsc2007.h\n" - "@@ -14,8 +14,12 @@ struct tsc2007_platform_data {\n" - " \tint\tfuzzy;\n" - " \tint\tfuzzz;\n" - " \n" - "-\tint\t(*get_pendown_state)(void);\n" - "-\tvoid\t(*clear_penirq)(void);\t\t/* If needed, clear 2nd level\n" - "+\tint\tpendown_gpio;\n" - "+\tbool\tactive_low;\n" - "+\n" - "+\tvoid\t*callback_data;\n" - "+\tint\t(*get_pendown_state)(void *data);\n" - "+\tvoid\t(*clear_penirq)(void *data);\t/* If needed, clear 2nd level\n" - " \t\t\t\t\t\t interrupt source */\n" - " \tint\t(*init_platform_hw)(void);\n" - " \tvoid\t(*exit_platform_hw)(void);" - "\01:2\0" - "b\0" - "-----BEGIN PGP SIGNATURE-----\n" - "Version: GnuPG v2.0.22 (GNU/Linux)\n" - "\n" - "iQIcBAEBAgAGBQJSZ4cDAAoJEN0jrNd/PrOhkTsP/1oWovDOS6cgGeKdEPYc3byt\n" - "FD/V88qxw/6nnzjFdVGT0Qbcwa306HiYi96j7wD46apyLsIflU3K89TmkfRwWd5I\n" - "6/AqoiFtAKlEjZ9RTVHhrX0AhZldHqXeA2XaAttTGLlz2dQJayMagcc1+Xa1USfU\n" - "dhydtfnInq+YguYHa8eIAmoQKCr0iGwZwbL6k1r7P4WDb4SWpyVixu2f+CD+dBss\n" - "Pk22AHKqVt8BniU3XrdZIh5lEgoqilX5bizJA8B3EdsT1C6v+JL4gvbuYtipv9FP\n" - "fb0GkDu0AbsnC8nYWTl5IfqS+wCsWqQ3TK2Mrd0kTNdEd35oPiLp2mtmzC9um1LE\n" - "AH0Y/SHbWFe8gRed1PXrxmgHBf4fsxfE+QHfOU45KnJ+WZgLAjZhyfNqM08F02si\n" - "WxIk8T9CdVAHSSZ9G3ztkBU5YwLJTMn3ShXeGU7M+oxp1cVaExr9UnNdIYg/wWnV\n" - "O0c5xlUpc2/q8kHK837WPTHMHyq2audWdm6cYMYScLgTRzEVqYCfC9ewvJIvQnnV\n" - "j3hw13dKJCmhYpjn39Di01TwB4TyH6YCi5jI2dJEB8qZyRa/AnmT14coWnsmlc6d\n" - "0I2FF3crF1SlxoFCinudj4nu59lM50CT5n6AT7Oeah/qcHr1PRcLnGDEMbfHVXQY\n" - "ExlLrMhOfo3yA+wUe+xF\n" - "=n0pj\n" - "-----END PGP SIGNATURE-----\n" + "Thierry\n" + "-------------- next part --------------\n" + "A non-text attachment was scrubbed...\n" + "Name: tsc2007.patch\n" + "Type: text/x-diff\n" + "Size: 9863 bytes\n" + "Desc: not available\n" + "URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131023/771afff9/attachment-0001.bin>\n" + "-------------- next part --------------\n" + "A non-text attachment was scrubbed...\n" + "Name: not available\n" + "Type: application/pgp-signature\n" + "Size: 836 bytes\n" + "Desc: not available\n" + URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131023/771afff9/attachment-0001.sig> -c18e34719ff478fbba79fe9dc029a030748d4f7d236233bc051434b07eb58905 +827e7498a7a9fd56d014842185de03bf8183024b81715d7552555b4c5621f351
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.