From 498e7e7ed1fd72c275a682f0903c4a20cc538658 Mon Sep 17 00:00:00 2001 From: Andi Shyti Date: Thu, 1 Feb 2018 10:18:59 -0800 Subject: Input: mms114 - fix license module information The driver has been released with GNU Public License v2 as stated in the header, but the module license information has been tagged as "GPL" (GNU Public License v2 or later). Fix the module license information so that it matches the one in the header as "GPL v2". Fixes: 07b8481d4aff ("Input: add MELFAS mms114 touchscreen driver") Reported-by: Marcus Folkesson Signed-off-by: Andi Shyti Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/mms114.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index db4f6bb502e3..68236743632e 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c @@ -624,4 +624,4 @@ module_i2c_driver(mms114_driver); /* Module information */ MODULE_AUTHOR("Joonyoung Shim "); MODULE_DESCRIPTION("MELFAS mms114 Touchscreen driver"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); -- cgit v1.2.3 From 0004520af32fca8b40abe78c11654be4e9e20fdf Mon Sep 17 00:00:00 2001 From: Andi Shyti Date: Thu, 1 Feb 2018 10:22:20 -0800 Subject: Input: mms114 - add SPDX identifier Replace the original license statement with the SPDX identifier. Add also one line of description as recommended by the COPYING file. Signed-off-by: Andi Shyti Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/mms114.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 68236743632e..a5ab774da4cc 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c @@ -1,11 +1,8 @@ -/* - * Copyright (C) 2012 Samsung Electronics Co.Ltd - * Author: Joonyoung Shim - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ +// SPDX-License-Identifier: GPL-2.0 +// Melfas MMS114/MMS152 touchscreen device driver +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// Author: Joonyoung Shim #include #include -- cgit v1.2.3 From d80808e1ebc2def95def245c39347c3f4ab02aa6 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 20 Mar 2018 15:31:25 -0700 Subject: Input: atmel_mxt_ts - do not pass suspend mode in platform data The way we are supposed to put controller to sleep and wake it up does not depend on the platform, but rather on controller itself, so we want to get rid of suspend mode in platform data (and eventually get rid of platform data completely). Unfortunately some early chromebooks (the original Pixel, Acer C720) were shipped with config that requires manually re-enabling touch reporting in T9. We will sort it out, but in the meantime let's switch to a simple DMI quirk. We'll keep pdata->suspend_mode for now and remove it when we rework chromeos-laptop driver. Signed-off-by: Dmitry Torokhov Signed-off-by: Benson Leung --- drivers/input/touchscreen/atmel_mxt_ts.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 7659bc48f1db..20e1224d1a6d 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -324,6 +324,8 @@ struct mxt_data { /* for config update handling */ struct completion crc_completion; + + enum mxt_suspend_mode suspend_mode; }; struct mxt_vb2_buffer { @@ -2868,7 +2870,7 @@ static const struct attribute_group mxt_attr_group = { static void mxt_start(struct mxt_data *data) { - switch (data->pdata->suspend_mode) { + switch (data->suspend_mode) { case MXT_SUSPEND_T9_CTRL: mxt_soft_reset(data); @@ -2886,12 +2888,11 @@ static void mxt_start(struct mxt_data *data) mxt_t6_command(data, MXT_COMMAND_CALIBRATE, 1, false); break; } - } static void mxt_stop(struct mxt_data *data) { - switch (data->pdata->suspend_mode) { + switch (data->suspend_mode) { case MXT_SUSPEND_T9_CTRL: /* Touch disable */ mxt_write_object(data, @@ -2954,8 +2955,6 @@ static const struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client) pdata->t19_keymap = keymap; } - pdata->suspend_mode = MXT_SUSPEND_DEEP_SLEEP; - return pdata; } #else @@ -3109,6 +3108,21 @@ mxt_get_platform_data(struct i2c_client *client) return ERR_PTR(-EINVAL); } +static const struct dmi_system_id chromebook_T9_suspend_dmi[] = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), + DMI_MATCH(DMI_PRODUCT_NAME, "Link"), + }, + }, + { + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "Peppy"), + }, + }, + { } +}; + static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct mxt_data *data; @@ -3135,6 +3149,9 @@ 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->suspend_mode = dmi_check_system(chromebook_T9_suspend_dmi) ? + MXT_SUSPEND_T9_CTRL : MXT_SUSPEND_DEEP_SLEEP; + data->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(data->reset_gpio)) { -- cgit v1.2.3 From 93afb1d6e72a1a61bcfb49364d3550924276ee20 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 20 Mar 2018 15:31:26 -0700 Subject: Input: atmel_mxt_ts - switch from OF to generic device properties Instead of using OF-specific APIs to fecth device properties, let's switch to generic device properties API. This will allow us to use device properties on legacy ChromeOS devices and get rid of platform data down the road. Acked-by: Nick Dyer Signed-off-by: Dmitry Torokhov Signed-off-by: Benson Leung --- drivers/input/touchscreen/atmel_mxt_ts.c | 59 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 20e1224d1a6d..73d9c0254ad7 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -2922,47 +2923,52 @@ static void mxt_input_close(struct input_dev *dev) mxt_stop(data); } -#ifdef CONFIG_OF -static const struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client) +static const struct mxt_platform_data * +mxt_parse_device_properties(struct i2c_client *client) { + static const char keymap_property[] = "linux,gpio-keymap"; struct mxt_platform_data *pdata; - struct device_node *np = client->dev.of_node; u32 *keymap; - int proplen, ret; - - if (!np) - return ERR_PTR(-ENOENT); + int n_keys; + int error; pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) return ERR_PTR(-ENOMEM); - if (of_find_property(np, "linux,gpio-keymap", &proplen)) { - pdata->t19_num_keys = proplen / sizeof(u32); + if (device_property_present(&client->dev, keymap_property)) { + n_keys = device_property_read_u32_array(&client->dev, + keymap_property, + NULL, 0); + if (n_keys <= 0) { + error = n_keys < 0 ? n_keys : -EINVAL; + dev_err(&client->dev, + "invalid/malformed '%s' property: %d\n", + keymap_property, error); + return ERR_PTR(error); + } - keymap = devm_kzalloc(&client->dev, - pdata->t19_num_keys * sizeof(keymap[0]), - GFP_KERNEL); + keymap = devm_kmalloc_array(&client->dev, n_keys, sizeof(u32), + GFP_KERNEL); if (!keymap) return ERR_PTR(-ENOMEM); - ret = of_property_read_u32_array(np, "linux,gpio-keymap", - keymap, pdata->t19_num_keys); - if (ret) - dev_warn(&client->dev, - "Couldn't read linux,gpio-keymap: %d\n", ret); + error = device_property_read_u32_array(&client->dev, + keymap_property, + keymap, n_keys); + if (error) { + dev_err(&client->dev, + "failed to parse '%s' property: %d\n", + keymap_property, error); + return ERR_PTR(error); + } pdata->t19_keymap = keymap; + pdata->t19_num_keys = n_keys; } return pdata; } -#else -static const struct mxt_platform_data *mxt_parse_dt(struct i2c_client *client) -{ - return ERR_PTR(-ENOENT); -} -#endif #ifdef CONFIG_ACPI @@ -3096,16 +3102,11 @@ mxt_get_platform_data(struct i2c_client *client) if (pdata) return pdata; - pdata = mxt_parse_dt(client); - if (!IS_ERR(pdata) || PTR_ERR(pdata) != -ENOENT) - return pdata; - pdata = mxt_parse_acpi(client); if (!IS_ERR(pdata) || PTR_ERR(pdata) != -ENOENT) return pdata; - dev_err(&client->dev, "No platform data specified\n"); - return ERR_PTR(-EINVAL); + return mxt_parse_device_properties(client); } static const struct dmi_system_id chromebook_T9_suspend_dmi[] = { -- cgit v1.2.3 From d3f810ce0802e71966d97b1c41619063a5c2362c Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 20 Mar 2018 15:31:27 -0700 Subject: Input: atmel_mxt_ts - switch ChromeOS ACPI devices to generic props Move older ChromeOS devices describing Atmel controllers in ACPI, but not providing enough details to configure the controllers properly, from platform data over to generic device properties. This will allow us remove support for platform data later on, leaving only generic device properties in place. Acked-by: Nick Dyer Signed-off-by: Dmitry Torokhov Signed-off-by: Benson Leung --- drivers/input/touchscreen/atmel_mxt_ts.c | 63 ++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 23 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 73d9c0254ad7..799d2ac35787 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -2974,7 +2974,7 @@ mxt_parse_device_properties(struct i2c_client *client) struct mxt_acpi_platform_data { const char *hid; - struct mxt_platform_data pdata; + const struct property_entry *props; }; static unsigned int samus_touchpad_buttons[] = { @@ -2984,14 +2984,16 @@ static unsigned int samus_touchpad_buttons[] = { BTN_LEFT }; +static const struct property_entry samus_touchpad_props[] = { + PROPERTY_ENTRY_U32_ARRAY("linux,gpio-keymap", samus_touchpad_buttons), + { } +}; + static struct mxt_acpi_platform_data samus_platform_data[] = { { /* Touchpad */ .hid = "ATML0000", - .pdata = { - .t19_num_keys = ARRAY_SIZE(samus_touchpad_buttons), - .t19_keymap = samus_touchpad_buttons, - }, + .props = samus_touchpad_props, }, { /* Touchscreen */ @@ -3009,14 +3011,16 @@ static unsigned int chromebook_tp_buttons[] = { BTN_LEFT }; +static const struct property_entry chromebook_tp_props[] = { + PROPERTY_ENTRY_U32_ARRAY("linux,gpio-keymap", chromebook_tp_buttons), + { } +}; + static struct mxt_acpi_platform_data chromebook_platform_data[] = { { /* Touchpad */ .hid = "ATML0000", - .pdata = { - .t19_num_keys = ARRAY_SIZE(chromebook_tp_buttons), - .t19_keymap = chromebook_tp_buttons, - }, + .props = chromebook_tp_props, }, { /* Touchscreen */ @@ -3046,7 +3050,7 @@ static const struct dmi_system_id mxt_dmi_table[] = { { } }; -static const struct mxt_platform_data *mxt_parse_acpi(struct i2c_client *client) +static int mxt_acpi_probe(struct i2c_client *client) { struct acpi_device *adev; const struct dmi_system_id *system_id; @@ -3063,33 +3067,46 @@ static const struct mxt_platform_data *mxt_parse_acpi(struct i2c_client *client) * as a threshold. */ if (client->addr < 0x40) - return ERR_PTR(-ENXIO); + return -ENXIO; adev = ACPI_COMPANION(&client->dev); if (!adev) - return ERR_PTR(-ENOENT); + return -ENOENT; system_id = dmi_first_match(mxt_dmi_table); if (!system_id) - return ERR_PTR(-ENOENT); + return -ENOENT; acpi_pdata = system_id->driver_data; if (!acpi_pdata) - return ERR_PTR(-ENOENT); + return -ENOENT; while (acpi_pdata->hid) { - if (!strcmp(acpi_device_hid(adev), acpi_pdata->hid)) - return &acpi_pdata->pdata; + if (!strcmp(acpi_device_hid(adev), acpi_pdata->hid)) { + /* + * Remove previously installed properties if we + * are probing this device not for the very first + * time. + */ + device_remove_properties(&client->dev); + + /* + * Now install the platform-specific properties + * that are missing from ACPI. + */ + device_add_properties(&client->dev, acpi_pdata->props); + break; + } acpi_pdata++; } - return ERR_PTR(-ENOENT); + return 0; } #else -static const struct mxt_platform_data *mxt_parse_acpi(struct i2c_client *client) +static int mxt_acpi_probe(struct i2c_client *client) { - return ERR_PTR(-ENOENT); + return -ENOENT; } #endif @@ -3102,10 +3119,6 @@ mxt_get_platform_data(struct i2c_client *client) if (pdata) return pdata; - pdata = mxt_parse_acpi(client); - if (!IS_ERR(pdata) || PTR_ERR(pdata) != -ENOENT) - return pdata; - return mxt_parse_device_properties(client); } @@ -3130,6 +3143,10 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) const struct mxt_platform_data *pdata; int error; + error = mxt_acpi_probe(client); + if (error && error != -ENOENT) + return error; + pdata = mxt_get_platform_data(client); if (IS_ERR(pdata)) return PTR_ERR(pdata); -- cgit v1.2.3 From 96a938aa214e965d5b4a2f10443b29cad14289b9 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 20 Mar 2018 15:31:38 -0700 Subject: Input: atmel_mxt_ts - remove platform data support Now that there are no users of custom Atmel platform data, and everyone has switched to the generic device properties, we can remove support for the platform data. Acked-by: Nick Dyer Signed-off-by: Dmitry Torokhov Signed-off-by: Benson Leung --- MAINTAINERS | 1 - drivers/input/touchscreen/atmel_mxt_ts.c | 130 ++++++++++++----------------- include/linux/platform_data/atmel_mxt_ts.h | 31 ------- 3 files changed, 55 insertions(+), 107 deletions(-) delete mode 100644 include/linux/platform_data/atmel_mxt_ts.h (limited to 'drivers/input/touchscreen') diff --git a/MAINTAINERS b/MAINTAINERS index 73c0cdabf755..d4b0b09d2e3f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2394,7 +2394,6 @@ T: git git://github.com/ndyer/linux.git S: Maintained F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt F: drivers/input/touchscreen/atmel_mxt_ts.c -F: include/linux/platform_data/atmel_mxt_ts.h ATMEL SAMA5D2 ADC DRIVER M: Ludovic Desroches diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 799d2ac35787..5d9699fe1b55 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -23,10 +23,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -269,12 +269,16 @@ static const struct v4l2_file_operations mxt_video_fops = { .poll = vb2_fop_poll, }; +enum mxt_suspend_mode { + MXT_SUSPEND_DEEP_SLEEP = 0, + MXT_SUSPEND_T9_CTRL = 1, +}; + /* Each client has this additional data */ struct mxt_data { struct i2c_client *client; struct input_dev *input_dev; char phys[64]; /* device physical location */ - const struct mxt_platform_data *pdata; struct mxt_object *object_table; struct mxt_info info; unsigned int irq; @@ -326,6 +330,9 @@ struct mxt_data { /* for config update handling */ struct completion crc_completion; + u32 *t19_keymap; + unsigned int t19_num_keys; + enum mxt_suspend_mode suspend_mode; }; @@ -745,15 +752,14 @@ static int mxt_write_object(struct mxt_data *data, static void mxt_input_button(struct mxt_data *data, u8 *message) { struct input_dev *input = data->input_dev; - const struct mxt_platform_data *pdata = data->pdata; int i; - for (i = 0; i < pdata->t19_num_keys; i++) { - if (pdata->t19_keymap[i] == KEY_RESERVED) + for (i = 0; i < data->t19_num_keys; i++) { + if (data->t19_keymap[i] == KEY_RESERVED) continue; /* Active-low switch */ - input_report_key(input, pdata->t19_keymap[i], + input_report_key(input, data->t19_keymap[i], !(message[1] & BIT(i))); } } @@ -761,7 +767,7 @@ static void mxt_input_button(struct mxt_data *data, u8 *message) static void mxt_input_sync(struct mxt_data *data) { input_mt_report_pointer_emulation(data->input_dev, - data->pdata->t19_num_keys); + data->t19_num_keys); input_sync(data->input_dev); } @@ -1861,7 +1867,6 @@ static void mxt_input_close(struct input_dev *dev); static void mxt_set_up_as_touchpad(struct input_dev *input_dev, struct mxt_data *data) { - const struct mxt_platform_data *pdata = data->pdata; int i; input_dev->name = "Atmel maXTouch Touchpad"; @@ -1875,15 +1880,14 @@ static void mxt_set_up_as_touchpad(struct input_dev *input_dev, input_abs_set_res(input_dev, ABS_MT_POSITION_Y, MXT_PIXELS_PER_MM); - for (i = 0; i < pdata->t19_num_keys; i++) - if (pdata->t19_keymap[i] != KEY_RESERVED) + for (i = 0; i < data->t19_num_keys; i++) + if (data->t19_keymap[i] != KEY_RESERVED) input_set_capability(input_dev, EV_KEY, - pdata->t19_keymap[i]); + data->t19_keymap[i]); } static int mxt_initialize_input_device(struct mxt_data *data) { - const struct mxt_platform_data *pdata = data->pdata; struct device *dev = &data->client->dev; struct input_dev *input_dev; int error; @@ -1949,7 +1953,7 @@ static int mxt_initialize_input_device(struct mxt_data *data) } /* If device has buttons we assume it is a touchpad */ - if (pdata->t19_num_keys) { + if (data->t19_num_keys) { mxt_set_up_as_touchpad(input_dev, data); mt_flags |= INPUT_MT_POINTER; } else { @@ -2923,51 +2927,42 @@ static void mxt_input_close(struct input_dev *dev) mxt_stop(data); } -static const struct mxt_platform_data * -mxt_parse_device_properties(struct i2c_client *client) +static int mxt_parse_device_properties(struct mxt_data *data) { static const char keymap_property[] = "linux,gpio-keymap"; - struct mxt_platform_data *pdata; + struct device *dev = &data->client->dev; u32 *keymap; int n_keys; int error; - pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return ERR_PTR(-ENOMEM); - - if (device_property_present(&client->dev, keymap_property)) { - n_keys = device_property_read_u32_array(&client->dev, - keymap_property, + if (device_property_present(dev, keymap_property)) { + n_keys = device_property_read_u32_array(dev, keymap_property, NULL, 0); if (n_keys <= 0) { error = n_keys < 0 ? n_keys : -EINVAL; - dev_err(&client->dev, - "invalid/malformed '%s' property: %d\n", + dev_err(dev, "invalid/malformed '%s' property: %d\n", keymap_property, error); - return ERR_PTR(error); + return error; } - keymap = devm_kmalloc_array(&client->dev, n_keys, sizeof(u32), + keymap = devm_kmalloc_array(dev, n_keys, sizeof(*keymap), GFP_KERNEL); if (!keymap) - return ERR_PTR(-ENOMEM); + return -ENOMEM; - error = device_property_read_u32_array(&client->dev, - keymap_property, + error = device_property_read_u32_array(dev, keymap_property, keymap, n_keys); if (error) { - dev_err(&client->dev, - "failed to parse '%s' property: %d\n", + dev_err(dev, "failed to parse '%s' property: %d\n", keymap_property, error); - return ERR_PTR(error); + return error; } - pdata->t19_keymap = keymap; - pdata->t19_num_keys = n_keys; + data->t19_keymap = keymap; + data->t19_num_keys = n_keys; } - return pdata; + return 0; } #ifdef CONFIG_ACPI @@ -3050,25 +3045,12 @@ static const struct dmi_system_id mxt_dmi_table[] = { { } }; -static int mxt_acpi_probe(struct i2c_client *client) +static int mxt_prepare_acpi_properties(struct i2c_client *client) { struct acpi_device *adev; const struct dmi_system_id *system_id; const struct mxt_acpi_platform_data *acpi_pdata; - /* - * Ignore ACPI devices representing bootloader mode. - * - * This is a bit of a hack: Google Chromebook BIOS creates ACPI - * devices for both application and bootloader modes, but we are - * interested in application mode only (if device is in bootloader - * mode we'll end up switching into application anyway). So far - * application mode addresses were all above 0x40, so we'll use it - * as a threshold. - */ - if (client->addr < 0x40) - return -ENXIO; - adev = ACPI_COMPANION(&client->dev); if (!adev) return -ENOENT; @@ -3104,24 +3086,12 @@ static int mxt_acpi_probe(struct i2c_client *client) return 0; } #else -static int mxt_acpi_probe(struct i2c_client *client) +static int mxt_prepare_acpi_properties(struct i2c_client *client) { return -ENOENT; } #endif -static const struct mxt_platform_data * -mxt_get_platform_data(struct i2c_client *client) -{ - const struct mxt_platform_data *pdata; - - pdata = dev_get_platdata(&client->dev); - if (pdata) - return pdata; - - return mxt_parse_device_properties(client); -} - static const struct dmi_system_id chromebook_T9_suspend_dmi[] = { { .matches = { @@ -3140,16 +3110,20 @@ static const struct dmi_system_id chromebook_T9_suspend_dmi[] = { static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct mxt_data *data; - const struct mxt_platform_data *pdata; int error; - error = mxt_acpi_probe(client); - if (error && error != -ENOENT) - return error; - - pdata = mxt_get_platform_data(client); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); + /* + * Ignore ACPI devices representing bootloader mode. + * + * This is a bit of a hack: Google Chromebook BIOS creates ACPI + * devices for both application and bootloader modes, but we are + * interested in application mode only (if device is in bootloader + * mode we'll end up switching into application anyway). So far + * application mode addresses were all above 0x40, so we'll use it + * as a threshold. + */ + if (ACPI_COMPANION(&client->dev) && client->addr < 0x40) + return -ENXIO; data = devm_kzalloc(&client->dev, sizeof(struct mxt_data), GFP_KERNEL); if (!data) @@ -3159,7 +3133,6 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) client->adapter->nr, client->addr); data->client = client; - data->pdata = pdata; data->irq = client->irq; i2c_set_clientdata(client, data); @@ -3170,6 +3143,14 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) data->suspend_mode = dmi_check_system(chromebook_T9_suspend_dmi) ? MXT_SUSPEND_T9_CTRL : MXT_SUSPEND_DEEP_SLEEP; + error = mxt_prepare_acpi_properties(client); + if (error && error != -ENOENT) + return error; + + error = mxt_parse_device_properties(data); + if (error) + return error; + data->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(data->reset_gpio)) { @@ -3179,8 +3160,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) } error = devm_request_threaded_irq(&client->dev, client->irq, - NULL, mxt_interrupt, - pdata->irqflags | IRQF_ONESHOT, + NULL, mxt_interrupt, IRQF_ONESHOT, client->name, data); if (error) { dev_err(&client->dev, "Failed to register interrupt\n"); @@ -3300,7 +3280,7 @@ MODULE_DEVICE_TABLE(i2c, mxt_id); static struct i2c_driver mxt_driver = { .driver = { .name = "atmel_mxt_ts", - .of_match_table = of_match_ptr(mxt_of_match), + .of_match_table = mxt_of_match, .acpi_match_table = ACPI_PTR(mxt_acpi_id), .pm = &mxt_pm_ops, }, diff --git a/include/linux/platform_data/atmel_mxt_ts.h b/include/linux/platform_data/atmel_mxt_ts.h deleted file mode 100644 index 695035a8d7fb..000000000000 --- a/include/linux/platform_data/atmel_mxt_ts.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Atmel maXTouch Touchscreen driver - * - * Copyright (C) 2010 Samsung Electronics Co.Ltd - * Author: Joonyoung Shim - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#ifndef __LINUX_PLATFORM_DATA_ATMEL_MXT_TS_H -#define __LINUX_PLATFORM_DATA_ATMEL_MXT_TS_H - -#include - -enum mxt_suspend_mode { - MXT_SUSPEND_DEEP_SLEEP = 0, - MXT_SUSPEND_T9_CTRL = 1, -}; - -/* The platform data for the Atmel maXTouch touchscreen driver */ -struct mxt_platform_data { - unsigned long irqflags; - u8 t19_num_keys; - const unsigned int *t19_keymap; - enum mxt_suspend_mode suspend_mode; -}; - -#endif /* __LINUX_PLATFORM_DATA_ATMEL_MXT_TS_H */ -- cgit v1.2.3