tvenc.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* Copyright (c) 2008-2010, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef TVENC_H
  14. #define TVENC_H
  15. #include <linux/kernel.h>
  16. #include <linux/sched.h>
  17. #include <linux/time.h>
  18. #include <linux/init.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/fb.h>
  21. #include <mach/hardware.h>
  22. #include <linux/io.h>
  23. #include <asm/system.h>
  24. #include <asm/mach-types.h>
  25. #include "msm_fb_panel.h"
  26. #define NTSC_M 0 /* North America, Korea */
  27. #define NTSC_J 1 /* Japan */
  28. #define PAL_BDGHIN 2 /* Non-argentina PAL-N */
  29. #define PAL_M 3 /* PAL-M */
  30. #define PAL_N 4 /* Argentina PAL-N */
  31. #define CLOCK_OFF 0
  32. #define CLOCK_ON 1
  33. /* 3.57954545 Mhz */
  34. #define TVENC_CTL_TV_MODE_NTSC_M_PAL60 0
  35. /* 3.57961149 Mhz */
  36. #define TVENC_CTL_TV_MODE_PAL_M BIT(0)
  37. /*non-Argintina = 4.3361875 Mhz */
  38. #define TVENC_CTL_TV_MODE_PAL_BDGHIN BIT(1)
  39. /*Argentina = 3.582055625 Mhz */
  40. #define TVENC_CTL_TV_MODE_PAL_N (BIT(1)|BIT(0))
  41. #define TVENC_CTL_ENC_EN BIT(2)
  42. #define TVENC_CTL_CC_EN BIT(3)
  43. #define TVENC_CTL_CGMS_EN BIT(4)
  44. #define TVENC_CTL_MACRO_EN BIT(5)
  45. #define TVENC_CTL_Y_FILTER_W_NOTCH BIT(6)
  46. #define TVENC_CTL_Y_FILTER_WO_NOTCH 0
  47. #define TVENC_CTL_Y_FILTER_EN BIT(7)
  48. #define TVENC_CTL_CR_FILTER_EN BIT(8)
  49. #define TVENC_CTL_CB_FILTER_EN BIT(9)
  50. #define TVENC_CTL_SINX_FILTER_EN BIT(10)
  51. #define TVENC_CTL_TEST_PATT_EN BIT(11)
  52. #define TVENC_CTL_OUTPUT_INV BIT(12)
  53. #define TVENC_CTL_PAL60_MODE BIT(13)
  54. #define TVENC_CTL_NTSCJ_MODE BIT(14)
  55. #define TVENC_CTL_S_VIDEO_EN BIT(19)
  56. #define TVENC_CTL_TPG_CLRBAR 0
  57. #define TVENC_CTL_TPG_MODRAMP BIT(15)
  58. #define TVENC_CTL_TPG_REDCLR BIT(16)
  59. #define TVENC_CTL_TPG_NTSC_CBAR (BIT(16)|BIT(15))
  60. #define TVENC_CTL_TPG_BLACK BIT(17)
  61. #define TVENC_CTL_TPG_WHITE100 (BIT(17)|BIT(15))
  62. #define TVENC_CTL_TPG_YELLOW75 (BIT(17)|BIT(16))
  63. #define TVENC_CTL_TPG_CYAN75 (BIT(17)|BIT(16)|BIT(15))
  64. #define TVENC_CTL_TPG_GREEN75 BIT(18)
  65. #define TVENC_CTL_TPG_MAGENTA75 (BIT(18)|BIT(15))
  66. #define TVENC_CTL_TPG_RED75 (BIT(18)|BIT(16))
  67. #define TVENC_CTL_TPG_BLUE75 (BIT(18)|BIT(16)|BIT(15))
  68. #define TVENC_CTL_TPG_WHITE75 (BIT(18)|BIT(17))
  69. #define TVENC_CTL_TPG_WHITE_TRSTN (BIT(18)|BIT(17)|BIT(15))
  70. #define TVENC_LOAD_DETECT_EN BIT(8)
  71. #ifdef TVENC_C
  72. void *tvenc_base;
  73. struct tvenc_platform_data *tvenc_pdata;
  74. #else
  75. extern void *tvenc_base;
  76. extern struct tvenc_platform_data *tvenc_pdata;
  77. #endif
  78. #define TV_OUT(reg, v) writel(v, tvenc_base + MSM_##reg)
  79. #define TV_IN(reg) readl(tvenc_base + MSM_##reg)
  80. #define MSM_TV_ENC_CTL 0x00
  81. #define MSM_TV_LEVEL 0x04
  82. #define MSM_TV_GAIN 0x08
  83. #define MSM_TV_OFFSET 0x0c
  84. #define MSM_TV_CGMS 0x10
  85. #define MSM_TV_SYNC_1 0x14
  86. #define MSM_TV_SYNC_2 0x18
  87. #define MSM_TV_SYNC_3 0x1c
  88. #define MSM_TV_SYNC_4 0x20
  89. #define MSM_TV_SYNC_5 0x24
  90. #define MSM_TV_SYNC_6 0x28
  91. #define MSM_TV_SYNC_7 0x2c
  92. #define MSM_TV_BURST_V1 0x30
  93. #define MSM_TV_BURST_V2 0x34
  94. #define MSM_TV_BURST_V3 0x38
  95. #define MSM_TV_BURST_V4 0x3c
  96. #define MSM_TV_BURST_H 0x40
  97. #define MSM_TV_SOL_REQ_ODD 0x44
  98. #define MSM_TV_SOL_REQ_EVEN 0x48
  99. #define MSM_TV_DAC_CTL 0x4c
  100. #define MSM_TV_TEST_MUX 0x50
  101. #define MSM_TV_TEST_MODE 0x54
  102. #define MSM_TV_TEST_MISR_RESET 0x58
  103. #define MSM_TV_TEST_EXPORT_MISR 0x5c
  104. #define MSM_TV_TEST_MISR_CURR_VAL 0x60
  105. #define MSM_TV_TEST_SOF_CFG 0x64
  106. #define MSM_TV_DAC_INTF 0x100
  107. #define MSM_TV_INTR_ENABLE 0x200
  108. #define MSM_TV_INTR_STATUS 0x204
  109. #define MSM_TV_INTR_CLEAR 0x208
  110. int tvenc_set_encoder_clock(boolean clock_on);
  111. int tvenc_set_clock(boolean clock_on);
  112. #endif /* TVENC_H */