aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2018-03-20 18:31:35 -0400
committerBenson Leung <bleung@chromium.org>2018-04-10 01:49:59 -0400
commite6215eeaa23c5d80a72caa91fc80795b9cde038f (patch)
treeacdb6544b7de812be9f9f378eb9fc3c84ace1427
parent8d88cb03c22e4cbde4c3020883f534e8ba7f5c79 (diff)
platform/chrome: chromeos_laptop - rely on I2C to set up interrupt trigger
Instead of passing interrupt flags via platform data to drivers, or hoping that drivers will do the right thing and set it up the way we need, let's set up IRQ resource and attach it to the I2C board info, and let I2C core set it up for us. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
-rw-r--r--drivers/platform/chrome/chromeos_laptop.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c
index e5015dfaa81e..1191c1a3a0cd 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -11,6 +11,7 @@
11#include <linux/platform_data/atmel_mxt_ts.h> 11#include <linux/platform_data/atmel_mxt_ts.h>
12#include <linux/input.h> 12#include <linux/input.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/ioport.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/pci.h> 16#include <linux/pci.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -42,7 +43,11 @@ enum i2c_adapter_type {
42struct i2c_peripheral { 43struct i2c_peripheral {
43 struct i2c_board_info board_info; 44 struct i2c_board_info board_info;
44 unsigned short alt_addr; 45 unsigned short alt_addr;
46
45 const char *dmi_name; 47 const char *dmi_name;
48 unsigned long irqflags;
49 struct resource irq_resource;
50
46 enum i2c_adapter_type type; 51 enum i2c_adapter_type type;
47 u32 pci_devid; 52 u32 pci_devid;
48 53
@@ -215,10 +220,6 @@ static struct chromeos_laptop samsung_series_5 = {
215 }, 220 },
216}; 221};
217 222
218static struct mxt_platform_data atmel_1664s_platform_data = {
219 .irqflags = IRQF_TRIGGER_FALLING,
220};
221
222static int chromebook_pixel_tp_keys[] = { 223static int chromebook_pixel_tp_keys[] = {
223 KEY_RESERVED, 224 KEY_RESERVED,
224 KEY_RESERVED, 225 KEY_RESERVED,
@@ -229,7 +230,6 @@ static int chromebook_pixel_tp_keys[] = {
229}; 230};
230 231
231static struct mxt_platform_data chromebook_pixel_tp_platform_data = { 232static struct mxt_platform_data chromebook_pixel_tp_platform_data = {
232 .irqflags = IRQF_TRIGGER_FALLING,
233 .t19_num_keys = ARRAY_SIZE(chromebook_pixel_tp_keys), 233 .t19_num_keys = ARRAY_SIZE(chromebook_pixel_tp_keys),
234 .t19_keymap = chromebook_pixel_tp_keys, 234 .t19_keymap = chromebook_pixel_tp_keys,
235}; 235};
@@ -241,10 +241,10 @@ static struct chromeos_laptop chromebook_pixel = {
241 .board_info = { 241 .board_info = {
242 I2C_BOARD_INFO("atmel_mxt_ts", 242 I2C_BOARD_INFO("atmel_mxt_ts",
243 ATMEL_TS_I2C_ADDR), 243 ATMEL_TS_I2C_ADDR),
244 .platform_data = &atmel_1664s_platform_data,
245 .flags = I2C_CLIENT_WAKE, 244 .flags = I2C_CLIENT_WAKE,
246 }, 245 },
247 .dmi_name = "touchscreen", 246 .dmi_name = "touchscreen",
247 .irqflags = IRQF_TRIGGER_FALLING,
248 .type = I2C_ADAPTER_PANEL, 248 .type = I2C_ADAPTER_PANEL,
249 .alt_addr = ATMEL_TS_I2C_BL_ADDR, 249 .alt_addr = ATMEL_TS_I2C_BL_ADDR,
250 }, 250 },
@@ -258,6 +258,7 @@ static struct chromeos_laptop chromebook_pixel = {
258 .flags = I2C_CLIENT_WAKE, 258 .flags = I2C_CLIENT_WAKE,
259 }, 259 },
260 .dmi_name = "trackpad", 260 .dmi_name = "trackpad",
261 .irqflags = IRQF_TRIGGER_FALLING,
261 .type = I2C_ADAPTER_VGADDC, 262 .type = I2C_ADAPTER_VGADDC,
262 .alt_addr = ATMEL_TP_I2C_BL_ADDR, 263 .alt_addr = ATMEL_TP_I2C_BL_ADDR,
263 }, 264 },
@@ -356,10 +357,10 @@ static struct chromeos_laptop acer_c720 = {
356 .board_info = { 357 .board_info = {
357 I2C_BOARD_INFO("atmel_mxt_ts", 358 I2C_BOARD_INFO("atmel_mxt_ts",
358 ATMEL_TS_I2C_ADDR), 359 ATMEL_TS_I2C_ADDR),
359 .platform_data = &atmel_1664s_platform_data,
360 .flags = I2C_CLIENT_WAKE, 360 .flags = I2C_CLIENT_WAKE,
361 }, 361 },
362 .dmi_name = "touchscreen", 362 .dmi_name = "touchscreen",
363 .irqflags = IRQF_TRIGGER_FALLING,
363 .type = I2C_ADAPTER_DESIGNWARE, 364 .type = I2C_ADAPTER_DESIGNWARE,
364 .pci_devid = PCI_DEVID(0, PCI_DEVFN(0x15, 0x2)), 365 .pci_devid = PCI_DEVID(0, PCI_DEVFN(0x15, 0x2)),
365 .alt_addr = ATMEL_TS_I2C_BL_ADDR, 366 .alt_addr = ATMEL_TS_I2C_BL_ADDR,
@@ -558,6 +559,12 @@ chromeos_laptop_prepare(const struct dmi_system_id *id)
558 irq = chromeos_laptop_get_irq_from_dmi(i2c_dev->dmi_name); 559 irq = chromeos_laptop_get_irq_from_dmi(i2c_dev->dmi_name);
559 if (irq < 0) 560 if (irq < 0)
560 return ERR_PTR(irq); 561 return ERR_PTR(irq);
562
563 i2c_dev->irq_resource = (struct resource)
564 DEFINE_RES_NAMED(irq, 1, NULL,
565 IORESOURCE_IRQ | i2c_dev->irqflags);
566 i2c_dev->board_info.resources = &i2c_dev->irq_resource;
567 i2c_dev->board_info.num_resources = 1;
561 } 568 }
562 569
563 return cros_laptop; 570 return cros_laptop;