cx25821-video.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. * Driver for the Conexant CX25821 PCIe bridge
  3. *
  4. * Copyright (C) 2009 Conexant Systems Inc.
  5. * Authors <shu.lin@conexant.com>, <hiep.huynh@conexant.com>
  6. * Based on Steven Toth <stoth@linuxtv.org> cx23885 driver
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. *
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */
  23. #ifndef CX25821_VIDEO_H_
  24. #define CX25821_VIDEO_H_
  25. #include <linux/init.h>
  26. #include <linux/list.h>
  27. #include <linux/module.h>
  28. #include <linux/moduleparam.h>
  29. #include <linux/kmod.h>
  30. #include <linux/kernel.h>
  31. #include <linux/slab.h>
  32. #include <linux/interrupt.h>
  33. #include <linux/delay.h>
  34. #include <linux/kthread.h>
  35. #include <asm/div64.h>
  36. #include "cx25821.h"
  37. #include <media/v4l2-common.h>
  38. #include <media/v4l2-ioctl.h>
  39. #define TUNER_FLAG
  40. #define VIDEO_DEBUG 0
  41. #define dprintk(level, fmt, arg...) \
  42. do { \
  43. if (VIDEO_DEBUG >= level) \
  44. printk(KERN_DEBUG "%s/0: " fmt, dev->name, ##arg); \
  45. } while (0)
  46. /* For IOCTL to identify running upstream */
  47. #define UPSTREAM_START_VIDEO 700
  48. #define UPSTREAM_STOP_VIDEO 701
  49. #define UPSTREAM_START_AUDIO 702
  50. #define UPSTREAM_STOP_AUDIO 703
  51. #define UPSTREAM_DUMP_REGISTERS 702
  52. #define SET_VIDEO_STD 800
  53. #define SET_PIXEL_FORMAT 1000
  54. #define ENABLE_CIF_RESOLUTION 1001
  55. #define REG_READ 900
  56. #define REG_WRITE 901
  57. #define MEDUSA_READ 910
  58. #define MEDUSA_WRITE 911
  59. extern struct sram_channel *channel0;
  60. extern struct sram_channel *channel1;
  61. extern struct sram_channel *channel2;
  62. extern struct sram_channel *channel3;
  63. extern struct sram_channel *channel4;
  64. extern struct sram_channel *channel5;
  65. extern struct sram_channel *channel6;
  66. extern struct sram_channel *channel7;
  67. extern struct sram_channel *channel9;
  68. extern struct sram_channel *channel10;
  69. extern struct sram_channel *channel11;
  70. extern struct video_device cx25821_videoioctl_template;
  71. /* extern const u32 *ctrl_classes[]; */
  72. extern unsigned int vid_limit;
  73. #define FORMAT_FLAGS_PACKED 0x01
  74. extern struct cx25821_fmt formats[];
  75. extern struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc);
  76. extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM];
  77. extern void cx25821_video_wakeup(struct cx25821_dev *dev,
  78. struct cx25821_dmaqueue *q, u32 count);
  79. #ifdef TUNER_FLAG
  80. extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm);
  81. #endif
  82. extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
  83. unsigned int bit);
  84. extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit);
  85. extern int cx25821_res_locked(struct cx25821_fh *fh, unsigned int bit);
  86. extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh,
  87. unsigned int bits);
  88. extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input);
  89. extern int cx25821_start_video_dma(struct cx25821_dev *dev,
  90. struct cx25821_dmaqueue *q,
  91. struct cx25821_buffer *buf,
  92. struct sram_channel *channel);
  93. extern int cx25821_set_scale(struct cx25821_dev *dev, unsigned int width,
  94. unsigned int height, enum v4l2_field field);
  95. extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status);
  96. extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num);
  97. extern int cx25821_video_register(struct cx25821_dev *dev);
  98. extern int cx25821_get_format_size(void);
  99. extern int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count,
  100. unsigned int *size);
  101. extern int cx25821_buffer_prepare(struct videobuf_queue *q,
  102. struct videobuf_buffer *vb,
  103. enum v4l2_field field);
  104. extern void cx25821_buffer_release(struct videobuf_queue *q,
  105. struct videobuf_buffer *vb);
  106. extern struct videobuf_queue *get_queue(struct cx25821_fh *fh);
  107. extern int cx25821_get_resource(struct cx25821_fh *fh, int resource);
  108. extern int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma);
  109. extern int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
  110. struct v4l2_format *f);
  111. extern int cx25821_vidioc_querycap(struct file *file, void *priv,
  112. struct v4l2_capability *cap);
  113. extern int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
  114. struct v4l2_fmtdesc *f);
  115. extern int cx25821_vidioc_reqbufs(struct file *file, void *priv,
  116. struct v4l2_requestbuffers *p);
  117. extern int cx25821_vidioc_querybuf(struct file *file, void *priv,
  118. struct v4l2_buffer *p);
  119. extern int cx25821_vidioc_qbuf(struct file *file, void *priv,
  120. struct v4l2_buffer *p);
  121. extern int cx25821_vidioc_s_std(struct file *file, void *priv,
  122. v4l2_std_id *tvnorms);
  123. extern int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i);
  124. extern int cx25821_vidioc_enum_input(struct file *file, void *priv,
  125. struct v4l2_input *i);
  126. extern int cx25821_vidioc_g_input(struct file *file, void *priv,
  127. unsigned int *i);
  128. extern int cx25821_vidioc_s_input(struct file *file, void *priv,
  129. unsigned int i);
  130. extern int cx25821_vidioc_g_ctrl(struct file *file, void *priv,
  131. struct v4l2_control *ctl);
  132. extern int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
  133. struct v4l2_format *f);
  134. extern int cx25821_vidioc_g_frequency(struct file *file, void *priv,
  135. struct v4l2_frequency *f);
  136. extern int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f);
  137. extern int cx25821_vidioc_s_frequency(struct file *file, void *priv,
  138. struct v4l2_frequency *f);
  139. extern int cx25821_vidioc_g_register(struct file *file, void *fh,
  140. struct v4l2_dbg_register *reg);
  141. extern int cx25821_vidioc_s_register(struct file *file, void *fh,
  142. struct v4l2_dbg_register *reg);
  143. extern int cx25821_vidioc_g_tuner(struct file *file, void *priv,
  144. struct v4l2_tuner *t);
  145. extern int cx25821_vidioc_s_tuner(struct file *file, void *priv,
  146. struct v4l2_tuner *t);
  147. extern int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm);
  148. extern int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm);
  149. extern int cx25821_vidioc_g_priority(struct file *file, void *f,
  150. enum v4l2_priority *p);
  151. extern int cx25821_vidioc_s_priority(struct file *file, void *f,
  152. enum v4l2_priority prio);
  153. extern int cx25821_vidioc_queryctrl(struct file *file, void *priv,
  154. struct v4l2_queryctrl *qctrl);
  155. extern int cx25821_set_control(struct cx25821_dev *dev,
  156. struct v4l2_control *ctrl, int chan_num);
  157. extern int cx25821_vidioc_cropcap(struct file *file, void *fh,
  158. struct v4l2_cropcap *cropcap);
  159. extern int cx25821_vidioc_s_crop(struct file *file, void *priv,
  160. const struct v4l2_crop *crop);
  161. extern int cx25821_vidioc_g_crop(struct file *file, void *priv,
  162. struct v4l2_crop *crop);
  163. extern int cx25821_vidioc_querystd(struct file *file, void *priv,
  164. v4l2_std_id *norm);
  165. #endif