cx18-cards.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. /* audio inputs */
  37. #define CX18_CARD_INPUT_AUD_TUNER 1
  38. #define CX18_CARD_INPUT_LINE_IN1 2
  39. #define CX18_CARD_INPUT_LINE_IN2 3
  40. #define CX18_CARD_MAX_VIDEO_INPUTS 6
  41. #define CX18_CARD_MAX_AUDIO_INPUTS 3
  42. #define CX18_CARD_MAX_TUNERS 2
  43. /* V4L2 capability aliases */
  44. #define CX18_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \
  45. V4L2_CAP_AUDIO | V4L2_CAP_READWRITE)
  46. /* | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_CAPTURE) not yet */
  47. struct cx18_card_video_input {
  48. u8 video_type; /* video input type */
  49. u8 audio_index; /* index in cx18_card_audio_input array */
  50. u16 video_input; /* hardware video input */
  51. };
  52. struct cx18_card_audio_input {
  53. u8 audio_type; /* audio input type */
  54. u32 audio_input; /* hardware audio input */
  55. u16 muxer_input; /* hardware muxer input for boards with a
  56. multiplexer chip */
  57. };
  58. struct cx18_card_pci_info {
  59. u16 device;
  60. u16 subsystem_vendor;
  61. u16 subsystem_device;
  62. };
  63. /* GPIO definitions */
  64. /* The mask is the set of bits used by the operation */
  65. struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */
  66. u32 direction; /* DIR setting. Leave to 0 if no init is needed */
  67. u32 initial_value;
  68. };
  69. struct cx18_gpio_i2c_slave_reset {
  70. u32 active_lo_mask; /* GPIO outputs that reset i2c chips when low */
  71. u32 active_hi_mask; /* GPIO outputs that reset i2c chips when high */
  72. int msecs_asserted; /* time period reset must remain asserted */
  73. int msecs_recovery; /* time after deassert for chips to be ready */
  74. };
  75. struct cx18_card_tuner {
  76. v4l2_std_id std; /* standard for which the tuner is suitable */
  77. int tuner; /* tuner ID (from tuner.h) */
  78. };
  79. struct cx18_card_tuner_i2c {
  80. unsigned short radio[2];/* radio tuner i2c address to probe */
  81. unsigned short demod[2];/* demodulator i2c address to probe */
  82. unsigned short tv[4]; /* tv tuner i2c addresses to probe */
  83. };
  84. struct cx18_ddr { /* DDR config data */
  85. u32 chip_config;
  86. u32 refresh;
  87. u32 timing1;
  88. u32 timing2;
  89. u32 tune_lane;
  90. u32 initial_emrs;
  91. };
  92. /* for card information/parameters */
  93. struct cx18_card {
  94. int type;
  95. char *name;
  96. char *comment;
  97. u32 v4l2_capabilities;
  98. u32 hw_audio_ctrl; /* hardware used for the V4L2 controls (only
  99. 1 dev allowed) */
  100. u32 hw_muxer; /* hardware used to multiplex audio input */
  101. u32 hw_all; /* all hardware used by the board */
  102. struct cx18_card_video_input video_inputs[CX18_CARD_MAX_VIDEO_INPUTS];
  103. struct cx18_card_audio_input audio_inputs[CX18_CARD_MAX_AUDIO_INPUTS];
  104. struct cx18_card_audio_input radio_input;
  105. /* GPIO card-specific settings */
  106. u8 xceive_pin; /* XCeive tuner GPIO reset pin */
  107. struct cx18_gpio_init gpio_init;
  108. struct cx18_gpio_i2c_slave_reset gpio_i2c_slave_reset;
  109. struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
  110. struct cx18_card_tuner_i2c *i2c;
  111. struct cx18_ddr ddr;
  112. /* list of device and subsystem vendor/devices that
  113. correspond to this card type. */
  114. const struct cx18_card_pci_info *pci_list;
  115. };
  116. int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input);
  117. int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *input);
  118. const struct cx18_card *cx18_get_card(u16 index);