diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-10 16:50:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-10 16:50:23 -0500 |
commit | e9d46f74ecf5eb2c604b32bb43e632d2a5bd44a9 (patch) | |
tree | 2754cef2252b2ebe82e86136d90f0669bc24a9aa | |
parent | 15303ba5d1cd9b28d03a980456c0978c0ea3b208 (diff) | |
parent | d48b8c58c57f6edbe2965f0a5f62c5cf9593ca96 (diff) |
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
-rw-r--r-- | drivers/platform/chrome/chromeos_laptop.c | 22 | ||||
-rw-r--r-- | drivers/platform/chrome/cros_ec_lpc.c | 44 | ||||
-rw-r--r-- | drivers/platform/chrome/cros_ec_proto.c | 8 | ||||
-rw-r--r-- | drivers/platform/chrome/cros_ec_sysfs.c | 2 |
4 files changed, 57 insertions, 19 deletions
diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index d8599736a41a..6dec6ab13300 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c | |||
@@ -423,7 +423,7 @@ static int chromeos_laptop_probe(struct platform_device *pdev) | |||
423 | return ret; | 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 | .i2c_peripherals = { | 427 | .i2c_peripherals = { |
428 | /* Touchpad. */ | 428 | /* Touchpad. */ |
429 | { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, | 429 | { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, |
@@ -432,14 +432,14 @@ static struct chromeos_laptop samsung_series_5_550 = { | |||
432 | }, | 432 | }, |
433 | }; | 433 | }; |
434 | 434 | ||
435 | static struct chromeos_laptop samsung_series_5 = { | 435 | static const struct chromeos_laptop samsung_series_5 = { |
436 | .i2c_peripherals = { | 436 | .i2c_peripherals = { |
437 | /* Light Sensor. */ | 437 | /* Light Sensor. */ |
438 | { .add = setup_tsl2583_als, I2C_ADAPTER_SMBUS }, | 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 | .i2c_peripherals = { | 443 | .i2c_peripherals = { |
444 | /* Touch Screen. */ | 444 | /* Touch Screen. */ |
445 | { .add = setup_atmel_1664s_ts, I2C_ADAPTER_PANEL }, | 445 | { .add = setup_atmel_1664s_ts, I2C_ADAPTER_PANEL }, |
@@ -450,14 +450,14 @@ static struct chromeos_laptop chromebook_pixel = { | |||
450 | }, | 450 | }, |
451 | }; | 451 | }; |
452 | 452 | ||
453 | static struct chromeos_laptop hp_chromebook_14 = { | 453 | static const struct chromeos_laptop hp_chromebook_14 = { |
454 | .i2c_peripherals = { | 454 | .i2c_peripherals = { |
455 | /* Touchpad. */ | 455 | /* Touchpad. */ |
456 | { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, | 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 | .i2c_peripherals = { | 461 | .i2c_peripherals = { |
462 | /* Touchpad. */ | 462 | /* Touchpad. */ |
463 | { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, | 463 | { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, |
@@ -466,28 +466,28 @@ static struct chromeos_laptop dell_chromebook_11 = { | |||
466 | }, | 466 | }, |
467 | }; | 467 | }; |
468 | 468 | ||
469 | static struct chromeos_laptop toshiba_cb35 = { | 469 | static const struct chromeos_laptop toshiba_cb35 = { |
470 | .i2c_peripherals = { | 470 | .i2c_peripherals = { |
471 | /* Touchpad. */ | 471 | /* Touchpad. */ |
472 | { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, | 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 | .i2c_peripherals = { | 477 | .i2c_peripherals = { |
478 | /* Touchpad. */ | 478 | /* Touchpad. */ |
479 | { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, | 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 | .i2c_peripherals = { | 484 | .i2c_peripherals = { |
485 | /* Light Sensor. */ | 485 | /* Light Sensor. */ |
486 | { .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS }, | 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 | .i2c_peripherals = { | 491 | .i2c_peripherals = { |
492 | /* Touchscreen. */ | 492 | /* Touchscreen. */ |
493 | { .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 }, | 493 | { .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 }, |
@@ -500,14 +500,14 @@ static struct chromeos_laptop acer_c720 = { | |||
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 | .i2c_peripherals = { | 504 | .i2c_peripherals = { |
505 | /* Touchpad. */ | 505 | /* Touchpad. */ |
506 | { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, | 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 | .i2c_peripherals = { | 511 | .i2c_peripherals = { |
512 | /* Light Sensor. */ | 512 | /* Light Sensor. */ |
513 | { .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS }, | 513 | { .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS }, |
diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c index 1baf720faf69..af89e82eecd2 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c | |||
@@ -35,6 +35,9 @@ | |||
35 | #define DRV_NAME "cros_ec_lpcs" | 35 | #define DRV_NAME "cros_ec_lpcs" |
36 | #define ACPI_DRV_NAME "GOOG0004" | 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 | static int ec_response_timed_out(void) | 41 | static int ec_response_timed_out(void) |
39 | { | 42 | { |
40 | unsigned long one_second = jiffies + HZ; | 43 | unsigned long one_second = jiffies + HZ; |
@@ -54,7 +57,6 @@ static int ec_response_timed_out(void) | |||
54 | static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec, | 57 | static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec, |
55 | struct cros_ec_command *msg) | 58 | struct cros_ec_command *msg) |
56 | { | 59 | { |
57 | struct ec_host_request *request; | ||
58 | struct ec_host_response response; | 60 | struct ec_host_response response; |
59 | u8 sum; | 61 | u8 sum; |
60 | int ret = 0; | 62 | int ret = 0; |
@@ -65,8 +67,6 @@ static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec, | |||
65 | /* Write buffer */ | 67 | /* Write buffer */ |
66 | cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_PACKET, ret, ec->dout); | 68 | cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_PACKET, ret, ec->dout); |
67 | 69 | ||
68 | request = (struct ec_host_request *)ec->dout; | ||
69 | |||
70 | /* Here we go */ | 70 | /* Here we go */ |
71 | sum = EC_COMMAND_PROTOCOL_3; | 71 | sum = EC_COMMAND_PROTOCOL_3; |
72 | cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_CMD, 1, &sum); | 72 | cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_CMD, 1, &sum); |
@@ -362,6 +362,13 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = { | |||
362 | DMI_MATCH(DMI_PRODUCT_NAME, "Peppy"), | 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 | { /* sentinel */ } | 372 | { /* sentinel */ } |
366 | }; | 373 | }; |
367 | MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table); | 374 | MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table); |
@@ -396,9 +403,21 @@ static struct platform_driver cros_ec_lpc_driver = { | |||
396 | .remove = cros_ec_lpc_remove, | 403 | .remove = cros_ec_lpc_remove, |
397 | }; | 404 | }; |
398 | 405 | ||
406 | static struct platform_device cros_ec_lpc_device = { | ||
407 | .name = DRV_NAME | ||
408 | }; | ||
409 | |||
410 | static acpi_status cros_ec_lpc_parse_device(acpi_handle handle, u32 level, | ||
411 | void *context, void **retval) | ||
412 | { | ||
413 | *(bool *)context = true; | ||
414 | return AE_CTRL_TERMINATE; | ||
415 | } | ||
416 | |||
399 | static int __init cros_ec_lpc_init(void) | 417 | static int __init cros_ec_lpc_init(void) |
400 | { | 418 | { |
401 | int ret; | 419 | int ret; |
420 | acpi_status status; | ||
402 | 421 | ||
403 | if (!dmi_check_system(cros_ec_lpc_dmi_table)) { | 422 | if (!dmi_check_system(cros_ec_lpc_dmi_table)) { |
404 | pr_err(DRV_NAME ": unsupported system.\n"); | 423 | pr_err(DRV_NAME ": unsupported system.\n"); |
@@ -415,11 +434,28 @@ static int __init cros_ec_lpc_init(void) | |||
415 | return ret; | 434 | return ret; |
416 | } | 435 | } |
417 | 436 | ||
418 | return 0; | 437 | status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device, |
438 | &cros_ec_lpc_acpi_device_found, NULL); | ||
439 | if (ACPI_FAILURE(status)) | ||
440 | pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME); | ||
441 | |||
442 | if (!cros_ec_lpc_acpi_device_found) { | ||
443 | /* Register the device, and it'll get hooked up automatically */ | ||
444 | ret = platform_device_register(&cros_ec_lpc_device); | ||
445 | if (ret) { | ||
446 | pr_err(DRV_NAME ": can't register device: %d\n", ret); | ||
447 | platform_driver_unregister(&cros_ec_lpc_driver); | ||
448 | cros_ec_lpc_reg_destroy(); | ||
449 | } | ||
450 | } | ||
451 | |||
452 | return ret; | ||
419 | } | 453 | } |
420 | 454 | ||
421 | static void __exit cros_ec_lpc_exit(void) | 455 | static void __exit cros_ec_lpc_exit(void) |
422 | { | 456 | { |
457 | if (!cros_ec_lpc_acpi_device_found) | ||
458 | platform_device_unregister(&cros_ec_lpc_device); | ||
423 | platform_driver_unregister(&cros_ec_lpc_driver); | 459 | platform_driver_unregister(&cros_ec_lpc_driver); |
424 | cros_ec_lpc_reg_destroy(); | 460 | cros_ec_lpc_reg_destroy(); |
425 | } | 461 | } |
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c index 8dfa7fcb1248..e7bbdf947bbc 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c | |||
@@ -60,12 +60,14 @@ static int send_command(struct cros_ec_device *ec_dev, | |||
60 | struct cros_ec_command *msg) | 60 | struct cros_ec_command *msg) |
61 | { | 61 | { |
62 | int ret; | 62 | int ret; |
63 | int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg); | ||
63 | 64 | ||
64 | if (ec_dev->proto_version > 2) | 65 | if (ec_dev->proto_version > 2) |
65 | ret = ec_dev->pkt_xfer(ec_dev, msg); | 66 | xfer_fxn = ec_dev->pkt_xfer; |
66 | else | 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 | if (msg->result == EC_RES_IN_PROGRESS) { | 71 | if (msg->result == EC_RES_IN_PROGRESS) { |
70 | int i; | 72 | int i; |
71 | struct cros_ec_command *status_msg; | 73 | struct cros_ec_command *status_msg; |
@@ -88,7 +90,7 @@ static int send_command(struct cros_ec_device *ec_dev, | |||
88 | for (i = 0; i < EC_COMMAND_RETRIES; i++) { | 90 | for (i = 0; i < EC_COMMAND_RETRIES; i++) { |
89 | usleep_range(10000, 11000); | 91 | usleep_range(10000, 11000); |
90 | 92 | ||
91 | ret = ec_dev->cmd_xfer(ec_dev, status_msg); | 93 | ret = (*xfer_fxn)(ec_dev, status_msg); |
92 | if (ret < 0) | 94 | if (ret < 0) |
93 | break; | 95 | break; |
94 | 96 | ||
diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c index d6eebe872187..da0a719d32f7 100644 --- a/drivers/platform/chrome/cros_ec_sysfs.c +++ b/drivers/platform/chrome/cros_ec_sysfs.c | |||
@@ -185,7 +185,7 @@ static ssize_t show_ec_version(struct device *dev, | |||
185 | count += scnprintf(buf + count, PAGE_SIZE - count, | 185 | count += scnprintf(buf + count, PAGE_SIZE - count, |
186 | "Build info: EC error %d\n", msg->result); | 186 | "Build info: EC error %d\n", msg->result); |
187 | else { | 187 | else { |
188 | msg->data[sizeof(msg->data) - 1] = '\0'; | 188 | msg->data[EC_HOST_PARAM_SIZE - 1] = '\0'; |
189 | count += scnprintf(buf + count, PAGE_SIZE - count, | 189 | count += scnprintf(buf + count, PAGE_SIZE - count, |
190 | "Build info: %s\n", msg->data); | 190 | "Build info: %s\n", msg->data); |
191 | } | 191 | } |