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#ifndef V4L2_COMMON_H_
27#define V4L2_COMMON_H_
28
29#include <media/v4l2-dev.h>
30
31
32
33
34#define v4l_printk(level, name, adapter, addr, fmt, arg...) \
35 printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg)
36
37#define v4l_client_printk(level, client, fmt, arg...) \
38 v4l_printk(level, (client)->dev.driver->name, (client)->adapter, \
39 (client)->addr, fmt , ## arg)
40
41#define v4l_err(client, fmt, arg...) \
42 v4l_client_printk(KERN_ERR, client, fmt , ## arg)
43
44#define v4l_warn(client, fmt, arg...) \
45 v4l_client_printk(KERN_WARNING, client, fmt , ## arg)
46
47#define v4l_info(client, fmt, arg...) \
48 v4l_client_printk(KERN_INFO, client, fmt , ## arg)
49
50
51
52#define v4l_dbg(level, debug, client, fmt, arg...) \
53 do { \
54 if (debug >= (level)) \
55 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
56 } while (0)
57
58
59
60
61#define v4l2_printk(level, dev, fmt, arg...) \
62 printk(level "%s: " fmt, (dev)->name , ## arg)
63
64#define v4l2_err(dev, fmt, arg...) \
65 v4l2_printk(KERN_ERR, dev, fmt , ## arg)
66
67#define v4l2_warn(dev, fmt, arg...) \
68 v4l2_printk(KERN_WARNING, dev, fmt , ## arg)
69
70#define v4l2_info(dev, fmt, arg...) \
71 v4l2_printk(KERN_INFO, dev, fmt , ## arg)
72
73
74
75#define v4l2_dbg(level, debug, dev, fmt, arg...) \
76 do { \
77 if (debug >= (level)) \
78 v4l2_printk(KERN_DEBUG, dev, fmt , ## arg); \
79 } while (0)
80
81
82
83
84
85int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
86
87
88
89
90
91struct i2c_driver;
92struct i2c_adapter;
93struct i2c_client;
94struct i2c_device_id;
95struct v4l2_device;
96struct v4l2_subdev;
97struct v4l2_subdev_ops;
98
99
100
101
102struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
103 struct i2c_adapter *adapter, const char *client_type,
104 u8 addr, const unsigned short *probe_addrs);
105
106struct i2c_board_info;
107
108struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
109 struct i2c_adapter *adapter, struct i2c_board_info *info,
110 const unsigned short *probe_addrs);
111
112
113void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
114 const struct v4l2_subdev_ops *ops);
115
116unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd);
117
118enum v4l2_i2c_tuner_type {
119 ADDRS_RADIO,
120 ADDRS_DEMOD,
121 ADDRS_TV,
122
123
124
125 ADDRS_TV_WITH_DEMOD,
126};
127
128
129const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type);
130
131
132
133
134#if defined(CONFIG_SPI)
135
136#include <linux/spi/spi.h>
137
138struct spi_device;
139
140
141
142struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,
143 struct spi_master *master, struct spi_board_info *info);
144
145
146void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi,
147 const struct v4l2_subdev_ops *ops);
148#endif
149
150
151
152
153
154
155
156
157
158struct v4l2_priv_tun_config {
159 int tuner;
160 void *priv;
161};
162#define TUNER_SET_CONFIG _IOW('d', 92, struct v4l2_priv_tun_config)
163
164#define VIDIOC_INT_RESET _IOW ('d', 102, u32)
165
166struct v4l2_routing {
167 u32 input;
168 u32 output;
169};
170
171
172
173
174
175void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
176 unsigned int wmax, unsigned int walign,
177 unsigned int *h, unsigned int hmin,
178 unsigned int hmax, unsigned int halign,
179 unsigned int salign);
180
181struct v4l2_discrete_probe {
182 const struct v4l2_frmsize_discrete *sizes;
183 int num_sizes;
184};
185
186const struct v4l2_frmsize_discrete *v4l2_find_nearest_format(
187 const struct v4l2_discrete_probe *probe,
188 s32 width, s32 height);
189
190void v4l2_get_timestamp(struct timeval *tv);
191
192#endif
193