Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform

Pull chrome platform updates from Olof Johansson:
"Updates to the Chromebook/box platform drivers:

- a bugfix to pstore registration that makes it also work on
non-Google systems
- addition of new shipped Chromebooks (later models have more probing
through ACPI so the need for these updates will be less over time).
- A couple of minor coding style updates"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform:
platform/chrome: chromeos_laptop - Add a limit for deferred retries
platform/chrome: Add support for the acer c720p touchscreen.
platform/chrome: pstore: fix dmi table to match all chrome systems
platform/chrome: coding style fixes
platform/chrome: chromeos_laptop - Add Toshiba CB35 Touch
platform/chrome: chromeos_laptop - Add Dell Chromebook 11 touch
platform/chrome: chromeos_laptop - Add HP Chromebook 14
platform/chrome: chromeos_laptop - Add support for Acer C720

+132 -22
+130 -10
drivers/platform/chrome/chromeos_laptop.c
··· 37 37 #define ISL_ALS_I2C_ADDR 0x44 38 38 #define TAOS_ALS_I2C_ADDR 0x29 39 39 40 + #define MAX_I2C_DEVICE_DEFERRALS 5 41 + 40 42 static struct i2c_client *als; 41 43 static struct i2c_client *tp; 42 44 static struct i2c_client *ts; ··· 47 45 "SMBus I801 adapter", 48 46 "i915 gmbus vga", 49 47 "i915 gmbus panel", 48 + "i2c-designware-pci", 49 + "i2c-designware-pci", 50 50 }; 51 51 52 52 /* Keep this enum consistent with i2c_adapter_names */ ··· 56 52 I2C_ADAPTER_SMBUS = 0, 57 53 I2C_ADAPTER_VGADDC, 58 54 I2C_ADAPTER_PANEL, 55 + I2C_ADAPTER_DESIGNWARE_0, 56 + I2C_ADAPTER_DESIGNWARE_1, 57 + }; 58 + 59 + enum i2c_peripheral_state { 60 + UNPROBED = 0, 61 + PROBED, 62 + TIMEDOUT, 59 63 }; 60 64 61 65 struct i2c_peripheral { 62 66 int (*add)(enum i2c_adapter_type type); 63 67 enum i2c_adapter_type type; 68 + enum i2c_peripheral_state state; 69 + int tries; 64 70 }; 65 71 66 72 #define MAX_I2C_PERIPHERALS 3 ··· 172 158 /* add the i2c device */ 173 159 client = i2c_new_probed_device(adapter, info, addrs, NULL); 174 160 if (!client) 175 - pr_err("%s failed to register device %d-%02x\n", 176 - __func__, bus, info->addr); 161 + pr_notice("%s failed to register device %d-%02x\n", 162 + __func__, bus, info->addr); 177 163 else 178 164 pr_debug("%s added i2c device %d-%02x\n", 179 165 __func__, bus, info->addr); ··· 182 168 return client; 183 169 } 184 170 171 + struct i2c_lookup { 172 + const char *name; 173 + int instance; 174 + int n; 175 + }; 176 + 185 177 static int __find_i2c_adap(struct device *dev, void *data) 186 178 { 187 - const char *name = data; 179 + struct i2c_lookup *lookup = data; 188 180 static const char *prefix = "i2c-"; 189 181 struct i2c_adapter *adapter; 182 + 190 183 if (strncmp(dev_name(dev), prefix, strlen(prefix)) != 0) 191 184 return 0; 192 185 adapter = to_i2c_adapter(dev); 193 - return (strncmp(adapter->name, name, strlen(name)) == 0); 186 + if (strncmp(adapter->name, lookup->name, strlen(lookup->name)) == 0 && 187 + lookup->n++ == lookup->instance) 188 + return 1; 189 + return 0; 194 190 } 195 191 196 192 static int find_i2c_adapter_num(enum i2c_adapter_type type) 197 193 { 198 194 struct device *dev = NULL; 199 195 struct i2c_adapter *adapter; 200 - const char *name = i2c_adapter_names[type]; 196 + struct i2c_lookup lookup; 197 + 198 + memset(&lookup, 0, sizeof(lookup)); 199 + lookup.name = i2c_adapter_names[type]; 200 + lookup.instance = (type == I2C_ADAPTER_DESIGNWARE_1) ? 1 : 0; 201 + 201 202 /* find the adapter by name */ 202 - dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, 203 - __find_i2c_adap); 203 + dev = bus_find_device(&i2c_bus_type, NULL, &lookup, __find_i2c_adap); 204 204 if (!dev) { 205 205 /* Adapters may appear later. Deferred probing will retry */ 206 206 pr_notice("%s: i2c adapter %s not found on system.\n", __func__, 207 - name); 207 + lookup.name); 208 208 return -ENODEV; 209 209 } 210 210 adapter = to_i2c_adapter(dev); ··· 255 227 struct i2c_board_info *info) 256 228 { 257 229 const unsigned short addr_list[] = { info->addr, I2C_CLIENT_END }; 230 + 258 231 return __add_probed_i2c_device(name, 259 232 find_i2c_adapter_num(type), 260 233 info, ··· 353 324 if (i2c_dev->add == NULL) 354 325 break; 355 326 356 - /* Add the device. Set -EPROBE_DEFER on any failure */ 357 - if (i2c_dev->add(i2c_dev->type)) 327 + if (i2c_dev->state == TIMEDOUT || i2c_dev->state == PROBED) 328 + continue; 329 + 330 + /* 331 + * Check that the i2c adapter is present. 332 + * -EPROBE_DEFER if missing as the adapter may appear much 333 + * later. 334 + */ 335 + if (find_i2c_adapter_num(i2c_dev->type) == -ENODEV) { 358 336 ret = -EPROBE_DEFER; 337 + continue; 338 + } 339 + 340 + /* Add the device. */ 341 + if (i2c_dev->add(i2c_dev->type) == -EAGAIN) { 342 + /* 343 + * Set -EPROBE_DEFER a limited num of times 344 + * if device is not successfully added. 345 + */ 346 + if (++i2c_dev->tries < MAX_I2C_DEVICE_DEFERRALS) { 347 + ret = -EPROBE_DEFER; 348 + } else { 349 + /* Ran out of tries. */ 350 + pr_notice("%s: Ran out of tries for device.\n", 351 + __func__); 352 + i2c_dev->state = TIMEDOUT; 353 + } 354 + } else { 355 + i2c_dev->state = PROBED; 356 + } 359 357 } 360 358 361 359 return ret; ··· 415 359 }, 416 360 }; 417 361 362 + static struct chromeos_laptop hp_chromebook_14 = { 363 + .i2c_peripherals = { 364 + /* Touchpad. */ 365 + { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, 366 + }, 367 + }; 368 + 369 + static struct chromeos_laptop dell_chromebook_11 = { 370 + .i2c_peripherals = { 371 + /* Touchpad. */ 372 + { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, 373 + }, 374 + }; 375 + 376 + static struct chromeos_laptop toshiba_cb35 = { 377 + .i2c_peripherals = { 378 + /* Touchpad. */ 379 + { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, 380 + }, 381 + }; 382 + 418 383 static struct chromeos_laptop acer_c7_chromebook = { 419 384 .i2c_peripherals = { 420 385 /* Touchpad. */ ··· 447 370 .i2c_peripherals = { 448 371 /* Light Sensor. */ 449 372 { .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS }, 373 + }, 374 + }; 375 + 376 + static struct chromeos_laptop acer_c720 = { 377 + .i2c_peripherals = { 378 + /* Touchscreen. */ 379 + { .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 }, 380 + /* Touchpad. */ 381 + { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, 382 + /* Light Sensor. */ 383 + { .add = setup_isl29018_als, I2C_ADAPTER_DESIGNWARE_1 }, 450 384 }, 451 385 }; 452 386 ··· 504 416 _CBDD(chromebook_pixel), 505 417 }, 506 418 { 419 + .ident = "Wolf", 420 + .matches = { 421 + DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"), 422 + DMI_MATCH(DMI_PRODUCT_NAME, "Wolf"), 423 + }, 424 + _CBDD(dell_chromebook_11), 425 + }, 426 + { 427 + .ident = "HP Chromebook 14", 428 + .matches = { 429 + DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"), 430 + DMI_MATCH(DMI_PRODUCT_NAME, "Falco"), 431 + }, 432 + _CBDD(hp_chromebook_14), 433 + }, 434 + { 435 + .ident = "Toshiba CB35", 436 + .matches = { 437 + DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"), 438 + DMI_MATCH(DMI_PRODUCT_NAME, "Leon"), 439 + }, 440 + _CBDD(toshiba_cb35), 441 + }, 442 + { 507 443 .ident = "Acer C7 Chromebook", 508 444 .matches = { 509 445 DMI_MATCH(DMI_PRODUCT_NAME, "Parrot"), ··· 540 428 DMI_MATCH(DMI_PRODUCT_NAME, "ZGB"), 541 429 }, 542 430 _CBDD(acer_ac700), 431 + }, 432 + { 433 + .ident = "Acer C720", 434 + .matches = { 435 + DMI_MATCH(DMI_PRODUCT_NAME, "Peppy"), 436 + }, 437 + _CBDD(acer_c720), 543 438 }, 544 439 { 545 440 .ident = "HP Pavilion 14 Chromebook", ··· 579 460 static int __init chromeos_laptop_init(void) 580 461 { 581 462 int ret; 463 + 582 464 if (!dmi_check_system(chromeos_laptop_dmi_table)) { 583 465 pr_debug("%s unsupported system.\n", __func__); 584 466 return -ENODEV;
+2 -12
drivers/platform/chrome/chromeos_pstore.c
··· 16 16 static struct dmi_system_id chromeos_pstore_dmi_table[] __initdata = { 17 17 { 18 18 /* 19 - * Today all Chromebooks/boxes ship with GOOGLE as vendor and 19 + * Today all Chromebooks/boxes ship with Google_* as version and 20 20 * coreboot as bios vendor. No other systems with this 21 21 * combination are known to date. 22 22 */ 23 23 .matches = { 24 - DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), 25 24 DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"), 26 - }, 27 - }, 28 - { 29 - /* 30 - * The first Samsung Chromebox and Chromebook Series 5 550 use 31 - * coreboot but with Samsung as the system vendor. 32 - */ 33 - .matches = { 34 - DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG"), 35 - DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"), 25 + DMI_MATCH(DMI_BIOS_VERSION, "Google_"), 36 26 }, 37 27 }, 38 28 {