diff options
Diffstat (limited to 'drivers/media/video/em28xx/em28xx.h')
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 318 |
1 files changed, 180 insertions, 138 deletions
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 04e0e48ecabe..002f170b211a 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -26,11 +26,39 @@ | |||
26 | #define _EM28XX_H | 26 | #define _EM28XX_H |
27 | 27 | ||
28 | #include <linux/videodev2.h> | 28 | #include <linux/videodev2.h> |
29 | #include <media/videobuf-vmalloc.h> | ||
30 | |||
29 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
30 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
31 | #include <media/ir-kbd-i2c.h> | 33 | #include <media/ir-kbd-i2c.h> |
32 | 34 | #if defined(CONFIG_VIDEO_EM28XX_DVB) || defined(CONFIG_VIDEO_EM28XX_DVB_MODULE) | |
33 | #define UNSET -1 | 35 | #include <media/videobuf-dvb.h> |
36 | #endif | ||
37 | #include "tuner-xc2028.h" | ||
38 | #include "em28xx-reg.h" | ||
39 | |||
40 | /* Boards supported by driver */ | ||
41 | #define EM2800_BOARD_UNKNOWN 0 | ||
42 | #define EM2820_BOARD_UNKNOWN 1 | ||
43 | #define EM2820_BOARD_TERRATEC_CINERGY_250 2 | ||
44 | #define EM2820_BOARD_PINNACLE_USB_2 3 | ||
45 | #define EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 4 | ||
46 | #define EM2820_BOARD_MSI_VOX_USB_2 5 | ||
47 | #define EM2800_BOARD_TERRATEC_CINERGY_200 6 | ||
48 | #define EM2800_BOARD_LEADTEK_WINFAST_USBII 7 | ||
49 | #define EM2800_BOARD_KWORLD_USB2800 8 | ||
50 | #define EM2820_BOARD_PINNACLE_DVC_90 9 | ||
51 | #define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 10 | ||
52 | #define EM2880_BOARD_TERRATEC_HYBRID_XS 11 | ||
53 | #define EM2820_BOARD_KWORLD_PVRTV2800RF 12 | ||
54 | #define EM2880_BOARD_TERRATEC_PRODIGY_XS 13 | ||
55 | #define EM2820_BOARD_PROLINK_PLAYTV_USB2 14 | ||
56 | #define EM2800_BOARD_VGEAR_POCKETTV 15 | ||
57 | #define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 16 | ||
58 | |||
59 | /* Limits minimum and default number of buffers */ | ||
60 | #define EM28XX_MIN_BUF 4 | ||
61 | #define EM28XX_DEF_BUF 8 | ||
34 | 62 | ||
35 | /* maximum number of em28xx boards */ | 63 | /* maximum number of em28xx boards */ |
36 | #define EM28XX_MAXBOARDS 4 /*FIXME: should be bigger */ | 64 | #define EM28XX_MAXBOARDS 4 /*FIXME: should be bigger */ |
@@ -81,31 +109,78 @@ | |||
81 | /* time in msecs to wait for i2c writes to finish */ | 109 | /* time in msecs to wait for i2c writes to finish */ |
82 | #define EM2800_I2C_WRITE_TIMEOUT 20 | 110 | #define EM2800_I2C_WRITE_TIMEOUT 20 |
83 | 111 | ||
84 | /* the various frame states */ | 112 | enum em28xx_mode { |
85 | enum em28xx_frame_state { | 113 | EM28XX_MODE_UNDEFINED, |
86 | F_UNUSED = 0, | 114 | EM28XX_ANALOG_MODE, |
87 | F_QUEUED, | 115 | EM28XX_DIGITAL_MODE, |
88 | F_GRABBING, | ||
89 | F_DONE, | ||
90 | F_ERROR, | ||
91 | }; | 116 | }; |
92 | 117 | ||
93 | /* stream states */ | ||
94 | enum em28xx_stream_state { | 118 | enum em28xx_stream_state { |
95 | STREAM_OFF, | 119 | STREAM_OFF, |
96 | STREAM_INTERRUPT, | 120 | STREAM_INTERRUPT, |
97 | STREAM_ON, | 121 | STREAM_ON, |
98 | }; | 122 | }; |
99 | 123 | ||
100 | /* frames */ | 124 | struct em28xx; |
101 | struct em28xx_frame_t { | 125 | |
102 | void *bufmem; | 126 | struct em28xx_usb_isoc_ctl { |
103 | struct v4l2_buffer buf; | 127 | /* max packet size of isoc transaction */ |
104 | enum em28xx_frame_state state; | 128 | int max_pkt_size; |
129 | |||
130 | /* number of allocated urbs */ | ||
131 | int num_bufs; | ||
132 | |||
133 | /* urb for isoc transfers */ | ||
134 | struct urb **urb; | ||
135 | |||
136 | /* transfer buffers for isoc transfer */ | ||
137 | char **transfer_buffer; | ||
138 | |||
139 | /* Last buffer command and region */ | ||
140 | u8 cmd; | ||
141 | int pos, size, pktsize; | ||
142 | |||
143 | /* Last field: ODD or EVEN? */ | ||
144 | int field; | ||
145 | |||
146 | /* Stores incomplete commands */ | ||
147 | u32 tmp_buf; | ||
148 | int tmp_buf_len; | ||
149 | |||
150 | /* Stores already requested buffers */ | ||
151 | struct em28xx_buffer *buf; | ||
152 | |||
153 | /* Stores the number of received fields */ | ||
154 | int nfields; | ||
155 | |||
156 | /* isoc urb callback */ | ||
157 | int (*isoc_copy) (struct em28xx *dev, struct urb *urb); | ||
158 | |||
159 | }; | ||
160 | |||
161 | struct em28xx_fmt { | ||
162 | char *name; | ||
163 | u32 fourcc; /* v4l2 format id */ | ||
164 | }; | ||
165 | |||
166 | /* buffer for one video frame */ | ||
167 | struct em28xx_buffer { | ||
168 | /* common v4l buffer stuff -- must be first */ | ||
169 | struct videobuf_buffer vb; | ||
170 | |||
105 | struct list_head frame; | 171 | struct list_head frame; |
106 | unsigned long vma_use_count; | ||
107 | int top_field; | 172 | int top_field; |
108 | int fieldbytesused; | 173 | int receiving; |
174 | }; | ||
175 | |||
176 | struct em28xx_dmaqueue { | ||
177 | struct list_head active; | ||
178 | struct list_head queued; | ||
179 | |||
180 | wait_queue_head_t wq; | ||
181 | |||
182 | /* Counters to control buffer fill */ | ||
183 | int pos; | ||
109 | }; | 184 | }; |
110 | 185 | ||
111 | /* io methods */ | 186 | /* io methods */ |
@@ -152,6 +227,12 @@ enum em28xx_decoder { | |||
152 | EM28XX_SAA7114 | 227 | EM28XX_SAA7114 |
153 | }; | 228 | }; |
154 | 229 | ||
230 | struct em28xx_reg_seq { | ||
231 | int reg; | ||
232 | unsigned char val, mask; | ||
233 | int sleep; | ||
234 | }; | ||
235 | |||
155 | struct em28xx_board { | 236 | struct em28xx_board { |
156 | char *name; | 237 | char *name; |
157 | int vchannels; | 238 | int vchannels; |
@@ -165,8 +246,7 @@ struct em28xx_board { | |||
165 | unsigned int mts_firmware:1; | 246 | unsigned int mts_firmware:1; |
166 | unsigned int has_12mhz_i2s:1; | 247 | unsigned int has_12mhz_i2s:1; |
167 | unsigned int max_range_640_480:1; | 248 | unsigned int max_range_640_480:1; |
168 | 249 | unsigned int has_dvb:1; | |
169 | unsigned int analog_gpio; | ||
170 | 250 | ||
171 | enum em28xx_decoder decoder; | 251 | enum em28xx_decoder decoder; |
172 | 252 | ||
@@ -199,7 +279,10 @@ enum em28xx_dev_state { | |||
199 | #define EM28XX_NUM_AUDIO_PACKETS 64 | 279 | #define EM28XX_NUM_AUDIO_PACKETS 64 |
200 | #define EM28XX_AUDIO_MAX_PACKET_SIZE 196 /* static value */ | 280 | #define EM28XX_AUDIO_MAX_PACKET_SIZE 196 /* static value */ |
201 | #define EM28XX_CAPTURE_STREAM_EN 1 | 281 | #define EM28XX_CAPTURE_STREAM_EN 1 |
282 | |||
283 | /* em28xx extensions */ | ||
202 | #define EM28XX_AUDIO 0x10 | 284 | #define EM28XX_AUDIO 0x10 |
285 | #define EM28XX_DVB 0x20 | ||
203 | 286 | ||
204 | struct em28xx_audio { | 287 | struct em28xx_audio { |
205 | char name[50]; | 288 | char name[50]; |
@@ -217,13 +300,24 @@ struct em28xx_audio { | |||
217 | spinlock_t slock; | 300 | spinlock_t slock; |
218 | }; | 301 | }; |
219 | 302 | ||
303 | struct em28xx; | ||
304 | |||
305 | struct em28xx_fh { | ||
306 | struct em28xx *dev; | ||
307 | unsigned int stream_on:1; /* Locks streams */ | ||
308 | int radio; | ||
309 | |||
310 | struct videobuf_queue vb_vidq; | ||
311 | |||
312 | enum v4l2_buf_type type; | ||
313 | }; | ||
314 | |||
220 | /* main device struct */ | 315 | /* main device struct */ |
221 | struct em28xx { | 316 | struct em28xx { |
222 | /* generic device properties */ | 317 | /* generic device properties */ |
223 | char name[30]; /* name (including minor) of the device */ | 318 | char name[30]; /* name (including minor) of the device */ |
224 | int model; /* index in the device_data struct */ | 319 | int model; /* index in the device_data struct */ |
225 | int devno; /* marks the number of this device */ | 320 | int devno; /* marks the number of this device */ |
226 | unsigned int analog_gpio; | ||
227 | unsigned int is_em2800:1; | 321 | unsigned int is_em2800:1; |
228 | unsigned int has_msp34xx:1; | 322 | unsigned int has_msp34xx:1; |
229 | unsigned int has_tda9887:1; | 323 | unsigned int has_tda9887:1; |
@@ -231,6 +325,16 @@ struct em28xx { | |||
231 | unsigned int has_audio_class:1; | 325 | unsigned int has_audio_class:1; |
232 | unsigned int has_12mhz_i2s:1; | 326 | unsigned int has_12mhz_i2s:1; |
233 | unsigned int max_range_640_480:1; | 327 | unsigned int max_range_640_480:1; |
328 | unsigned int has_dvb:1; | ||
329 | |||
330 | /* Some older em28xx chips needs a waiting time after writing */ | ||
331 | unsigned int wait_after_write; | ||
332 | |||
333 | /* GPIO sequences for analog and digital mode */ | ||
334 | struct em28xx_reg_seq *analog_gpio, *digital_gpio; | ||
335 | |||
336 | /* GPIO sequences for tuner callbacks */ | ||
337 | struct em28xx_reg_seq *tun_analog_gpio, *tun_digital_gpio; | ||
234 | 338 | ||
235 | int video_inputs; /* number of video inputs */ | 339 | int video_inputs; /* number of video inputs */ |
236 | struct list_head devlist; | 340 | struct list_head devlist; |
@@ -255,36 +359,28 @@ struct em28xx { | |||
255 | int mute; | 359 | int mute; |
256 | int volume; | 360 | int volume; |
257 | /* frame properties */ | 361 | /* frame properties */ |
258 | struct em28xx_frame_t frame[EM28XX_NUM_FRAMES]; /* list of frames */ | ||
259 | int num_frames; /* number of frames currently in use */ | ||
260 | unsigned int frame_count; /* total number of transfered frames */ | ||
261 | struct em28xx_frame_t *frame_current; /* the frame that is being filled */ | ||
262 | int width; /* current frame width */ | 362 | int width; /* current frame width */ |
263 | int height; /* current frame height */ | 363 | int height; /* current frame height */ |
264 | int frame_size; /* current frame size */ | ||
265 | int field_size; /* current field size */ | ||
266 | int bytesperline; | ||
267 | int hscale; /* horizontal scale factor (see datasheet) */ | 364 | int hscale; /* horizontal scale factor (see datasheet) */ |
268 | int vscale; /* vertical scale factor (see datasheet) */ | 365 | int vscale; /* vertical scale factor (see datasheet) */ |
269 | int interlaced; /* 1=interlace fileds, 0=just top fileds */ | 366 | int interlaced; /* 1=interlace fileds, 0=just top fileds */ |
270 | int type; | ||
271 | unsigned int video_bytesread; /* Number of bytes read */ | 367 | unsigned int video_bytesread; /* Number of bytes read */ |
272 | 368 | ||
273 | unsigned long hash; /* eeprom hash - for boards with generic ID */ | 369 | unsigned long hash; /* eeprom hash - for boards with generic ID */ |
274 | unsigned long i2c_hash; /* i2c devicelist hash - for boards with generic ID */ | 370 | unsigned long i2c_hash; /* i2c devicelist hash - |
371 | for boards with generic ID */ | ||
275 | 372 | ||
276 | struct em28xx_audio *adev; | 373 | struct em28xx_audio *adev; |
277 | 374 | ||
278 | /* states */ | 375 | /* states */ |
279 | enum em28xx_dev_state state; | 376 | enum em28xx_dev_state state; |
280 | enum em28xx_stream_state stream; | ||
281 | enum em28xx_io_method io; | 377 | enum em28xx_io_method io; |
282 | 378 | ||
283 | struct work_struct request_module_wk; | 379 | struct work_struct request_module_wk; |
284 | 380 | ||
285 | /* locks */ | 381 | /* locks */ |
286 | struct mutex lock; | 382 | struct mutex lock; |
287 | spinlock_t queue_lock; | 383 | /* spinlock_t queue_lock; */ |
288 | struct list_head inqueue, outqueue; | 384 | struct list_head inqueue, outqueue; |
289 | wait_queue_head_t open, wait_frame, wait_stream; | 385 | wait_queue_head_t open, wait_frame, wait_stream; |
290 | struct video_device *vbi_dev; | 386 | struct video_device *vbi_dev; |
@@ -292,6 +388,11 @@ struct em28xx { | |||
292 | 388 | ||
293 | unsigned char eedata[256]; | 389 | unsigned char eedata[256]; |
294 | 390 | ||
391 | /* Isoc control struct */ | ||
392 | struct em28xx_dmaqueue vidq; | ||
393 | struct em28xx_usb_isoc_ctl isoc_ctl; | ||
394 | spinlock_t slock; | ||
395 | |||
295 | /* usb transfer */ | 396 | /* usb transfer */ |
296 | struct usb_device *udev; /* the usb device */ | 397 | struct usb_device *udev; /* the usb device */ |
297 | int alt; /* alternate */ | 398 | int alt; /* alternate */ |
@@ -301,20 +402,21 @@ struct em28xx { | |||
301 | struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */ | 402 | struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */ |
302 | char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */ | 403 | char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */ |
303 | /* helper funcs that call usb_control_msg */ | 404 | /* helper funcs that call usb_control_msg */ |
304 | int (*em28xx_write_regs) (struct em28xx * dev, u16 reg, char *buf, | 405 | int (*em28xx_write_regs) (struct em28xx *dev, u16 reg, |
305 | int len); | ||
306 | int (*em28xx_read_reg) (struct em28xx * dev, u16 reg); | ||
307 | int (*em28xx_read_reg_req_len) (struct em28xx * dev, u8 req, u16 reg, | ||
308 | char *buf, int len); | 406 | char *buf, int len); |
309 | int (*em28xx_write_regs_req) (struct em28xx * dev, u8 req, u16 reg, | 407 | int (*em28xx_read_reg) (struct em28xx *dev, u16 reg); |
408 | int (*em28xx_read_reg_req_len) (struct em28xx *dev, u8 req, u16 reg, | ||
409 | char *buf, int len); | ||
410 | int (*em28xx_write_regs_req) (struct em28xx *dev, u8 req, u16 reg, | ||
310 | char *buf, int len); | 411 | char *buf, int len); |
311 | int (*em28xx_read_reg_req) (struct em28xx * dev, u8 req, u16 reg); | 412 | int (*em28xx_read_reg_req) (struct em28xx *dev, u8 req, u16 reg); |
312 | }; | ||
313 | 413 | ||
314 | struct em28xx_fh { | 414 | enum em28xx_mode mode; |
315 | struct em28xx *dev; | 415 | |
316 | unsigned int stream_on:1; /* Locks streams */ | 416 | /* Caches GPO and GPIO registers */ |
317 | int radio; | 417 | unsigned char reg_gpo, reg_gpio; |
418 | |||
419 | struct em28xx_dvb *dvb; | ||
318 | }; | 420 | }; |
319 | 421 | ||
320 | struct em28xx_ops { | 422 | struct em28xx_ops { |
@@ -351,22 +453,27 @@ int em28xx_colorlevels_set_default(struct em28xx *dev); | |||
351 | int em28xx_capture_start(struct em28xx *dev, int start); | 453 | int em28xx_capture_start(struct em28xx *dev, int start); |
352 | int em28xx_outfmt_set_yuv422(struct em28xx *dev); | 454 | int em28xx_outfmt_set_yuv422(struct em28xx *dev); |
353 | int em28xx_resolution_set(struct em28xx *dev); | 455 | int em28xx_resolution_set(struct em28xx *dev); |
354 | int em28xx_init_isoc(struct em28xx *dev); | ||
355 | void em28xx_uninit_isoc(struct em28xx *dev); | ||
356 | int em28xx_set_alternate(struct em28xx *dev); | 456 | int em28xx_set_alternate(struct em28xx *dev); |
457 | int em28xx_init_isoc(struct em28xx *dev, int max_packets, | ||
458 | int num_bufs, int max_pkt_size, | ||
459 | int (*isoc_copy) (struct em28xx *dev, struct urb *urb)); | ||
460 | void em28xx_uninit_isoc(struct em28xx *dev); | ||
461 | int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode); | ||
462 | int em28xx_gpio_set(struct em28xx *dev, struct em28xx_reg_seq *gpio); | ||
357 | 463 | ||
358 | /* Provided by em28xx-video.c */ | 464 | /* Provided by em28xx-video.c */ |
359 | int em28xx_register_extension(struct em28xx_ops *dev); | 465 | int em28xx_register_extension(struct em28xx_ops *dev); |
360 | void em28xx_unregister_extension(struct em28xx_ops *dev); | 466 | void em28xx_unregister_extension(struct em28xx_ops *dev); |
361 | 467 | ||
362 | /* Provided by em28xx-cards.c */ | 468 | /* Provided by em28xx-cards.c */ |
363 | extern int em2800_variant_detect(struct usb_device* udev,int model); | 469 | extern int em2800_variant_detect(struct usb_device *udev, int model); |
364 | extern void em28xx_pre_card_setup(struct em28xx *dev); | 470 | extern void em28xx_pre_card_setup(struct em28xx *dev); |
365 | extern void em28xx_card_setup(struct em28xx *dev); | 471 | extern void em28xx_card_setup(struct em28xx *dev); |
366 | extern struct em28xx_board em28xx_boards[]; | 472 | extern struct em28xx_board em28xx_boards[]; |
367 | extern struct usb_device_id em28xx_id_table[]; | 473 | extern struct usb_device_id em28xx_id_table[]; |
368 | extern const unsigned int em28xx_bcount; | 474 | extern const unsigned int em28xx_bcount; |
369 | void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir); | 475 | void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir); |
476 | int em28xx_tuner_callback(void *ptr, int command, int arg); | ||
370 | 477 | ||
371 | /* Provided by em28xx-input.c */ | 478 | /* Provided by em28xx-input.c */ |
372 | /* TODO: Check if the standard get_key handlers on ir-common can be used */ | 479 | /* TODO: Check if the standard get_key handlers on ir-common can be used */ |
@@ -375,71 +482,6 @@ int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw); | |||
375 | int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, | 482 | int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, |
376 | u32 *ir_raw); | 483 | u32 *ir_raw); |
377 | 484 | ||
378 | /* em2800 registers */ | ||
379 | #define EM2800_AUDIOSRC_REG 0x08 | ||
380 | |||
381 | /* em28xx registers */ | ||
382 | #define I2C_CLK_REG 0x06 | ||
383 | #define CHIPID_REG 0x0a | ||
384 | #define USBSUSP_REG 0x0c /* */ | ||
385 | |||
386 | #define AUDIOSRC_REG 0x0e | ||
387 | #define XCLK_REG 0x0f | ||
388 | |||
389 | #define VINMODE_REG 0x10 | ||
390 | #define VINCTRL_REG 0x11 | ||
391 | #define VINENABLE_REG 0x12 /* */ | ||
392 | |||
393 | #define GAMMA_REG 0x14 | ||
394 | #define RGAIN_REG 0x15 | ||
395 | #define GGAIN_REG 0x16 | ||
396 | #define BGAIN_REG 0x17 | ||
397 | #define ROFFSET_REG 0x18 | ||
398 | #define GOFFSET_REG 0x19 | ||
399 | #define BOFFSET_REG 0x1a | ||
400 | |||
401 | #define OFLOW_REG 0x1b | ||
402 | #define HSTART_REG 0x1c | ||
403 | #define VSTART_REG 0x1d | ||
404 | #define CWIDTH_REG 0x1e | ||
405 | #define CHEIGHT_REG 0x1f | ||
406 | |||
407 | #define YGAIN_REG 0x20 | ||
408 | #define YOFFSET_REG 0x21 | ||
409 | #define UVGAIN_REG 0x22 | ||
410 | #define UOFFSET_REG 0x23 | ||
411 | #define VOFFSET_REG 0x24 | ||
412 | #define SHARPNESS_REG 0x25 | ||
413 | |||
414 | #define COMPR_REG 0x26 | ||
415 | #define OUTFMT_REG 0x27 | ||
416 | |||
417 | #define XMIN_REG 0x28 | ||
418 | #define XMAX_REG 0x29 | ||
419 | #define YMIN_REG 0x2a | ||
420 | #define YMAX_REG 0x2b | ||
421 | |||
422 | #define HSCALELOW_REG 0x30 | ||
423 | #define HSCALEHIGH_REG 0x31 | ||
424 | #define VSCALELOW_REG 0x32 | ||
425 | #define VSCALEHIGH_REG 0x33 | ||
426 | |||
427 | #define AC97LSB_REG 0x40 | ||
428 | #define AC97MSB_REG 0x41 | ||
429 | #define AC97ADDR_REG 0x42 | ||
430 | #define AC97BUSY_REG 0x43 | ||
431 | |||
432 | /* em202 registers */ | ||
433 | #define MASTER_AC97 0x02 | ||
434 | #define LINE_IN_AC97 0x10 | ||
435 | #define VIDEO_AC97 0x14 | ||
436 | |||
437 | /* register settings */ | ||
438 | #define EM2800_AUDIO_SRC_TUNER 0x0d | ||
439 | #define EM2800_AUDIO_SRC_LINE 0x0c | ||
440 | #define EM28XX_AUDIO_SRC_TUNER 0xc0 | ||
441 | #define EM28XX_AUDIO_SRC_LINE 0x80 | ||
442 | |||
443 | /* printk macros */ | 485 | /* printk macros */ |
444 | 486 | ||
445 | #define em28xx_err(fmt, arg...) do {\ | 487 | #define em28xx_err(fmt, arg...) do {\ |
@@ -456,80 +498,80 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, | |||
456 | printk(KERN_WARNING "%s: "fmt,\ | 498 | printk(KERN_WARNING "%s: "fmt,\ |
457 | dev->name , ##arg); } while (0) | 499 | dev->name , ##arg); } while (0) |
458 | 500 | ||
459 | inline static int em28xx_compression_disable(struct em28xx *dev) | 501 | static inline int em28xx_compression_disable(struct em28xx *dev) |
460 | { | 502 | { |
461 | /* side effect of disabling scaler and mixer */ | 503 | /* side effect of disabling scaler and mixer */ |
462 | return em28xx_write_regs(dev, COMPR_REG, "\x00", 1); | 504 | return em28xx_write_regs(dev, EM28XX_R26_COMPR, "\x00", 1); |
463 | } | 505 | } |
464 | 506 | ||
465 | inline static int em28xx_contrast_get(struct em28xx *dev) | 507 | static inline int em28xx_contrast_get(struct em28xx *dev) |
466 | { | 508 | { |
467 | return em28xx_read_reg(dev, YGAIN_REG) & 0x1f; | 509 | return em28xx_read_reg(dev, EM28XX_R20_YGAIN) & 0x1f; |
468 | } | 510 | } |
469 | 511 | ||
470 | inline static int em28xx_brightness_get(struct em28xx *dev) | 512 | static inline int em28xx_brightness_get(struct em28xx *dev) |
471 | { | 513 | { |
472 | return em28xx_read_reg(dev, YOFFSET_REG); | 514 | return em28xx_read_reg(dev, EM28XX_R21_YOFFSET); |
473 | } | 515 | } |
474 | 516 | ||
475 | inline static int em28xx_saturation_get(struct em28xx *dev) | 517 | static inline int em28xx_saturation_get(struct em28xx *dev) |
476 | { | 518 | { |
477 | return em28xx_read_reg(dev, UVGAIN_REG) & 0x1f; | 519 | return em28xx_read_reg(dev, EM28XX_R22_UVGAIN) & 0x1f; |
478 | } | 520 | } |
479 | 521 | ||
480 | inline static int em28xx_u_balance_get(struct em28xx *dev) | 522 | static inline int em28xx_u_balance_get(struct em28xx *dev) |
481 | { | 523 | { |
482 | return em28xx_read_reg(dev, UOFFSET_REG); | 524 | return em28xx_read_reg(dev, EM28XX_R23_UOFFSET); |
483 | } | 525 | } |
484 | 526 | ||
485 | inline static int em28xx_v_balance_get(struct em28xx *dev) | 527 | static inline int em28xx_v_balance_get(struct em28xx *dev) |
486 | { | 528 | { |
487 | return em28xx_read_reg(dev, VOFFSET_REG); | 529 | return em28xx_read_reg(dev, EM28XX_R24_VOFFSET); |
488 | } | 530 | } |
489 | 531 | ||
490 | inline static int em28xx_gamma_get(struct em28xx *dev) | 532 | static inline int em28xx_gamma_get(struct em28xx *dev) |
491 | { | 533 | { |
492 | return em28xx_read_reg(dev, GAMMA_REG) & 0x3f; | 534 | return em28xx_read_reg(dev, EM28XX_R14_GAMMA) & 0x3f; |
493 | } | 535 | } |
494 | 536 | ||
495 | inline static int em28xx_contrast_set(struct em28xx *dev, s32 val) | 537 | static inline int em28xx_contrast_set(struct em28xx *dev, s32 val) |
496 | { | 538 | { |
497 | u8 tmp = (u8) val; | 539 | u8 tmp = (u8) val; |
498 | return em28xx_write_regs(dev, YGAIN_REG, &tmp, 1); | 540 | return em28xx_write_regs(dev, EM28XX_R20_YGAIN, &tmp, 1); |
499 | } | 541 | } |
500 | 542 | ||
501 | inline static int em28xx_brightness_set(struct em28xx *dev, s32 val) | 543 | static inline int em28xx_brightness_set(struct em28xx *dev, s32 val) |
502 | { | 544 | { |
503 | u8 tmp = (u8) val; | 545 | u8 tmp = (u8) val; |
504 | return em28xx_write_regs(dev, YOFFSET_REG, &tmp, 1); | 546 | return em28xx_write_regs(dev, EM28XX_R21_YOFFSET, &tmp, 1); |
505 | } | 547 | } |
506 | 548 | ||
507 | inline static int em28xx_saturation_set(struct em28xx *dev, s32 val) | 549 | static inline int em28xx_saturation_set(struct em28xx *dev, s32 val) |
508 | { | 550 | { |
509 | u8 tmp = (u8) val; | 551 | u8 tmp = (u8) val; |
510 | return em28xx_write_regs(dev, UVGAIN_REG, &tmp, 1); | 552 | return em28xx_write_regs(dev, EM28XX_R22_UVGAIN, &tmp, 1); |
511 | } | 553 | } |
512 | 554 | ||
513 | inline static int em28xx_u_balance_set(struct em28xx *dev, s32 val) | 555 | static inline int em28xx_u_balance_set(struct em28xx *dev, s32 val) |
514 | { | 556 | { |
515 | u8 tmp = (u8) val; | 557 | u8 tmp = (u8) val; |
516 | return em28xx_write_regs(dev, UOFFSET_REG, &tmp, 1); | 558 | return em28xx_write_regs(dev, EM28XX_R23_UOFFSET, &tmp, 1); |
517 | } | 559 | } |
518 | 560 | ||
519 | inline static int em28xx_v_balance_set(struct em28xx *dev, s32 val) | 561 | static inline int em28xx_v_balance_set(struct em28xx *dev, s32 val) |
520 | { | 562 | { |
521 | u8 tmp = (u8) val; | 563 | u8 tmp = (u8) val; |
522 | return em28xx_write_regs(dev, VOFFSET_REG, &tmp, 1); | 564 | return em28xx_write_regs(dev, EM28XX_R24_VOFFSET, &tmp, 1); |
523 | } | 565 | } |
524 | 566 | ||
525 | inline static int em28xx_gamma_set(struct em28xx *dev, s32 val) | 567 | static inline int em28xx_gamma_set(struct em28xx *dev, s32 val) |
526 | { | 568 | { |
527 | u8 tmp = (u8) val; | 569 | u8 tmp = (u8) val; |
528 | return em28xx_write_regs(dev, GAMMA_REG, &tmp, 1); | 570 | return em28xx_write_regs(dev, EM28XX_R14_GAMMA, &tmp, 1); |
529 | } | 571 | } |
530 | 572 | ||
531 | /*FIXME: maxw should be dependent of alt mode */ | 573 | /*FIXME: maxw should be dependent of alt mode */ |
532 | inline static unsigned int norm_maxw(struct em28xx *dev) | 574 | static inline unsigned int norm_maxw(struct em28xx *dev) |
533 | { | 575 | { |
534 | if (dev->max_range_640_480) | 576 | if (dev->max_range_640_480) |
535 | return 640; | 577 | return 640; |
@@ -537,7 +579,7 @@ inline static unsigned int norm_maxw(struct em28xx *dev) | |||
537 | return 720; | 579 | return 720; |
538 | } | 580 | } |
539 | 581 | ||
540 | inline static unsigned int norm_maxh(struct em28xx *dev) | 582 | static inline unsigned int norm_maxh(struct em28xx *dev) |
541 | { | 583 | { |
542 | if (dev->max_range_640_480) | 584 | if (dev->max_range_640_480) |
543 | return 480; | 585 | return 480; |