dss_features.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. /*
  2. * linux/drivers/video/omap2/dss/dss_features.c
  3. *
  4. * Copyright (C) 2010 Texas Instruments
  5. * Author: Archit Taneja <archit@ti.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published by
  9. * the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <linux/kernel.h>
  20. #include <linux/types.h>
  21. #include <linux/err.h>
  22. #include <linux/slab.h>
  23. #include <video/omapdss.h>
  24. #include <plat/cpu.h>
  25. #include "dss.h"
  26. #include "dss_features.h"
  27. /* Defines a generic omap register field */
  28. struct dss_reg_field {
  29. u8 start, end;
  30. };
  31. struct dss_param_range {
  32. int min, max;
  33. };
  34. struct omap_dss_features {
  35. const struct dss_reg_field *reg_fields;
  36. const int num_reg_fields;
  37. const enum dss_feat_id *features;
  38. const int num_features;
  39. const int num_mgrs;
  40. const int num_ovls;
  41. const enum omap_display_type *supported_displays;
  42. const enum omap_color_mode *supported_color_modes;
  43. const enum omap_overlay_caps *overlay_caps;
  44. const char * const *clksrc_names;
  45. const struct dss_param_range *dss_params;
  46. const u32 buffer_size_unit;
  47. const u32 burst_size_unit;
  48. };
  49. /* This struct is assigned to one of the below during initialization */
  50. static const struct omap_dss_features *omap_current_dss_features;
  51. static const struct dss_reg_field omap2_dss_reg_fields[] = {
  52. [FEAT_REG_FIRHINC] = { 11, 0 },
  53. [FEAT_REG_FIRVINC] = { 27, 16 },
  54. [FEAT_REG_FIFOLOWTHRESHOLD] = { 8, 0 },
  55. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 24, 16 },
  56. [FEAT_REG_FIFOSIZE] = { 8, 0 },
  57. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  58. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  59. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  60. [FEAT_REG_DSIPLL_REGN] = { 0, 0 },
  61. [FEAT_REG_DSIPLL_REGM] = { 0, 0 },
  62. [FEAT_REG_DSIPLL_REGM_DISPC] = { 0, 0 },
  63. [FEAT_REG_DSIPLL_REGM_DSI] = { 0, 0 },
  64. };
  65. static const struct dss_reg_field omap3_dss_reg_fields[] = {
  66. [FEAT_REG_FIRHINC] = { 12, 0 },
  67. [FEAT_REG_FIRVINC] = { 28, 16 },
  68. [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 },
  69. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 },
  70. [FEAT_REG_FIFOSIZE] = { 10, 0 },
  71. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  72. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  73. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  74. [FEAT_REG_DSIPLL_REGN] = { 7, 1 },
  75. [FEAT_REG_DSIPLL_REGM] = { 18, 8 },
  76. [FEAT_REG_DSIPLL_REGM_DISPC] = { 22, 19 },
  77. [FEAT_REG_DSIPLL_REGM_DSI] = { 26, 23 },
  78. };
  79. static const struct dss_reg_field omap4_dss_reg_fields[] = {
  80. [FEAT_REG_FIRHINC] = { 12, 0 },
  81. [FEAT_REG_FIRVINC] = { 28, 16 },
  82. [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
  83. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
  84. [FEAT_REG_FIFOSIZE] = { 15, 0 },
  85. [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
  86. [FEAT_REG_VERTICALACCU] = { 26, 16 },
  87. [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
  88. [FEAT_REG_DSIPLL_REGN] = { 8, 1 },
  89. [FEAT_REG_DSIPLL_REGM] = { 20, 9 },
  90. [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 },
  91. [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 },
  92. };
  93. static const enum omap_display_type omap2_dss_supported_displays[] = {
  94. /* OMAP_DSS_CHANNEL_LCD */
  95. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI,
  96. /* OMAP_DSS_CHANNEL_DIGIT */
  97. OMAP_DISPLAY_TYPE_VENC,
  98. };
  99. static const enum omap_display_type omap3430_dss_supported_displays[] = {
  100. /* OMAP_DSS_CHANNEL_LCD */
  101. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  102. OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI,
  103. /* OMAP_DSS_CHANNEL_DIGIT */
  104. OMAP_DISPLAY_TYPE_VENC,
  105. };
  106. static const enum omap_display_type omap3630_dss_supported_displays[] = {
  107. /* OMAP_DSS_CHANNEL_LCD */
  108. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  109. OMAP_DISPLAY_TYPE_DSI,
  110. /* OMAP_DSS_CHANNEL_DIGIT */
  111. OMAP_DISPLAY_TYPE_VENC,
  112. };
  113. static const enum omap_display_type omap4_dss_supported_displays[] = {
  114. /* OMAP_DSS_CHANNEL_LCD */
  115. OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI,
  116. /* OMAP_DSS_CHANNEL_DIGIT */
  117. OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI,
  118. /* OMAP_DSS_CHANNEL_LCD2 */
  119. OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI |
  120. OMAP_DISPLAY_TYPE_DSI,
  121. };
  122. static const enum omap_color_mode omap2_dss_supported_color_modes[] = {
  123. /* OMAP_DSS_GFX */
  124. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  125. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  126. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
  127. OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
  128. /* OMAP_DSS_VIDEO1 */
  129. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  130. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  131. OMAP_DSS_COLOR_UYVY,
  132. /* OMAP_DSS_VIDEO2 */
  133. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  134. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  135. OMAP_DSS_COLOR_UYVY,
  136. };
  137. static const enum omap_color_mode omap3_dss_supported_color_modes[] = {
  138. /* OMAP_DSS_GFX */
  139. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  140. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  141. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  142. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  143. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
  144. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
  145. /* OMAP_DSS_VIDEO1 */
  146. OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
  147. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
  148. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
  149. /* OMAP_DSS_VIDEO2 */
  150. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  151. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  152. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
  153. OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
  154. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
  155. };
  156. static const enum omap_color_mode omap4_dss_supported_color_modes[] = {
  157. /* OMAP_DSS_GFX */
  158. OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
  159. OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
  160. OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
  161. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
  162. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
  163. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32 |
  164. OMAP_DSS_COLOR_ARGB16_1555,
  165. /* OMAP_DSS_VIDEO1 */
  166. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  167. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  168. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  169. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  170. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  171. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  172. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  173. OMAP_DSS_COLOR_RGBX32,
  174. /* OMAP_DSS_VIDEO2 */
  175. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  176. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  177. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  178. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  179. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  180. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  181. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  182. OMAP_DSS_COLOR_RGBX32,
  183. /* OMAP_DSS_VIDEO3 */
  184. OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB12U |
  185. OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_ARGB16_1555 |
  186. OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_NV12 |
  187. OMAP_DSS_COLOR_RGBA16 | OMAP_DSS_COLOR_RGB24U |
  188. OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_UYVY |
  189. OMAP_DSS_COLOR_ARGB16 | OMAP_DSS_COLOR_XRGB16_1555 |
  190. OMAP_DSS_COLOR_ARGB32 | OMAP_DSS_COLOR_RGBX16 |
  191. OMAP_DSS_COLOR_RGBX32,
  192. };
  193. static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
  194. /* OMAP_DSS_GFX */
  195. 0,
  196. /* OMAP_DSS_VIDEO1 */
  197. OMAP_DSS_OVL_CAP_SCALE,
  198. /* OMAP_DSS_VIDEO2 */
  199. OMAP_DSS_OVL_CAP_SCALE,
  200. };
  201. static const enum omap_overlay_caps omap3430_dss_overlay_caps[] = {
  202. /* OMAP_DSS_GFX */
  203. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
  204. /* OMAP_DSS_VIDEO1 */
  205. OMAP_DSS_OVL_CAP_SCALE,
  206. /* OMAP_DSS_VIDEO2 */
  207. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA,
  208. };
  209. static const enum omap_overlay_caps omap3630_dss_overlay_caps[] = {
  210. /* OMAP_DSS_GFX */
  211. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
  212. /* OMAP_DSS_VIDEO1 */
  213. OMAP_DSS_OVL_CAP_SCALE,
  214. /* OMAP_DSS_VIDEO2 */
  215. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  216. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA,
  217. };
  218. static const enum omap_overlay_caps omap4_dss_overlay_caps[] = {
  219. /* OMAP_DSS_GFX */
  220. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA |
  221. OMAP_DSS_OVL_CAP_ZORDER,
  222. /* OMAP_DSS_VIDEO1 */
  223. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  224. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
  225. /* OMAP_DSS_VIDEO2 */
  226. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  227. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
  228. /* OMAP_DSS_VIDEO3 */
  229. OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_GLOBAL_ALPHA |
  230. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA | OMAP_DSS_OVL_CAP_ZORDER,
  231. };
  232. static const char * const omap2_dss_clk_source_names[] = {
  233. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A",
  234. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A",
  235. [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1",
  236. };
  237. static const char * const omap3_dss_clk_source_names[] = {
  238. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK",
  239. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK",
  240. [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK",
  241. };
  242. static const char * const omap4_dss_clk_source_names[] = {
  243. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1",
  244. [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2",
  245. [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK",
  246. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1",
  247. [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2",
  248. };
  249. static const struct dss_param_range omap2_dss_param_range[] = {
  250. [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
  251. [FEAT_PARAM_DSS_PCD] = { 2, 255 },
  252. [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 },
  253. [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 },
  254. [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 },
  255. [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 },
  256. [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 },
  257. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 },
  258. [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
  259. /*
  260. * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
  261. * scaler cannot scale a image with width more than 768.
  262. */
  263. [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
  264. };
  265. static const struct dss_param_range omap3_dss_param_range[] = {
  266. [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
  267. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  268. [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 },
  269. [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 },
  270. [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 },
  271. [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 },
  272. [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 },
  273. [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
  274. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  275. [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
  276. };
  277. static const struct dss_param_range omap4_dss_param_range[] = {
  278. [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
  279. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  280. [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 },
  281. [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 },
  282. [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 },
  283. [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 },
  284. [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 },
  285. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
  286. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  287. [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
  288. };
  289. static const enum dss_feat_id omap2_dss_feat_list[] = {
  290. FEAT_LCDENABLEPOL,
  291. FEAT_LCDENABLESIGNAL,
  292. FEAT_PCKFREEENABLE,
  293. FEAT_FUNCGATED,
  294. FEAT_ROWREPEATENABLE,
  295. FEAT_RESIZECONF,
  296. };
  297. static const enum dss_feat_id omap3430_dss_feat_list[] = {
  298. FEAT_LCDENABLEPOL,
  299. FEAT_LCDENABLESIGNAL,
  300. FEAT_PCKFREEENABLE,
  301. FEAT_FUNCGATED,
  302. FEAT_LINEBUFFERSPLIT,
  303. FEAT_ROWREPEATENABLE,
  304. FEAT_RESIZECONF,
  305. FEAT_DSI_PLL_FREQSEL,
  306. FEAT_DSI_REVERSE_TXCLKESC,
  307. FEAT_VENC_REQUIRES_TV_DAC_CLK,
  308. FEAT_CPR,
  309. FEAT_PRELOAD,
  310. FEAT_FIR_COEF_V,
  311. FEAT_ALPHA_FIXED_ZORDER,
  312. FEAT_FIFO_MERGE,
  313. FEAT_OMAP3_DSI_FIFO_BUG,
  314. };
  315. static const enum dss_feat_id omap3630_dss_feat_list[] = {
  316. FEAT_LCDENABLEPOL,
  317. FEAT_LCDENABLESIGNAL,
  318. FEAT_PCKFREEENABLE,
  319. FEAT_FUNCGATED,
  320. FEAT_LINEBUFFERSPLIT,
  321. FEAT_ROWREPEATENABLE,
  322. FEAT_RESIZECONF,
  323. FEAT_DSI_PLL_PWR_BUG,
  324. FEAT_DSI_PLL_FREQSEL,
  325. FEAT_CPR,
  326. FEAT_PRELOAD,
  327. FEAT_FIR_COEF_V,
  328. FEAT_ALPHA_FIXED_ZORDER,
  329. FEAT_FIFO_MERGE,
  330. FEAT_OMAP3_DSI_FIFO_BUG,
  331. };
  332. static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
  333. FEAT_MGR_LCD2,
  334. FEAT_CORE_CLK_DIV,
  335. FEAT_LCD_CLK_SRC,
  336. FEAT_DSI_DCS_CMD_CONFIG_VC,
  337. FEAT_DSI_VC_OCP_WIDTH,
  338. FEAT_DSI_GNQ,
  339. FEAT_HANDLE_UV_SEPARATE,
  340. FEAT_ATTR2,
  341. FEAT_CPR,
  342. FEAT_PRELOAD,
  343. FEAT_FIR_COEF_V,
  344. FEAT_ALPHA_FREE_ZORDER,
  345. FEAT_FIFO_MERGE,
  346. };
  347. static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
  348. FEAT_MGR_LCD2,
  349. FEAT_CORE_CLK_DIV,
  350. FEAT_LCD_CLK_SRC,
  351. FEAT_DSI_DCS_CMD_CONFIG_VC,
  352. FEAT_DSI_VC_OCP_WIDTH,
  353. FEAT_DSI_GNQ,
  354. FEAT_HDMI_CTS_SWMODE,
  355. FEAT_HANDLE_UV_SEPARATE,
  356. FEAT_ATTR2,
  357. FEAT_CPR,
  358. FEAT_PRELOAD,
  359. FEAT_FIR_COEF_V,
  360. FEAT_ALPHA_FREE_ZORDER,
  361. FEAT_FIFO_MERGE,
  362. };
  363. static const enum dss_feat_id omap4_dss_feat_list[] = {
  364. FEAT_MGR_LCD2,
  365. FEAT_CORE_CLK_DIV,
  366. FEAT_LCD_CLK_SRC,
  367. FEAT_DSI_DCS_CMD_CONFIG_VC,
  368. FEAT_DSI_VC_OCP_WIDTH,
  369. FEAT_DSI_GNQ,
  370. FEAT_HDMI_CTS_SWMODE,
  371. FEAT_HDMI_AUDIO_USE_MCLK,
  372. FEAT_HANDLE_UV_SEPARATE,
  373. FEAT_ATTR2,
  374. FEAT_CPR,
  375. FEAT_PRELOAD,
  376. FEAT_FIR_COEF_V,
  377. FEAT_ALPHA_FREE_ZORDER,
  378. FEAT_FIFO_MERGE,
  379. };
  380. /* OMAP2 DSS Features */
  381. static const struct omap_dss_features omap2_dss_features = {
  382. .reg_fields = omap2_dss_reg_fields,
  383. .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
  384. .features = omap2_dss_feat_list,
  385. .num_features = ARRAY_SIZE(omap2_dss_feat_list),
  386. .num_mgrs = 2,
  387. .num_ovls = 3,
  388. .supported_displays = omap2_dss_supported_displays,
  389. .supported_color_modes = omap2_dss_supported_color_modes,
  390. .overlay_caps = omap2_dss_overlay_caps,
  391. .clksrc_names = omap2_dss_clk_source_names,
  392. .dss_params = omap2_dss_param_range,
  393. .buffer_size_unit = 1,
  394. .burst_size_unit = 8,
  395. };
  396. /* OMAP3 DSS Features */
  397. static const struct omap_dss_features omap3430_dss_features = {
  398. .reg_fields = omap3_dss_reg_fields,
  399. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  400. .features = omap3430_dss_feat_list,
  401. .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
  402. .num_mgrs = 2,
  403. .num_ovls = 3,
  404. .supported_displays = omap3430_dss_supported_displays,
  405. .supported_color_modes = omap3_dss_supported_color_modes,
  406. .overlay_caps = omap3430_dss_overlay_caps,
  407. .clksrc_names = omap3_dss_clk_source_names,
  408. .dss_params = omap3_dss_param_range,
  409. .buffer_size_unit = 1,
  410. .burst_size_unit = 8,
  411. };
  412. static const struct omap_dss_features omap3630_dss_features = {
  413. .reg_fields = omap3_dss_reg_fields,
  414. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  415. .features = omap3630_dss_feat_list,
  416. .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
  417. .num_mgrs = 2,
  418. .num_ovls = 3,
  419. .supported_displays = omap3630_dss_supported_displays,
  420. .supported_color_modes = omap3_dss_supported_color_modes,
  421. .overlay_caps = omap3630_dss_overlay_caps,
  422. .clksrc_names = omap3_dss_clk_source_names,
  423. .dss_params = omap3_dss_param_range,
  424. .buffer_size_unit = 1,
  425. .burst_size_unit = 8,
  426. };
  427. /* OMAP4 DSS Features */
  428. /* For OMAP4430 ES 1.0 revision */
  429. static const struct omap_dss_features omap4430_es1_0_dss_features = {
  430. .reg_fields = omap4_dss_reg_fields,
  431. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  432. .features = omap4430_es1_0_dss_feat_list,
  433. .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
  434. .num_mgrs = 3,
  435. .num_ovls = 4,
  436. .supported_displays = omap4_dss_supported_displays,
  437. .supported_color_modes = omap4_dss_supported_color_modes,
  438. .overlay_caps = omap4_dss_overlay_caps,
  439. .clksrc_names = omap4_dss_clk_source_names,
  440. .dss_params = omap4_dss_param_range,
  441. .buffer_size_unit = 16,
  442. .burst_size_unit = 16,
  443. };
  444. /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
  445. static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
  446. .reg_fields = omap4_dss_reg_fields,
  447. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  448. .features = omap4430_es2_0_1_2_dss_feat_list,
  449. .num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
  450. .num_mgrs = 3,
  451. .num_ovls = 4,
  452. .supported_displays = omap4_dss_supported_displays,
  453. .supported_color_modes = omap4_dss_supported_color_modes,
  454. .overlay_caps = omap4_dss_overlay_caps,
  455. .clksrc_names = omap4_dss_clk_source_names,
  456. .dss_params = omap4_dss_param_range,
  457. .buffer_size_unit = 16,
  458. .burst_size_unit = 16,
  459. };
  460. /* For all the other OMAP4 versions */
  461. static const struct omap_dss_features omap4_dss_features = {
  462. .reg_fields = omap4_dss_reg_fields,
  463. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  464. .features = omap4_dss_feat_list,
  465. .num_features = ARRAY_SIZE(omap4_dss_feat_list),
  466. .num_mgrs = 3,
  467. .num_ovls = 4,
  468. .supported_displays = omap4_dss_supported_displays,
  469. .supported_color_modes = omap4_dss_supported_color_modes,
  470. .overlay_caps = omap4_dss_overlay_caps,
  471. .clksrc_names = omap4_dss_clk_source_names,
  472. .dss_params = omap4_dss_param_range,
  473. .buffer_size_unit = 16,
  474. .burst_size_unit = 16,
  475. };
  476. #if defined(CONFIG_OMAP4_DSS_HDMI)
  477. /* HDMI OMAP4 Functions*/
  478. static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
  479. .video_configure = ti_hdmi_4xxx_basic_configure,
  480. .phy_enable = ti_hdmi_4xxx_phy_enable,
  481. .phy_disable = ti_hdmi_4xxx_phy_disable,
  482. .read_edid = ti_hdmi_4xxx_read_edid,
  483. .detect = ti_hdmi_4xxx_detect,
  484. .pll_enable = ti_hdmi_4xxx_pll_enable,
  485. .pll_disable = ti_hdmi_4xxx_pll_disable,
  486. .video_enable = ti_hdmi_4xxx_wp_video_start,
  487. .dump_wrapper = ti_hdmi_4xxx_wp_dump,
  488. .dump_core = ti_hdmi_4xxx_core_dump,
  489. .dump_pll = ti_hdmi_4xxx_pll_dump,
  490. .dump_phy = ti_hdmi_4xxx_phy_dump,
  491. #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
  492. defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
  493. .audio_enable = ti_hdmi_4xxx_wp_audio_enable,
  494. #endif
  495. };
  496. void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
  497. {
  498. if (cpu_is_omap44xx())
  499. ip_data->ops = &omap4_hdmi_functions;
  500. }
  501. #endif
  502. /* Functions returning values related to a DSS feature */
  503. int dss_feat_get_num_mgrs(void)
  504. {
  505. return omap_current_dss_features->num_mgrs;
  506. }
  507. int dss_feat_get_num_ovls(void)
  508. {
  509. return omap_current_dss_features->num_ovls;
  510. }
  511. unsigned long dss_feat_get_param_min(enum dss_range_param param)
  512. {
  513. return omap_current_dss_features->dss_params[param].min;
  514. }
  515. unsigned long dss_feat_get_param_max(enum dss_range_param param)
  516. {
  517. return omap_current_dss_features->dss_params[param].max;
  518. }
  519. enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel)
  520. {
  521. return omap_current_dss_features->supported_displays[channel];
  522. }
  523. enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane)
  524. {
  525. return omap_current_dss_features->supported_color_modes[plane];
  526. }
  527. enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane plane)
  528. {
  529. return omap_current_dss_features->overlay_caps[plane];
  530. }
  531. bool dss_feat_color_mode_supported(enum omap_plane plane,
  532. enum omap_color_mode color_mode)
  533. {
  534. return omap_current_dss_features->supported_color_modes[plane] &
  535. color_mode;
  536. }
  537. const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id)
  538. {
  539. return omap_current_dss_features->clksrc_names[id];
  540. }
  541. u32 dss_feat_get_buffer_size_unit(void)
  542. {
  543. return omap_current_dss_features->buffer_size_unit;
  544. }
  545. u32 dss_feat_get_burst_size_unit(void)
  546. {
  547. return omap_current_dss_features->burst_size_unit;
  548. }
  549. /* DSS has_feature check */
  550. bool dss_has_feature(enum dss_feat_id id)
  551. {
  552. int i;
  553. const enum dss_feat_id *features = omap_current_dss_features->features;
  554. const int num_features = omap_current_dss_features->num_features;
  555. for (i = 0; i < num_features; i++) {
  556. if (features[i] == id)
  557. return true;
  558. }
  559. return false;
  560. }
  561. void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
  562. {
  563. if (id >= omap_current_dss_features->num_reg_fields)
  564. BUG();
  565. *start = omap_current_dss_features->reg_fields[id].start;
  566. *end = omap_current_dss_features->reg_fields[id].end;
  567. }
  568. void dss_features_init(void)
  569. {
  570. if (cpu_is_omap24xx())
  571. omap_current_dss_features = &omap2_dss_features;
  572. else if (cpu_is_omap3630())
  573. omap_current_dss_features = &omap3630_dss_features;
  574. else if (cpu_is_omap34xx())
  575. omap_current_dss_features = &omap3430_dss_features;
  576. else if (omap_rev() == OMAP4430_REV_ES1_0)
  577. omap_current_dss_features = &omap4430_es1_0_dss_features;
  578. else if (omap_rev() == OMAP4430_REV_ES2_0 ||
  579. omap_rev() == OMAP4430_REV_ES2_1 ||
  580. omap_rev() == OMAP4430_REV_ES2_2)
  581. omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
  582. else if (cpu_is_omap44xx())
  583. omap_current_dss_features = &omap4_dss_features;
  584. else
  585. DSSWARN("Unsupported OMAP version");
  586. }