saa7191.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * saa7191.h - Philips SAA7191 video decoder driver
  3. *
  4. * Copyright (C) 2003 Ladislav Michl <ladis@linux-mips.org>
  5. * Copyright (C) 2004,2005 Mikael Nousiainen <tmnousia@cc.hut.fi>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _SAA7191_H_
  12. #define _SAA7191_H_
  13. /* Philips SAA7191 DMSD I2C bus address */
  14. #define SAA7191_ADDR 0x8a
  15. /* Register subaddresses. */
  16. #define SAA7191_REG_IDEL 0x00
  17. #define SAA7191_REG_HSYB 0x01
  18. #define SAA7191_REG_HSYS 0x02
  19. #define SAA7191_REG_HCLB 0x03
  20. #define SAA7191_REG_HCLS 0x04
  21. #define SAA7191_REG_HPHI 0x05
  22. #define SAA7191_REG_LUMA 0x06
  23. #define SAA7191_REG_HUEC 0x07
  24. #define SAA7191_REG_CKTQ 0x08
  25. #define SAA7191_REG_CKTS 0x09
  26. #define SAA7191_REG_PLSE 0x0a
  27. #define SAA7191_REG_SESE 0x0b
  28. #define SAA7191_REG_GAIN 0x0c
  29. #define SAA7191_REG_STDC 0x0d
  30. #define SAA7191_REG_IOCK 0x0e
  31. #define SAA7191_REG_CTL3 0x0f
  32. #define SAA7191_REG_CTL4 0x10
  33. #define SAA7191_REG_CHCV 0x11
  34. #define SAA7191_REG_HS6B 0x14
  35. #define SAA7191_REG_HS6S 0x15
  36. #define SAA7191_REG_HC6B 0x16
  37. #define SAA7191_REG_HC6S 0x17
  38. #define SAA7191_REG_HP6I 0x18
  39. #define SAA7191_REG_STATUS 0xff /* not really a subaddress */
  40. /* Status Register definitions */
  41. #define SAA7191_STATUS_CODE 0x01 /* color detected flag */
  42. #define SAA7191_STATUS_FIDT 0x20 /* format type NTSC/PAL */
  43. #define SAA7191_STATUS_HLCK 0x40 /* PLL unlocked/locked */
  44. #define SAA7191_STATUS_STTC 0x80 /* tv/vtr time constant */
  45. /* Luminance Control Register definitions */
  46. #define SAA7191_LUMA_BYPS 0x80
  47. /* Chroma Gain Control Settings Register definitions */
  48. /* 0=automatic colour-killer enabled, 1=forced colour on */
  49. #define SAA7191_GAIN_COLO 0x80
  50. /* Standard/Mode Control Register definitions */
  51. /* tv/vtr mode bit: 0=TV mode (slow time constant),
  52. * 1=VTR mode (fast time constant) */
  53. #define SAA7191_STDC_VTRC 0x80
  54. /* SECAM mode bit: 0=other standards, 1=SECAM */
  55. #define SAA7191_STDC_SECS 0x01
  56. /* the bit fields above must be or'd with this value */
  57. #define SAA7191_STDC_VALUE 0x0c
  58. /* I/O and Clock Control Register definitions */
  59. /* horizontal clock PLL: 0=PLL closed,
  60. * 1=PLL circuit open and horizontal freq fixed */
  61. #define SAA7191_IOCK_HPLL 0x80
  62. /* S-VHS bit (chrominance from CVBS or from chrominance input):
  63. * 0=controlled by BYPS-bit, 1=from chrominance input */
  64. #define SAA7191_IOCK_CHRS 0x04
  65. /* general purpose switch 2
  66. * VINO-specific: 0=used with CVBS, 1=used with S-Video */
  67. #define SAA7191_IOCK_GPSW2 0x02
  68. /* general purpose switch 1 */
  69. /* VINO-specific: 0=always, 1=not used!*/
  70. #define SAA7191_IOCK_GPSW1 0x01
  71. /* Miscellaneous Control #1 Register definitions */
  72. /* automatic field detection (50/60Hz standard) */
  73. #define SAA7191_CTL3_AUFD 0x80
  74. /* field select: (if AUFD=0)
  75. * 0=50Hz (625 lines), 1=60Hz (525 lines) */
  76. #define SAA7191_CTL3_FSEL 0x40
  77. /* the bit fields above must be or'd with this value */
  78. #define SAA7191_CTL3_VALUE 0x19
  79. /* Chrominance Gain Control Register definitions
  80. * (nominal value for UV CCIR level) */
  81. #define SAA7191_CHCV_NTSC 0x2c
  82. #define SAA7191_CHCV_PAL 0x59
  83. /* Driver interface definitions */
  84. #define SAA7191_INPUT_COMPOSITE 0
  85. #define SAA7191_INPUT_SVIDEO 1
  86. #define SAA7191_NORM_AUTO 0
  87. #define SAA7191_NORM_PAL 1
  88. #define SAA7191_NORM_NTSC 2
  89. #define SAA7191_NORM_SECAM 3
  90. #define SAA7191_VALUE_ENABLED 1
  91. #define SAA7191_VALUE_DISABLED 0
  92. #define SAA7191_VALUE_UNCHANGED -1
  93. struct saa7191_status {
  94. /* 0=no signal, 1=signal active*/
  95. int signal;
  96. /* 0=50hz (pal) signal, 1=60hz (ntsc) signal */
  97. int ntsc;
  98. /* 0=no color detected, 1=color detected */
  99. int color;
  100. /* current SAA7191_INPUT_ */
  101. int input;
  102. /* current SAA7191_NORM_ */
  103. int norm;
  104. };
  105. #define SAA7191_HUE_MIN 0x00
  106. #define SAA7191_HUE_MAX 0xff
  107. #define SAA7191_HUE_DEFAULT 0x80
  108. #define SAA7191_VTRC_MIN 0x00
  109. #define SAA7191_VTRC_MAX 0x01
  110. #define SAA7191_VTRC_DEFAULT 0x00
  111. struct saa7191_control {
  112. int hue;
  113. int vtrc;
  114. };
  115. #define DECODER_SAA7191_GET_STATUS _IOR('d', 195, struct saa7191_status)
  116. #define DECODER_SAA7191_SET_NORM _IOW('d', 196, int)
  117. #define DECODER_SAA7191_GET_CONTROLS _IOR('d', 197, struct saa7191_control)
  118. #define DECODER_SAA7191_SET_CONTROLS _IOW('d', 198, struct saa7191_control)
  119. #endif