Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2010-2011, 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 | |
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, |
| 37 | }; |
| 38 | |
Jay Chokshi | 12e49bf | 2011-07-22 16:24:39 -0700 | [diff] [blame] | 39 | /** |
| 40 | * pm8xxx_led_modes - Operating modes of LEDs |
| 41 | */ |
| 42 | enum pm8xxx_led_modes { |
| 43 | PM8XXX_LED_MODE_MANUAL, |
| 44 | PM8XXX_LED_MODE_PWM1, |
| 45 | PM8XXX_LED_MODE_PWM2, |
| 46 | PM8XXX_LED_MODE_PWM3, |
| 47 | PM8XXX_LED_MODE_DTEST1, |
| 48 | PM8XXX_LED_MODE_DTEST2, |
| 49 | PM8XXX_LED_MODE_DTEST3, |
| 50 | PM8XXX_LED_MODE_DTEST4 |
| 51 | }; |
| 52 | |
Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 53 | /** |
| 54 | * pm8xxx_led_config - led configuration parameters |
Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame^] | 55 | * @id - LED id |
| 56 | * @mode - LED mode |
| 57 | * @max_current - maximum current that LED can sustain |
| 58 | * @pwm_channel - PWM channel ID the LED is driven to |
| 59 | * @pwm_period_us - PWM period value in micro seconds |
| 60 | * @pwm_duty_cycles - PWM duty cycle information |
Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 61 | */ |
| 62 | struct pm8xxx_led_config { |
| 63 | u8 id; |
| 64 | u8 mode; |
| 65 | u16 max_current; |
Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame^] | 66 | int pwm_channel; |
| 67 | u32 pwm_period_us; |
| 68 | struct pm8xxx_pwm_duty_cycles *pwm_duty_cycles; |
Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | /** |
| 72 | * pm8xxx_led_platform_data - platform data for LED |
Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame^] | 73 | * @led_core - array of LEDs. Each datum in array contains |
Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 74 | * core data for the LED |
Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame^] | 75 | * @configs - array of platform configuration parameters |
Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 76 | * for each LED. It maps one-to-one with |
| 77 | * array of LEDs |
Jay Chokshi | 868312e | 2011-09-16 13:57:13 -0700 | [diff] [blame^] | 78 | * @num_configs - count of members of configs array |
Jay Chokshi | 8994e39 | 2011-09-14 18:20:39 -0700 | [diff] [blame] | 79 | */ |
| 80 | struct pm8xxx_led_platform_data { |
| 81 | struct led_platform_data *led_core; |
| 82 | struct pm8xxx_led_config *configs; |
| 83 | u32 num_configs; |
| 84 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 85 | #endif /* __LEDS_PM8XXX_H__ */ |