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' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform

Pull chrome platform updates from Olof Johansson
"A handful of Chrome driver and binding changes this merge window:

- a few patches to fix probing and configuration of pstore

- a few patches adding Elan touchpad registration on a few devices

- EC changes: a security fix dealing with max message sizes and
addition of compat_ioctl support.

- keyboard backlight control support

There was also an accidential duplicate registration of trackpads on
'Leon', which was reverted just recently"

* tag 'chrome-platform' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform:
Revert "platform/chrome: chromeos_laptop: Add Leon Touch"
platform/chrome: chromeos_laptop - Add Elan touchpad for Wolf
platform/chrome: chromeos_laptop - Add elan trackpad option for C720
platform/chrome: cros_ec_dev - Populate compat_ioctl
platform/chrome: cros_ec_lightbar - use name instead of ID to hide lightbar attributes
platform/chrome: cros_ec_dev - Fix security issue
platform/chrome: Add Chrome OS keyboard backlight LEDs support
platform/chrome: use to_platform_device()
platform/chrome: pstore: Move to larger record size.
platform/chrome: pstore: probe for ramoops buffer using acpi
platform/chrome: chromeos_laptop: Add Leon Touch

+234 -17
+10
drivers/platform/chrome/Kconfig
··· 64 64 help 65 65 ChromeOS EC communication protocol helpers. 66 66 67 + config CROS_KBD_LED_BACKLIGHT 68 + tristate "Backlight LED support for Chrome OS keyboards" 69 + depends on LEDS_CLASS && ACPI 70 + help 71 + This option enables support for the keyboard backlight LEDs on 72 + select Chrome OS systems. 73 + 74 + To compile this driver as a module, choose M here: the 75 + module will be called cros_kbd_led_backlight. 76 + 67 77 endif # CHROMEOS_PLATFORMS
+8 -7
drivers/platform/chrome/Makefile
··· 1 1 2 - obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o 3 - obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o 4 - cros_ec_devs-objs := cros_ec_dev.o cros_ec_sysfs.o \ 5 - cros_ec_lightbar.o cros_ec_vbc.o 6 - obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_devs.o 7 - obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpc.o 8 - obj-$(CONFIG_CROS_EC_PROTO) += cros_ec_proto.o 2 + obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o 3 + obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o 4 + cros_ec_devs-objs := cros_ec_dev.o cros_ec_sysfs.o \ 5 + cros_ec_lightbar.o cros_ec_vbc.o 6 + obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_devs.o 7 + obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpc.o 8 + obj-$(CONFIG_CROS_EC_PROTO) += cros_ec_proto.o 9 + obj-$(CONFIG_CROS_KBD_LED_BACKLIGHT) += cros_kbd_led_backlight.o
+21 -1
drivers/platform/chrome/chromeos_laptop.c
··· 34 34 #define ATMEL_TS_I2C_ADDR 0x4a 35 35 #define ATMEL_TS_I2C_BL_ADDR 0x26 36 36 #define CYAPA_TP_I2C_ADDR 0x67 37 + #define ELAN_TP_I2C_ADDR 0x15 37 38 #define ISL_ALS_I2C_ADDR 0x44 38 39 #define TAOS_ALS_I2C_ADDR 0x29 39 40 ··· 74 73 int tries; 75 74 }; 76 75 77 - #define MAX_I2C_PERIPHERALS 3 76 + #define MAX_I2C_PERIPHERALS 4 78 77 79 78 struct chromeos_laptop { 80 79 struct i2c_peripheral i2c_peripherals[MAX_I2C_PERIPHERALS]; ··· 84 83 85 84 static struct i2c_board_info cyapa_device = { 86 85 I2C_BOARD_INFO("cyapa", CYAPA_TP_I2C_ADDR), 86 + .flags = I2C_CLIENT_WAKE, 87 + }; 88 + 89 + static struct i2c_board_info elantech_device = { 90 + I2C_BOARD_INFO("elan_i2c", ELAN_TP_I2C_ADDR), 87 91 .flags = I2C_CLIENT_WAKE, 88 92 }; 89 93 ··· 312 306 return (!tp) ? -EAGAIN : 0; 313 307 } 314 308 309 + static int setup_elantech_tp(enum i2c_adapter_type type) 310 + { 311 + if (tp) 312 + return 0; 313 + 314 + /* add elantech touchpad */ 315 + tp = add_i2c_device("trackpad", type, &elantech_device); 316 + return (!tp) ? -EAGAIN : 0; 317 + } 318 + 315 319 static int setup_atmel_1664s_ts(enum i2c_adapter_type type) 316 320 { 317 321 const unsigned short addr_list[] = { ATMEL_TS_I2C_BL_ADDR, ··· 461 445 .i2c_peripherals = { 462 446 /* Touchpad. */ 463 447 { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, 448 + /* Elan Touchpad option. */ 449 + { .add = setup_elantech_tp, I2C_ADAPTER_DESIGNWARE_0 }, 464 450 }, 465 451 }; 466 452 ··· 493 475 { .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 }, 494 476 /* Touchpad. */ 495 477 { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, 478 + /* Elan Touchpad option. */ 479 + { .add = setup_elantech_tp, I2C_ADAPTER_DESIGNWARE_0 }, 496 480 /* Light Sensor. */ 497 481 { .add = setup_isl29018_als, I2C_ADAPTER_DESIGNWARE_1 }, 498 482 },
+53 -2
drivers/platform/chrome/chromeos_pstore.c
··· 8 8 * the Free Software Foundation, version 2 of the License. 9 9 */ 10 10 11 + #include <linux/acpi.h> 11 12 #include <linux/dmi.h> 12 13 #include <linux/module.h> 13 14 #include <linux/platform_device.h> ··· 59 58 static struct ramoops_platform_data chromeos_ramoops_data = { 60 59 .mem_size = 0x100000, 61 60 .mem_address = 0xf00000, 62 - .record_size = 0x20000, 61 + .record_size = 0x40000, 63 62 .console_size = 0x20000, 64 63 .ftrace_size = 0x20000, 65 64 .dump_oops = 1, ··· 72 71 }, 73 72 }; 74 73 74 + #ifdef CONFIG_ACPI 75 + static const struct acpi_device_id cros_ramoops_acpi_match[] = { 76 + { "GOOG9999", 0 }, 77 + { } 78 + }; 79 + MODULE_DEVICE_TABLE(acpi, cros_ramoops_acpi_match); 80 + 81 + static struct platform_driver chromeos_ramoops_acpi = { 82 + .driver = { 83 + .name = "chromeos_pstore", 84 + .acpi_match_table = ACPI_PTR(cros_ramoops_acpi_match), 85 + }, 86 + }; 87 + 88 + static int __init chromeos_probe_acpi(struct platform_device *pdev) 89 + { 90 + struct resource *res; 91 + resource_size_t len; 92 + 93 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 94 + if (!res) 95 + return -ENOMEM; 96 + 97 + len = resource_size(res); 98 + if (!res->start || !len) 99 + return -ENOMEM; 100 + 101 + pr_info("chromeos ramoops using acpi device.\n"); 102 + 103 + chromeos_ramoops_data.mem_size = len; 104 + chromeos_ramoops_data.mem_address = res->start; 105 + 106 + return 0; 107 + } 108 + 109 + static bool __init chromeos_check_acpi(void) 110 + { 111 + if (!platform_driver_probe(&chromeos_ramoops_acpi, chromeos_probe_acpi)) 112 + return true; 113 + return false; 114 + } 115 + #else 116 + static inline bool chromeos_check_acpi(void) { return false; } 117 + #endif 118 + 75 119 static int __init chromeos_pstore_init(void) 76 120 { 77 - if (dmi_check_system(chromeos_pstore_dmi_table)) 121 + bool acpi_dev_found; 122 + 123 + /* First check ACPI for non-hardcoded values from firmware. */ 124 + acpi_dev_found = chromeos_check_acpi(); 125 + 126 + if (acpi_dev_found || dmi_check_system(chromeos_pstore_dmi_table)) 78 127 return platform_device_register(&chromeos_ramoops); 79 128 80 129 return -ENODEV;
+7
drivers/platform/chrome/cros_ec_dev.c
··· 137 137 if (copy_from_user(&u_cmd, arg, sizeof(u_cmd))) 138 138 return -EFAULT; 139 139 140 + if ((u_cmd.outsize > EC_MAX_MSG_BYTES) || 141 + (u_cmd.insize > EC_MAX_MSG_BYTES)) 142 + return -EINVAL; 143 + 140 144 s_cmd = kmalloc(sizeof(*s_cmd) + max(u_cmd.outsize, u_cmd.insize), 141 145 GFP_KERNEL); 142 146 if (!s_cmd) ··· 212 208 .release = ec_device_release, 213 209 .read = ec_device_read, 214 210 .unlocked_ioctl = ec_device_ioctl, 211 + #ifdef CONFIG_COMPAT 212 + .compat_ioctl = ec_device_ioctl, 213 + #endif 215 214 }; 216 215 217 216 static void __remove(struct device *dev)
+7 -3
drivers/platform/chrome/cros_ec_lightbar.c
··· 412 412 struct device *dev = container_of(kobj, struct device, kobj); 413 413 struct cros_ec_dev *ec = container_of(dev, 414 414 struct cros_ec_dev, class_dev); 415 - struct platform_device *pdev = container_of(ec->dev, 416 - struct platform_device, dev); 417 - if (pdev->id != 0) 415 + struct platform_device *pdev = to_platform_device(ec->dev); 416 + struct cros_ec_platform *pdata = pdev->dev.platform_data; 417 + int is_cros_ec; 418 + 419 + is_cros_ec = strcmp(pdata->ec_name, CROS_EC_DEV_NAME); 420 + 421 + if (is_cros_ec != 0) 418 422 return 0; 419 423 420 424 /* Only instantiate this stuff if the EC has a lightbar */
+2 -2
drivers/platform/chrome/cros_ec_proto.c
··· 298 298 ec_dev->max_response = EC_PROTO2_MAX_PARAM_SIZE; 299 299 ec_dev->max_passthru = 0; 300 300 ec_dev->pkt_xfer = NULL; 301 - ec_dev->din_size = EC_MSG_BYTES; 302 - ec_dev->dout_size = EC_MSG_BYTES; 301 + ec_dev->din_size = EC_PROTO2_MSG_BYTES; 302 + ec_dev->dout_size = EC_PROTO2_MSG_BYTES; 303 303 } else { 304 304 /* 305 305 * It's possible for a test to occur too early when
+122
drivers/platform/chrome/cros_kbd_led_backlight.c
··· 1 + /* 2 + * Keyboard backlight LED driver for Chrome OS. 3 + * 4 + * Copyright (C) 2012 Google, Inc. 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + */ 16 + 17 + #include <linux/acpi.h> 18 + #include <linux/leds.h> 19 + #include <linux/delay.h> 20 + #include <linux/err.h> 21 + #include <linux/module.h> 22 + #include <linux/init.h> 23 + #include <linux/kernel.h> 24 + #include <linux/platform_device.h> 25 + #include <linux/slab.h> 26 + 27 + /* Keyboard LED ACPI Device must be defined in firmware */ 28 + #define ACPI_KEYBOARD_BACKLIGHT_DEVICE "\\_SB.KBLT" 29 + #define ACPI_KEYBOARD_BACKLIGHT_READ ACPI_KEYBOARD_BACKLIGHT_DEVICE ".KBQC" 30 + #define ACPI_KEYBOARD_BACKLIGHT_WRITE ACPI_KEYBOARD_BACKLIGHT_DEVICE ".KBCM" 31 + 32 + #define ACPI_KEYBOARD_BACKLIGHT_MAX 100 33 + 34 + static void keyboard_led_set_brightness(struct led_classdev *cdev, 35 + enum led_brightness brightness) 36 + { 37 + union acpi_object param; 38 + struct acpi_object_list input; 39 + acpi_status status; 40 + 41 + param.type = ACPI_TYPE_INTEGER; 42 + param.integer.value = brightness; 43 + input.count = 1; 44 + input.pointer = &param; 45 + 46 + status = acpi_evaluate_object(NULL, ACPI_KEYBOARD_BACKLIGHT_WRITE, 47 + &input, NULL); 48 + if (ACPI_FAILURE(status)) 49 + dev_err(cdev->dev, "Error setting keyboard LED value: %d\n", 50 + status); 51 + } 52 + 53 + static enum led_brightness 54 + keyboard_led_get_brightness(struct led_classdev *cdev) 55 + { 56 + unsigned long long brightness; 57 + acpi_status status; 58 + 59 + status = acpi_evaluate_integer(NULL, ACPI_KEYBOARD_BACKLIGHT_READ, 60 + NULL, &brightness); 61 + if (ACPI_FAILURE(status)) { 62 + dev_err(cdev->dev, "Error getting keyboard LED value: %d\n", 63 + status); 64 + return -EIO; 65 + } 66 + 67 + return brightness; 68 + } 69 + 70 + static int keyboard_led_probe(struct platform_device *pdev) 71 + { 72 + struct led_classdev *cdev; 73 + acpi_handle handle; 74 + acpi_status status; 75 + int error; 76 + 77 + /* Look for the keyboard LED ACPI Device */ 78 + status = acpi_get_handle(ACPI_ROOT_OBJECT, 79 + ACPI_KEYBOARD_BACKLIGHT_DEVICE, 80 + &handle); 81 + if (ACPI_FAILURE(status)) { 82 + dev_err(&pdev->dev, "Unable to find ACPI device %s: %d\n", 83 + ACPI_KEYBOARD_BACKLIGHT_DEVICE, status); 84 + return -ENXIO; 85 + } 86 + 87 + cdev = devm_kzalloc(&pdev->dev, sizeof(*cdev), GFP_KERNEL); 88 + if (!cdev) 89 + return -ENOMEM; 90 + 91 + cdev->name = "chromeos::kbd_backlight"; 92 + cdev->max_brightness = ACPI_KEYBOARD_BACKLIGHT_MAX; 93 + cdev->flags |= LED_CORE_SUSPENDRESUME; 94 + cdev->brightness_set = keyboard_led_set_brightness; 95 + cdev->brightness_get = keyboard_led_get_brightness; 96 + 97 + error = devm_led_classdev_register(&pdev->dev, cdev); 98 + if (error) 99 + return error; 100 + 101 + return 0; 102 + } 103 + 104 + static const struct acpi_device_id keyboard_led_id[] = { 105 + { "GOOG0002", 0 }, 106 + { } 107 + }; 108 + MODULE_DEVICE_TABLE(acpi, keyboard_led_id); 109 + 110 + static struct platform_driver keyboard_led_driver = { 111 + .driver = { 112 + .name = "chromeos-keyboard-leds", 113 + .acpi_match_table = ACPI_PTR(keyboard_led_id), 114 + }, 115 + .probe = keyboard_led_probe, 116 + }; 117 + module_platform_driver(keyboard_led_driver); 118 + 119 + MODULE_AUTHOR("Simon Que <sque@chromium.org>"); 120 + MODULE_DESCRIPTION("ChromeOS Keyboard backlight LED Driver"); 121 + MODULE_LICENSE("GPL"); 122 + MODULE_ALIAS("platform:chromeos-keyboard-leds");
+4 -2
include/linux/mfd/cros_ec.h
··· 50 50 EC_MSG_TX_TRAILER_BYTES, 51 51 EC_MSG_RX_PROTO_BYTES = 3, 52 52 53 - /* Max length of messages */ 54 - EC_MSG_BYTES = EC_PROTO2_MAX_PARAM_SIZE + 53 + /* Max length of messages for proto 2*/ 54 + EC_PROTO2_MSG_BYTES = EC_PROTO2_MAX_PARAM_SIZE + 55 55 EC_MSG_TX_PROTO_BYTES, 56 + 57 + EC_MAX_MSG_BYTES = 64 * 1024, 56 58 }; 57 59 58 60 /*