summaryrefslogtreecommitdiff
path: root/include/media/tps61050.h
blob: ac7a328a4b2d27995041348b4a4769060fe16bcf (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
/*
 * tps61050.h - tps61050 flash/torch kernel driver
 *
 * Copyright (C) 2011 NVIDIA Corp.
 *
 * This file is licensed under the terms of the GNU General Public License
 * version 2. This program is licensed "as is" without any warranty of any
 * kind, whether express or implied.
 */

#ifndef __TPS61050_H__
#define __TPS61050_H__

#include <linux/ioctl.h> /* For IOCTL macros */

#define NUM_TORCH_LEVELS	8
#define NUM_FLASH_LEVELS	9

/* Expected higher level power calls are:
 * 1 = OFF
 * 2 = STANDBY
 * 3 = ON
 * These will be multiplied by 2 before given to the driver PM code
 * that uses the _PWR_ defines. This allows us to insert defines
 * (most notably _PWR_COMM) allowing more versatile PM.
 * The PM actions:
 * _PWR_OFF     = board support for regulators, clocks, etc so no
 *                power to device.
 * _PWR_STDBY   = board support to put device in reset. Device is
 *                useless but powered.  No communication possible.
 * _PWR_COMM    = Device is powered but in SW standby. Communication
 *                is possible and device retains programming.
 * _PWR_ON      = Full power with active output.
 */

#define TPS61050_PWR_ERR		0
#define TPS61050_PWR_OFF		2
#define TPS61050_PWR_STDBY		4
#define TPS61050_PWR_COMM		5
#define TPS61050_PWR_ON			6

#define TPS61050_CFG_NOSENSOR		(1 << 0)

#define TPS61050_IOCTL_CAP		_IOWR('o', 1, struct tps61050_param)
#define TPS61050_IOCTL_PWR		_IOW('o', 2, __u8)
#define TPS61050_IOCTL_PARAM_RD		_IOWR('o', 3, struct tps61050_param)
#define TPS61050_IOCTL_PARAM_WR		_IOW('o', 4, struct tps61050_param)

#define TPS61050_FLASH_CAPS		6
#define TPS61050_FLASH_LEVEL		7
#define TPS61050_FLASH_PIN_STATE	8
#define TPS61050_TORCH_CAPS		9
#define TPS61050_TORCH_LEVEL		10

struct tps61050_param {
	int param;
	__s32 sizeofvalue;
	void *p_value;
};

struct tps61050_level_info {
	__s32 guidenum;
	__u32 sustaintime;
	__s32 rechargefactor;
};

struct tps61050_pin_state {
	__u16 mask;
	__u16 values;
};

struct tps61050_flash_capabilities {
	__u32 numberoflevels;
	struct tps61050_level_info levels[NUM_FLASH_LEVELS];
};

struct tps61050_torch_capabilities {
	__u32 numberoflevels;
	__s32 guidenum[NUM_TORCH_LEVELS];
};

#ifdef __KERNEL__
struct tps61050_platform_data {
	int cfg;
	int num;
	int max_amp_torch;
	int max_amp_flash;
	void (*pinstate);
	int (*init)(void);
	void (*exit)(void);
	int (*pm)(int);
	int (*gpio_envm)(int);
	int (*gpio_sync)(int);
};
#endif /* __KERNEL__ */

#endif /* __TPS61050_H__ */