From: Jiada Wang <jiada_wang@mentor.com>
To: <nick@shmanahar.org>, <dmitry.torokhov@gmail.com>
Cc: <linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<jiada_wang@mentor.com>, <george_davis@mentor.com>
Subject: [PATCH v1 39/63] Input: touchscreen: Atmel: Add device tree support for T15 key array objects
Date: Fri, 16 Aug 2019 17:35:01 +0900 [thread overview]
Message-ID: <20190816083525.19071-5-jiada_wang@mentor.com> (raw)
In-Reply-To: <20190816083525.19071-1-jiada_wang@mentor.com>
From: Daniel Gong <Zhanli.Gong@cn.bosch.com>
Signed-off-by: Daniel Gong <Zhanli.Gong@cn.bosch.com>
Signed-off-by: George G. Davis <george_davis@mentor.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 29 ++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index be63002c2b31..3b9544c0a209 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -4143,10 +4143,12 @@ static int mxt_parse_device_properties(struct mxt_data *data)
{
static const char keymap_property[] = "linux,gpio-keymap";
static const char gpios_property[] = "atmel,gpios";
+ static const char buttons_property[] = "atmel,key-buttons";
struct device *dev = &data->client->dev;
struct device_node *np = dev ? dev->of_node : NULL;
struct device_node *np_gpio;
u32 *keymap;
+ u32 *buttonmap;
int n_keys;
int error;
@@ -4181,6 +4183,33 @@ static int mxt_parse_device_properties(struct mxt_data *data)
data->t19_num_keys = n_keys;
}
+ if (device_property_present(dev, buttons_property)) {
+ n_keys = device_property_read_u32_array(dev, buttons_property,
+ NULL, 0);
+ if (n_keys <= 0) {
+ error = n_keys < 0 ? n_keys : -EINVAL;
+ dev_err(dev, "invalid/malformed '%s' property: %d\n",
+ buttons_property, error);
+ return error;
+ }
+
+ buttonmap = devm_kmalloc_array(dev, n_keys, sizeof(*buttonmap),
+ GFP_KERNEL);
+ if (!buttonmap)
+ return -ENOMEM;
+
+ error = device_property_read_u32_array(dev, buttons_property,
+ buttonmap, n_keys);
+ if (error) {
+ dev_err(dev, "failed to parse '%s' property: %d\n",
+ buttons_property, error);
+ return error;
+ }
+
+ data->t15_keymap = buttonmap;
+ data->t15_num_keys = n_keys;
+ }
+
device_property_read_u32(dev, "atmel,suspend-mode", &data->suspend_mode);
np_gpio = of_get_child_by_name(np, gpios_property);
--
2.19.2
next prev parent reply other threads:[~2019-08-16 8:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 8:34 [PATCH v1 35/63] Input: atmel_mxt_ts - rely on calculated_crc rather than file config_crc Jiada Wang
2019-08-16 8:34 ` [PATCH v1 36/63] Input: atmel_mxt_ts - configure and use gpios as real gpios Jiada Wang
2019-08-16 17:24 ` Dmitry Torokhov
2019-08-23 5:16 ` Jiada Wang
2019-08-16 8:34 ` [PATCH v1 37/63] input: atmel_mxt_ts: export GPIO reset line via sysfs Jiada Wang
2019-08-16 8:35 ` [PATCH v1 38/63] Input: atmel_mxt_ts: Add support for run self-test routine Jiada Wang
2019-08-16 8:35 ` Jiada Wang [this message]
2019-08-16 17:25 ` [PATCH v1 39/63] Input: touchscreen: Atmel: Add device tree support for T15 key array objects Dmitry Torokhov
2019-08-22 7:57 ` Jiada Wang
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=20190816083525.19071-5-jiada_wang@mentor.com \
--to=jiada_wang@mentor.com \
--cc=dmitry.torokhov@gmail.com \
--cc=george_davis@mentor.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nick@shmanahar.org \
/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).