Skip to content

Commit

Permalink
Add backlight notification support for Pico
Browse files Browse the repository at this point in the history
  • Loading branch information
galaxyfreak authored and John Doe committed May 19, 2014
1 parent 6c1b7ef commit 3da335e
Show file tree
Hide file tree
Showing 6 changed files with 605 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/arm/configs/sxdnanhuics_defconfig
Expand Up @@ -2451,6 +2451,9 @@ CONFIG_LEDS_ACM_BLUE=y
# CONFIG_LEDS_MSM_PMIC is not set
# CONFIG_LEDS_LT3593 is not set
# CONFIG_LEDS_TRIGGERS is not set
CONFIG_GENERIC_BLN=y
# CONFIG_GENERIC_BLN_EMULATE_BUTTONS_LED is not set
CONFIG_GENERIC_BLN_USE_WAKELOCK=y

#
# LED Triggers
Expand Down
44 changes: 44 additions & 0 deletions drivers/leds/led-class.c 100755 → 100644
Expand Up @@ -24,6 +24,43 @@

#define LED_BUFF_SIZE 50

#ifdef CONFIG_GENERIC_BLN
#include <linux/bln.h>

struct led_classdev *bln_led_cdev;

static int led_bln_enable(int led_mask)
{
led_set_brightness(bln_led_cdev, bln_led_cdev->max_brightness);
return 0;
}

static int led_bln_disable(int led_mask)
{
led_set_brightness(bln_led_cdev, LED_OFF);
return 0;
}

static int led_bln_power_on(void)
{
return 0;
}

static int led_bln_power_off(void)
{
return 0;
}

static struct bln_implementation led_bln = {
.enable = led_bln_enable,
.disable = led_bln_disable,
.power_on = led_bln_power_on,
.power_off = led_bln_power_off,
.led_count = 1
};

#endif

static struct class *leds_class;

static void led_update_brightness(struct led_classdev *led_cdev)
Expand Down Expand Up @@ -256,6 +293,13 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)

printk(KERN_DEBUG "Registered led device: %s\n",
led_cdev->name);
#ifdef CONFIG_GENERIC_BLN
if (strcmp(led_cdev, "button-backlight"))
{
bln_led_cdev = led_cdev;
register_bln_implementation(&led_bln);
}
#endif

return 0;
}
Expand Down
22 changes: 22 additions & 0 deletions drivers/misc/Kconfig
Expand Up @@ -650,6 +650,28 @@ config QFP_FUSE
to the fuse block. Currently this is supported only
on FSM targets.

config GENERIC_BLN
bool "Generic BLN support for backlight notification"
depends on SYSFS && EXPERIMENTAL
default y
help
Say Y here to enable the backlight notification
for android led-notification (modified liblight needed)

config GENERIC_BLN_EMULATE_BUTTONS_LED
bool "Emulate buttons led"
depends on GENERIC_BLN
default n
help
Say Y here to simulate buttons led

config GENERIC_BLN_USE_WAKELOCK
bool "Use a kernel wakelock to retain the leds enabled in suspend."
depends on GENERIC_BLN
default n
help
Say Y here use the wakelock implementation of the bln driver

source "drivers/misc/c2port/Kconfig"
source "drivers/misc/eeprom/Kconfig"
source "drivers/misc/cb710/Kconfig"
Expand Down
2 changes: 2 additions & 0 deletions drivers/misc/Makefile
Expand Up @@ -67,3 +67,5 @@ obj-$(CONFIG_PMIC8058_XOADC) += pmic8058-xoadc.o
obj-$(CONFIG_TZCOM) += tzcom.o
obj-$(CONFIG_QSEECOM) += qseecom.o
obj-$(CONFIG_QFP_FUSE) += qfp_fuse.o
obj-$(CONFIG_GENERIC_BLN) += bln.o

0 comments on commit 3da335e

Please sign in to comment.