cx18-cards.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * cx18 functions to query card hardware
  3. *
  4. * Derived from ivtv-cards.c
  5. *
  6. * Copyright (C) 2007 Hans Verkuil <[email protected]>
  7. * Copyright (C) 2008 Andy Walls <[email protected]>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. /* hardware flags */
  24. #define CX18_HW_TUNER (1 << 0)
  25. #define CX18_HW_TVEEPROM (1 << 1)
  26. #define CX18_HW_CS5345 (1 << 2)
  27. #define CX18_HW_DVB (1 << 3)
  28. #define CX18_HW_418_AV (1 << 4)
  29. #define CX18_HW_GPIO_MUX (1 << 5)
  30. #define CX18_HW_GPIO_RESET_CTRL (1 << 6)
  31. #define CX18_HW_Z8F0811_IR_TX_HAUP (1 << 7)
  32. #define CX18_HW_Z8F0811_IR_RX_HAUP (1 << 8)
  33. #define CX18_HW_Z8F0811_IR_HAUP (CX18_HW_Z8F0811_IR_RX_HAUP | \
  34. CX18_HW_Z8F0811_IR_TX_HAUP)
  35. #define CX18_HW_IR_ANY (CX18_HW_Z8F0811_IR_RX_HAUP | \
  36. CX18_HW_Z8F0811_IR_TX_HAUP)
  37. /* video inputs */
  38. #define CX18_CARD_INPUT_VID_TUNER 1
  39. #define CX18_CARD_INPUT_SVIDEO1 2
  40. #define CX18_CARD_INPUT_SVIDEO2 3
  41. #define CX18_CARD_INPUT_COMPOSITE1 4
  42. #define CX18_CARD_INPUT_COMPOSITE2 5
  43. #define CX18_CARD_INPUT_COMPONENT1 6
  44. /* audio inputs */
  45. #define CX18_CARD_INPUT_AUD_TUNER 1
  46. #define CX18_CARD_INPUT_LINE_IN1 2
  47. #define CX18_CARD_INPUT_LINE_IN2 3
  48. #define CX18_CARD_MAX_VIDEO_INPUTS 6
  49. #define CX18_CARD_MAX_AUDIO_INPUTS 3
  50. #define CX18_CARD_MAX_TUNERS 2
  51. /* V4L2 capability aliases */
  52. #define CX18_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
  53. V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | \
  54. V4L2_CAP_STREAMING | V4L2_CAP_VBI_CAPTURE | \
  55. V4L2_CAP_SLICED_VBI_CAPTURE)
  56. struct cx18_card_video_input {
  57. u8 video_type; /* video input type */
  58. u8 audio_index; /* index in cx18_card_audio_input array */
  59. u32 video_input; /* hardware video input */
  60. };
  61. struct cx18_card_audio_input {
  62. u8 audio_type; /* audio input type */
  63. u32 audio_input; /* hardware audio input */
  64. u16 muxer_input; /* hardware muxer input for boards with a
  65. multiplexer chip */
  66. };
  67. struct cx18_card_pci_info {
  68. u16 device;
  69. u16 subsystem_vendor;
  70. u16 subsystem_device;
  71. };
  72. /* GPIO definitions */
  73. /* The mask is the set of bits used by the operation */
  74. struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */
  75. u32 direction; /* DIR setting. Leave to 0 if no init is needed */
  76. u32 initial_value;
  77. };
  78. struct cx18_gpio_i2c_slave_reset {
  79. u32 active_lo_mask; /* GPIO outputs that reset i2c chips when low */
  80. u32 active_hi_mask; /* GPIO outputs that reset i2c chips when high */
  81. int msecs_asserted; /* time period reset must remain asserted */
  82. int msecs_recovery; /* time after deassert for chips to be ready */
  83. u32 ir_reset_mask; /* GPIO to reset the Zilog Z8F0811 IR contoller */
  84. };
  85. struct cx18_gpio_audio_input { /* select tuner/line in input */
  86. u32 mask; /* leave to 0 if not supported */
  87. u32 tuner;
  88. u32 linein;
  89. u32 radio;
  90. };
  91. struct cx18_card_tuner {
  92. v4l2_std_id std; /* standard for which the tuner is suitable */
  93. int tuner; /* tuner ID (from tuner.h) */
  94. };
  95. struct cx18_card_tuner_i2c {
  96. unsigned short radio[2];/* radio tuner i2c address to probe */
  97. unsigned short demod[3];/* demodulator i2c address to probe */
  98. unsigned short tv[4]; /* tv tuner i2c addresses to probe */
  99. };
  100. struct cx18_ddr { /* DDR config data */
  101. u32 chip_config;
  102. u32 refresh;
  103. u32 timing1;
  104. u32 timing2;
  105. u32 tune_lane;
  106. u32 initial_emrs;
  107. };
  108. /* for card information/parameters */
  109. struct cx18_card {
  110. int type;
  111. char *name;
  112. char *comment;
  113. u32 v4l2_capabilities;
  114. u32 hw_audio_ctrl; /* hardware used for the V4L2 controls (only
  115. 1 dev allowed currently) */
  116. u32 hw_muxer; /* hardware used to multiplex audio input */
  117. u32 hw_all; /* all hardware used by the board */
  118. struct cx18_card_video_input video_inputs[CX18_CARD_MAX_VIDEO_INPUTS];
  119. struct cx18_card_audio_input audio_inputs[CX18_CARD_MAX_AUDIO_INPUTS];
  120. struct cx18_card_audio_input radio_input;
  121. /* GPIO card-specific settings */
  122. u8 xceive_pin; /* XCeive tuner GPIO reset pin */
  123. struct cx18_gpio_init gpio_init;
  124. struct cx18_gpio_i2c_slave_reset gpio_i2c_slave_reset;
  125. struct cx18_gpio_audio_input gpio_audio_input;
  126. struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
  127. struct cx18_card_tuner_i2c *i2c;
  128. struct cx18_ddr ddr;
  129. /* list of device and subsystem vendor/devices that
  130. correspond to this card type. */
  131. const struct cx18_card_pci_info *pci_list;
  132. };
  133. int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input);
  134. int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *input);
  135. const struct cx18_card *cx18_get_card(u16 index);