Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -uNr linux-3.9-rc6/drivers/leds/Kconfig linux-3.9-rc6-CrBkPx/drivers/leds/Kconfig
- --- linux-3.9-rc6/drivers/leds/Kconfig 2013-04-08 12:49:54.000000000 +0900
- +++ linux-3.9-rc6-CrBkPx/drivers/leds/Kconfig 2013-04-11 15:30:40.964012115 +0900
- @@ -24,6 +24,13 @@
- comment "LED drivers"
- +config LEDS_CHROMEOS_KEYBOARD
- + tristate "LED support for Chrome OS keyboards"
- + depends on LEDS_CLASS && ACPI
- + help
- + This option enables support for the LEDs on Chrome OS keyboards.
- + Say Y to enable keyboard LEDs on Chrome OS systems.
- +
- config LEDS_88PM860X
- tristate "LED Support for Marvell 88PM860x PMIC"
- depends on LEDS_CLASS
- diff -uNr linux-3.9-rc6/drivers/leds/leds-chromeos-keyboard.c linux-3.9-rc6-CrBkPx/drivers/leds/leds-chromeos-keyboard.c
- --- linux-3.9-rc6/drivers/leds/leds-chromeos-keyboard.c 1970-01-01 09:00:00.000000000 +0900
- +++ linux-3.9-rc6-CrBkPx/drivers/leds/leds-chromeos-keyboard.c 2013-04-11 15:30:00.116013092 +0900
- @@ -0,0 +1,120 @@
- +/*
- + * leds-chromeos-keyboard.c - 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.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- + *
- + */
- +
- +#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;
- +
- + if (!(cdev->flags & LED_SUSPENDED))
- + cdev->brightness = brightness;
- +
- + 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");
- +}
- +
- +static int keyboard_led_probe(struct platform_device *pdev)
- +{
- + struct led_classdev *cdev;
- + acpi_handle handle;
- + acpi_status status;
- + int ret;
- +
- + /* 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 fo find ACPI device %s\n",
- + ACPI_KEYBOARD_BACKLIGHT_DEVICE);
- + return -ENODEV;
- + }
- +
- + cdev = kzalloc(sizeof(struct led_classdev), GFP_KERNEL);
- + if (!cdev)
- + return -ENOMEM;
- + cdev->name = "chromeos::kbd_backlight";
- + cdev->brightness_set = keyboard_led_set_brightness;
- + cdev->max_brightness = ACPI_KEYBOARD_BACKLIGHT_MAX;
- + cdev->brightness = cdev->max_brightness;
- + cdev->flags |= LED_CORE_SUSPENDRESUME;
- +
- + ret = led_classdev_register(&pdev->dev, cdev);
- + if (ret)
- + goto err;
- +
- + platform_set_drvdata(pdev, cdev);
- + return 0;
- +err:
- + kfree(cdev);
- + return ret;
- +}
- +
- +static int keyboard_led_remove(struct platform_device *pdev)
- +{
- + struct led_classdev *cdev = platform_get_drvdata(pdev);
- +
- + platform_set_drvdata(pdev, NULL);
- + kfree(cdev);
- + return 0;
- +}
- +
- +static struct platform_driver keyboard_led_driver = {
- + .driver = {
- + .name = "chromeos-keyboard-leds",
- + .owner = THIS_MODULE,
- + },
- + .probe = keyboard_led_probe,
- + .remove = keyboard_led_remove,
- +};
- +
- +module_platform_driver(keyboard_led_driver);
- +
- +MODULE_AUTHOR("Simon Que <sque@chromium.org>");
- +MODULE_DESCRIPTION("ChromeOS Keyboard LED Driver");
- +MODULE_LICENSE("GPL");
- +MODULE_ALIAS("platform:chromeos-keyboard-leds");
- diff -uNr linux-3.9-rc6/drivers/leds/Makefile linux-3.9-rc6-CrBkPx/drivers/leds/Makefile
- --- linux-3.9-rc6/drivers/leds/Makefile 2013-04-08 12:49:54.000000000 +0900
- +++ linux-3.9-rc6-CrBkPx/drivers/leds/Makefile 2013-04-11 15:31:06.124011514 +0900
- @@ -52,6 +52,7 @@
- obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
- obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o
- obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o
- +obj-$(CONFIG_LEDS_CHROMEOS_KEYBOARD) += leds-chromeos-keyboard.o
- # LED SPI Drivers
- obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
- diff -uNr linux-3.9-rc6/drivers/tty/sysrq.c linux-3.9-rc6-CrBkPx/drivers/tty/sysrq.c
- --- linux-3.9-rc6/drivers/tty/sysrq.c 2013-04-08 12:49:54.000000000 +0900
- +++ linux-3.9-rc6-CrBkPx/drivers/tty/sysrq.c 2013-04-11 15:37:39.332002111 +0900
- @@ -693,6 +693,7 @@
- }
- break;
- + case KEY_F10:
- case KEY_SYSRQ:
- if (value == 1 && sysrq->alt != KEY_RESERVED) {
- sysrq->active = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement