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 <linux/types.h>
27 #include <linux/ioctl.h>
28 #include <linux/i2c.h>
29 #include <linux/i2c-algo-bit.h>
30 #include <linux/mutex.h>
33 #include <media/videobuf-vmalloc.h>
34 #include <media/v4l2-device.h>
35 #include <media/ir-kbd-i2c.h>
36 #if defined(CONFIG_VIDEO_CX231XX_DVB) || \
37 defined(CONFIG_VIDEO_CX231XX_DVB_MODULE)
38 #include <media/videobuf-dvb.h>
41 #include "cx231xx-reg.h"
42 #include "cx231xx-pcb-cfg.h"
43 #include "cx231xx-conf-reg.h"
45 #define DRIVER_NAME "cx231xx"
46 #define PWR_SLEEP_INTERVAL 5
48 /* I2C addresses for control block in Cx231xx */
49 #define AFE_DEVICE_ADDRESS 0x60
50 #define I2S_BLK_DEVICE_ADDRESS 0x98
51 #define VID_BLK_I2C_ADDRESS 0x88
52 #define DIF_USE_BASEBAND 0xFFFFFFFF
54 /* Boards supported by driver */
55 #define CX231XX_BOARD_UNKNOWN 0
56 #define CX231XX_BOARD_CNXT_RDE_250 1
57 #define CX231XX_BOARD_CNXT_RDU_250 2
59 /* Limits minimum and default number of buffers */
60 #define CX231XX_MIN_BUF 4
61 #define CX231XX_DEF_BUF 12
62 #define CX231XX_DEF_VBI_BUF 6
64 #define VBI_LINE_COUNT 17
65 #define VBI_LINE_LENGTH 1440
67 /*Limits the max URB message size */
68 #define URB_MAX_CTRL_SIZE 80
70 /* Params for validated field */
71 #define CX231XX_BOARD_NOT_VALIDATED 1
72 #define CX231XX_BOARD_VALIDATED 0
74 /* maximum number of cx231xx boards */
75 #define CX231XX_MAXBOARDS 8
77 /* maximum number of frames that can be queued */
78 #define CX231XX_NUM_FRAMES 5
80 /* number of buffers for isoc transfers */
81 #define CX231XX_NUM_BUFS 8
83 /* number of packets for each buffer
84 windows requests only 40 packets .. so we better do the same
85 this is what I found out for all alternate numbers there!
87 #define CX231XX_NUM_PACKETS 40
89 /* default alternate; 0 means choose the best */
90 #define CX231XX_PINOUT 0
92 #define CX231XX_INTERLACED_DEFAULT 1
94 /* time to wait when stopping the isoc transfer */
95 #define CX231XX_URB_TIMEOUT \
96 msecs_to_jiffies(CX231XX_NUM_BUFS * CX231XX_NUM_PACKETS)
101 CX231XX_DIGITAL_MODE
,
104 enum cx231xx_std_mode
{
109 enum cx231xx_stream_state
{
117 struct cx231xx_usb_isoc_ctl
{
118 /* max packet size of isoc transaction */
121 /* number of allocated urbs */
124 /* urb for isoc transfers */
127 /* transfer buffers for isoc transfer */
128 char **transfer_buffer
;
130 /* Last buffer command and region */
132 int pos
, size
, pktsize
;
134 /* Last field: ODD or EVEN? */
137 /* Stores incomplete commands */
141 /* Stores already requested buffers */
142 struct cx231xx_buffer
*buf
;
144 /* Stores the number of received fields */
147 /* isoc urb callback */
148 int (*isoc_copy
) (struct cx231xx
*dev
, struct urb
*urb
);
153 u32 fourcc
; /* v4l2 format id */
158 /* buffer for one video frame */
159 struct cx231xx_buffer
{
160 /* common v4l buffer stuff -- must be first */
161 struct videobuf_buffer vb
;
163 struct list_head frame
;
168 struct cx231xx_dmaqueue
{
169 struct list_head active
;
170 struct list_head queued
;
172 wait_queue_head_t wq
;
174 /* Counters to control buffer fill */
180 u32 bytes_left_in_line
;
188 #define MAX_CX231XX_INPUT 4
191 CX231XX_VMUX_COMPOSITE1
= 1,
193 CX231XX_VMUX_TELEVISION
,
200 enum cx231xx_v_input
{
201 CX231XX_VIN_1_1
= 0x1,
205 CX231XX_VIN_1_2
= 0x01,
208 CX231XX_VIN_1_3
= 0x1,
213 /* cx231xx has two audio inputs: tuner and line in */
215 /* This is the only entry for cx231xx tuner input */
216 CX231XX_AMUX_VIDEO
, /* cx231xx tuner */
217 CX231XX_AMUX_LINE_IN
, /* Line In */
220 struct cx231xx_reg_seq
{
226 struct cx231xx_input
{
227 enum cx231xx_itype type
;
229 enum cx231xx_amux amux
;
230 struct cx231xx_reg_seq
*gpio
;
233 #define INPUT(nr) (&cx231xx_boards[dev->model].input[nr])
235 enum cx231xx_decoder
{
240 enum CX231XX_I2C_MASTER_PORT
{
247 struct cx231xx_board
{
252 v4l2_std_id norm
; /* tv norm */
256 u8 demod_xfer_mode
; /* 0 - Serial; 1 - parallel */
259 struct cx231xx_reg_seq
*dvb_gpio
;
260 struct cx231xx_reg_seq
*suspend_gpio
;
261 struct cx231xx_reg_seq
*tuner_gpio
;
267 u32 ctl_pin_status_mask
;
268 u8 agc_analog_digital_select_gpio
;
269 u32 gpio_pin_status_mask
;
275 unsigned int max_range_640_480
:1;
276 unsigned int has_dvb
:1;
277 unsigned int valid
:1;
279 unsigned char xclk
, i2c_speed
;
281 enum cx231xx_decoder decoder
;
283 struct cx231xx_input input
[MAX_CX231XX_INPUT
];
284 struct cx231xx_input radio
;
285 struct ir_scancode_table
*ir_codes
;
289 enum cx231xx_dev_state
{
290 DEV_INITIALIZED
= 0x01,
291 DEV_DISCONNECTED
= 0x02,
292 DEV_MISCONFIGURED
= 0x04,
306 AUDIO_INPUT_TUNER_TV
,
311 #define CX231XX_AUDIO_BUFS 5
312 #define CX231XX_NUM_AUDIO_PACKETS 64
313 #define CX231XX_CAPTURE_STREAM_EN 1
314 #define CX231XX_STOP_AUDIO 0
315 #define CX231XX_START_AUDIO 1
317 /* cx231xx extensions */
318 #define CX231XX_AUDIO 0x10
319 #define CX231XX_DVB 0x20
321 struct cx231xx_audio
{
323 char *transfer_buffer
[CX231XX_AUDIO_BUFS
];
324 struct urb
*urb
[CX231XX_AUDIO_BUFS
];
325 struct usb_device
*udev
;
326 unsigned int capture_transfer_done
;
327 struct snd_pcm_substream
*capture_pcm_substream
;
329 unsigned int hwptr_done_capture
;
330 struct snd_card
*sndcard
;
333 enum cx231xx_stream_state capture_stream
;
336 int alt
; /* alternate */
337 int max_pkt_size
; /* max packet size of isoc transaction */
338 int num_alt
; /* Number of alternative settings */
339 unsigned int *alt_max_pkt_size
; /* array of wMaxPacketSize */
347 unsigned int stream_on
:1; /* Locks streams */
350 struct videobuf_queue vb_vidq
;
352 enum v4l2_buf_type type
;
355 /*****************************************************************/
357 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */
358 #define I2C_SPEED_1M 0x0
359 #define I2C_SPEED_400K 0x1
360 #define I2C_SPEED_100K 0x2
361 #define I2C_SPEED_5M 0x3
363 /* 0-- STOP transaction */
365 /* 1-- do not transmit STOP at end of transaction */
366 #define I2C_NOSTOP 0x1
367 /* 1--alllow slave to insert clock wait states */
376 struct i2c_adapter i2c_adap
;
377 struct i2c_algo_bit_data i2c_algo
;
378 struct i2c_client i2c_client
;
381 /* different settings for each bus */
387 struct cx231xx_i2c_xfer_data
{
389 u8 direction
; /* 1 - IN, 0 - OUT */
390 u8 saddr_len
; /* sub address len */
391 u16 saddr_dat
; /* sub addr data */
392 u8 buf_size
; /* buffer size */
393 u8
*p_buffer
; /* pointer to the buffer */
396 struct VENDOR_REQUEST_IN
{
406 struct cx231xx_ctrl
{
407 struct v4l2_queryctrl v
;
418 Sliced_cc
, /* HANC */
424 struct cx231xx_video_mode
{
425 /* Isoc control struct */
426 struct cx231xx_dmaqueue vidq
;
427 struct cx231xx_usb_isoc_ctl isoc_ctl
;
431 int alt
; /* alternate */
432 int max_pkt_size
; /* max packet size of isoc transaction */
433 int num_alt
; /* Number of alternative settings */
434 unsigned int *alt_max_pkt_size
; /* array of wMaxPacketSize */
438 /* main device struct */
440 /* generic device properties */
441 char name
[30]; /* name (including minor) of the device */
442 int model
; /* index in the device_data struct */
443 int devno
; /* marks the number of this device */
445 struct cx231xx_board board
;
447 unsigned int stream_on
:1; /* Locks streams */
448 unsigned int vbi_stream_on
:1; /* Locks streams for VBI */
449 unsigned int has_audio_class
:1;
450 unsigned int has_alsa_audio
:1;
452 struct cx231xx_fmt
*format
;
454 struct v4l2_device v4l2_dev
;
455 struct v4l2_subdev
*sd_cx25840
;
456 struct v4l2_subdev
*sd_tuner
;
458 struct cx231xx_IR
*ir
;
460 struct list_head devlist
;
462 int tuner_type
; /* type of the tuner */
463 int tuner_addr
; /* tuner address */
465 /* I2C adapters: Master 1 & 2 (External) & Master 3 (Internal only) */
466 struct cx231xx_i2c i2c_bus
[3];
467 unsigned int xc_fw_load_done
:1;
468 struct mutex gpio_i2c_lock
;
470 /* video for linux */
471 int users
; /* user count for exclusive use */
472 struct video_device
*vdev
; /* video for linux device struct */
473 v4l2_std_id norm
; /* selected tv norm */
474 int ctl_freq
; /* selected frequency */
475 unsigned int ctl_ainput
; /* selected audio input */
479 /* frame properties */
480 int width
; /* current frame width */
481 int height
; /* current frame height */
482 unsigned hscale
; /* horizontal scale factor (see datasheet) */
483 unsigned vscale
; /* vertical scale factor (see datasheet) */
484 int interlaced
; /* 1=interlace fileds, 0=just top fileds */
486 struct cx231xx_audio adev
;
489 enum cx231xx_dev_state state
;
491 struct work_struct request_module_wk
;
495 struct mutex ctrl_urb_lock
; /* protects urb_buf */
496 struct list_head inqueue
, outqueue
;
497 wait_queue_head_t open
, wait_frame
, wait_stream
;
498 struct video_device
*vbi_dev
;
499 struct video_device
*radio_dev
;
501 unsigned char eedata
[256];
503 struct cx231xx_video_mode video_mode
;
504 struct cx231xx_video_mode vbi_mode
;
505 struct cx231xx_video_mode sliced_cc_mode
;
506 struct cx231xx_video_mode ts1_mode
;
508 struct usb_device
*udev
; /* the usb device */
509 char urb_buf
[URB_MAX_CTRL_SIZE
]; /* urb control msg buffer */
511 /* helper funcs that call usb_control_msg */
512 int (*cx231xx_read_ctrl_reg
) (struct cx231xx
*dev
, u8 req
, u16 reg
,
514 int (*cx231xx_write_ctrl_reg
) (struct cx231xx
*dev
, u8 req
, u16 reg
,
516 int (*cx231xx_send_usb_command
) (struct cx231xx_i2c
*i2c_bus
,
517 struct cx231xx_i2c_xfer_data
*req_data
);
518 int (*cx231xx_gpio_i2c_read
) (struct cx231xx
*dev
, u8 dev_addr
,
520 int (*cx231xx_gpio_i2c_write
) (struct cx231xx
*dev
, u8 dev_addr
,
523 int (*cx231xx_set_analog_freq
) (struct cx231xx
*dev
, u32 freq
);
524 int (*cx231xx_reset_analog_tuner
) (struct cx231xx
*dev
);
526 enum cx231xx_mode mode
;
528 struct cx231xx_dvb
*dvb
;
530 /* Cx231xx supported PCB config's */
531 struct pcb_config current_pcb_config
;
532 u8 current_scenario_idx
;
534 u8 max_iad_interface_count
;
536 /* GPIO related register direction and values */
544 enum AFE_MODE afe_mode
;
547 /* video related parameters */
550 u8 vbi_or_sliced_cc_mode
; /* 0 - vbi ; 1 - sliced cc mode */
551 enum cx231xx_std_mode std_mode
; /* 0 - Air; 1 - cable */
555 #define cx25840_call(cx231xx, o, f, args...) \
556 v4l2_subdev_call(cx231xx->sd_cx25840, o, f, ##args)
557 #define tuner_call(cx231xx, o, f, args...) \
558 v4l2_subdev_call(cx231xx->sd_tuner, o, f, ##args)
559 #define call_all(dev, o, f, args...) \
560 v4l2_device_call_until_err(&dev->v4l2_dev, 0, o, f, ##args)
563 struct list_head next
;
566 int (*init
) (struct cx231xx
*);
567 int (*fini
) (struct cx231xx
*);
570 /* call back functions in dvb module */
571 int cx231xx_set_analog_freq(struct cx231xx
*dev
, u32 freq
);
572 int cx231xx_reset_analog_tuner(struct cx231xx
*dev
);
574 /* Provided by cx231xx-i2c.c */
575 void cx231xx_do_i2c_scan(struct cx231xx
*dev
, struct i2c_client
*c
);
576 int cx231xx_i2c_register(struct cx231xx_i2c
*bus
);
577 int cx231xx_i2c_unregister(struct cx231xx_i2c
*bus
);
579 /* Internal block control functions */
580 int cx231xx_read_i2c_data(struct cx231xx
*dev
, u8 dev_addr
,
581 u16 saddr
, u8 saddr_len
, u32
*data
, u8 data_len
);
582 int cx231xx_write_i2c_data(struct cx231xx
*dev
, u8 dev_addr
,
583 u16 saddr
, u8 saddr_len
, u32 data
, u8 data_len
);
584 int cx231xx_reg_mask_write(struct cx231xx
*dev
, u8 dev_addr
, u8 size
,
585 u16 register_address
, u8 bit_start
, u8 bit_end
,
587 int cx231xx_read_modify_write_i2c_dword(struct cx231xx
*dev
, u8 dev_addr
,
588 u16 saddr
, u32 mask
, u32 value
);
589 u32
cx231xx_set_field(u32 field_mask
, u32 data
);
591 /* afe related functions */
592 int cx231xx_afe_init_super_block(struct cx231xx
*dev
, u32 ref_count
);
593 int cx231xx_afe_init_channels(struct cx231xx
*dev
);
594 int cx231xx_afe_setup_AFE_for_baseband(struct cx231xx
*dev
);
595 int cx231xx_afe_set_input_mux(struct cx231xx
*dev
, u32 input_mux
);
596 int cx231xx_afe_set_mode(struct cx231xx
*dev
, enum AFE_MODE mode
);
597 int cx231xx_afe_update_power_control(struct cx231xx
*dev
,
598 enum AV_MODE avmode
);
599 int cx231xx_afe_adjust_ref_count(struct cx231xx
*dev
, u32 video_input
);
601 /* i2s block related functions */
602 int cx231xx_i2s_blk_initialize(struct cx231xx
*dev
);
603 int cx231xx_i2s_blk_update_power_control(struct cx231xx
*dev
,
604 enum AV_MODE avmode
);
605 int cx231xx_i2s_blk_set_audio_input(struct cx231xx
*dev
, u8 audio_input
);
607 /* DIF related functions */
608 int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx
*dev
, u32 mode
,
609 u32 function_mode
, u32 standard
);
610 int cx231xx_dif_set_standard(struct cx231xx
*dev
, u32 standard
);
611 int cx231xx_tuner_pre_channel_change(struct cx231xx
*dev
);
612 int cx231xx_tuner_post_channel_change(struct cx231xx
*dev
);
614 /* video parser functions */
615 u8
cx231xx_find_next_SAV_EAV(u8
*p_buffer
, u32 buffer_size
,
617 u8
cx231xx_find_boundary_SAV_EAV(u8
*p_buffer
, u8
*partial_buf
,
619 int cx231xx_do_copy(struct cx231xx
*dev
, struct cx231xx_dmaqueue
*dma_q
,
620 u8
*p_buffer
, u32 bytes_to_copy
);
621 void cx231xx_reset_video_buffer(struct cx231xx
*dev
,
622 struct cx231xx_dmaqueue
*dma_q
);
623 u8
cx231xx_is_buffer_done(struct cx231xx
*dev
, struct cx231xx_dmaqueue
*dma_q
);
624 u32
cx231xx_copy_video_line(struct cx231xx
*dev
, struct cx231xx_dmaqueue
*dma_q
,
625 u8
*p_line
, u32 length
, int field_number
);
626 u32
cx231xx_get_video_line(struct cx231xx
*dev
, struct cx231xx_dmaqueue
*dma_q
,
627 u8 sav_eav
, u8
*p_buffer
, u32 buffer_size
);
628 void cx231xx_swab(u16
*from
, u16
*to
, u16 len
);
630 /* Provided by cx231xx-core.c */
632 u32
cx231xx_request_buffers(struct cx231xx
*dev
, u32 count
);
633 void cx231xx_queue_unusedframes(struct cx231xx
*dev
);
634 void cx231xx_release_buffers(struct cx231xx
*dev
);
636 /* read from control pipe */
637 int cx231xx_read_ctrl_reg(struct cx231xx
*dev
, u8 req
, u16 reg
,
640 /* write to control pipe */
641 int cx231xx_write_ctrl_reg(struct cx231xx
*dev
, u8 req
, u16 reg
,
643 int cx231xx_mode_register(struct cx231xx
*dev
, u16 address
, u32 mode
);
645 int cx231xx_send_vendor_cmd(struct cx231xx
*dev
,
646 struct VENDOR_REQUEST_IN
*ven_req
);
647 int cx231xx_send_usb_command(struct cx231xx_i2c
*i2c_bus
,
648 struct cx231xx_i2c_xfer_data
*req_data
);
650 /* Gpio related functions */
651 int cx231xx_send_gpio_cmd(struct cx231xx
*dev
, u32 gpio_bit
, u8
*gpio_val
,
652 u8 len
, u8 request
, u8 direction
);
653 int cx231xx_set_gpio_bit(struct cx231xx
*dev
, u32 gpio_bit
, u8
*gpio_val
);
654 int cx231xx_get_gpio_bit(struct cx231xx
*dev
, u32 gpio_bit
, u8
*gpio_val
);
655 int cx231xx_set_gpio_value(struct cx231xx
*dev
, int pin_number
, int pin_value
);
656 int cx231xx_set_gpio_direction(struct cx231xx
*dev
, int pin_number
,
659 int cx231xx_gpio_i2c_start(struct cx231xx
*dev
);
660 int cx231xx_gpio_i2c_end(struct cx231xx
*dev
);
661 int cx231xx_gpio_i2c_write_byte(struct cx231xx
*dev
, u8 data
);
662 int cx231xx_gpio_i2c_read_byte(struct cx231xx
*dev
, u8
*buf
);
663 int cx231xx_gpio_i2c_read_ack(struct cx231xx
*dev
);
664 int cx231xx_gpio_i2c_write_ack(struct cx231xx
*dev
);
665 int cx231xx_gpio_i2c_write_nak(struct cx231xx
*dev
);
667 int cx231xx_gpio_i2c_read(struct cx231xx
*dev
, u8 dev_addr
, u8
*buf
, u8 len
);
668 int cx231xx_gpio_i2c_write(struct cx231xx
*dev
, u8 dev_addr
, u8
*buf
, u8 len
);
670 /* audio related functions */
671 int cx231xx_set_audio_decoder_input(struct cx231xx
*dev
,
672 enum AUDIO_INPUT audio_input
);
674 int cx231xx_capture_start(struct cx231xx
*dev
, int start
, u8 media_type
);
675 int cx231xx_resolution_set(struct cx231xx
*dev
);
676 int cx231xx_set_video_alternate(struct cx231xx
*dev
);
677 int cx231xx_set_alt_setting(struct cx231xx
*dev
, u8 index
, u8 alt
);
678 int cx231xx_init_isoc(struct cx231xx
*dev
, int max_packets
,
679 int num_bufs
, int max_pkt_size
,
680 int (*isoc_copy
) (struct cx231xx
*dev
,
682 void cx231xx_uninit_isoc(struct cx231xx
*dev
);
683 int cx231xx_set_mode(struct cx231xx
*dev
, enum cx231xx_mode set_mode
);
684 int cx231xx_gpio_set(struct cx231xx
*dev
, struct cx231xx_reg_seq
*gpio
);
686 /* Device list functions */
687 void cx231xx_release_resources(struct cx231xx
*dev
);
688 void cx231xx_release_analog_resources(struct cx231xx
*dev
);
689 int cx231xx_register_analog_devices(struct cx231xx
*dev
);
690 void cx231xx_remove_from_devlist(struct cx231xx
*dev
);
691 void cx231xx_add_into_devlist(struct cx231xx
*dev
);
692 struct cx231xx
*cx231xx_get_device(int minor
,
693 enum v4l2_buf_type
*fh_type
, int *has_radio
);
694 void cx231xx_init_extension(struct cx231xx
*dev
);
695 void cx231xx_close_extension(struct cx231xx
*dev
);
697 /* hardware init functions */
698 int cx231xx_dev_init(struct cx231xx
*dev
);
699 void cx231xx_dev_uninit(struct cx231xx
*dev
);
700 void cx231xx_config_i2c(struct cx231xx
*dev
);
701 int cx231xx_config(struct cx231xx
*dev
);
703 /* Stream control functions */
704 int cx231xx_start_stream(struct cx231xx
*dev
, u32 ep_mask
);
705 int cx231xx_stop_stream(struct cx231xx
*dev
, u32 ep_mask
);
707 int cx231xx_initialize_stream_xfer(struct cx231xx
*dev
, u32 media_type
);
709 /* Power control functions */
710 int cx231xx_set_power_mode(struct cx231xx
*dev
, enum AV_MODE mode
);
711 int cx231xx_power_suspend(struct cx231xx
*dev
);
713 /* chip specific control functions */
714 int cx231xx_init_ctrl_pin_status(struct cx231xx
*dev
);
715 int cx231xx_set_agc_analog_digital_mux_select(struct cx231xx
*dev
,
716 u8 analog_or_digital
);
717 int cx231xx_enable_i2c_for_tuner(struct cx231xx
*dev
, u8 I2CIndex
);
719 /* video audio decoder related functions */
720 void video_mux(struct cx231xx
*dev
, int index
);
721 int cx231xx_set_video_input_mux(struct cx231xx
*dev
, u8 input
);
722 int cx231xx_set_decoder_video_input(struct cx231xx
*dev
, u8 pin_type
, u8 input
);
723 int cx231xx_do_mode_ctrl_overrides(struct cx231xx
*dev
);
724 int cx231xx_set_audio_input(struct cx231xx
*dev
, u8 input
);
726 /* Provided by cx231xx-video.c */
727 int cx231xx_register_extension(struct cx231xx_ops
*dev
);
728 void cx231xx_unregister_extension(struct cx231xx_ops
*dev
);
729 void cx231xx_init_extension(struct cx231xx
*dev
);
730 void cx231xx_close_extension(struct cx231xx
*dev
);
732 /* Provided by cx231xx-cards.c */
733 extern void cx231xx_pre_card_setup(struct cx231xx
*dev
);
734 extern void cx231xx_card_setup(struct cx231xx
*dev
);
735 extern struct cx231xx_board cx231xx_boards
[];
736 extern struct usb_device_id cx231xx_id_table
[];
737 extern const unsigned int cx231xx_bcount
;
738 void cx231xx_register_i2c_ir(struct cx231xx
*dev
);
739 int cx231xx_tuner_callback(void *ptr
, int component
, int command
, int arg
);
741 /* Provided by cx231xx-input.c */
742 int cx231xx_ir_init(struct cx231xx
*dev
);
743 int cx231xx_ir_fini(struct cx231xx
*dev
);
747 #define cx231xx_err(fmt, arg...) do {\
748 printk(KERN_ERR fmt , ##arg); } while (0)
750 #define cx231xx_errdev(fmt, arg...) do {\
751 printk(KERN_ERR "%s: "fmt,\
752 dev->name , ##arg); } while (0)
754 #define cx231xx_info(fmt, arg...) do {\
755 printk(KERN_INFO "%s: "fmt,\
756 dev->name , ##arg); } while (0)
757 #define cx231xx_warn(fmt, arg...) do {\
758 printk(KERN_WARNING "%s: "fmt,\
759 dev->name , ##arg); } while (0)
761 static inline unsigned int norm_maxw(struct cx231xx
*dev
)
763 if (dev
->board
.max_range_640_480
)
769 static inline unsigned int norm_maxh(struct cx231xx
*dev
)
771 if (dev
->board
.max_range_640_480
)
774 return (dev
->norm
& V4L2_STD_625_50
) ? 576 : 480;