mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
led: Bring in PMIC LED driver
Signed-off-by: Stepan Moskovchenko <stepanm@quicinc.com>
This commit is contained in:
parent
df77beda7c
commit
178aba2ef6
3 changed files with 115 additions and 0 deletions
|
@ -307,6 +307,15 @@ config LEDS_BD2802
|
|||
This option enables support for BD2802GU RGB LED driver chips
|
||||
accessed via the I2C bus.
|
||||
|
||||
config LEDS_MSM_PMIC
|
||||
tristate "LED Support for Qualcomm PMIC connected LEDs"
|
||||
default n
|
||||
depends on ARCH_MSM
|
||||
help
|
||||
This option enables support for LEDs connected over PMIC
|
||||
(Power Management IC) chip on Qualcomm reference boards,
|
||||
for example SURF and FFAs.
|
||||
|
||||
config LEDS_INTEL_SS4200
|
||||
tristate "LED driver for Intel NAS SS4200 series"
|
||||
depends on LEDS_CLASS
|
||||
|
|
|
@ -30,6 +30,7 @@ obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o
|
|||
obj-$(CONFIG_LEDS_OT200) += leds-ot200.o
|
||||
obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
|
||||
obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o
|
||||
obj-$(CONFIG_LEDS_MSM_PMIC) += leds-msm-pmic.o
|
||||
obj-$(CONFIG_LEDS_PCA9633) += leds-pca9633.o
|
||||
obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o
|
||||
obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o
|
||||
|
|
105
drivers/leds/leds-msm-pmic.c
Normal file
105
drivers/leds/leds-msm-pmic.c
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* leds-msm-pmic.c - MSM PMIC LEDs driver.
|
||||
*
|
||||
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* 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/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/leds.h>
|
||||
|
||||
#include <mach/pmic.h>
|
||||
|
||||
#define MAX_KEYPAD_BL_LEVEL 16
|
||||
|
||||
static void msm_keypad_bl_led_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness value)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = pmic_set_led_intensity(LED_KEYPAD, value / MAX_KEYPAD_BL_LEVEL);
|
||||
if (ret)
|
||||
dev_err(led_cdev->dev, "can't set keypad backlight\n");
|
||||
}
|
||||
|
||||
static struct led_classdev msm_kp_bl_led = {
|
||||
.name = "keyboard-backlight",
|
||||
.brightness_set = msm_keypad_bl_led_set,
|
||||
.brightness = LED_OFF,
|
||||
};
|
||||
|
||||
static int msm_pmic_led_probe(struct platform_device *pdev)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = led_classdev_register(&pdev->dev, &msm_kp_bl_led);
|
||||
if (rc) {
|
||||
dev_err(&pdev->dev, "unable to register led class driver\n");
|
||||
return rc;
|
||||
}
|
||||
msm_keypad_bl_led_set(&msm_kp_bl_led, LED_OFF);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __devexit msm_pmic_led_remove(struct platform_device *pdev)
|
||||
{
|
||||
led_classdev_unregister(&msm_kp_bl_led);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int msm_pmic_led_suspend(struct platform_device *dev,
|
||||
pm_message_t state)
|
||||
{
|
||||
led_classdev_suspend(&msm_kp_bl_led);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_pmic_led_resume(struct platform_device *dev)
|
||||
{
|
||||
led_classdev_resume(&msm_kp_bl_led);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define msm_pmic_led_suspend NULL
|
||||
#define msm_pmic_led_resume NULL
|
||||
#endif
|
||||
|
||||
static struct platform_driver msm_pmic_led_driver = {
|
||||
.probe = msm_pmic_led_probe,
|
||||
.remove = __devexit_p(msm_pmic_led_remove),
|
||||
.suspend = msm_pmic_led_suspend,
|
||||
.resume = msm_pmic_led_resume,
|
||||
.driver = {
|
||||
.name = "pmic-leds",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init msm_pmic_led_init(void)
|
||||
{
|
||||
return platform_driver_register(&msm_pmic_led_driver);
|
||||
}
|
||||
module_init(msm_pmic_led_init);
|
||||
|
||||
static void __exit msm_pmic_led_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&msm_pmic_led_driver);
|
||||
}
|
||||
module_exit(msm_pmic_led_exit);
|
||||
|
||||
MODULE_DESCRIPTION("MSM PMIC LEDs driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_ALIAS("platform:pmic-leds");
|
Loading…
Reference in a new issue