2 cx231xx.h - driver for Conexant Cx23100/101/102 USB video capture devices
4 Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <linux/videodev2.h>
26 #include <media/videobuf-vmalloc.h>
28 #include <linux/i2c.h>
29 #include <linux/i2c-algo-bit.h>
30 #include <linux/mutex.h>
31 #include <media/ir-kbd-i2c.h>
32 #if defined(CONFIG_VIDEO_CX231XX_DVB) || defined(CONFIG_VIDEO_CX231XX_DVB_MODULE)
33 #include <media/videobuf-dvb.h>
36 #include "cx231xx-reg.h"
37 #include "cx231xx-pcb-config.h"
38 #include "cx231xx-conf-reg.h"
40 #define CX231XX_VERSION_CODE KERNEL_VERSION(0, 1, 0)
41 #define DRIVER_NAME "cx231xx"
42 #define PWR_SLEEP_INTERVAL 5
44 /* I2C addresses for control block in Cx231xx */
45 #define Colibri_DEVICE_ADDRESS 0x60
46 #define Flatrion_DEVICE_ADDRESS 0x98
47 #define HAMMERHEAD_I2C_ADDRESS 0x88
48 #define DIF_USE_BASEBAND 0xFFFFFFFF
50 /* Boards supported by driver */
51 #define CX231XX_BOARD_UNKNOWN 0
52 #define CX231XX_BOARD_CNXT_RDE_250 1
53 #define CX231XX_BOARD_CNXT_RDU_250 2
55 /* Limits minimum and default number of buffers */
56 #define CX231XX_MIN_BUF 4
57 #define CX231XX_DEF_BUF 12
58 #define CX231XX_DEF_VBI_BUF 6
60 #define VBI_LINE_COUNT 17
61 #define VBI_LINE_LENGTH 1440
63 /*Limits the max URB message size */
64 #define URB_MAX_CTRL_SIZE 80
66 /* Params for validated field */
67 #define CX231XX_BOARD_NOT_VALIDATED 1
68 #define CX231XX_BOARD_VALIDATED 0
70 /* maximum number of cx231xx boards */
71 #define CX231XX_MAXBOARDS 8
73 /* maximum number of frames that can be queued */
74 #define CX231XX_NUM_FRAMES 5
76 /* number of buffers for isoc transfers */
77 #define CX231XX_NUM_BUFS 8
79 /* number of packets for each buffer
80 windows requests only 40 packets .. so we better do the same
81 this is what I found out for all alternate numbers there!
83 #define CX231XX_NUM_PACKETS 40
85 /* default alternate; 0 means choose the best */
86 #define CX231XX_PINOUT 0
88 #define CX231XX_INTERLACED_DEFAULT 1
90 /* time to wait when stopping the isoc transfer */
91 #define CX231XX_URB_TIMEOUT msecs_to_jiffies(CX231XX_NUM_BUFS * CX231XX_NUM_PACKETS)
99 enum cx231xx_std_mode {
104 enum cx231xx_stream_state {
112 struct cx231xx_usb_isoc_ctl {
113 /* max packet size of isoc transaction */
116 /* number of allocated urbs */
119 /* urb for isoc transfers */
122 /* transfer buffers for isoc transfer */
123 char **transfer_buffer;
125 /* Last buffer command and region */
127 int pos, size, pktsize;
129 /* Last field: ODD or EVEN? */
132 /* Stores incomplete commands */
136 /* Stores already requested buffers */
137 struct cx231xx_buffer *buf;
139 /* Stores the number of received fields */
142 /* isoc urb callback */
143 int (*isoc_copy) (struct cx231xx * dev, struct urb * urb);
149 u32 fourcc; /* v4l2 format id */
154 /* buffer for one video frame */
155 struct cx231xx_buffer {
156 /* common v4l buffer stuff -- must be first */
157 struct videobuf_buffer vb;
159 struct list_head frame;
164 struct cx231xx_dmaqueue {
165 struct list_head active;
166 struct list_head queued;
168 wait_queue_head_t wq;
170 /* Counters to control buffer fill */
176 u32 bytes_left_in_line;
184 #define MAX_CX231XX_INPUT 4
187 CX231XX_VMUX_COMPOSITE1 = 1,
189 CX231XX_VMUX_TELEVISION,
196 enum cx231xx_v_input {
197 CX231XX_VIN_1_1 = 0x1,
201 CX231XX_VIN_1_2 = 0x01,
204 CX231XX_VIN_1_3 = 0x1,
209 /* cx231xx has two audio inputs: tuner and line in */
211 /* This is the only entry for cx231xx tuner input */
212 CX231XX_AMUX_VIDEO, /* cx231xx tuner */
213 CX231XX_AMUX_LINE_IN, /* Line In */
216 struct cx231xx_reg_seq {
222 struct cx231xx_input {
223 enum cx231xx_itype type;
225 enum cx231xx_amux amux;
226 struct cx231xx_reg_seq *gpio;
229 #define INPUT(nr) (&cx231xx_boards[dev->model].input[nr])
231 enum cx231xx_decoder {
236 typedef enum _I2C_MASTER_PORT {
241 } CX231XX_I2C_MASTER_PORT;
243 struct cx231xx_board {
248 v4l2_std_id norm; /* tv norm */
252 u8 demod_xfer_mode; /* 0 - Serial; 1 - parallel */
255 struct cx231xx_reg_seq *dvb_gpio;
256 struct cx231xx_reg_seq *suspend_gpio;
257 struct cx231xx_reg_seq *tuner_gpio;
263 u32 ctl_pin_status_mask;
264 u8 agc_analog_digital_select_gpio;
265 u32 gpio_pin_status_mask;
271 unsigned int max_range_640_480:1;
272 unsigned int has_dvb:1;
273 unsigned int valid:1;
275 unsigned char xclk, i2c_speed;
277 enum cx231xx_decoder decoder;
279 struct cx231xx_input input[MAX_CX231XX_INPUT];
280 struct cx231xx_input radio;
281 IR_KEYTAB_TYPE *ir_codes;
285 enum cx231xx_dev_state {
286 DEV_INITIALIZED = 0x01,
287 DEV_DISCONNECTED = 0x02,
288 DEV_MISCONFIGURED = 0x04,
302 AUDIO_INPUT_TUNER_TV,
307 #define CX231XX_AUDIO_BUFS 5
308 #define CX231XX_NUM_AUDIO_PACKETS 64
309 #define CX231XX_CAPTURE_STREAM_EN 1
310 #define CX231XX_STOP_AUDIO 0
311 #define CX231XX_START_AUDIO 1
313 /* cx231xx extensions */
314 #define CX231XX_AUDIO 0x10
315 #define CX231XX_DVB 0x20
317 struct cx231xx_audio {
319 char *transfer_buffer[CX231XX_AUDIO_BUFS];
320 struct urb *urb[CX231XX_AUDIO_BUFS];
321 struct usb_device *udev;
322 unsigned int capture_transfer_done;
323 struct snd_pcm_substream *capture_pcm_substream;
325 unsigned int hwptr_done_capture;
326 struct snd_card *sndcard;
329 enum cx231xx_stream_state capture_stream;
332 int alt; /* alternate */
333 int max_pkt_size; /* max packet size of isoc transaction */
334 int num_alt; /* Number of alternative settings */
335 unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */
343 unsigned int stream_on:1; /* Locks streams */
346 struct videobuf_queue vb_vidq;
348 enum v4l2_buf_type type;
351 /**********************************************************************************/
353 #define I2C_SPEED_1M 0x0 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */
354 #define I2C_SPEED_400K 0x1 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */
355 #define I2C_SPEED_100K 0x2 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */
356 #define I2C_SPEED_5M 0x3 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */
358 #define I2C_STOP 0x0 /* 0-- STOP transaction */
359 #define I2C_NOSTOP 0x1 /* 1-- do not transmit STOP at end of transaction */
360 #define I2C_SYNC 0x1 /* 1--alllow slave to insert clock wait states */
368 struct i2c_adapter i2c_adap;
369 struct i2c_algo_bit_data i2c_algo;
370 struct i2c_client i2c_client;
373 /* different settings for each bus */
379 struct cx231xx_i2c_xfer_data {
381 u8 direction; /* 1 - IN, 0 - OUT */
382 u8 saddr_len; /* sub address len */
383 u16 saddr_dat; /* sub addr data */
384 u8 buf_size; /* buffer size */
385 u8 *p_buffer; /* pointer to the buffer */
388 typedef struct _VENDOR_REQUEST_IN {
396 } VENDOR_REQUEST_IN, *PVENDOR_REQUEST_IN;
398 struct cx231xx_ctrl {
399 struct v4l2_queryctrl v;
410 Sliced_cc, /* HANC */
416 struct cx231xx_video_mode {
417 /* Isoc control struct */
418 struct cx231xx_dmaqueue vidq;
419 struct cx231xx_usb_isoc_ctl isoc_ctl;
423 int alt; /* alternate */
424 int max_pkt_size; /* max packet size of isoc transaction */
425 int num_alt; /* Number of alternative settings */
426 unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */
430 /* main device struct */
432 /* generic device properties */
433 char name[30]; /* name (including minor) of the device */
434 int model; /* index in the device_data struct */
435 int devno; /* marks the number of this device */
437 struct cx231xx_board board;
439 unsigned int stream_on:1; /* Locks streams */
440 unsigned int vbi_stream_on:1; /* Locks streams for VBI */
441 unsigned int has_audio_class:1;
442 unsigned int has_alsa_audio:1;
444 struct cx231xx_fmt *format;
446 struct cx231xx_IR *ir;
448 struct list_head devlist;
450 int tuner_type; /* type of the tuner */
451 int tuner_addr; /* tuner address */
453 /* I2C adapters: Master 1 & 2 (External) & Master 3 (Internal only) */
454 struct cx231xx_i2c i2c_bus[3];
455 unsigned int xc_fw_load_done:1;
456 struct mutex gpio_i2c_lock;
458 /* video for linux */
459 int users; /* user count for exclusive use */
460 struct video_device *vdev; /* video for linux device struct */
461 v4l2_std_id norm; /* selected tv norm */
462 int ctl_freq; /* selected frequency */
463 unsigned int ctl_ainput; /* selected audio input */
467 /* frame properties */
468 int width; /* current frame width */
469 int height; /* current frame height */
470 unsigned hscale; /* horizontal scale factor (see datasheet) */
471 unsigned vscale; /* vertical scale factor (see datasheet) */
472 int interlaced; /* 1=interlace fileds, 0=just top fileds */
474 struct cx231xx_audio adev;
477 enum cx231xx_dev_state state;
479 struct work_struct request_module_wk;
483 struct mutex ctrl_urb_lock; /* protects urb_buf */
484 struct list_head inqueue, outqueue;
485 wait_queue_head_t open, wait_frame, wait_stream;
486 struct video_device *vbi_dev;
487 struct video_device *radio_dev;
489 unsigned char eedata[256];
491 struct cx231xx_video_mode video_mode;
492 struct cx231xx_video_mode vbi_mode;
493 struct cx231xx_video_mode sliced_cc_mode;
494 struct cx231xx_video_mode ts1_mode;
496 struct usb_device *udev; /* the usb device */
497 char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */
499 /* helper funcs that call usb_control_msg */
500 int (*cx231xx_read_ctrl_reg) (struct cx231xx * dev, u8 req, u16 reg,
502 int (*cx231xx_write_ctrl_reg) (struct cx231xx * dev, u8 req, u16 reg,
504 int (*cx231xx_send_usb_command) (struct cx231xx_i2c * i2c_bus,
505 struct cx231xx_i2c_xfer_data *
507 int (*cx231xx_gpio_i2c_read) (struct cx231xx * dev, u8 dev_addr,
509 int (*cx231xx_gpio_i2c_write) (struct cx231xx * dev, u8 dev_addr,
512 int (*cx231xx_set_analog_freq) (struct cx231xx * dev, u32 freq);
513 int (*cx231xx_reset_analog_tuner) (struct cx231xx * dev);
515 enum cx231xx_mode mode;
517 struct cx231xx_dvb *dvb;
519 /* Cx231xx supported PCB config's */
520 struct pcb_config current_pcb_config;
521 u8 current_scenario_idx;
523 u8 max_iad_interface_count;
525 /* GPIO related register direction and values */
532 /* colibri parameters */
533 enum AFE_MODE colibri_mode;
534 u32 colibri_ref_count;
536 /* video related parameters */
539 u8 vbi_or_sliced_cc_mode; /* 0 - vbi ; 1 - sliced cc mode */
540 enum cx231xx_std_mode std_mode; /* 0 - Air; 1 - cable */
545 struct list_head next;
548 int (*init) (struct cx231xx *);
549 int (*fini) (struct cx231xx *);
552 /* call back functions in dvb module */
553 int cx231xx_set_analog_freq(struct cx231xx *dev, u32 freq);
554 int cx231xx_reset_analog_tuner(struct cx231xx *dev);
556 /* Provided by cx231xx-i2c.c */
557 void cx231xx_i2c_call_clients(struct cx231xx_i2c *bus, unsigned int cmd,
559 void cx231xx_do_i2c_scan(struct cx231xx *dev, struct i2c_client *c);
560 int cx231xx_i2c_register(struct cx231xx_i2c *bus);
561 int cx231xx_i2c_unregister(struct cx231xx_i2c *bus);
563 /* Internal block control functions */
564 int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr,
565 u16 saddr, u8 saddr_len, u32 * data, u8 data_len);
566 int cx231xx_write_i2c_data(struct cx231xx *dev, u8 dev_addr,
567 u16 saddr, u8 saddr_len, u32 data, u8 data_len);
568 int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size,
569 u16 register_address, u8 bit_start, u8 bit_end,
571 int cx231xx_read_modify_write_i2c_dword(struct cx231xx *dev, u8 dev_addr,
572 u16 saddr, u32 mask, u32 value);
573 u32 cx231xx_set_field(u32 field_mask, u32 data);
575 /* Colibri related functions */
576 int cx231xx_colibri_init_super_block(struct cx231xx *dev, u32 ref_count);
577 int cx231xx_colibri_init_channels(struct cx231xx *dev);
578 int cx231xx_colibri_setup_AFE_for_baseband(struct cx231xx *dev);
579 int cx231xx_colibri_set_input_mux(struct cx231xx *dev, u32 input_mux);
580 int cx231xx_colibri_set_mode(struct cx231xx *dev, enum AFE_MODE mode);
581 int cx231xx_colibri_update_power_control(struct cx231xx *dev, AV_MODE avmode);
582 int cx231xx_colibri_adjust_ref_count(struct cx231xx *dev, u32 video_input);
584 /* flatiron related functions */
585 int cx231xx_flatiron_initialize(struct cx231xx *dev);
586 int cx231xx_flatiron_update_power_control(struct cx231xx *dev, AV_MODE avmode);
587 int cx231xx_flatiron_set_audio_input(struct cx231xx *dev, u8 audio_input);
589 /* DIF related functions */
590 int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode,
591 u32 function_mode, u32 standard);
592 int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard);
593 int cx231xx_tuner_pre_channel_change(struct cx231xx *dev);
594 int cx231xx_tuner_post_channel_change(struct cx231xx *dev);
596 /* video parser functions */
597 u8 cx231xx_find_next_SAV_EAV(u8 * p_buffer, u32 buffer_size,
599 u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf,
601 int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
602 u8 * p_buffer, u32 bytes_to_copy);
603 void cx231xx_reset_video_buffer(struct cx231xx *dev,
604 struct cx231xx_dmaqueue *dma_q);
605 u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q);
606 u32 cx231xx_copy_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
607 u8 * p_line, u32 length, int field_number);
608 u32 cx231xx_get_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
609 u8 sav_eav, u8 * p_buffer, u32 buffer_size);
610 void cx231xx_swab(u16 * from, u16 * to, u16 len);
612 /* Provided by cx231xx-core.c */
614 u32 cx231xx_request_buffers(struct cx231xx *dev, u32 count);
615 void cx231xx_queue_unusedframes(struct cx231xx *dev);
616 void cx231xx_release_buffers(struct cx231xx *dev);
618 /* read from control pipe */
619 int cx231xx_read_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg,
622 /* write to control pipe */
623 int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg,
625 int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode);
627 int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN * ven_req);
628 int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus,
629 struct cx231xx_i2c_xfer_data *req_data);
631 /* Gpio related functions */
632 int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val,
633 u8 len, u8 request, u8 direction);
634 int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val);
635 int cx231xx_get_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val);
636 int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value);
637 int cx231xx_set_gpio_direction(struct cx231xx *dev, int pin_number,
640 int cx231xx_gpio_i2c_start(struct cx231xx *dev);
641 int cx231xx_gpio_i2c_end(struct cx231xx *dev);
642 int cx231xx_gpio_i2c_write_byte(struct cx231xx *dev, u8 data);
643 int cx231xx_gpio_i2c_read_byte(struct cx231xx *dev, u8 * buf);
644 int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev);
645 int cx231xx_gpio_i2c_write_ack(struct cx231xx *dev);
646 int cx231xx_gpio_i2c_write_nak(struct cx231xx *dev);
648 int cx231xx_gpio_i2c_read(struct cx231xx *dev, u8 dev_addr, u8 * buf, u8 len);
649 int cx231xx_gpio_i2c_write(struct cx231xx *dev, u8 dev_addr, u8 * buf, u8 len);
651 /* audio related functions */
652 int cx231xx_set_audio_decoder_input(struct cx231xx *dev,
653 enum AUDIO_INPUT audio_input);
655 int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type);
656 int cx231xx_resolution_set(struct cx231xx *dev);
657 int cx231xx_set_video_alternate(struct cx231xx *dev);
658 int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt);
659 int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
660 int num_bufs, int max_pkt_size,
661 int (*isoc_copy) (struct cx231xx * dev,
663 void cx231xx_uninit_isoc(struct cx231xx *dev);
664 int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode);
665 int cx231xx_gpio_set(struct cx231xx *dev, struct cx231xx_reg_seq *gpio);
667 /* Device list functions */
668 void cx231xx_release_resources(struct cx231xx *dev);
669 void cx231xx_release_analog_resources(struct cx231xx *dev);
670 int cx231xx_register_analog_devices(struct cx231xx *dev);
671 void cx231xx_remove_from_devlist(struct cx231xx *dev);
672 void cx231xx_add_into_devlist(struct cx231xx *dev);
673 struct cx231xx *cx231xx_get_device(int minor,
674 enum v4l2_buf_type *fh_type, int *has_radio);
675 void cx231xx_init_extension(struct cx231xx *dev);
676 void cx231xx_close_extension(struct cx231xx *dev);
678 /* hardware init functions */
679 int cx231xx_dev_init(struct cx231xx *dev);
680 void cx231xx_dev_uninit(struct cx231xx *dev);
681 void cx231xx_config_i2c(struct cx231xx *dev);
682 int cx231xx_config(struct cx231xx *dev);
684 /* Stream control functions */
685 int cx231xx_start_stream(struct cx231xx *dev, u32 ep_mask);
686 int cx231xx_stop_stream(struct cx231xx *dev, u32 ep_mask);
688 int cx231xx_initialize_stream_xfer(struct cx231xx *dev, u32 media_type);
690 /* Power control functions */
691 int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode);
692 int cx231xx_power_suspend(struct cx231xx *dev);
694 /* chip specific control functions */
695 int cx231xx_init_ctrl_pin_status(struct cx231xx *dev);
696 int cx231xx_set_agc_analog_digital_mux_select(struct cx231xx *dev,
697 u8 analog_or_digital);
698 int cx231xx_enable_i2c_for_tuner(struct cx231xx *dev, u8 I2CIndex);
700 /* video audio decoder related functions */
701 void video_mux(struct cx231xx *dev, int index);
702 int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input);
703 int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input);
704 int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev);
705 int cx231xx_set_audio_input(struct cx231xx *dev, u8 input);
706 void get_scale(struct cx231xx *dev,
707 unsigned int width, unsigned int height,
708 unsigned int *hscale, unsigned int *vscale);
710 /* Provided by cx231xx-video.c */
711 int cx231xx_register_extension(struct cx231xx_ops *dev);
712 void cx231xx_unregister_extension(struct cx231xx_ops *dev);
713 void cx231xx_init_extension(struct cx231xx *dev);
714 void cx231xx_close_extension(struct cx231xx *dev);
716 /* Provided by cx231xx-cards.c */
717 extern void cx231xx_pre_card_setup(struct cx231xx *dev);
718 extern void cx231xx_card_setup(struct cx231xx *dev);
719 extern struct cx231xx_board cx231xx_boards[];
720 extern struct usb_device_id cx231xx_id_table[];
721 extern const unsigned int cx231xx_bcount;
722 void cx231xx_set_ir(struct cx231xx *dev, struct IR_i2c *ir);
723 int cx231xx_tuner_callback(void *ptr, int component, int command, int arg);
725 /* Provided by cx231xx-input.c */
726 int cx231xx_ir_init(struct cx231xx *dev);
727 int cx231xx_ir_fini(struct cx231xx *dev);
731 #define cx231xx_err(fmt, arg...) do {\
732 printk(KERN_ERR fmt , ##arg); } while (0)
734 #define cx231xx_errdev(fmt, arg...) do {\
735 printk(KERN_ERR "%s: "fmt,\
736 dev->name , ##arg); } while (0)
738 #define cx231xx_info(fmt, arg...) do {\
739 printk(KERN_INFO "%s: "fmt,\
740 dev->name , ##arg); } while (0)
741 #define cx231xx_warn(fmt, arg...) do {\
742 printk(KERN_WARNING "%s: "fmt,\
743 dev->name , ##arg); } while (0)
745 static inline unsigned int norm_maxw(struct cx231xx *dev)
747 if (dev->board.max_range_640_480)
753 static inline unsigned int norm_maxh(struct cx231xx *dev)
755 if (dev->board.max_range_640_480)
758 return (dev->norm & V4L2_STD_625_50) ? 576 : 480;