cx88.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. /*
  2. *
  3. * v4l2 device driver for cx2388x based TV cards
  4. *
  5. * (c) 2003,04 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs]
  6. *
  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.
  11. *
  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.
  16. *
  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.
  20. */
  21. #include <linux/pci.h>
  22. #include <linux/i2c.h>
  23. #include <linux/i2c-algo-bit.h>
  24. #include <linux/videodev2.h>
  25. #include <linux/kdev_t.h>
  26. #include <media/v4l2-common.h>
  27. #include <media/tuner.h>
  28. #include <media/tveeprom.h>
  29. #include <media/videobuf-dma-sg.h>
  30. #include <media/v4l2-chip-ident.h>
  31. #include <media/cx2341x.h>
  32. #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
  33. #include <media/videobuf-dvb.h>
  34. #endif
  35. #include "btcx-risc.h"
  36. #include "cx88-reg.h"
  37. #include "tuner-xc2028.h"
  38. #include <linux/version.h>
  39. #include <linux/mutex.h>
  40. #define CX88_VERSION_CODE KERNEL_VERSION(0,0,6)
  41. #define UNSET (-1U)
  42. #define CX88_MAXBOARDS 8
  43. /* Max number of inputs by card */
  44. #define MAX_CX88_INPUT 8
  45. /* ----------------------------------------------------------- */
  46. /* defines and enums */
  47. /* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM B/G/H/LC */
  48. #define CX88_NORMS (\
  49. V4L2_STD_NTSC_M| V4L2_STD_NTSC_M_JP| V4L2_STD_NTSC_443 | \
  50. V4L2_STD_PAL_BG| V4L2_STD_PAL_DK | V4L2_STD_PAL_I | \
  51. V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | \
  52. V4L2_STD_PAL_60| V4L2_STD_SECAM_L | V4L2_STD_SECAM_DK | \
  53. V4L2_STD_SECAM_B| V4L2_STD_SECAM_G | V4L2_STD_SECAM_H )
  54. #define FORMAT_FLAGS_PACKED 0x01
  55. #define FORMAT_FLAGS_PLANAR 0x02
  56. #define VBI_LINE_COUNT 17
  57. #define VBI_LINE_LENGTH 2048
  58. /* need "shadow" registers for some write-only ones ... */
  59. #define SHADOW_AUD_VOL_CTL 1
  60. #define SHADOW_AUD_BAL_CTL 2
  61. #define SHADOW_MAX 3
  62. /* FM Radio deemphasis type */
  63. enum cx88_deemph_type {
  64. FM_NO_DEEMPH = 0,
  65. FM_DEEMPH_50,
  66. FM_DEEMPH_75
  67. };
  68. enum cx88_board_type {
  69. CX88_BOARD_NONE = 0,
  70. CX88_MPEG_DVB,
  71. CX88_MPEG_BLACKBIRD
  72. };
  73. enum cx8802_board_access {
  74. CX8802_DRVCTL_SHARED = 1,
  75. CX8802_DRVCTL_EXCLUSIVE = 2,
  76. };
  77. /* ----------------------------------------------------------- */
  78. /* tv norms */
  79. static unsigned int inline norm_maxw(v4l2_std_id norm)
  80. {
  81. return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768;
  82. }
  83. static unsigned int inline norm_maxh(v4l2_std_id norm)
  84. {
  85. return (norm & V4L2_STD_625_50) ? 576 : 480;
  86. }
  87. /* ----------------------------------------------------------- */
  88. /* static data */
  89. struct cx8800_fmt {
  90. char *name;
  91. u32 fourcc; /* v4l2 format id */
  92. int depth;
  93. int flags;
  94. u32 cxformat;
  95. };
  96. struct cx88_ctrl {
  97. struct v4l2_queryctrl v;
  98. u32 off;
  99. u32 reg;
  100. u32 sreg;
  101. u32 mask;
  102. u32 shift;
  103. };
  104. /* ----------------------------------------------------------- */
  105. /* SRAM memory management data (see cx88-core.c) */
  106. #define SRAM_CH21 0 /* video */
  107. #define SRAM_CH22 1
  108. #define SRAM_CH23 2
  109. #define SRAM_CH24 3 /* vbi */
  110. #define SRAM_CH25 4 /* audio */
  111. #define SRAM_CH26 5
  112. #define SRAM_CH28 6 /* mpeg */
  113. /* more */
  114. struct sram_channel {
  115. char *name;
  116. u32 cmds_start;
  117. u32 ctrl_start;
  118. u32 cdt;
  119. u32 fifo_start;
  120. u32 fifo_size;
  121. u32 ptr1_reg;
  122. u32 ptr2_reg;
  123. u32 cnt1_reg;
  124. u32 cnt2_reg;
  125. };
  126. extern struct sram_channel cx88_sram_channels[];
  127. /* ----------------------------------------------------------- */
  128. /* card configuration */
  129. #define CX88_BOARD_NOAUTO UNSET
  130. #define CX88_BOARD_UNKNOWN 0
  131. #define CX88_BOARD_HAUPPAUGE 1
  132. #define CX88_BOARD_GDI 2
  133. #define CX88_BOARD_PIXELVIEW 3
  134. #define CX88_BOARD_ATI_WONDER_PRO 4
  135. #define CX88_BOARD_WINFAST2000XP_EXPERT 5
  136. #define CX88_BOARD_AVERTV_STUDIO_303 6
  137. #define CX88_BOARD_MSI_TVANYWHERE_MASTER 7
  138. #define CX88_BOARD_WINFAST_DV2000 8
  139. #define CX88_BOARD_LEADTEK_PVR2000 9
  140. #define CX88_BOARD_IODATA_GVVCP3PCI 10
  141. #define CX88_BOARD_PROLINK_PLAYTVPVR 11
  142. #define CX88_BOARD_ASUS_PVR_416 12
  143. #define CX88_BOARD_MSI_TVANYWHERE 13
  144. #define CX88_BOARD_KWORLD_DVB_T 14
  145. #define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1 15
  146. #define CX88_BOARD_KWORLD_LTV883 16
  147. #define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q 17
  148. #define CX88_BOARD_HAUPPAUGE_DVB_T1 18
  149. #define CX88_BOARD_CONEXANT_DVB_T1 19
  150. #define CX88_BOARD_PROVIDEO_PV259 20
  151. #define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS 21
  152. #define CX88_BOARD_PCHDTV_HD3000 22
  153. #define CX88_BOARD_DNTV_LIVE_DVB_T 23
  154. #define CX88_BOARD_HAUPPAUGE_ROSLYN 24
  155. #define CX88_BOARD_DIGITALLOGIC_MEC 25
  156. #define CX88_BOARD_IODATA_GVBCTV7E 26
  157. #define CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO 27
  158. #define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28
  159. #define CX88_BOARD_ADSTECH_DVB_T_PCI 29
  160. #define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30
  161. #define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31
  162. #define CX88_BOARD_AVERMEDIA_ULTRATV_MC_550 32
  163. #define CX88_BOARD_KWORLD_VSTREAM_EXPERT_DVD 33
  164. #define CX88_BOARD_ATI_HDTVWONDER 34
  165. #define CX88_BOARD_WINFAST_DTV1000 35
  166. #define CX88_BOARD_AVERTV_303 36
  167. #define CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1 37
  168. #define CX88_BOARD_HAUPPAUGE_NOVASE2_S1 38
  169. #define CX88_BOARD_KWORLD_DVBS_100 39
  170. #define CX88_BOARD_HAUPPAUGE_HVR1100 40
  171. #define CX88_BOARD_HAUPPAUGE_HVR1100LP 41
  172. #define CX88_BOARD_DNTV_LIVE_DVB_T_PRO 42
  173. #define CX88_BOARD_KWORLD_DVB_T_CX22702 43
  174. #define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL 44
  175. #define CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT 45
  176. #define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID 46
  177. #define CX88_BOARD_PCHDTV_HD5500 47
  178. #define CX88_BOARD_KWORLD_MCE200_DELUXE 48
  179. #define CX88_BOARD_PIXELVIEW_PLAYTV_P7000 49
  180. #define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50
  181. #define CX88_BOARD_WINFAST_DTV2000H 51
  182. #define CX88_BOARD_GENIATECH_DVBS 52
  183. #define CX88_BOARD_HAUPPAUGE_HVR3000 53
  184. #define CX88_BOARD_NORWOOD_MICRO 54
  185. #define CX88_BOARD_TE_DTV_250_OEM_SWANN 55
  186. #define CX88_BOARD_HAUPPAUGE_HVR1300 56
  187. #define CX88_BOARD_ADSTECH_PTV_390 57
  188. #define CX88_BOARD_PINNACLE_PCTV_HD_800i 58
  189. #define CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO 59
  190. #define CX88_BOARD_PINNACLE_HYBRID_PCTV 60
  191. #define CX88_BOARD_WINFAST_TV2000_XP_GLOBAL 61
  192. #define CX88_BOARD_POWERCOLOR_REAL_ANGEL 62
  193. #define CX88_BOARD_GENIATECH_X8000_MT 63
  194. #define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PRO 64
  195. #define CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD 65
  196. #define CX88_BOARD_PROLINK_PV_8000GT 66
  197. #define CX88_BOARD_KWORLD_ATSC_120 67
  198. #define CX88_BOARD_HAUPPAUGE_HVR4000 68
  199. #define CX88_BOARD_HAUPPAUGE_HVR4000LITE 69
  200. #define CX88_BOARD_TEVII_S460 70
  201. #define CX88_BOARD_OMICOM_SS4_PCI 71
  202. #define CX88_BOARD_TBS_8920 72
  203. #define CX88_BOARD_TEVII_S420 73
  204. #define CX88_BOARD_PROLINK_PV_GLOBAL_XTREME 74
  205. #define CX88_BOARD_PROF_7300 75
  206. enum cx88_itype {
  207. CX88_VMUX_COMPOSITE1 = 1,
  208. CX88_VMUX_COMPOSITE2,
  209. CX88_VMUX_COMPOSITE3,
  210. CX88_VMUX_COMPOSITE4,
  211. CX88_VMUX_SVIDEO,
  212. CX88_VMUX_TELEVISION,
  213. CX88_VMUX_CABLE,
  214. CX88_VMUX_DVB,
  215. CX88_VMUX_DEBUG,
  216. CX88_RADIO,
  217. };
  218. struct cx88_input {
  219. enum cx88_itype type;
  220. u32 gpio0, gpio1, gpio2, gpio3;
  221. unsigned int vmux:2;
  222. unsigned int audioroute:4;
  223. };
  224. struct cx88_board {
  225. char *name;
  226. unsigned int tuner_type;
  227. unsigned int radio_type;
  228. unsigned char tuner_addr;
  229. unsigned char radio_addr;
  230. int tda9887_conf;
  231. struct cx88_input input[MAX_CX88_INPUT];
  232. struct cx88_input radio;
  233. enum cx88_board_type mpeg;
  234. unsigned int audio_chip;
  235. int num_frontends;
  236. };
  237. struct cx88_subid {
  238. u16 subvendor;
  239. u16 subdevice;
  240. u32 card;
  241. };
  242. #define INPUT(nr) (core->board.input[nr])
  243. /* ----------------------------------------------------------- */
  244. /* device / file handle status */
  245. #define RESOURCE_OVERLAY 1
  246. #define RESOURCE_VIDEO 2
  247. #define RESOURCE_VBI 4
  248. #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */
  249. /* buffer for one video frame */
  250. struct cx88_buffer {
  251. /* common v4l buffer stuff -- must be first */
  252. struct videobuf_buffer vb;
  253. /* cx88 specific */
  254. unsigned int bpl;
  255. struct btcx_riscmem risc;
  256. struct cx8800_fmt *fmt;
  257. u32 count;
  258. };
  259. struct cx88_dmaqueue {
  260. struct list_head active;
  261. struct list_head queued;
  262. struct timer_list timeout;
  263. struct btcx_riscmem stopper;
  264. u32 count;
  265. };
  266. struct cx88_core {
  267. struct list_head devlist;
  268. atomic_t refcount;
  269. /* board name */
  270. int nr;
  271. char name[32];
  272. /* pci stuff */
  273. int pci_bus;
  274. int pci_slot;
  275. u32 __iomem *lmmio;
  276. u8 __iomem *bmmio;
  277. u32 shadow[SHADOW_MAX];
  278. int pci_irqmask;
  279. /* i2c i/o */
  280. struct i2c_adapter i2c_adap;
  281. struct i2c_algo_bit_data i2c_algo;
  282. struct i2c_client i2c_client;
  283. u32 i2c_state, i2c_rc;
  284. /* config info -- analog */
  285. unsigned int boardnr;
  286. struct cx88_board board;
  287. /* Supported V4L _STD_ tuner formats */
  288. unsigned int tuner_formats;
  289. /* config info -- dvb */
  290. #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
  291. int (*prev_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
  292. #endif
  293. /* state info */
  294. struct task_struct *kthread;
  295. v4l2_std_id tvnorm;
  296. u32 tvaudio;
  297. u32 audiomode_manual;
  298. u32 audiomode_current;
  299. u32 input;
  300. u32 astat;
  301. u32 use_nicam;
  302. /* IR remote control state */
  303. struct cx88_IR *ir;
  304. struct mutex lock;
  305. /* various v4l controls */
  306. u32 freq;
  307. atomic_t users;
  308. atomic_t mpeg_users;
  309. /* cx88-video needs to access cx8802 for hybrid tuner pll access. */
  310. struct cx8802_dev *dvbdev;
  311. enum cx88_board_type active_type_id;
  312. int active_ref;
  313. int active_fe_id;
  314. };
  315. struct cx8800_dev;
  316. struct cx8802_dev;
  317. /* ----------------------------------------------------------- */
  318. /* function 0: video stuff */
  319. struct cx8800_fh {
  320. struct cx8800_dev *dev;
  321. enum v4l2_buf_type type;
  322. int radio;
  323. unsigned int resources;
  324. /* video overlay */
  325. struct v4l2_window win;
  326. struct v4l2_clip *clips;
  327. unsigned int nclips;
  328. /* video capture */
  329. struct cx8800_fmt *fmt;
  330. unsigned int width,height;
  331. struct videobuf_queue vidq;
  332. /* vbi capture */
  333. struct videobuf_queue vbiq;
  334. };
  335. struct cx8800_suspend_state {
  336. int disabled;
  337. };
  338. struct cx8800_dev {
  339. struct cx88_core *core;
  340. struct list_head devlist;
  341. spinlock_t slock;
  342. /* various device info */
  343. unsigned int resources;
  344. struct video_device *video_dev;
  345. struct video_device *vbi_dev;
  346. struct video_device *radio_dev;
  347. /* pci i/o */
  348. struct pci_dev *pci;
  349. unsigned char pci_rev,pci_lat;
  350. /* capture queues */
  351. struct cx88_dmaqueue vidq;
  352. struct cx88_dmaqueue vbiq;
  353. /* various v4l controls */
  354. /* other global state info */
  355. struct cx8800_suspend_state state;
  356. };
  357. /* ----------------------------------------------------------- */
  358. /* function 1: audio/alsa stuff */
  359. /* =============> moved to cx88-alsa.c <====================== */
  360. /* ----------------------------------------------------------- */
  361. /* function 2: mpeg stuff */
  362. struct cx8802_fh {
  363. struct cx8802_dev *dev;
  364. struct videobuf_queue mpegq;
  365. };
  366. struct cx8802_suspend_state {
  367. int disabled;
  368. };
  369. struct cx8802_driver {
  370. struct cx88_core *core;
  371. /* List of drivers attached to device */
  372. struct list_head drvlist;
  373. /* Type of driver and access required */
  374. enum cx88_board_type type_id;
  375. enum cx8802_board_access hw_access;
  376. /* MPEG 8802 internal only */
  377. int (*suspend)(struct pci_dev *pci_dev, pm_message_t state);
  378. int (*resume)(struct pci_dev *pci_dev);
  379. /* MPEG 8802 -> mini driver - Driver probe and configuration */
  380. int (*probe)(struct cx8802_driver *drv);
  381. int (*remove)(struct cx8802_driver *drv);
  382. /* MPEG 8802 -> mini driver - Access for hardware control */
  383. int (*advise_acquire)(struct cx8802_driver *drv);
  384. int (*advise_release)(struct cx8802_driver *drv);
  385. /* MPEG 8802 <- mini driver - Access for hardware control */
  386. int (*request_acquire)(struct cx8802_driver *drv);
  387. int (*request_release)(struct cx8802_driver *drv);
  388. };
  389. struct cx8802_dev {
  390. struct cx88_core *core;
  391. spinlock_t slock;
  392. /* pci i/o */
  393. struct pci_dev *pci;
  394. unsigned char pci_rev,pci_lat;
  395. /* dma queues */
  396. struct cx88_dmaqueue mpegq;
  397. u32 ts_packet_size;
  398. u32 ts_packet_count;
  399. /* other global state info */
  400. struct cx8802_suspend_state state;
  401. /* for blackbird only */
  402. struct list_head devlist;
  403. #if defined(CONFIG_VIDEO_CX88_BLACKBIRD) || \
  404. defined(CONFIG_VIDEO_CX88_BLACKBIRD_MODULE)
  405. struct video_device *mpeg_dev;
  406. u32 mailbox;
  407. int width;
  408. int height;
  409. unsigned char mpeg_active; /* nonzero if mpeg encoder is active */
  410. /* mpeg params */
  411. struct cx2341x_mpeg_params params;
  412. #endif
  413. #if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
  414. /* for dvb only */
  415. struct videobuf_dvb_frontends frontends;
  416. #endif
  417. #if defined(CONFIG_VIDEO_CX88_VP3054) || \
  418. defined(CONFIG_VIDEO_CX88_VP3054_MODULE)
  419. /* For VP3045 secondary I2C bus support */
  420. struct vp3054_i2c_state *vp3054;
  421. #endif
  422. /* for switching modulation types */
  423. unsigned char ts_gen_cntrl;
  424. /* List of attached drivers */
  425. struct list_head drvlist;
  426. struct work_struct request_module_wk;
  427. };
  428. /* ----------------------------------------------------------- */
  429. #define cx_read(reg) readl(core->lmmio + ((reg)>>2))
  430. #define cx_write(reg,value) writel((value), core->lmmio + ((reg)>>2))
  431. #define cx_writeb(reg,value) writeb((value), core->bmmio + (reg))
  432. #define cx_andor(reg,mask,value) \
  433. writel((readl(core->lmmio+((reg)>>2)) & ~(mask)) |\
  434. ((value) & (mask)), core->lmmio+((reg)>>2))
  435. #define cx_set(reg,bit) cx_andor((reg),(bit),(bit))
  436. #define cx_clear(reg,bit) cx_andor((reg),(bit),0)
  437. #define cx_wait(d) { if (need_resched()) schedule(); else udelay(d); }
  438. /* shadow registers */
  439. #define cx_sread(sreg) (core->shadow[sreg])
  440. #define cx_swrite(sreg,reg,value) \
  441. (core->shadow[sreg] = value, \
  442. writel(core->shadow[sreg], core->lmmio + ((reg)>>2)))
  443. #define cx_sandor(sreg,reg,mask,value) \
  444. (core->shadow[sreg] = (core->shadow[sreg] & ~(mask)) | ((value) & (mask)), \
  445. writel(core->shadow[sreg], core->lmmio + ((reg)>>2)))
  446. /* ----------------------------------------------------------- */
  447. /* cx88-core.c */
  448. extern void cx88_print_irqbits(char *name, char *tag, char **strings,
  449. int len, u32 bits, u32 mask);
  450. extern int cx88_core_irq(struct cx88_core *core, u32 status);
  451. extern void cx88_wakeup(struct cx88_core *core,
  452. struct cx88_dmaqueue *q, u32 count);
  453. extern void cx88_shutdown(struct cx88_core *core);
  454. extern int cx88_reset(struct cx88_core *core);
  455. extern int
  456. cx88_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc,
  457. struct scatterlist *sglist,
  458. unsigned int top_offset, unsigned int bottom_offset,
  459. unsigned int bpl, unsigned int padding, unsigned int lines);
  460. extern int
  461. cx88_risc_databuffer(struct pci_dev *pci, struct btcx_riscmem *risc,
  462. struct scatterlist *sglist, unsigned int bpl,
  463. unsigned int lines, unsigned int lpi);
  464. extern int
  465. cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
  466. u32 reg, u32 mask, u32 value);
  467. extern void
  468. cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf);
  469. extern void cx88_risc_disasm(struct cx88_core *core,
  470. struct btcx_riscmem *risc);
  471. extern int cx88_sram_channel_setup(struct cx88_core *core,
  472. struct sram_channel *ch,
  473. unsigned int bpl, u32 risc);
  474. extern void cx88_sram_channel_dump(struct cx88_core *core,
  475. struct sram_channel *ch);
  476. extern int cx88_set_scale(struct cx88_core *core, unsigned int width,
  477. unsigned int height, enum v4l2_field field);
  478. extern int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm);
  479. extern struct video_device *cx88_vdev_init(struct cx88_core *core,
  480. struct pci_dev *pci,
  481. struct video_device *template,
  482. char *type);
  483. extern struct cx88_core* cx88_core_get(struct pci_dev *pci);
  484. extern void cx88_core_put(struct cx88_core *core,
  485. struct pci_dev *pci);
  486. extern int cx88_start_audio_dma(struct cx88_core *core);
  487. extern int cx88_stop_audio_dma(struct cx88_core *core);
  488. /* ----------------------------------------------------------- */
  489. /* cx88-vbi.c */
  490. /* Can be used as g_vbi_fmt, try_vbi_fmt and s_vbi_fmt */
  491. int cx8800_vbi_fmt (struct file *file, void *priv,
  492. struct v4l2_format *f);
  493. /*
  494. int cx8800_start_vbi_dma(struct cx8800_dev *dev,
  495. struct cx88_dmaqueue *q,
  496. struct cx88_buffer *buf);
  497. */
  498. int cx8800_stop_vbi_dma(struct cx8800_dev *dev);
  499. int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
  500. struct cx88_dmaqueue *q);
  501. void cx8800_vbi_timeout(unsigned long data);
  502. extern struct videobuf_queue_ops cx8800_vbi_qops;
  503. /* ----------------------------------------------------------- */
  504. /* cx88-i2c.c */
  505. extern int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci);
  506. extern void cx88_call_i2c_clients(struct cx88_core *core,
  507. unsigned int cmd, void *arg);
  508. /* ----------------------------------------------------------- */
  509. /* cx88-cards.c */
  510. extern int cx88_tuner_callback(void *dev, int component, int command, int arg);
  511. extern int cx88_get_resources(const struct cx88_core *core,
  512. struct pci_dev *pci);
  513. extern struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr);
  514. extern void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl);
  515. /* ----------------------------------------------------------- */
  516. /* cx88-tvaudio.c */
  517. #define WW_NONE 1
  518. #define WW_BTSC 2
  519. #define WW_BG 3
  520. #define WW_DK 4
  521. #define WW_I 5
  522. #define WW_L 6
  523. #define WW_EIAJ 7
  524. #define WW_I2SPT 8
  525. #define WW_FM 9
  526. #define WW_I2SADC 10
  527. void cx88_set_tvaudio(struct cx88_core *core);
  528. void cx88_newstation(struct cx88_core *core);
  529. void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t);
  530. void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual);
  531. int cx88_audio_thread(void *data);
  532. int cx8802_register_driver(struct cx8802_driver *drv);
  533. int cx8802_unregister_driver(struct cx8802_driver *drv);
  534. struct cx8802_dev * cx8802_get_device(struct inode *inode);
  535. struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype);
  536. /* ----------------------------------------------------------- */
  537. /* cx88-input.c */
  538. int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci);
  539. int cx88_ir_fini(struct cx88_core *core);
  540. void cx88_ir_irq(struct cx88_core *core);
  541. void cx88_ir_start(struct cx88_core *core, struct cx88_IR *ir);
  542. void cx88_ir_stop(struct cx88_core *core, struct cx88_IR *ir);
  543. /* ----------------------------------------------------------- */
  544. /* cx88-mpeg.c */
  545. int cx8802_buf_prepare(struct videobuf_queue *q,struct cx8802_dev *dev,
  546. struct cx88_buffer *buf, enum v4l2_field field);
  547. void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf);
  548. void cx8802_cancel_buffers(struct cx8802_dev *dev);
  549. /* ----------------------------------------------------------- */
  550. /* cx88-video.c*/
  551. extern const u32 cx88_user_ctrls[];
  552. extern int cx8800_ctrl_query(struct cx88_core *core,
  553. struct v4l2_queryctrl *qctrl);
  554. int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i);
  555. int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f);
  556. int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl);
  557. int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl);
  558. int cx88_video_mux(struct cx88_core *core, unsigned int input);
  559. /*
  560. * Local variables:
  561. * c-basic-offset: 8
  562. * End:
  563. * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off
  564. */