blob: 3f31498dcd8bd928dc3b4931fb9a72168194e3dd [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* 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 Chokshi8994e392011-09-14 18:20:39 -070016#include <linux/kernel.h>
Jay Chokshi868312e2011-09-16 13:57:13 -070017#include <linux/mfd/pm8xxx/pwm.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070018
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 */
30enum 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 Chokshi12e49bf2011-07-22 16:24:39 -070039/**
40 * pm8xxx_led_modes - Operating modes of LEDs
41 */
42enum 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 Chokshi8994e392011-09-14 18:20:39 -070053/**
54 * pm8xxx_led_config - led configuration parameters
Jay Chokshi868312e2011-09-16 13:57:13 -070055 * @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 Chokshi8994e392011-09-14 18:20:39 -070061 */
62struct pm8xxx_led_config {
63 u8 id;
64 u8 mode;
65 u16 max_current;
Jay Chokshi868312e2011-09-16 13:57:13 -070066 int pwm_channel;
67 u32 pwm_period_us;
68 struct pm8xxx_pwm_duty_cycles *pwm_duty_cycles;
Jay Chokshi8994e392011-09-14 18:20:39 -070069};
70
71/**
72 * pm8xxx_led_platform_data - platform data for LED
Jay Chokshi868312e2011-09-16 13:57:13 -070073 * @led_core - array of LEDs. Each datum in array contains
Jay Chokshi8994e392011-09-14 18:20:39 -070074 * core data for the LED
Jay Chokshi868312e2011-09-16 13:57:13 -070075 * @configs - array of platform configuration parameters
Jay Chokshi8994e392011-09-14 18:20:39 -070076 * for each LED. It maps one-to-one with
77 * array of LEDs
Jay Chokshi868312e2011-09-16 13:57:13 -070078 * @num_configs - count of members of configs array
Jay Chokshi8994e392011-09-14 18:20:39 -070079 */
80struct pm8xxx_led_platform_data {
81 struct led_platform_data *led_core;
82 struct pm8xxx_led_config *configs;
83 u32 num_configs;
84};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070085#endif /* __LEDS_PM8XXX_H__ */