cx18-cards.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * cx18 functions to query card hardware
  3. *
  4. * Derived from ivtv-cards.c
  5. *
  6. * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
  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. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. /* hardware flags */
  23. #define CX18_HW_TUNER (1 << 0)
  24. #define CX18_HW_TVEEPROM (1 << 1)
  25. #define CX18_HW_CS5345 (1 << 2)
  26. #define CX18_HW_GPIO (1 << 3)
  27. #define CX18_HW_CX23418 (1 << 4)
  28. #define CX18_HW_DVB (1 << 5)
  29. /* video inputs */
  30. #define CX18_CARD_INPUT_VID_TUNER 1
  31. #define CX18_CARD_INPUT_SVIDEO1 2
  32. #define CX18_CARD_INPUT_SVIDEO2 3
  33. #define CX18_CARD_INPUT_COMPOSITE1 4
  34. #define CX18_CARD_INPUT_COMPOSITE2 5
  35. #define CX18_CARD_INPUT_COMPOSITE3 6
  36. enum cx34180_video_input {
  37. /* Composite video inputs In1-In8 */
  38. CX23418_COMPOSITE1 = 1,
  39. CX23418_COMPOSITE2,
  40. CX23418_COMPOSITE3,
  41. CX23418_COMPOSITE4,
  42. CX23418_COMPOSITE5,
  43. CX23418_COMPOSITE6,
  44. CX23418_COMPOSITE7,
  45. CX23418_COMPOSITE8,
  46. /* S-Video inputs consist of one luma input (In1-In4) ORed with one
  47. chroma input (In5-In8) */
  48. CX23418_SVIDEO_LUMA1 = 0x10,
  49. CX23418_SVIDEO_LUMA2 = 0x20,
  50. CX23418_SVIDEO_LUMA3 = 0x30,
  51. CX23418_SVIDEO_LUMA4 = 0x40,
  52. CX23418_SVIDEO_CHROMA4 = 0x400,
  53. CX23418_SVIDEO_CHROMA5 = 0x500,
  54. CX23418_SVIDEO_CHROMA6 = 0x600,
  55. CX23418_SVIDEO_CHROMA7 = 0x700,
  56. CX23418_SVIDEO_CHROMA8 = 0x800,
  57. /* S-Video aliases for common luma/chroma combinations */
  58. CX23418_SVIDEO1 = 0x510,
  59. CX23418_SVIDEO2 = 0x620,
  60. CX23418_SVIDEO3 = 0x730,
  61. CX23418_SVIDEO4 = 0x840,
  62. };
  63. /* audio inputs */
  64. #define CX18_CARD_INPUT_AUD_TUNER 1
  65. #define CX18_CARD_INPUT_LINE_IN1 2
  66. #define CX18_CARD_INPUT_LINE_IN2 3
  67. #define CX18_CARD_MAX_VIDEO_INPUTS 6
  68. #define CX18_CARD_MAX_AUDIO_INPUTS 3
  69. #define CX18_CARD_MAX_TUNERS 2
  70. enum cx23418_audio_input {
  71. /* Audio inputs: serial or In4-In8 */
  72. CX23418_AUDIO_SERIAL,
  73. CX23418_AUDIO4 = 4,
  74. CX23418_AUDIO5,
  75. CX23418_AUDIO6,
  76. CX23418_AUDIO7,
  77. CX23418_AUDIO8,
  78. };
  79. /* V4L2 capability aliases */
  80. #define CX18_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
  81. V4L2_CAP_AUDIO | V4L2_CAP_READWRITE)
  82. /* | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_CAPTURE) not yet */
  83. struct cx18_card_video_input {
  84. u8 video_type; /* video input type */
  85. u8 audio_index; /* index in cx18_card_audio_input array */
  86. u16 video_input; /* hardware video input */
  87. };
  88. struct cx18_card_audio_input {
  89. u8 audio_type; /* audio input type */
  90. u32 audio_input; /* hardware audio input */
  91. u16 muxer_input; /* hardware muxer input for boards with a
  92. multiplexer chip */
  93. };
  94. struct cx18_card_pci_info {
  95. u16 device;
  96. u16 subsystem_vendor;
  97. u16 subsystem_device;
  98. };
  99. /* GPIO definitions */
  100. /* The mask is the set of bits used by the operation */
  101. struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */
  102. u16 direction; /* DIR setting. Leave to 0 if no init is needed */
  103. u16 initial_value;
  104. };
  105. struct cx18_card_tuner {
  106. v4l2_std_id std; /* standard for which the tuner is suitable */
  107. int tuner; /* tuner ID (from tuner.h) */
  108. };
  109. struct cx18_card_tuner_i2c {
  110. unsigned short radio[2];/* radio tuner i2c address to probe */
  111. unsigned short demod[2];/* demodulator i2c address to probe */
  112. unsigned short tv[4]; /* tv tuner i2c addresses to probe */
  113. };
  114. struct cx18_ddr { /* DDR config data */
  115. u32 chip_config;
  116. u32 refresh;
  117. u32 timing1;
  118. u32 timing2;
  119. u32 tune_lane;
  120. u32 initial_emrs;
  121. };
  122. /* for card information/parameters */
  123. struct cx18_card {
  124. int type;
  125. char *name;
  126. char *comment;
  127. u32 v4l2_capabilities;
  128. u32 hw_audio_ctrl; /* hardware used for the V4L2 controls (only
  129. 1 dev allowed) */
  130. u32 hw_muxer; /* hardware used to multiplex audio input */
  131. u32 hw_all; /* all hardware used by the board */
  132. struct cx18_card_video_input video_inputs[CX18_CARD_MAX_VIDEO_INPUTS];
  133. struct cx18_card_audio_input audio_inputs[CX18_CARD_MAX_AUDIO_INPUTS];
  134. struct cx18_card_audio_input radio_input;
  135. /* GPIO card-specific settings */
  136. struct cx18_gpio_init gpio_init;
  137. struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
  138. struct cx18_card_tuner_i2c *i2c;
  139. struct cx18_ddr ddr;
  140. /* list of device and subsystem vendor/devices that
  141. correspond to this card type. */
  142. const struct cx18_card_pci_info *pci_list;
  143. };
  144. int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input);
  145. int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *input);
  146. const struct cx18_card *cx18_get_card(u16 index);