blob: b657f742145a7fb9c57a9db57ba6bde21b9aaf42 [file] [log] [blame]
Ethan Chen7ff32f82013-09-08 23:34:34 -07001/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __LEDS_PM8XXX_H__
14#define __LEDS_PM8XXX_H__
15
16#include <linux/kernel.h>
17#include <linux/mfd/pm8xxx/pwm.h>
18
19#define PM8XXX_LEDS_DEV_NAME "pm8xxx-led"
20
21enum pm8xxx_blink_type {
22 BLINK_STOP = -1,
23 BLINK_UNCHANGE = 0,
24 BLINK_64MS_PER_2SEC,
25 BLINK_64MS_ON_310MS_PER_2SEC,
26 BLINK_64MS_ON_2SEC_PER_2SEC,
27 BLINK_1SEC_PER_2SEC,
28 key_blink_on,
29 key_blink_off,
30};
31
32enum pm8xxx_leds {
33 PM8XXX_ID_LED_KB_LIGHT = 1,
34 PM8XXX_ID_LED_0,
35 PM8XXX_ID_LED_1,
36 PM8XXX_ID_LED_2,
37 PM8XXX_ID_FLASH_LED_0,
38 PM8XXX_ID_FLASH_LED_1,
39 PM8XXX_ID_WLED,
40 PM8XXX_ID_RGB_LED_RED,
41 PM8XXX_ID_RGB_LED_GREEN,
42 PM8XXX_ID_RGB_LED_BLUE,
43 PM8XXX_ID_MAX,
44};
45
46enum pm8xxx_led_modes {
47 PM8XXX_LED_MODE_MANUAL,
48 PM8XXX_LED_MODE_PWM1,
49 PM8XXX_LED_MODE_PWM2,
50 PM8XXX_LED_MODE_PWM3,
51 PM8XXX_LED_MODE_DTEST1,
52 PM8XXX_LED_MODE_DTEST2,
53 PM8XXX_LED_MODE_DTEST3,
54 PM8XXX_LED_MODE_DTEST4
55};
56
57enum wled_current_bost_limit {
58 WLED_CURR_LIMIT_105mA,
59 WLED_CURR_LIMIT_385mA,
60 WLED_CURR_LIMIT_525mA,
61 WLED_CURR_LIMIT_805mA,
62 WLED_CURR_LIMIT_980mA,
63 WLED_CURR_LIMIT_1260mA,
64 WLED_CURR_LIMIT_1400mA,
65 WLED_CURR_LIMIT_1680mA,
66};
67
68enum wled_ovp_threshold {
69 WLED_OVP_35V,
70 WLED_OVP_32V,
71 WLED_OVP_29V,
72 WLED_OVP_37V,
73};
74
75struct wled_config_data {
76 u8 num_strings;
77 u8 ovp_val;
78 u8 boost_curr_lim;
79 u8 cp_select;
80 u8 ctrl_delay_us;
81 bool dig_mod_gen_en;
82 bool cs_out_en;
83 bool op_fdbck;
84};
85
86struct pm8xxx_led_config {
87 u8 id;
88 u8 mode;
89 u16 max_current;
90 int pwm_channel;
91 u32 pwm_period_us;
92 bool default_state;
93 struct pm8xxx_pwm_duty_cycles *pwm_duty_cycles;
94 struct wled_config_data *wled_cfg;
95 int pwm_coefficient;
96 int lut_coefficient;
97};
98
99struct pm8xxx_led_platform_data {
100 struct led_platform_data *led_core;
101 struct pm8xxx_led_config *configs;
102 u32 num_configs;
103};
104void pm8xxx_led_current_set_for_key(int brightness_key);
105
106#endif