ivtv-cards.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*
  2. Functions to query card hardware
  3. Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com>
  4. Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. /* hardware flags */
  18. #define IVTV_HW_CX25840 (1 << 0)
  19. #define IVTV_HW_SAA7115 (1 << 1)
  20. #define IVTV_HW_SAA7127 (1 << 2)
  21. #define IVTV_HW_MSP34XX (1 << 3)
  22. #define IVTV_HW_TUNER (1 << 4)
  23. #define IVTV_HW_WM8775 (1 << 5)
  24. #define IVTV_HW_CS53L32A (1 << 6)
  25. #define IVTV_HW_TVEEPROM (1 << 7)
  26. #define IVTV_HW_SAA7114 (1 << 8)
  27. #define IVTV_HW_TVAUDIO (1 << 9)
  28. #define IVTV_HW_UPD64031A (1 << 10)
  29. #define IVTV_HW_UPD6408X (1 << 11)
  30. #define IVTV_HW_SAA717X (1 << 12)
  31. #define IVTV_HW_WM8739 (1 << 13)
  32. #define IVTV_HW_VP27SMPX (1 << 14)
  33. #define IVTV_HW_GPIO (1 << 15)
  34. #define IVTV_HW_SAA711X (IVTV_HW_SAA7115 | IVTV_HW_SAA7114)
  35. /* video inputs */
  36. #define IVTV_CARD_INPUT_VID_TUNER 1
  37. #define IVTV_CARD_INPUT_SVIDEO1 2
  38. #define IVTV_CARD_INPUT_SVIDEO2 3
  39. #define IVTV_CARD_INPUT_COMPOSITE1 4
  40. #define IVTV_CARD_INPUT_COMPOSITE2 5
  41. #define IVTV_CARD_INPUT_COMPOSITE3 6
  42. /* audio inputs */
  43. #define IVTV_CARD_INPUT_AUD_TUNER 1
  44. #define IVTV_CARD_INPUT_LINE_IN1 2
  45. #define IVTV_CARD_INPUT_LINE_IN2 3
  46. #define IVTV_CARD_MAX_VIDEO_INPUTS 6
  47. #define IVTV_CARD_MAX_AUDIO_INPUTS 3
  48. #define IVTV_CARD_MAX_TUNERS 2
  49. /* SAA71XX HW inputs */
  50. #define IVTV_SAA71XX_COMPOSITE0 0
  51. #define IVTV_SAA71XX_COMPOSITE1 1
  52. #define IVTV_SAA71XX_COMPOSITE2 2
  53. #define IVTV_SAA71XX_COMPOSITE3 3
  54. #define IVTV_SAA71XX_COMPOSITE4 4
  55. #define IVTV_SAA71XX_COMPOSITE5 5
  56. #define IVTV_SAA71XX_SVIDEO0 6
  57. #define IVTV_SAA71XX_SVIDEO1 7
  58. #define IVTV_SAA71XX_SVIDEO2 8
  59. #define IVTV_SAA71XX_SVIDEO3 9
  60. /* SAA717X needs to mark the tuner input by ORing with this flag */
  61. #define IVTV_SAA717X_TUNER_FLAG 0x80
  62. /* Dummy HW input */
  63. #define IVTV_DUMMY_AUDIO 0
  64. /* GPIO HW inputs */
  65. #define IVTV_GPIO_TUNER 0
  66. #define IVTV_GPIO_LINE_IN 1
  67. /* SAA717X HW inputs */
  68. #define IVTV_SAA717X_IN0 0
  69. #define IVTV_SAA717X_IN1 1
  70. #define IVTV_SAA717X_IN2 2
  71. /* V4L2 capability aliases */
  72. #define IVTV_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
  73. V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \
  74. V4L2_CAP_SLICED_VBI_CAPTURE)
  75. #define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \
  76. V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY)
  77. struct ivtv_card_video_input {
  78. u8 video_type; /* video input type */
  79. u8 audio_index; /* index in ivtv_card_audio_input array */
  80. u16 video_input; /* hardware video input */
  81. };
  82. struct ivtv_card_audio_input {
  83. u8 audio_type; /* audio input type */
  84. u32 audio_input; /* hardware audio input */
  85. u16 muxer_input; /* hardware muxer input for boards with a
  86. multiplexer chip */
  87. };
  88. struct ivtv_card_output {
  89. u8 name[32];
  90. u16 video_output; /* hardware video output */
  91. };
  92. struct ivtv_card_pci_info {
  93. u16 device;
  94. u16 subsystem_vendor;
  95. u16 subsystem_device;
  96. };
  97. /* GPIO definitions */
  98. /* The mask is the set of bits used by the operation */
  99. struct ivtv_gpio_init { /* set initial GPIO DIR and OUT values */
  100. u16 direction; /* DIR setting. Leave to 0 if no init is needed */
  101. u16 initial_value;
  102. };
  103. struct ivtv_gpio_video_input { /* select tuner/line in input */
  104. u16 mask; /* leave to 0 if not supported */
  105. u16 tuner;
  106. u16 composite;
  107. u16 svideo;
  108. };
  109. struct ivtv_gpio_audio_input { /* select tuner/line in input */
  110. u16 mask; /* leave to 0 if not supported */
  111. u16 tuner;
  112. u16 linein;
  113. u16 radio;
  114. };
  115. struct ivtv_gpio_audio_mute {
  116. u16 mask; /* leave to 0 if not supported */
  117. u16 mute; /* set this value to mute, 0 to unmute */
  118. };
  119. struct ivtv_gpio_audio_mode {
  120. u16 mask; /* leave to 0 if not supported */
  121. u16 mono; /* set audio to mono */
  122. u16 stereo; /* set audio to stereo */
  123. u16 lang1; /* set audio to the first language */
  124. u16 lang2; /* set audio to the second language */
  125. u16 both; /* both languages are output */
  126. };
  127. struct ivtv_gpio_audio_freq {
  128. u16 mask; /* leave to 0 if not supported */
  129. u16 f32000;
  130. u16 f44100;
  131. u16 f48000;
  132. };
  133. struct ivtv_gpio_audio_detect {
  134. u16 mask; /* leave to 0 if not supported */
  135. u16 stereo; /* if the input matches this value then
  136. stereo is detected */
  137. };
  138. struct ivtv_card_tuner {
  139. v4l2_std_id std; /* standard for which the tuner is suitable */
  140. int tuner; /* tuner ID (from tuner.h) */
  141. };
  142. /* for card information/parameters */
  143. struct ivtv_card {
  144. int type;
  145. char *name;
  146. u32 v4l2_capabilities;
  147. u32 hw_video; /* hardware used to process video */
  148. u32 hw_audio; /* hardware used to process audio */
  149. u32 hw_audio_ctrl; /* hardware used for the V4L2 controls (only 1 dev allowed) */
  150. u32 hw_muxer; /* hardware used to multiplex audio input */
  151. u32 hw_all; /* all hardware used by the board */
  152. struct ivtv_card_video_input video_inputs[IVTV_CARD_MAX_VIDEO_INPUTS];
  153. struct ivtv_card_audio_input audio_inputs[IVTV_CARD_MAX_AUDIO_INPUTS];
  154. struct ivtv_card_audio_input radio_input;
  155. int nof_outputs;
  156. const struct ivtv_card_output *video_outputs;
  157. u8 gr_config; /* config byte for the ghost reduction device */
  158. /* GPIO card-specific settings */
  159. struct ivtv_gpio_init gpio_init;
  160. struct ivtv_gpio_video_input gpio_video_input;
  161. struct ivtv_gpio_audio_input gpio_audio_input;
  162. struct ivtv_gpio_audio_mute gpio_audio_mute;
  163. struct ivtv_gpio_audio_mode gpio_audio_mode;
  164. struct ivtv_gpio_audio_freq gpio_audio_freq;
  165. struct ivtv_gpio_audio_detect gpio_audio_detect;
  166. struct ivtv_card_tuner tuners[IVTV_CARD_MAX_TUNERS];
  167. /* list of device and subsystem vendor/devices that
  168. correspond to this card type. */
  169. const struct ivtv_card_pci_info *pci_list;
  170. };
  171. int ivtv_get_input(struct ivtv *itv, u16 index, struct v4l2_input *input);
  172. int ivtv_get_output(struct ivtv *itv, u16 index, struct v4l2_output *output);
  173. int ivtv_get_audio_input(struct ivtv *itv, u16 index, struct v4l2_audio *input);
  174. int ivtv_get_audio_output(struct ivtv *itv, u16 index, struct v4l2_audioout *output);
  175. const struct ivtv_card *ivtv_get_card(u16 index);