blob: 1be4e46c078233940fdbb11890a16c453fbbcd1e [file] [log] [blame]
Flemmard6cc4dbb2013-05-20 01:01:06 -07001/*
2 * arch/arm/mach-msm/include/mach/msm_flashlight.h - The flashlight header
3 * Copyright (C) 2009 HTC Corporation
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef __HTC_FLASHLIGHT_H
21#define __HTC_FLASHLIGHT_H
22#include <linux/earlysuspend.h>
23
24#define FLASHLIGHT_NAME "flashlight"
25
26#define FLASHLIGHT_OFF 0
27#define FLASHLIGHT_TORCH 1
28#define FLASHLIGHT_FLASH 2
29#define FLASHLIGHT_NUM 3
30
31
32enum flashlight_mode_flags {
33 FL_MODE_OFF = 0,
34 FL_MODE_TORCH,
35 FL_MODE_FLASH,
36 FL_MODE_PRE_FLASH,
37 FL_MODE_TORCH_LED_A,
38 FL_MODE_TORCH_LED_B,
39 FL_MODE_TORCH_LEVEL_1,
40 FL_MODE_TORCH_LEVEL_2,
41 FL_MODE_CAMERA_EFFECT_FLASH,
42 FL_MODE_CAMERA_EFFECT_PRE_FLASH,
43 FL_MODE_FLASH_LEVEL1,
44 FL_MODE_FLASH_LEVEL2,
45 FL_MODE_FLASH_LEVEL3,
46 FL_MODE_FLASH_LEVEL4,
47 FL_MODE_FLASH_LEVEL5,
48 FL_MODE_FLASH_LEVEL6,
49 FL_MODE_FLASH_LEVEL7,
Ethan Chen4eb43ec2013-08-31 15:09:56 -070050 FL_MODE_VIDEO_TORCH = 30,
51 FL_MODE_VIDEO_TORCH_1,
52 FL_MODE_VIDEO_TORCH_2,
53 FL_MODE_VIDEO_TORCH_3,
54 FL_MODE_VIDEO_TORCH_4,
Flemmard6cc4dbb2013-05-20 01:01:06 -070055};
56
57#ifdef CONFIG_FLASHLIGHT_AAT
58struct flashlight_platform_data {
59 void (*gpio_init) (void);
60 uint32_t torch;
61 uint32_t flash;
62 uint32_t flash_adj;
63 uint32_t torch_set1;
64 uint32_t torch_set2;
65 uint32_t flash_duration_ms;
66 uint8_t led_count;
67 uint32_t chip_model;
68};
69
70enum flashlight_chip{
71 AAT1271 = 0,
72 AAT3177,
73 AAT1277,
74};
75#endif
76
77#ifdef CONFIG_FLASHLIGHT_TPS61310
78struct TPS61310_flashlight_platform_data {
79 void (*gpio_init) (void);
80 uint32_t flash_duration_ms;
81 uint8_t led_count;
82 uint32_t tps61310_strb0;
83 uint32_t tps61310_strb1;
Ethan Chen4eb43ec2013-08-31 15:09:56 -070084 uint32_t tps61310_reset;
Flemmard6cc4dbb2013-05-20 01:01:06 -070085 uint8_t mode_pin_suspend_state_low;
Ethan Chen4eb43ec2013-08-31 15:09:56 -070086 uint8_t enable_FLT_1500mA;
87 uint8_t disable_tx_mask;
88 uint32_t power_save;
89 uint32_t power_save_2;
Flemmard6cc4dbb2013-05-20 01:01:06 -070090};
91
92int aat1271_flashlight_control(int mode);
93int adp1650_flashlight_control(int mode);
94int aat3177_flashlight_control(int mode);
95int aat1277_flashlight_control(int mode);
96int tps61310_flashlight_control(int mode);
97int htc_flashlight_control(int flashlight_mode);
98#endif
99
100#undef __HTC_FLASHLIGHT_H
101#endif