Version:  2.0.40 2.2.26 2.4.37 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7

Linux/drivers/leds/leds-lp8788.c

  1 /*
  2  * TI LP8788 MFD - keyled driver
  3  *
  4  * Copyright 2012 Texas Instruments
  5  *
  6  * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
  7  *
  8  * This program is free software; you can redistribute it and/or modify
  9  * it under the terms of the GNU General Public License version 2 as
 10  * published by the Free Software Foundation.
 11  *
 12  */
 13 
 14 #include <linux/module.h>
 15 #include <linux/slab.h>
 16 #include <linux/err.h>
 17 #include <linux/platform_device.h>
 18 #include <linux/leds.h>
 19 #include <linux/mutex.h>
 20 #include <linux/mfd/lp8788.h>
 21 #include <linux/mfd/lp8788-isink.h>
 22 
 23 #define MAX_BRIGHTNESS                  LP8788_ISINK_MAX_PWM
 24 #define DEFAULT_LED_NAME                "keyboard-backlight"
 25 
 26 struct lp8788_led {
 27         struct lp8788 *lp;
 28         struct mutex lock;
 29         struct led_classdev led_dev;
 30         enum lp8788_isink_number isink_num;
 31         int on;
 32 };
 33 
 34 struct lp8788_led_config {
 35         enum lp8788_isink_scale scale;
 36         enum lp8788_isink_number num;
 37         int iout;
 38 };
 39 
 40 static struct lp8788_led_config default_led_config = {
 41         .scale = LP8788_ISINK_SCALE_100mA,
 42         .num   = LP8788_ISINK_3,
 43         .iout  = 0,
 44 };
 45 
 46 static int lp8788_led_init_device(struct lp8788_led *led,
 47                                 struct lp8788_led_platform_data *