forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'chrome-platform' of git://git.kernel.org/pub/scm/linux/ker…
…nel/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
- Loading branch information
Showing
9 changed files
with
234 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
|
||
obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o | ||
obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o | ||
cros_ec_devs-objs := cros_ec_dev.o cros_ec_sysfs.o \ | ||
cros_ec_lightbar.o cros_ec_vbc.o | ||
obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_devs.o | ||
obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpc.o | ||
obj-$(CONFIG_CROS_EC_PROTO) += cros_ec_proto.o | ||
obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o | ||
obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o | ||
cros_ec_devs-objs := cros_ec_dev.o cros_ec_sysfs.o \ | ||
cros_ec_lightbar.o cros_ec_vbc.o | ||
obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_devs.o | ||
obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpc.o | ||
obj-$(CONFIG_CROS_EC_PROTO) += cros_ec_proto.o | ||
obj-$(CONFIG_CROS_KBD_LED_BACKLIGHT) += cros_kbd_led_backlight.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
* Keyboard backlight LED driver for Chrome OS. | ||
* | ||
* Copyright (C) 2012 Google, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
*/ | ||
|
||
#include <linux/acpi.h> | ||
#include <linux/leds.h> | ||
#include <linux/delay.h> | ||
#include <linux/err.h> | ||
#include <linux/module.h> | ||
#include <linux/init.h> | ||
#include <linux/kernel.h> | ||
#include <linux/platform_device.h> | ||
#include <linux/slab.h> | ||
|
||
/* Keyboard LED ACPI Device must be defined in firmware */ | ||
#define ACPI_KEYBOARD_BACKLIGHT_DEVICE "\\_SB.KBLT" | ||
#define ACPI_KEYBOARD_BACKLIGHT_READ ACPI_KEYBOARD_BACKLIGHT_DEVICE ".KBQC" | ||
#define ACPI_KEYBOARD_BACKLIGHT_WRITE ACPI_KEYBOARD_BACKLIGHT_DEVICE ".KBCM" | ||
|
||
#define ACPI_KEYBOARD_BACKLIGHT_MAX 100 | ||
|
||
static void keyboard_led_set_brightness(struct led_classdev *cdev, | ||
enum led_brightness brightness) | ||
{ | ||
union acpi_object param; | ||
struct acpi_object_list input; | ||
acpi_status status; | ||
|
||
param.type = ACPI_TYPE_INTEGER; | ||
param.integer.value = brightness; | ||
input.count = 1; | ||
input.pointer = ¶m; | ||
|
||
status = acpi_evaluate_object(NULL, ACPI_KEYBOARD_BACKLIGHT_WRITE, | ||
&input, NULL); | ||
if (ACPI_FAILURE(status)) | ||
dev_err(cdev->dev, "Error setting keyboard LED value: %d\n", | ||
status); | ||
} | ||
|
||
static enum led_brightness | ||
keyboard_led_get_brightness(struct led_classdev *cdev) | ||
{ | ||
unsigned long long brightness; | ||
acpi_status status; | ||
|
||
status = acpi_evaluate_integer(NULL, ACPI_KEYBOARD_BACKLIGHT_READ, | ||
NULL, &brightness); | ||
if (ACPI_FAILURE(status)) { | ||
dev_err(cdev->dev, "Error getting keyboard LED value: %d\n", | ||
status); | ||
return -EIO; | ||
} | ||
|
||
return brightness; | ||
} | ||
|
||
static int keyboard_led_probe(struct platform_device *pdev) | ||
{ | ||
struct led_classdev *cdev; | ||
acpi_handle handle; | ||
acpi_status status; | ||
int error; | ||
|
||
/* Look for the keyboard LED ACPI Device */ | ||
status = acpi_get_handle(ACPI_ROOT_OBJECT, | ||
ACPI_KEYBOARD_BACKLIGHT_DEVICE, | ||
&handle); | ||
if (ACPI_FAILURE(status)) { | ||
dev_err(&pdev->dev, "Unable to find ACPI device %s: %d\n", | ||
ACPI_KEYBOARD_BACKLIGHT_DEVICE, status); | ||
return -ENXIO; | ||
} | ||
|
||
cdev = devm_kzalloc(&pdev->dev, sizeof(*cdev), GFP_KERNEL); | ||
if (!cdev) | ||
return -ENOMEM; | ||
|
||
cdev->name = "chromeos::kbd_backlight"; | ||
cdev->max_brightness = ACPI_KEYBOARD_BACKLIGHT_MAX; | ||
cdev->flags |= LED_CORE_SUSPENDRESUME; | ||
cdev->brightness_set = keyboard_led_set_brightness; | ||
cdev->brightness_get = keyboard_led_get_brightness; | ||
|
||
error = devm_led_classdev_register(&pdev->dev, cdev); | ||
if (error) | ||
return error; | ||
|
||
return 0; | ||
} | ||
|
||
static const struct acpi_device_id keyboard_led_id[] = { | ||
{ "GOOG0002", 0 }, | ||
{ } | ||
}; | ||
MODULE_DEVICE_TABLE(acpi, keyboard_led_id); | ||
|
||
static struct platform_driver keyboard_led_driver = { | ||
.driver = { | ||
.name = "chromeos-keyboard-leds", | ||
.acpi_match_table = ACPI_PTR(keyboard_led_id), | ||
}, | ||
.probe = keyboard_led_probe, | ||
}; | ||
module_platform_driver(keyboard_led_driver); | ||
|
||
MODULE_AUTHOR("Simon Que <[email protected]>"); | ||
MODULE_DESCRIPTION("ChromeOS Keyboard backlight LED Driver"); | ||
MODULE_LICENSE("GPL"); | ||
MODULE_ALIAS("platform:chromeos-keyboard-leds"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters