rockchip_lvds.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
  3. * Author:
  4. * Sandy Huang <hjc@rock-chips.com>
  5. * Mark Yao <mark.yao@rock-chips.com>
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #ifndef _ROCKCHIP_LVDS_
  17. #define _ROCKCHIP_LVDS_
  18. #define RK3288_LVDS_CH0_REG0 0x00
  19. #define RK3288_LVDS_CH0_REG0_LVDS_EN BIT(7)
  20. #define RK3288_LVDS_CH0_REG0_TTL_EN BIT(6)
  21. #define RK3288_LVDS_CH0_REG0_LANECK_EN BIT(5)
  22. #define RK3288_LVDS_CH0_REG0_LANE4_EN BIT(4)
  23. #define RK3288_LVDS_CH0_REG0_LANE3_EN BIT(3)
  24. #define RK3288_LVDS_CH0_REG0_LANE2_EN BIT(2)
  25. #define RK3288_LVDS_CH0_REG0_LANE1_EN BIT(1)
  26. #define RK3288_LVDS_CH0_REG0_LANE0_EN BIT(0)
  27. #define RK3288_LVDS_CH0_REG1 0x04
  28. #define RK3288_LVDS_CH0_REG1_LANECK_BIAS BIT(5)
  29. #define RK3288_LVDS_CH0_REG1_LANE4_BIAS BIT(4)
  30. #define RK3288_LVDS_CH0_REG1_LANE3_BIAS BIT(3)
  31. #define RK3288_LVDS_CH0_REG1_LANE2_BIAS BIT(2)
  32. #define RK3288_LVDS_CH0_REG1_LANE1_BIAS BIT(1)
  33. #define RK3288_LVDS_CH0_REG1_LANE0_BIAS BIT(0)
  34. #define RK3288_LVDS_CH0_REG2 0x08
  35. #define RK3288_LVDS_CH0_REG2_RESERVE_ON BIT(7)
  36. #define RK3288_LVDS_CH0_REG2_LANECK_LVDS_MODE BIT(6)
  37. #define RK3288_LVDS_CH0_REG2_LANE4_LVDS_MODE BIT(5)
  38. #define RK3288_LVDS_CH0_REG2_LANE3_LVDS_MODE BIT(4)
  39. #define RK3288_LVDS_CH0_REG2_LANE2_LVDS_MODE BIT(3)
  40. #define RK3288_LVDS_CH0_REG2_LANE1_LVDS_MODE BIT(2)
  41. #define RK3288_LVDS_CH0_REG2_LANE0_LVDS_MODE BIT(1)
  42. #define RK3288_LVDS_CH0_REG2_PLL_FBDIV8 BIT(0)
  43. #define RK3288_LVDS_CH0_REG3 0x0c
  44. #define RK3288_LVDS_CH0_REG3_PLL_FBDIV_MASK 0xff
  45. #define RK3288_LVDS_CH0_REG4 0x10
  46. #define RK3288_LVDS_CH0_REG4_LANECK_TTL_MODE BIT(5)
  47. #define RK3288_LVDS_CH0_REG4_LANE4_TTL_MODE BIT(4)
  48. #define RK3288_LVDS_CH0_REG4_LANE3_TTL_MODE BIT(3)
  49. #define RK3288_LVDS_CH0_REG4_LANE2_TTL_MODE BIT(2)
  50. #define RK3288_LVDS_CH0_REG4_LANE1_TTL_MODE BIT(1)
  51. #define RK3288_LVDS_CH0_REG4_LANE0_TTL_MODE BIT(0)
  52. #define RK3288_LVDS_CH0_REG5 0x14
  53. #define RK3288_LVDS_CH0_REG5_LANECK_TTL_DATA BIT(5)
  54. #define RK3288_LVDS_CH0_REG5_LANE4_TTL_DATA BIT(4)
  55. #define RK3288_LVDS_CH0_REG5_LANE3_TTL_DATA BIT(3)
  56. #define RK3288_LVDS_CH0_REG5_LANE2_TTL_DATA BIT(2)
  57. #define RK3288_LVDS_CH0_REG5_LANE1_TTL_DATA BIT(1)
  58. #define RK3288_LVDS_CH0_REG5_LANE0_TTL_DATA BIT(0)
  59. #define RK3288_LVDS_CFG_REGC 0x30
  60. #define RK3288_LVDS_CFG_REGC_PLL_ENABLE 0x00
  61. #define RK3288_LVDS_CFG_REGC_PLL_DISABLE 0xff
  62. #define RK3288_LVDS_CH0_REGD 0x34
  63. #define RK3288_LVDS_CH0_REGD_PLL_PREDIV_MASK 0x1f
  64. #define RK3288_LVDS_CH0_REG20 0x80
  65. #define RK3288_LVDS_CH0_REG20_MSB 0x45
  66. #define RK3288_LVDS_CH0_REG20_LSB 0x44
  67. #define RK3288_LVDS_CFG_REG21 0x84
  68. #define RK3288_LVDS_CFG_REG21_TX_ENABLE 0x92
  69. #define RK3288_LVDS_CFG_REG21_TX_DISABLE 0x00
  70. #define RK3288_LVDS_CH1_OFFSET 0x100
  71. /* fbdiv value is split over 2 registers, with bit8 in reg2 */
  72. #define RK3288_LVDS_PLL_FBDIV_REG2(_fbd) \
  73. (_fbd & BIT(8) ? RK3288_LVDS_CH0_REG2_PLL_FBDIV8 : 0)
  74. #define RK3288_LVDS_PLL_FBDIV_REG3(_fbd) \
  75. (_fbd & RK3288_LVDS_CH0_REG3_PLL_FBDIV_MASK)
  76. #define RK3288_LVDS_PLL_PREDIV_REGD(_pd) \
  77. (_pd & RK3288_LVDS_CH0_REGD_PLL_PREDIV_MASK)
  78. #define RK3288_LVDS_SOC_CON6_SEL_VOP_LIT BIT(3)
  79. #define LVDS_FMT_MASK (0x07 << 16)
  80. #define LVDS_MSB BIT(3)
  81. #define LVDS_DUAL BIT(4)
  82. #define LVDS_FMT_1 BIT(5)
  83. #define LVDS_TTL_EN BIT(6)
  84. #define LVDS_START_PHASE_RST_1 BIT(7)
  85. #define LVDS_DCLK_INV BIT(8)
  86. #define LVDS_CH0_EN BIT(11)
  87. #define LVDS_CH1_EN BIT(12)
  88. #define LVDS_PWRDN BIT(15)
  89. #define LVDS_24BIT (0 << 1)
  90. #define LVDS_18BIT (1 << 1)
  91. #define LVDS_FORMAT_VESA (0 << 0)
  92. #define LVDS_FORMAT_JEIDA (1 << 0)
  93. #define LVDS_VESA_24 0
  94. #define LVDS_JEIDA_24 1
  95. #define LVDS_VESA_18 2
  96. #define LVDS_JEIDA_18 3
  97. #endif /* _ROCKCHIP_LVDS_ */