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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull chrome platform updates from Benson Leung:

- move cros_ec_dev to drivers/mfd

- other small maintenance fixes

[ The cros_ec_dev movement came in earlier through the MFD tree - Linus ]

* tag 'chrome-platform-for-linus-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform:
platform/chrome: Use proper protocol transfer function
platform/chrome: cros_ec_lpc: Add support for Google Glimmer
platform/chrome: cros_ec_lpc: Register the driver if ACPI entry is missing.
platform/chrome: cros_ec_lpc: remove redundant pointer request
cros_ec: fix nul-termination for firmware build info
platform/chrome: chromeos_laptop: make chromeos_laptop const

+57 -19
+11 -11
drivers/platform/chrome/chromeos_laptop.c
··· 423 423 return ret; 424 424 } 425 425 426 - static struct chromeos_laptop samsung_series_5_550 = { 426 + static const struct chromeos_laptop samsung_series_5_550 = { 427 427 .i2c_peripherals = { 428 428 /* Touchpad. */ 429 429 { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, ··· 432 432 }, 433 433 }; 434 434 435 - static struct chromeos_laptop samsung_series_5 = { 435 + static const struct chromeos_laptop samsung_series_5 = { 436 436 .i2c_peripherals = { 437 437 /* Light Sensor. */ 438 438 { .add = setup_tsl2583_als, I2C_ADAPTER_SMBUS }, 439 439 }, 440 440 }; 441 441 442 - static struct chromeos_laptop chromebook_pixel = { 442 + static const struct chromeos_laptop chromebook_pixel = { 443 443 .i2c_peripherals = { 444 444 /* Touch Screen. */ 445 445 { .add = setup_atmel_1664s_ts, I2C_ADAPTER_PANEL }, ··· 450 450 }, 451 451 }; 452 452 453 - static struct chromeos_laptop hp_chromebook_14 = { 453 + static const struct chromeos_laptop hp_chromebook_14 = { 454 454 .i2c_peripherals = { 455 455 /* Touchpad. */ 456 456 { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, 457 457 }, 458 458 }; 459 459 460 - static struct chromeos_laptop dell_chromebook_11 = { 460 + static const struct chromeos_laptop dell_chromebook_11 = { 461 461 .i2c_peripherals = { 462 462 /* Touchpad. */ 463 463 { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, ··· 466 466 }, 467 467 }; 468 468 469 - static struct chromeos_laptop toshiba_cb35 = { 469 + static const struct chromeos_laptop toshiba_cb35 = { 470 470 .i2c_peripherals = { 471 471 /* Touchpad. */ 472 472 { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, 473 473 }, 474 474 }; 475 475 476 - static struct chromeos_laptop acer_c7_chromebook = { 476 + static const struct chromeos_laptop acer_c7_chromebook = { 477 477 .i2c_peripherals = { 478 478 /* Touchpad. */ 479 479 { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, 480 480 }, 481 481 }; 482 482 483 - static struct chromeos_laptop acer_ac700 = { 483 + static const struct chromeos_laptop acer_ac700 = { 484 484 .i2c_peripherals = { 485 485 /* Light Sensor. */ 486 486 { .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS }, 487 487 }, 488 488 }; 489 489 490 - static struct chromeos_laptop acer_c720 = { 490 + static const struct chromeos_laptop acer_c720 = { 491 491 .i2c_peripherals = { 492 492 /* Touchscreen. */ 493 493 { .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 }, ··· 500 500 }, 501 501 }; 502 502 503 - static struct chromeos_laptop hp_pavilion_14_chromebook = { 503 + static const struct chromeos_laptop hp_pavilion_14_chromebook = { 504 504 .i2c_peripherals = { 505 505 /* Touchpad. */ 506 506 { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, 507 507 }, 508 508 }; 509 509 510 - static struct chromeos_laptop cr48 = { 510 + static const struct chromeos_laptop cr48 = { 511 511 .i2c_peripherals = { 512 512 /* Light Sensor. */ 513 513 { .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS },
+40 -4
drivers/platform/chrome/cros_ec_lpc.c
··· 35 35 #define DRV_NAME "cros_ec_lpcs" 36 36 #define ACPI_DRV_NAME "GOOG0004" 37 37 38 + /* True if ACPI device is present */ 39 + static bool cros_ec_lpc_acpi_device_found; 40 + 38 41 static int ec_response_timed_out(void) 39 42 { 40 43 unsigned long one_second = jiffies + HZ; ··· 57 54 static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec, 58 55 struct cros_ec_command *msg) 59 56 { 60 - struct ec_host_request *request; 61 57 struct ec_host_response response; 62 58 u8 sum; 63 59 int ret = 0; ··· 66 64 67 65 /* Write buffer */ 68 66 cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_PACKET, ret, ec->dout); 69 - 70 - request = (struct ec_host_request *)ec->dout; 71 67 72 68 /* Here we go */ 73 69 sum = EC_COMMAND_PROTOCOL_3; ··· 362 362 DMI_MATCH(DMI_PRODUCT_NAME, "Peppy"), 363 363 }, 364 364 }, 365 + { 366 + /* x86-glimmer, the Lenovo Thinkpad Yoga 11e. */ 367 + .matches = { 368 + DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), 369 + DMI_MATCH(DMI_PRODUCT_NAME, "Glimmer"), 370 + }, 371 + }, 365 372 { /* sentinel */ } 366 373 }; 367 374 MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table); ··· 403 396 .remove = cros_ec_lpc_remove, 404 397 }; 405 398 399 + static struct platform_device cros_ec_lpc_device = { 400 + .name = DRV_NAME 401 + }; 402 + 403 + static acpi_status cros_ec_lpc_parse_device(acpi_handle handle, u32 level, 404 + void *context, void **retval) 405 + { 406 + *(bool *)context = true; 407 + return AE_CTRL_TERMINATE; 408 + } 409 + 406 410 static int __init cros_ec_lpc_init(void) 407 411 { 408 412 int ret; 413 + acpi_status status; 409 414 410 415 if (!dmi_check_system(cros_ec_lpc_dmi_table)) { 411 416 pr_err(DRV_NAME ": unsupported system.\n"); ··· 434 415 return ret; 435 416 } 436 417 437 - return 0; 418 + status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device, 419 + &cros_ec_lpc_acpi_device_found, NULL); 420 + if (ACPI_FAILURE(status)) 421 + pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME); 422 + 423 + if (!cros_ec_lpc_acpi_device_found) { 424 + /* Register the device, and it'll get hooked up automatically */ 425 + ret = platform_device_register(&cros_ec_lpc_device); 426 + if (ret) { 427 + pr_err(DRV_NAME ": can't register device: %d\n", ret); 428 + platform_driver_unregister(&cros_ec_lpc_driver); 429 + cros_ec_lpc_reg_destroy(); 430 + } 431 + } 432 + 433 + return ret; 438 434 } 439 435 440 436 static void __exit cros_ec_lpc_exit(void) 441 437 { 438 + if (!cros_ec_lpc_acpi_device_found) 439 + platform_device_unregister(&cros_ec_lpc_device); 442 440 platform_driver_unregister(&cros_ec_lpc_driver); 443 441 cros_ec_lpc_reg_destroy(); 444 442 }
+5 -3
drivers/platform/chrome/cros_ec_proto.c
··· 60 60 struct cros_ec_command *msg) 61 61 { 62 62 int ret; 63 + int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg); 63 64 64 65 if (ec_dev->proto_version > 2) 65 - ret = ec_dev->pkt_xfer(ec_dev, msg); 66 + xfer_fxn = ec_dev->pkt_xfer; 66 67 else 67 - ret = ec_dev->cmd_xfer(ec_dev, msg); 68 + xfer_fxn = ec_dev->cmd_xfer; 68 69 70 + ret = (*xfer_fxn)(ec_dev, msg); 69 71 if (msg->result == EC_RES_IN_PROGRESS) { 70 72 int i; 71 73 struct cros_ec_command *status_msg; ··· 90 88 for (i = 0; i < EC_COMMAND_RETRIES; i++) { 91 89 usleep_range(10000, 11000); 92 90 93 - ret = ec_dev->cmd_xfer(ec_dev, status_msg); 91 + ret = (*xfer_fxn)(ec_dev, status_msg); 94 92 if (ret < 0) 95 93 break; 96 94
+1 -1
drivers/platform/chrome/cros_ec_sysfs.c
··· 185 185 count += scnprintf(buf + count, PAGE_SIZE - count, 186 186 "Build info: EC error %d\n", msg->result); 187 187 else { 188 - msg->data[sizeof(msg->data) - 1] = '\0'; 188 + msg->data[EC_HOST_PARAM_SIZE - 1] = '\0'; 189 189 count += scnprintf(buf + count, PAGE_SIZE - count, 190 190 "Build info: %s\n", msg->data); 191 191 }