* [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support
@ 2017-07-03 12:38 Sebastian Reichel
  2017-07-03 12:38 ` [PATCHv2 1/2] Input: atmel_mxt_ts: Use more managed resources Sebastian Reichel
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sebastian Reichel @ 2017-07-03 12:38 UTC (permalink / raw)
  To: Sebastian Reichel, Nick Dyer, Dmitry Torokhov,
	linux-input-u79uwXL29TY76Z2rM5mHXA
  Cc: Henrik Rydberg, Rob Herring, Mark Rutland,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Sebastian Reichel
Hi,
This adds support for the reset pin of Atmel MXT.
Changes since PATCHv1:
 - Add new patch preparing for resource managed gpio
 - Use resource managed gpio
 - Wait for interrupt after reset
-- Sebastian
Sebastian Reichel (2):
  Input: atmel_mxt_ts: Use more managed resources
  Input: atmel_mxt_ts: Add support for reset line
 .../devicetree/bindings/input/atmel,maxtouch.txt   |  2 ++
 drivers/input/touchscreen/atmel_mxt_ts.c           | 42 +++++++++++++++-------
 2 files changed, 31 insertions(+), 13 deletions(-)
-- 
2.13.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
^ permalink raw reply	[flat|nested] 8+ messages in thread* [PATCHv2 1/2] Input: atmel_mxt_ts: Use more managed resources 2017-07-03 12:38 [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support Sebastian Reichel @ 2017-07-03 12:38 ` Sebastian Reichel 2017-07-03 12:38 ` [PATCHv2 2/2] Input: atmel_mxt_ts: Add support for reset line Sebastian Reichel [not found] ` <20170703123843.19340-1-sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> 2 siblings, 0 replies; 8+ messages in thread From: Sebastian Reichel @ 2017-07-03 12:38 UTC (permalink / raw) To: Sebastian Reichel, Nick Dyer, Dmitry Torokhov, linux-input Cc: Henrik Rydberg, Rob Herring, Mark Rutland, devicetree, linux-kernel, Sebastian Reichel Switch mxt_data and interrupt to resource managed allocation methods, which cleans up the driver slightly and prepares for adding reset GPIO support. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> --- drivers/input/touchscreen/atmel_mxt_ts.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index dd042a9b0aaa..9a7b8eba64a6 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3117,11 +3117,9 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) if (IS_ERR(pdata)) return PTR_ERR(pdata); - data = kzalloc(sizeof(struct mxt_data), GFP_KERNEL); - if (!data) { - dev_err(&client->dev, "Failed to allocate memory\n"); + data = devm_kzalloc(&client->dev, sizeof(struct mxt_data), GFP_KERNEL); + if (!data) return -ENOMEM; - } snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0", client->adapter->nr, client->addr); @@ -3135,19 +3133,20 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) init_completion(&data->reset_completion); init_completion(&data->crc_completion); - error = request_threaded_irq(client->irq, NULL, mxt_interrupt, + error = devm_request_threaded_irq(&client->dev, client->irq, NULL, + mxt_interrupt, pdata->irqflags | IRQF_ONESHOT, client->name, data); if (error) { dev_err(&client->dev, "Failed to register interrupt\n"); - goto err_free_mem; + return error; } disable_irq(client->irq); error = mxt_initialize(data); if (error) - goto err_free_irq; + return error; error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group); if (error) { @@ -3161,10 +3160,6 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) err_free_object: mxt_free_input_device(data); mxt_free_object_table(data); -err_free_irq: - free_irq(client->irq, data); -err_free_mem: - kfree(data); return error; } @@ -3172,11 +3167,10 @@ static int mxt_remove(struct i2c_client *client) { struct mxt_data *data = i2c_get_clientdata(client); + disable_irq(data->irq); sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); - free_irq(data->irq, data); mxt_free_input_device(data); mxt_free_object_table(data); - kfree(data); return 0; } -- 2.13.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCHv2 2/2] Input: atmel_mxt_ts: Add support for reset line 2017-07-03 12:38 [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support Sebastian Reichel 2017-07-03 12:38 ` [PATCHv2 1/2] Input: atmel_mxt_ts: Use more managed resources Sebastian Reichel @ 2017-07-03 12:38 ` Sebastian Reichel [not found] ` <20170703123843.19340-1-sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> 2 siblings, 0 replies; 8+ messages in thread From: Sebastian Reichel @ 2017-07-03 12:38 UTC (permalink / raw) To: Sebastian Reichel, Nick Dyer, Dmitry Torokhov, linux-input Cc: Henrik Rydberg, Rob Herring, Mark Rutland, devicetree, linux-kernel, Sebastian Reichel Provide support for controlling reset pin. If this is not driven correctly the device will be held in reset and will not respond. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> --- .../devicetree/bindings/input/atmel,maxtouch.txt | 2 ++ drivers/input/touchscreen/atmel_mxt_ts.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt index 1852906517ab..23e3abc3fdef 100644 --- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt +++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt @@ -22,6 +22,8 @@ Optional properties for main touchpad device: experiment to determine which bit corresponds to which input. Use KEY_RESERVED for unused padding values. +- reset-gpios: GPIO specifier for the touchscreen's reset pin (active low) + Example: touch@4b { diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 9a7b8eba64a6..599f92363188 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -28,6 +28,7 @@ #include <linux/interrupt.h> #include <linux/of.h> #include <linux/slab.h> +#include <linux/gpio/consumer.h> #include <asm/unaligned.h> #include <media/v4l2-device.h> #include <media/v4l2-ioctl.h> @@ -300,6 +301,7 @@ struct mxt_data { u8 multitouch; struct t7_config t7_cfg; struct mxt_dbg dbg; + struct gpio_desc *reset_gpio; /* Cached parameters from object table */ u16 T5_address; @@ -3133,6 +3135,14 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) init_completion(&data->reset_completion); init_completion(&data->crc_completion); + data->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(data->reset_gpio)) { + error = PTR_ERR(data->reset_gpio); + dev_err(&client->dev, "Failed to get reset gpio: %d\n", error); + return error; + } + error = devm_request_threaded_irq(&client->dev, client->irq, NULL, mxt_interrupt, pdata->irqflags | IRQF_ONESHOT, @@ -3142,6 +3152,18 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) return error; } + if (data->reset_gpio) { + data->in_bootloader = true; + msleep(MXT_RESET_TIME); + reinit_completion(&data->bl_completion); + gpiod_set_value(data->reset_gpio, 1); + error = mxt_wait_for_completion(data, &data->bl_completion, + MXT_RESET_TIMEOUT); + if (error) + return error; + data->in_bootloader = false; + } + disable_irq(client->irq); error = mxt_initialize(data); -- 2.13.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <20170703123843.19340-1-sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>]
* Re: [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support [not found] ` <20170703123843.19340-1-sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> @ 2017-07-25 13:56 ` Sebastian Reichel 2017-08-21 10:03 ` Sebastian Reichel 0 siblings, 1 reply; 8+ messages in thread From: Sebastian Reichel @ 2017-07-25 13:56 UTC (permalink / raw) To: Nick Dyer, Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA Cc: Henrik Rydberg, Rob Herring, Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 887 bytes --] Hi Dmitry, Gentle ping on this one. This helps to remove a hack from the Droid 4 DT and will also be used by PPD, which is currently being upstreamed: https://lkml.org/lkml/2017/7/19/898 -- Sebastian On Mon, Jul 03, 2017 at 02:38:41PM +0200, Sebastian Reichel wrote: > Hi, > > This adds support for the reset pin of Atmel MXT. > > Changes since PATCHv1: > - Add new patch preparing for resource managed gpio > - Use resource managed gpio > - Wait for interrupt after reset > > -- Sebastian > > Sebastian Reichel (2): > Input: atmel_mxt_ts: Use more managed resources > Input: atmel_mxt_ts: Add support for reset line > > .../devicetree/bindings/input/atmel,maxtouch.txt | 2 ++ > drivers/input/touchscreen/atmel_mxt_ts.c | 42 +++++++++++++++------- > 2 files changed, 31 insertions(+), 13 deletions(-) > > -- > 2.13.2 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support 2017-07-25 13:56 ` [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support Sebastian Reichel @ 2017-08-21 10:03 ` Sebastian Reichel 2017-09-04 9:02 ` Sebastian Reichel 0 siblings, 1 reply; 8+ messages in thread From: Sebastian Reichel @ 2017-08-21 10:03 UTC (permalink / raw) To: Nick Dyer, Dmitry Torokhov, linux-input Cc: Henrik Rydberg, Rob Herring, Mark Rutland, devicetree, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1057 bytes --] Hi, ping? -- Sebastian On Tue, Jul 25, 2017 at 03:56:56PM +0200, Sebastian Reichel wrote: > Hi Dmitry, > > Gentle ping on this one. This helps to remove a hack from the > Droid 4 DT and will also be used by PPD, which is currently > being upstreamed: > > https://lkml.org/lkml/2017/7/19/898 > > -- Sebastian > > On Mon, Jul 03, 2017 at 02:38:41PM +0200, Sebastian Reichel wrote: > > Hi, > > > > This adds support for the reset pin of Atmel MXT. > > > > Changes since PATCHv1: > > - Add new patch preparing for resource managed gpio > > - Use resource managed gpio > > - Wait for interrupt after reset > > > > -- Sebastian > > > > Sebastian Reichel (2): > > Input: atmel_mxt_ts: Use more managed resources > > Input: atmel_mxt_ts: Add support for reset line > > > > .../devicetree/bindings/input/atmel,maxtouch.txt | 2 ++ > > drivers/input/touchscreen/atmel_mxt_ts.c | 42 +++++++++++++++------- > > 2 files changed, 31 insertions(+), 13 deletions(-) > > > > -- > > 2.13.2 > > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support 2017-08-21 10:03 ` Sebastian Reichel @ 2017-09-04 9:02 ` Sebastian Reichel 2017-09-04 16:17 ` Dmitry Torokhov 0 siblings, 1 reply; 8+ messages in thread From: Sebastian Reichel @ 2017-09-04 9:02 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Henrik Rydberg, linux-kernel, linux-input, Nick Dyer [-- Attachment #1: Type: text/plain, Size: 1308 bytes --] Hi, Another two weeks, another ping. Is everything allright with Dmitry? -- Sebastian On Mon, Aug 21, 2017 at 12:03:51PM +0200, Sebastian Reichel wrote: > Hi, > > ping? > > -- Sebastian > > On Tue, Jul 25, 2017 at 03:56:56PM +0200, Sebastian Reichel wrote: > > Hi Dmitry, > > > > Gentle ping on this one. This helps to remove a hack from the > > Droid 4 DT and will also be used by PPD, which is currently > > being upstreamed: > > > > https://lkml.org/lkml/2017/7/19/898 > > > > -- Sebastian > > > > On Mon, Jul 03, 2017 at 02:38:41PM +0200, Sebastian Reichel wrote: > > > Hi, > > > > > > This adds support for the reset pin of Atmel MXT. > > > > > > Changes since PATCHv1: > > > - Add new patch preparing for resource managed gpio > > > - Use resource managed gpio > > > - Wait for interrupt after reset > > > > > > -- Sebastian > > > > > > Sebastian Reichel (2): > > > Input: atmel_mxt_ts: Use more managed resources > > > Input: atmel_mxt_ts: Add support for reset line > > > > > > .../devicetree/bindings/input/atmel,maxtouch.txt | 2 ++ > > > drivers/input/touchscreen/atmel_mxt_ts.c | 42 +++++++++++++++------- > > > 2 files changed, 31 insertions(+), 13 deletions(-) > > > > > > -- > > > 2.13.2 > > > > > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support 2017-09-04 9:02 ` Sebastian Reichel @ 2017-09-04 16:17 ` Dmitry Torokhov 2017-09-04 17:51 ` Sebastian Reichel 0 siblings, 1 reply; 8+ messages in thread From: Dmitry Torokhov @ 2017-09-04 16:17 UTC (permalink / raw) To: Sebastian Reichel; +Cc: Henrik Rydberg, linux-kernel, linux-input, Nick Dyer Hi Sebastian, On Mon, Sep 04, 2017 at 11:02:33AM +0200, Sebastian Reichel wrote: > Hi, > > Another two weeks, another ping. Is everything allright with Dmitry? Sorry, I apparently forgot to sent out a notice that I applied the 2 patches, but they have been in my tree for the last 2 weeks and will get into the next pull request for 4.14: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=next&id=f657b00df22e231da217ca0162a75db452475e8f Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support 2017-09-04 16:17 ` Dmitry Torokhov @ 2017-09-04 17:51 ` Sebastian Reichel 0 siblings, 0 replies; 8+ messages in thread From: Sebastian Reichel @ 2017-09-04 17:51 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Henrik Rydberg, linux-kernel, linux-input, Nick Dyer [-- Attachment #1: Type: text/plain, Size: 605 bytes --] Hi Dmitry, On Mon, Sep 04, 2017 at 09:17:09AM -0700, Dmitry Torokhov wrote: > On Mon, Sep 04, 2017 at 11:02:33AM +0200, Sebastian Reichel wrote: > > Another two weeks, another ping. Is everything allright with Dmitry? > > Sorry, I apparently forgot to sent out a notice that I applied the 2 > patches, but they have been in my tree for the last 2 weeks and will get > into the next pull request for 4.14: > > https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=next&id=f657b00df22e231da217ca0162a75db452475e8f ok, should have checked first. Thanks :) -- Sebastian [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-09-04 17:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03 12:38 [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support Sebastian Reichel
2017-07-03 12:38 ` [PATCHv2 1/2] Input: atmel_mxt_ts: Use more managed resources Sebastian Reichel
2017-07-03 12:38 ` [PATCHv2 2/2] Input: atmel_mxt_ts: Add support for reset line Sebastian Reichel
     [not found] ` <20170703123843.19340-1-sebastian.reichel-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
2017-07-25 13:56   ` [PATCHv2 0/2] Input: atmel_mxt_ts: Add reset support Sebastian Reichel
2017-08-21 10:03     ` Sebastian Reichel
2017-09-04  9:02       ` Sebastian Reichel
2017-09-04 16:17         ` Dmitry Torokhov
2017-09-04 17:51           ` Sebastian Reichel
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).