| Mohan Pallaka | 53fe1a1 | 2011-12-15 16:56:37 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 |  | 
| Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 16 | #include <linux/kernel.h> | 
| Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame] | 17 | #include <linux/mfd/pm8xxx/pwm.h> | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 18 |  | 
|  | 19 | #define PM8XXX_LEDS_DEV_NAME	"pm8xxx-led" | 
|  | 20 |  | 
|  | 21 | /** | 
|  | 22 | * enum pm8xxx_leds - PMIC8XXX supported led ids | 
|  | 23 | * @PM8XXX_ID_LED_KB_LIGHT - keyboard backlight led | 
|  | 24 | * @PM8XXX_ID_LED_0 - First low current led | 
|  | 25 | * @PM8XXX_ID_LED_1 - Second low current led | 
|  | 26 | * @PM8XXX_ID_LED_2 - Third low current led | 
|  | 27 | * @PM8XXX_ID_FLASH_LED_0 - First flash led | 
|  | 28 | * @PM8XXX_ID_FLASH_LED_0 - Second flash led | 
|  | 29 | */ | 
|  | 30 | enum pm8xxx_leds { | 
|  | 31 | PM8XXX_ID_LED_KB_LIGHT = 1, | 
|  | 32 | PM8XXX_ID_LED_0, | 
|  | 33 | PM8XXX_ID_LED_1, | 
|  | 34 | PM8XXX_ID_LED_2, | 
|  | 35 | PM8XXX_ID_FLASH_LED_0, | 
|  | 36 | PM8XXX_ID_FLASH_LED_1, | 
| Mohan Pallaka | 53fe1a1 | 2011-12-15 16:56:37 +0530 | [diff] [blame] | 37 | PM8XXX_ID_WLED, | 
| Amy Maloche | c17c373 | 2012-02-27 18:34:07 -0800 | [diff] [blame] | 38 | PM8XXX_ID_RGB_LED_RED, | 
|  | 39 | PM8XXX_ID_RGB_LED_GREEN, | 
|  | 40 | PM8XXX_ID_RGB_LED_BLUE, | 
| Mohan Pallaka | 53fe1a1 | 2011-12-15 16:56:37 +0530 | [diff] [blame] | 41 | PM8XXX_ID_MAX, | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 42 | }; | 
|  | 43 |  | 
| Jay Chokshi | 12e49bf | 2011-07-22 16:24:39 -0700 | [diff] [blame] | 44 | /** | 
|  | 45 | * pm8xxx_led_modes - Operating modes of LEDs | 
|  | 46 | */ | 
|  | 47 | enum pm8xxx_led_modes { | 
|  | 48 | PM8XXX_LED_MODE_MANUAL, | 
|  | 49 | PM8XXX_LED_MODE_PWM1, | 
|  | 50 | PM8XXX_LED_MODE_PWM2, | 
|  | 51 | PM8XXX_LED_MODE_PWM3, | 
|  | 52 | PM8XXX_LED_MODE_DTEST1, | 
|  | 53 | PM8XXX_LED_MODE_DTEST2, | 
|  | 54 | PM8XXX_LED_MODE_DTEST3, | 
|  | 55 | PM8XXX_LED_MODE_DTEST4 | 
|  | 56 | }; | 
|  | 57 |  | 
| Mohan Pallaka | 53fe1a1 | 2011-12-15 16:56:37 +0530 | [diff] [blame] | 58 | /* current boost limit */ | 
|  | 59 | enum wled_current_bost_limit { | 
|  | 60 | WLED_CURR_LIMIT_105mA, | 
|  | 61 | WLED_CURR_LIMIT_385mA, | 
|  | 62 | WLED_CURR_LIMIT_525mA, | 
|  | 63 | WLED_CURR_LIMIT_805mA, | 
|  | 64 | WLED_CURR_LIMIT_980mA, | 
|  | 65 | WLED_CURR_LIMIT_1260mA, | 
|  | 66 | WLED_CURR_LIMIT_1400mA, | 
|  | 67 | WLED_CURR_LIMIT_1680mA, | 
|  | 68 | }; | 
|  | 69 |  | 
|  | 70 | /* over voltage protection threshold */ | 
|  | 71 | enum wled_ovp_threshold { | 
|  | 72 | WLED_OVP_35V, | 
|  | 73 | WLED_OVP_32V, | 
|  | 74 | WLED_OVP_29V, | 
|  | 75 | WLED_OVP_37V, | 
|  | 76 | }; | 
|  | 77 |  | 
|  | 78 | /** | 
|  | 79 | *  wled_config_data - wled configuration data | 
|  | 80 | *  @num_strings - number of wled strings supported | 
|  | 81 | *  @ovp_val - over voltage protection threshold | 
|  | 82 | *  @boost_curr_lim - boot current limit | 
|  | 83 | *  @cp_select - high pole capacitance | 
|  | 84 | *  @ctrl_delay_us - delay in activation of led | 
|  | 85 | *  @dig_mod_gen_en - digital module generator | 
|  | 86 | *  @cs_out_en - current sink output enable | 
|  | 87 | *  @op_fdbck - selection of output as feedback for the boost | 
|  | 88 | */ | 
|  | 89 | struct wled_config_data { | 
|  | 90 | u8	num_strings; | 
|  | 91 | u8	ovp_val; | 
|  | 92 | u8	boost_curr_lim; | 
|  | 93 | u8	cp_select; | 
|  | 94 | u8	ctrl_delay_us; | 
|  | 95 | bool	dig_mod_gen_en; | 
|  | 96 | bool	cs_out_en; | 
|  | 97 | bool	op_fdbck; | 
|  | 98 | }; | 
|  | 99 |  | 
| Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 100 | /** | 
|  | 101 | * pm8xxx_led_config - led configuration parameters | 
| Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame] | 102 | * @id - LED id | 
|  | 103 | * @mode - LED mode | 
|  | 104 | * @max_current - maximum current that LED can sustain | 
|  | 105 | * @pwm_channel - PWM channel ID the LED is driven to | 
|  | 106 | * @pwm_period_us - PWM period value in micro seconds | 
| Mohan Pallaka | 53fe1a1 | 2011-12-15 16:56:37 +0530 | [diff] [blame] | 107 | * @default_state - default state of the led | 
| Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame] | 108 | * @pwm_duty_cycles - PWM duty cycle information | 
| Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 109 | */ | 
|  | 110 | struct pm8xxx_led_config { | 
|  | 111 | u8	id; | 
|  | 112 | u8	mode; | 
|  | 113 | u16	max_current; | 
| Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame] | 114 | int	pwm_channel; | 
|  | 115 | u32	pwm_period_us; | 
| Mohan Pallaka | 53fe1a1 | 2011-12-15 16:56:37 +0530 | [diff] [blame] | 116 | bool	default_state; | 
| Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame] | 117 | struct pm8xxx_pwm_duty_cycles *pwm_duty_cycles; | 
| Mohan Pallaka | 53fe1a1 | 2011-12-15 16:56:37 +0530 | [diff] [blame] | 118 | struct wled_config_data	*wled_cfg; | 
| Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 119 | }; | 
|  | 120 |  | 
|  | 121 | /** | 
|  | 122 | * pm8xxx_led_platform_data - platform data for LED | 
| Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame] | 123 | * @led_core - array of LEDs. Each datum in array contains | 
| Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 124 | *	core data for the LED | 
| Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame] | 125 | * @configs - array of platform configuration parameters | 
| Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 126 | *	for each LED. It maps one-to-one with | 
|  | 127 | *	array of LEDs | 
| Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame] | 128 | * @num_configs - count of members of configs array | 
| Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 129 | */ | 
|  | 130 | struct pm8xxx_led_platform_data { | 
|  | 131 | struct	led_platform_data	*led_core; | 
|  | 132 | struct	pm8xxx_led_config	*configs; | 
|  | 133 | u32				num_configs; | 
|  | 134 | }; | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 135 | #endif /* __LEDS_PM8XXX_H__ */ |