Flemmard | 9c7bb51 | 2014-01-30 12:55:16 +0100 | [diff] [blame] | 1 | /* include/linux/leds-pm8058.h |
| 2 | * |
| 3 | * Copyright (C) 2009 HTC Corporation. |
| 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #ifndef _LINUX_LEDS_PM8058_H |
| 17 | #define _LINUX_LEDS_PM8058_H |
| 18 | |
| 19 | #include <linux/leds.h> |
| 20 | #include <linux/workqueue.h> |
| 21 | #include <linux/android_alarm.h> |
| 22 | |
| 23 | #define PM_PWM_CLK_1KHZ 0 |
| 24 | #define PM_PWM_CLK_32KHZ 1 |
| 25 | #define PM_PWM_CLK_19P2MHZ 2 |
| 26 | |
| 27 | #define PM_PWM_PREDIVIDE_2 0 |
| 28 | #define PM_PWM_PREDIVIDE_3 1 |
| 29 | #define PM_PWM_PREDIVIDE_5 2 |
| 30 | #define PM_PWM_PREDIVIDE_6 3 |
| 31 | |
| 32 | #define PM8058_LED_RGB (1 << 0) |
| 33 | #define PM8058_LED_PWM (1 << 1) |
| 34 | #define PM8058_LED_CURRENT (1 << 2) |
| 35 | #define PM8058_LED_DRVX (1 << 3) |
| 36 | |
| 37 | #define PM8058_LED_LTU_EN (1 << 0) |
| 38 | #define PM8058_LED_FADE_EN (1 << 1) |
| 39 | #define PM8058_LED_BLINK_EN (1 << 2) |
| 40 | #define PM8058_LED_DYNAMIC_BRIGHTNESS_EN (1 << 3) |
| 41 | |
| 42 | struct pm8058_led_config { |
| 43 | const char *name; |
| 44 | uint32_t type; |
| 45 | int bank; |
| 46 | int flags; |
| 47 | int pwm_size; |
| 48 | int clk; |
| 49 | int pre_div; |
| 50 | int pre_div_exp; |
| 51 | int pwm_value; |
| 52 | int period_us; |
| 53 | int start_index; |
| 54 | int duites_size; |
| 55 | int duty_time_ms; |
| 56 | int lut_flag; |
| 57 | int out_current; |
| 58 | }; |
| 59 | |
| 60 | struct pm8058_led_platform_data { |
| 61 | struct pm8058_led_config *led_config; |
| 62 | int num_leds; |
| 63 | int duties[64]; |
| 64 | }; |
| 65 | |
| 66 | struct pm8058_led_data { |
| 67 | struct led_classdev ldev; |
| 68 | struct pm8058_led_config *led_config; |
| 69 | enum led_brightness brightness; |
| 70 | struct pwm_device *pwm_led; |
| 71 | struct alarm led_alarm; |
| 72 | struct work_struct led_work; |
| 73 | struct delayed_work led_delayed_work; |
| 74 | int bank; |
| 75 | int flags; |
| 76 | int pwm_size; |
| 77 | int clk; |
| 78 | int pre_div; |
| 79 | int pre_div_exp; |
| 80 | int pwm_value; |
| 81 | int period_us; |
| 82 | int start_index; |
| 83 | int duites_size; |
| 84 | int duty_time_ms; |
| 85 | int lut_flag; |
| 86 | int out_current; |
| 87 | }; |
| 88 | void pm8xxx_led_current_set_for_key (int brightness_key); |
| 89 | #endif |