aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2018-03-20 18:31:27 -0400
committerBenson Leung <bleung@chromium.org>2018-04-10 01:39:42 -0400
commitd3f810ce0802e71966d97b1c41619063a5c2362c (patch)
tree87c0bd976bef0a93156d0453b34ae45872562426
parent93afb1d6e72a1a61bcfb49364d3550924276ee20 (diff)
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 <nick@shmanahar.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c63
1 files changed, 40 insertions, 23 deletions
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)
2974 2974
2975struct mxt_acpi_platform_data { 2975struct mxt_acpi_platform_data {
2976 const char *hid; 2976 const char *hid;
2977 struct mxt_platform_data pdata; 2977 const struct property_entry *props;
2978}; 2978};
2979 2979
2980static unsigned int samus_touchpad_buttons[] = { 2980static unsigned int samus_touchpad_buttons[] = {
@@ -2984,14 +2984,16 @@ static unsigned int samus_touchpad_buttons[] = {
2984 BTN_LEFT 2984 BTN_LEFT
2985}; 2985};
2986 2986
2987static const struct property_entry samus_touchpad_props[] = {
2988 PROPERTY_ENTRY_U32_ARRAY("linux,gpio-keymap", samus_touchpad_buttons),
2989 { }
2990};
2991
2987static struct mxt_acpi_platform_data samus_platform_data[] = { 2992static struct mxt_acpi_platform_data samus_platform_data[] = {
2988 { 2993 {
2989 /* Touchpad */ 2994 /* Touchpad */
2990 .hid = "ATML0000", 2995 .hid = "ATML0000",
2991 .pdata = { 2996 .props = samus_touchpad_props,
2992 .t19_num_keys = ARRAY_SIZE(samus_touchpad_buttons),
2993 .t19_keymap = samus_touchpad_buttons,
2994 },
2995 }, 2997 },
2996 { 2998 {
2997 /* Touchscreen */ 2999 /* Touchscreen */
@@ -3009,14 +3011,16 @@ static unsigned int chromebook_tp_buttons[] = {
3009 BTN_LEFT 3011 BTN_LEFT
3010}; 3012};
3011 3013
3014static const struct property_entry chromebook_tp_props[] = {
3015 PROPERTY_ENTRY_U32_ARRAY("linux,gpio-keymap", chromebook_tp_buttons),
3016 { }
3017};
3018
3012static struct mxt_acpi_platform_data chromebook_platform_data[] = { 3019static struct mxt_acpi_platform_data chromebook_platform_data[] = {
3013 { 3020 {
3014 /* Touchpad */ 3021 /* Touchpad */
3015 .hid = "ATML0000", 3022 .hid = "ATML0000",
3016 .pdata = { 3023 .props = chromebook_tp_props,
3017 .t19_num_keys = ARRAY_SIZE(chromebook_tp_buttons),
3018 .t19_keymap = chromebook_tp_buttons,
3019 },
3020 }, 3024 },
3021 { 3025 {
3022 /* Touchscreen */ 3026 /* Touchscreen */
@@ -3046,7 +3050,7 @@ static const struct dmi_system_id mxt_dmi_table[] = {
3046 { } 3050 { }
3047}; 3051};
3048 3052
3049static const struct mxt_platform_data *mxt_parse_acpi(struct i2c_client *client) 3053static int mxt_acpi_probe(struct i2c_client *client)
3050{ 3054{
3051 struct acpi_device *adev; 3055 struct acpi_device *adev;
3052 const struct dmi_system_id *system_id; 3056 const struct dmi_system_id *system_id;
@@ -3063,33 +3067,46 @@ static const struct mxt_platform_data *mxt_parse_acpi(struct i2c_client *client)
3063 * as a threshold. 3067 * as a threshold.
3064 */ 3068 */
3065 if (client->addr < 0x40) 3069 if (client->addr < 0x40)
3066 return ERR_PTR(-ENXIO); 3070 return -ENXIO;
3067 3071
3068 adev = ACPI_COMPANION(&client->dev); 3072 adev = ACPI_COMPANION(&client->dev);
3069 if (!adev) 3073 if (!adev)
3070 return ERR_PTR(-ENOENT); 3074 return -ENOENT;
3071 3075
3072 system_id = dmi_first_match(mxt_dmi_table); 3076 system_id = dmi_first_match(mxt_dmi_table);
3073 if (!system_id) 3077 if (!system_id)
3074 return ERR_PTR(-ENOENT); 3078 return -ENOENT;
3075 3079
3076 acpi_pdata = system_id->driver_data; 3080 acpi_pdata = system_id->driver_data;
3077 if (!acpi_pdata) 3081 if (!acpi_pdata)
3078 return ERR_PTR(-ENOENT); 3082 return -ENOENT;
3079 3083
3080 while (acpi_pdata->hid) { 3084 while (acpi_pdata->hid) {
3081 if (!strcmp(acpi_device_hid(adev), acpi_pdata->hid)) 3085 if (!strcmp(acpi_device_hid(adev), acpi_pdata->hid)) {
3082 return &acpi_pdata->pdata; 3086 /*
3087 * Remove previously installed properties if we
3088 * are probing this device not for the very first
3089 * time.
3090 */
3091 device_remove_properties(&client->dev);
3092
3093 /*
3094 * Now install the platform-specific properties
3095 * that are missing from ACPI.
3096 */
3097 device_add_properties(&client->dev, acpi_pdata->props);
3098 break;
3099 }
3083 3100
3084 acpi_pdata++; 3101 acpi_pdata++;
3085 } 3102 }
3086 3103
3087 return ERR_PTR(-ENOENT); 3104 return 0;
3088} 3105}
3089#else 3106#else
3090static const struct mxt_platform_data *mxt_parse_acpi(struct i2c_client *client) 3107static int mxt_acpi_probe(struct i2c_client *client)
3091{ 3108{
3092 return ERR_PTR(-ENOENT); 3109 return -ENOENT;
3093} 3110}
3094#endif 3111#endif
3095 3112
@@ -3102,10 +3119,6 @@ mxt_get_platform_data(struct i2c_client *client)
3102 if (pdata) 3119 if (pdata)
3103 return pdata; 3120 return pdata;
3104 3121
3105 pdata = mxt_parse_acpi(client);
3106 if (!IS_ERR(pdata) || PTR_ERR(pdata) != -ENOENT)
3107 return pdata;
3108
3109 return mxt_parse_device_properties(client); 3122 return mxt_parse_device_properties(client);
3110} 3123}
3111 3124
@@ -3130,6 +3143,10 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
3130 const struct mxt_platform_data *pdata; 3143 const struct mxt_platform_data *pdata;
3131 int error; 3144 int error;
3132 3145
3146 error = mxt_acpi_probe(client);
3147 if (error && error != -ENOENT)
3148 return error;
3149
3133 pdata = mxt_get_platform_data(client); 3150 pdata = mxt_get_platform_data(client);
3134 if (IS_ERR(pdata)) 3151 if (IS_ERR(pdata))
3135 return PTR_ERR(pdata); 3152 return PTR_ERR(pdata);