Re: [PATCH v1 39/63] Input: touchscreen: Atmel: Add device tree support for T15 key array objects

Jiada Wang
2019-08-22T07:57:17Z

Hi

On 2019/08/17 2:25, Dmitry Torokhov wrote:
> On Fri, Aug 16, 2019 at 05:35:01PM +0900, Jiada Wang wrote:
>> From: Daniel Gong <Zhanli.Gong@cn.bosch.com>
>
> This should be with the code adding T15 handling.
>
will squash this patch into T15 handling one in v2 patchset

Thanks,
Jiada
>>
>> 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
>>
>