From: Nick Dyer <nick.dyer@itdev.co.uk>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Yufeng Shen <miletus@chromium.org>,
Benson Leung <bleung@chromium.org>,
Daniel Kurtz <djkurtz@chromium.org>,
Sjoerd Simons <sjoerd.simons@collabora.co.uk>,
Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
Olof Johansson <olof@lixom.net>
Subject: Re: [PATCH 2/2] Input: atmel_mxt_ts - allow specifying device-specific configs
Date: Thu, 09 Apr 2015 12:03:14 +0100 [thread overview]
Message-ID: <55265C72.1090008@itdev.co.uk> (raw)
In-Reply-To: <1428452770-20767-2-git-send-email-dmitry.torokhov@gmail.com>
Hi Dmitry-
This is similar to something that I've already got in my tree:
https://github.com/ndyer/linux/commit/449643df3c80
https://github.com/ndyer/linux/commit/a520bbbfbdd1
However, my version is based on the earlier Pixel code and allows updating
the config at any point in time by writing to the sysfs node, not just at
probe time, so it's a little more complex.
Would you like me to test this along with the T100 changes you just merged?
On 08/04/15 01:26, Dmitry Torokhov wrote:
> Atmel controolers are very flexible and to function optimally require
s/trool/troll/ :)
> device-specific configuration to be loaded. While the configuration is
> stored in NVRAM and is normally persistent, sometimes it gets corrupted
> and needs to be reloaded.
>
> Instead of using the same name, maxtouch.cfg, for all systems and all
> devices, let's allow platform data to specify the name of configuration
> file that should be loaded. This is especially useful for systems that
> use Atmel controllers for both touchscren and touchpad, since their
> configurations will surely differ.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> .../devicetree/bindings/input/atmel,maxtouch.txt | 6 ++++++
> drivers/input/touchscreen/atmel_mxt_ts.c | 18 +++++++++++++-----
> include/linux/i2c/atmel_mxt_ts.h | 1 +
> 3 files changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
> index 1852906..fd2344d 100644
> --- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
> +++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
> @@ -9,6 +9,12 @@ Required properties:
> - interrupts: The sink for the touchpad's IRQ output
> See ../interrupt-controller/interrupts.txt
>
> +Optional properties:
> +
> +- linux,config-name: name of configuration file that should be loaded
> + into device for optimal functioning. If not specified "maxtouch.cfg"
> + will be used.
> +
> Optional properties for main touchpad device:
>
> - linux,gpio-keymap: When enabled, the SPT_GPIOPWN_T19 object sends messages
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index dfc7309..0dcd455 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -2035,7 +2035,8 @@ static int mxt_initialize(struct mxt_data *data)
> if (error)
> goto err_free_object_table;
>
> - error = request_firmware_nowait(THIS_MODULE, true, MXT_CFG_NAME,
> + error = request_firmware_nowait(THIS_MODULE, true,
> + data->pdata->cfg_name ?: MXT_CFG_NAME,
> &client->dev, GFP_KERNEL, data,
> mxt_config_cb);
> if (error) {
> @@ -2375,20 +2376,21 @@ static void mxt_input_close(struct input_dev *dev)
> #ifdef CONFIG_OF
> static const struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client)
> {
> + struct device_node *np;
> struct mxt_platform_data *pdata;
> u32 *keymap;
> u32 keycode;
> int proplen, i, ret;
>
> - if (!client->dev.of_node)
> + np = client->dev.of_node;
> + if (!np)
> return ERR_PTR(-ENOENT);
>
> pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
> if (!pdata)
> return ERR_PTR(-ENOMEM);
>
> - if (of_find_property(client->dev.of_node, "linux,gpio-keymap",
> - &proplen)) {
> + if (of_find_property(np, "linux,gpio-keymap", &proplen)) {
> pdata->t19_num_keys = proplen / sizeof(u32);
>
> keymap = devm_kzalloc(&client->dev,
> @@ -2398,7 +2400,7 @@ static const struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client)
> return ERR_PTR(-ENOMEM);
>
> for (i = 0; i < pdata->t19_num_keys; i++) {
> - ret = of_property_read_u32_index(client->dev.of_node,
> + ret = of_property_read_u32_index(np,
> "linux,gpio-keymap", i, &keycode);
> if (ret)
> keycode = KEY_RESERVED;
> @@ -2409,6 +2411,8 @@ static const struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client)
> pdata->t19_keymap = keymap;
> }
>
> + of_property_read_string(np, "linux,config-name", &pdata->cfg_name);
> +
> return pdata;
> }
> #else
> @@ -2439,11 +2443,15 @@ static struct mxt_acpi_platform_data samus_platform_data[] = {
> .pdata = {
> .t19_num_keys = ARRAY_SIZE(samus_touchpad_buttons),
> .t19_keymap = samus_touchpad_buttons,
> + .cfg_name = "samus-337t.raw",
> },
> },
> {
> /* Touchscreen */
> .hid = "ATML0001",
> + .pdata = {
> + .cfg_name = "samus-2954t2.raw",
> + },
> },
> { }
> };
> diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
> index 02bf6ea..aeb8c9a 100644
> --- a/include/linux/i2c/atmel_mxt_ts.h
> +++ b/include/linux/i2c/atmel_mxt_ts.h
> @@ -20,6 +20,7 @@ struct mxt_platform_data {
> unsigned long irqflags;
> u8 t19_num_keys;
> const unsigned int *t19_keymap;
> + const char *cfg_name;
> };
>
> #endif /* __LINUX_ATMEL_MXT_TS_H */
>
next prev parent reply other threads:[~2015-04-09 11:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 0:26 [PATCH 1/2] Input: atmel_mxt_ts - add support for Google Pixel 2 Dmitry Torokhov
2015-04-08 0:26 ` [PATCH 2/2] Input: atmel_mxt_ts - allow specifying device-specific configs Dmitry Torokhov
2015-04-09 11:03 ` Nick Dyer [this message]
2015-04-09 16:42 ` Dmitry Torokhov
2015-04-15 15:58 ` Javier Martinez Canillas
2015-04-09 11:08 ` [PATCH 1/2] Input: atmel_mxt_ts - add support for Google Pixel 2 Nick Dyer
2015-04-09 16:29 ` Dmitry Torokhov
2015-04-15 15:58 ` Javier Martinez Canillas
2015-04-15 17:35 ` Dmitry Torokhov
2015-04-15 22:36 ` Javier Martinez Canillas
2015-04-15 21:20 ` Benjamin Tissoires
2015-04-15 22:23 ` Javier Martinez Canillas
2015-04-15 22:43 ` Dmitry Torokhov
2015-04-15 23:34 ` Benjamin Tissoires
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=55265C72.1090008@itdev.co.uk \
--to=nick.dyer@itdev.co.uk \
--cc=bleung@chromium.org \
--cc=djkurtz@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=javier.martinez@collabora.co.uk \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miletus@chromium.org \
--cc=olof@lixom.net \
--cc=sjoerd.simons@collabora.co.uk \
/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 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).