diff options
author | Rom Lemarchand <rlemarchand@sta.samsung.com> | 2010-11-22 10:58:04 -0800 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2011-11-17 17:52:34 -0800 |
commit | 709d517f17e1eb9e5ebfaee7e846fa7c90f35351 (patch) | |
tree | 95eddca36fa9e6f832da5593e48e42c4cf45a8eb | |
parent | e7438643f6aaa7e9f6be26dd830e16c49b867f04 (diff) | |
download | kernel_samsung_crespo-709d517f17e1eb9e5ebfaee7e846fa7c90f35351.zip kernel_samsung_crespo-709d517f17e1eb9e5ebfaee7e846fa7c90f35351.tar.gz kernel_samsung_crespo-709d517f17e1eb9e5ebfaee7e846fa7c90f35351.tar.bz2 |
input: touchkey: Add support for TFT touchkey LED backlight
This patch adds support for the touchkey LED backlight for the TFT SKU.
Change-Id: I912bd694f8e486ca78ddd4e444c706ee1f11e6ba
Signed-off-by: Rom Lemarchand <rlemarchand@sta.samsung.com>
-rw-r--r-- | arch/arm/mach-s5pv210/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/herring-touchkey-led.c | 76 |
2 files changed, 77 insertions, 0 deletions
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile index 552d9d5..a3ae5d5 100644 --- a/arch/arm/mach-s5pv210/Makefile +++ b/arch/arm/mach-s5pv210/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_MACH_HERRING) += herring-vibrator.o obj-$(CONFIG_MACH_HERRING) += herring-btlpm.o obj-$(CONFIG_MACH_HERRING) += herring-watchdog.o obj-$(CONFIG_MACH_HERRING) += herring-panel.o +obj-$(CONFIG_MACH_HERRING) += herring-touchkey-led.o obj-$(CONFIG_MACH_HERRING) += dev-herring-phone.o diff --git a/arch/arm/mach-s5pv210/herring-touchkey-led.c b/arch/arm/mach-s5pv210/herring-touchkey-led.c new file mode 100644 index 0000000..1dde182 --- /dev/null +++ b/arch/arm/mach-s5pv210/herring-touchkey-led.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Samsung Electronics Co. Ltd. All Rights Reserved. + * Author: Rom Lemarchand <rlemarchand@sta.samsung.com> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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/init.h> +#include <linux/gpio.h> +#include <linux/earlysuspend.h> +#include <asm/mach-types.h> + +static int led_gpios[] = { 2, 3, 6, 7 }; + +static void herring_touchkey_led_onoff(int onoff) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(led_gpios); i++) + gpio_direction_output(S5PV210_GPJ3(led_gpios[i]), !!onoff); +} + +static void herring_touchkey_led_early_suspend(struct early_suspend *h) +{ + herring_touchkey_led_onoff(0); +} + +static void herring_touchkey_led_late_resume(struct early_suspend *h) +{ + herring_touchkey_led_onoff(1); +} + +static struct early_suspend early_suspend = { + .level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1, + .suspend = herring_touchkey_led_early_suspend, + .resume = herring_touchkey_led_late_resume, +}; + +static int __init herring_init_touchkey_led(void) +{ + int i; + int ret = 0; + + if (!machine_is_herring() || system_rev < 0x10) + return 0; + + for (i = 0; i < ARRAY_SIZE(led_gpios); i++) { + ret = gpio_request(S5PV210_GPJ3(led_gpios[i]), "touchkey led"); + if (ret) { + pr_err("Failed to request touchkey led gpio %d\n", i); + goto err_req; + } + s3c_gpio_setpull(S5PV210_GPJ3(led_gpios[i]), + S3C_GPIO_PULL_NONE); + } + + herring_touchkey_led_onoff(1); + + register_early_suspend(&early_suspend); + + return 0; + +err_req: + while (--i >= 0) + gpio_free(S5PV210_GPJ3(led_gpios[i])); + return ret; +} + +device_initcall(herring_init_touchkey_led); |