summaryrefslogtreecommitdiff
path: root/include/media/nvc_torch.h
blob: 3acdc0cb6ce6e63a0b289cb565548cb0f47f23ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* Copyright (C) 2011 NVIDIA Corporation.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307, USA
 */

#ifndef __NVC_TORCH_H__
#define __NVC_TORCH_H__

struct nvc_torch_level_info {
	__s32 guidenum;
	__u32 sustaintime;
	__s32 rechargefactor;
} __packed;

struct nvc_torch_pin_state {
	__u16 mask;
	__u16 values;
} __packed;

struct nvc_torch_flash_capabilities {
	__u32 numberoflevels;
	struct nvc_torch_level_info levels[];
} __packed;

struct nvc_torch_torch_capabilities {
	__u32 numberoflevels;
	__s32 guidenum[];
} __packed;

/* advanced flash/torch capability settings */
/* use version number to distinguish between different capability structures */
#define NVC_TORCH_LED_ATTR_FLASH_SYNC	1
#define NVC_TORCH_LED_ATTR_IND_FTIMER	(1 << 1)
#define NVC_TORCH_LED_ATTR_TORCH_SYNC	(1 << 16)
#define NVC_TORCH_LED_ATTR_IND_TTIMER	(1 << 17)

struct nvc_torch_capability_query {
	__u8 version;
	__u8 flash_num;		/* number of flashes supported by this device */
	__u8 torch_num;		/* number of torches supported by this device */
	__u8 reserved;
	__u32 led_attr;
};

#define NVC_TORCH_CAPABILITY_LEGACY	0
#define NVC_TORCH_CAPABILITY_VER_1	1

struct nvc_torch_set_level_v1 {
	__u16 ledmask;
	__u16 timeout;
	/* flash/torch levels mapped to ledmask for lsb to msb respectively */
	__u16 levels[2];
};

struct nvc_torch_lumi_level_v1 {
	__u16 guidenum;
	__u32 luminance;
	__u32 reserved;
};

struct nvc_torch_timeout_v1 {
	__u32 timeout;
	__u32 reserved1;
};

struct nvc_torch_timer_capabilities_v1 {
	__u32 timeout_num;
	/* time out durations in uS */
	struct nvc_torch_timeout_v1 timeouts[];
};

struct nvc_torch_flash_capabilities_v1 {
	__u8 version;		/* fixed number 1 */
	__u8 led_idx;
	__u8 reserved1;
	__u8 reserved2;
	__u32 attribute;
	__u16 granularity;	/* 1, 10, 100, ... to carry float settings */
	__u16 flash_torch_ratio;
	__u32 timeout_num;
	__u32 timeout_off;
	__u32 numberoflevels;
	struct nvc_torch_lumi_level_v1 levels[];
};

struct nvc_torch_torch_capabilities_v1 {
	__u8 version;		/* fixed number 1 */
	__u8 led_idx;
	__u8 reserved1;
	__u8 reserved2;
	__u32 attribute;
	__u16 granularity;	/* 1, 10, 100, ... to carry float settings */
	__u16 reserved4;
	__u32 timeout_num;
	__u32 timeout_off;
	__u32 numberoflevels;
	struct nvc_torch_lumi_level_v1 levels[];
};

#endif /* __NVC_TORCH_H__ */