dss_features.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  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/module.h>
  21. #include <linux/types.h>
  22. #include <linux/err.h>
  23. #include <linux/slab.h>
  24. #include <drm/drm_fourcc.h>
  25. #include "omapdss.h"
  26. #include "dss.h"
  27. #include "dss_features.h"
  28. /* Defines a generic omap register field */
  29. struct dss_reg_field {
  30. u8 start, end;
  31. };
  32. struct dss_param_range {
  33. int min, max;
  34. };
  35. struct omap_dss_features {
  36. const struct dss_reg_field *reg_fields;
  37. const int num_reg_fields;
  38. const enum dss_feat_id *features;
  39. const int num_features;
  40. const int num_mgrs;
  41. const int num_ovls;
  42. const enum omap_dss_output_id *supported_outputs;
  43. const struct dss_param_range *dss_params;
  44. };
  45. /* This struct is assigned to one of the below during initialization */
  46. static const struct omap_dss_features *omap_current_dss_features;
  47. static const struct dss_reg_field omap2_dss_reg_fields[] = {
  48. [FEAT_REG_FIRHINC] = { 11, 0 },
  49. [FEAT_REG_FIRVINC] = { 27, 16 },
  50. [FEAT_REG_FIFOLOWTHRESHOLD] = { 8, 0 },
  51. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 24, 16 },
  52. [FEAT_REG_FIFOSIZE] = { 8, 0 },
  53. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  54. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  55. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  56. };
  57. static const struct dss_reg_field omap3_dss_reg_fields[] = {
  58. [FEAT_REG_FIRHINC] = { 12, 0 },
  59. [FEAT_REG_FIRVINC] = { 28, 16 },
  60. [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 },
  61. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 },
  62. [FEAT_REG_FIFOSIZE] = { 10, 0 },
  63. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  64. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  65. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  66. };
  67. static const struct dss_reg_field am43xx_dss_reg_fields[] = {
  68. [FEAT_REG_FIRHINC] = { 12, 0 },
  69. [FEAT_REG_FIRVINC] = { 28, 16 },
  70. [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 },
  71. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 },
  72. [FEAT_REG_FIFOSIZE] = { 10, 0 },
  73. [FEAT_REG_HORIZONTALACCU] = { 9, 0 },
  74. [FEAT_REG_VERTICALACCU] = { 25, 16 },
  75. [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 },
  76. };
  77. static const struct dss_reg_field omap4_dss_reg_fields[] = {
  78. [FEAT_REG_FIRHINC] = { 12, 0 },
  79. [FEAT_REG_FIRVINC] = { 28, 16 },
  80. [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
  81. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
  82. [FEAT_REG_FIFOSIZE] = { 15, 0 },
  83. [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
  84. [FEAT_REG_VERTICALACCU] = { 26, 16 },
  85. [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 },
  86. };
  87. static const struct dss_reg_field omap5_dss_reg_fields[] = {
  88. [FEAT_REG_FIRHINC] = { 12, 0 },
  89. [FEAT_REG_FIRVINC] = { 28, 16 },
  90. [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 },
  91. [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 },
  92. [FEAT_REG_FIFOSIZE] = { 15, 0 },
  93. [FEAT_REG_HORIZONTALACCU] = { 10, 0 },
  94. [FEAT_REG_VERTICALACCU] = { 26, 16 },
  95. [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 7 },
  96. };
  97. static const enum omap_dss_output_id omap2_dss_supported_outputs[] = {
  98. /* OMAP_DSS_CHANNEL_LCD */
  99. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI,
  100. /* OMAP_DSS_CHANNEL_DIGIT */
  101. OMAP_DSS_OUTPUT_VENC,
  102. };
  103. static const enum omap_dss_output_id omap3430_dss_supported_outputs[] = {
  104. /* OMAP_DSS_CHANNEL_LCD */
  105. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  106. OMAP_DSS_OUTPUT_SDI | OMAP_DSS_OUTPUT_DSI1,
  107. /* OMAP_DSS_CHANNEL_DIGIT */
  108. OMAP_DSS_OUTPUT_VENC,
  109. };
  110. static const enum omap_dss_output_id omap3630_dss_supported_outputs[] = {
  111. /* OMAP_DSS_CHANNEL_LCD */
  112. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  113. OMAP_DSS_OUTPUT_DSI1,
  114. /* OMAP_DSS_CHANNEL_DIGIT */
  115. OMAP_DSS_OUTPUT_VENC,
  116. };
  117. static const enum omap_dss_output_id am43xx_dss_supported_outputs[] = {
  118. /* OMAP_DSS_CHANNEL_LCD */
  119. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI,
  120. };
  121. static const enum omap_dss_output_id omap4_dss_supported_outputs[] = {
  122. /* OMAP_DSS_CHANNEL_LCD */
  123. OMAP_DSS_OUTPUT_DBI | OMAP_DSS_OUTPUT_DSI1,
  124. /* OMAP_DSS_CHANNEL_DIGIT */
  125. OMAP_DSS_OUTPUT_VENC | OMAP_DSS_OUTPUT_HDMI,
  126. /* OMAP_DSS_CHANNEL_LCD2 */
  127. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  128. OMAP_DSS_OUTPUT_DSI2,
  129. };
  130. static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
  131. /* OMAP_DSS_CHANNEL_LCD */
  132. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  133. OMAP_DSS_OUTPUT_DSI1 | OMAP_DSS_OUTPUT_DSI2,
  134. /* OMAP_DSS_CHANNEL_DIGIT */
  135. OMAP_DSS_OUTPUT_HDMI,
  136. /* OMAP_DSS_CHANNEL_LCD2 */
  137. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  138. OMAP_DSS_OUTPUT_DSI1,
  139. /* OMAP_DSS_CHANNEL_LCD3 */
  140. OMAP_DSS_OUTPUT_DPI | OMAP_DSS_OUTPUT_DBI |
  141. OMAP_DSS_OUTPUT_DSI2,
  142. };
  143. static const struct dss_param_range omap2_dss_param_range[] = {
  144. [FEAT_PARAM_DSS_FCK] = { 0, 133000000 },
  145. [FEAT_PARAM_DSS_PCD] = { 2, 255 },
  146. [FEAT_PARAM_DOWNSCALE] = { 1, 2 },
  147. /*
  148. * Assuming the line width buffer to be 768 pixels as OMAP2 DISPC
  149. * scaler cannot scale a image with width more than 768.
  150. */
  151. [FEAT_PARAM_LINEWIDTH] = { 1, 768 },
  152. };
  153. static const struct dss_param_range omap3_dss_param_range[] = {
  154. [FEAT_PARAM_DSS_FCK] = { 0, 173000000 },
  155. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  156. [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1},
  157. [FEAT_PARAM_DSI_FCK] = { 0, 173000000 },
  158. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  159. [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
  160. };
  161. static const struct dss_param_range am43xx_dss_param_range[] = {
  162. [FEAT_PARAM_DSS_FCK] = { 0, 200000000 },
  163. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  164. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  165. [FEAT_PARAM_LINEWIDTH] = { 1, 1024 },
  166. };
  167. static const struct dss_param_range omap4_dss_param_range[] = {
  168. [FEAT_PARAM_DSS_FCK] = { 0, 186000000 },
  169. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  170. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
  171. [FEAT_PARAM_DSI_FCK] = { 0, 170000000 },
  172. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  173. [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
  174. };
  175. static const struct dss_param_range omap5_dss_param_range[] = {
  176. [FEAT_PARAM_DSS_FCK] = { 0, 209250000 },
  177. [FEAT_PARAM_DSS_PCD] = { 1, 255 },
  178. [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 },
  179. [FEAT_PARAM_DSI_FCK] = { 0, 209250000 },
  180. [FEAT_PARAM_DOWNSCALE] = { 1, 4 },
  181. [FEAT_PARAM_LINEWIDTH] = { 1, 2048 },
  182. };
  183. static const enum dss_feat_id omap2_dss_feat_list[] = {
  184. FEAT_LCDENABLEPOL,
  185. FEAT_LCDENABLESIGNAL,
  186. FEAT_PCKFREEENABLE,
  187. FEAT_FUNCGATED,
  188. FEAT_ROWREPEATENABLE,
  189. FEAT_RESIZECONF,
  190. };
  191. static const enum dss_feat_id omap3430_dss_feat_list[] = {
  192. FEAT_LCDENABLEPOL,
  193. FEAT_LCDENABLESIGNAL,
  194. FEAT_PCKFREEENABLE,
  195. FEAT_FUNCGATED,
  196. FEAT_LINEBUFFERSPLIT,
  197. FEAT_ROWREPEATENABLE,
  198. FEAT_RESIZECONF,
  199. FEAT_DSI_REVERSE_TXCLKESC,
  200. FEAT_VENC_REQUIRES_TV_DAC_CLK,
  201. FEAT_CPR,
  202. FEAT_PRELOAD,
  203. FEAT_FIR_COEF_V,
  204. FEAT_ALPHA_FIXED_ZORDER,
  205. FEAT_FIFO_MERGE,
  206. FEAT_OMAP3_DSI_FIFO_BUG,
  207. FEAT_DPI_USES_VDDS_DSI,
  208. };
  209. static const enum dss_feat_id am35xx_dss_feat_list[] = {
  210. FEAT_LCDENABLEPOL,
  211. FEAT_LCDENABLESIGNAL,
  212. FEAT_PCKFREEENABLE,
  213. FEAT_FUNCGATED,
  214. FEAT_LINEBUFFERSPLIT,
  215. FEAT_ROWREPEATENABLE,
  216. FEAT_RESIZECONF,
  217. FEAT_DSI_REVERSE_TXCLKESC,
  218. FEAT_VENC_REQUIRES_TV_DAC_CLK,
  219. FEAT_CPR,
  220. FEAT_PRELOAD,
  221. FEAT_FIR_COEF_V,
  222. FEAT_ALPHA_FIXED_ZORDER,
  223. FEAT_FIFO_MERGE,
  224. FEAT_OMAP3_DSI_FIFO_BUG,
  225. };
  226. static const enum dss_feat_id am43xx_dss_feat_list[] = {
  227. FEAT_LCDENABLEPOL,
  228. FEAT_LCDENABLESIGNAL,
  229. FEAT_PCKFREEENABLE,
  230. FEAT_FUNCGATED,
  231. FEAT_LINEBUFFERSPLIT,
  232. FEAT_ROWREPEATENABLE,
  233. FEAT_RESIZECONF,
  234. FEAT_CPR,
  235. FEAT_PRELOAD,
  236. FEAT_FIR_COEF_V,
  237. FEAT_ALPHA_FIXED_ZORDER,
  238. FEAT_FIFO_MERGE,
  239. };
  240. static const enum dss_feat_id omap3630_dss_feat_list[] = {
  241. FEAT_LCDENABLEPOL,
  242. FEAT_LCDENABLESIGNAL,
  243. FEAT_PCKFREEENABLE,
  244. FEAT_FUNCGATED,
  245. FEAT_LINEBUFFERSPLIT,
  246. FEAT_ROWREPEATENABLE,
  247. FEAT_RESIZECONF,
  248. FEAT_DSI_PLL_PWR_BUG,
  249. FEAT_CPR,
  250. FEAT_PRELOAD,
  251. FEAT_FIR_COEF_V,
  252. FEAT_ALPHA_FIXED_ZORDER,
  253. FEAT_FIFO_MERGE,
  254. FEAT_OMAP3_DSI_FIFO_BUG,
  255. FEAT_DPI_USES_VDDS_DSI,
  256. };
  257. static const enum dss_feat_id omap4430_es1_0_dss_feat_list[] = {
  258. FEAT_MGR_LCD2,
  259. FEAT_CORE_CLK_DIV,
  260. FEAT_LCD_CLK_SRC,
  261. FEAT_DSI_DCS_CMD_CONFIG_VC,
  262. FEAT_DSI_VC_OCP_WIDTH,
  263. FEAT_DSI_GNQ,
  264. FEAT_HANDLE_UV_SEPARATE,
  265. FEAT_ATTR2,
  266. FEAT_CPR,
  267. FEAT_PRELOAD,
  268. FEAT_FIR_COEF_V,
  269. FEAT_ALPHA_FREE_ZORDER,
  270. FEAT_FIFO_MERGE,
  271. FEAT_BURST_2D,
  272. };
  273. static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
  274. FEAT_MGR_LCD2,
  275. FEAT_CORE_CLK_DIV,
  276. FEAT_LCD_CLK_SRC,
  277. FEAT_DSI_DCS_CMD_CONFIG_VC,
  278. FEAT_DSI_VC_OCP_WIDTH,
  279. FEAT_DSI_GNQ,
  280. FEAT_HDMI_CTS_SWMODE,
  281. FEAT_HANDLE_UV_SEPARATE,
  282. FEAT_ATTR2,
  283. FEAT_CPR,
  284. FEAT_PRELOAD,
  285. FEAT_FIR_COEF_V,
  286. FEAT_ALPHA_FREE_ZORDER,
  287. FEAT_FIFO_MERGE,
  288. FEAT_BURST_2D,
  289. };
  290. static const enum dss_feat_id omap4_dss_feat_list[] = {
  291. FEAT_MGR_LCD2,
  292. FEAT_CORE_CLK_DIV,
  293. FEAT_LCD_CLK_SRC,
  294. FEAT_DSI_DCS_CMD_CONFIG_VC,
  295. FEAT_DSI_VC_OCP_WIDTH,
  296. FEAT_DSI_GNQ,
  297. FEAT_HDMI_CTS_SWMODE,
  298. FEAT_HDMI_AUDIO_USE_MCLK,
  299. FEAT_HANDLE_UV_SEPARATE,
  300. FEAT_ATTR2,
  301. FEAT_CPR,
  302. FEAT_PRELOAD,
  303. FEAT_FIR_COEF_V,
  304. FEAT_ALPHA_FREE_ZORDER,
  305. FEAT_FIFO_MERGE,
  306. FEAT_BURST_2D,
  307. };
  308. static const enum dss_feat_id omap5_dss_feat_list[] = {
  309. FEAT_MGR_LCD2,
  310. FEAT_MGR_LCD3,
  311. FEAT_CORE_CLK_DIV,
  312. FEAT_LCD_CLK_SRC,
  313. FEAT_DSI_DCS_CMD_CONFIG_VC,
  314. FEAT_DSI_VC_OCP_WIDTH,
  315. FEAT_DSI_GNQ,
  316. FEAT_HDMI_CTS_SWMODE,
  317. FEAT_HDMI_AUDIO_USE_MCLK,
  318. FEAT_HANDLE_UV_SEPARATE,
  319. FEAT_ATTR2,
  320. FEAT_CPR,
  321. FEAT_PRELOAD,
  322. FEAT_FIR_COEF_V,
  323. FEAT_ALPHA_FREE_ZORDER,
  324. FEAT_FIFO_MERGE,
  325. FEAT_BURST_2D,
  326. FEAT_DSI_PHY_DCC,
  327. FEAT_MFLAG,
  328. };
  329. /* OMAP2 DSS Features */
  330. static const struct omap_dss_features omap2_dss_features = {
  331. .reg_fields = omap2_dss_reg_fields,
  332. .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields),
  333. .features = omap2_dss_feat_list,
  334. .num_features = ARRAY_SIZE(omap2_dss_feat_list),
  335. .num_mgrs = 2,
  336. .num_ovls = 3,
  337. .supported_outputs = omap2_dss_supported_outputs,
  338. .dss_params = omap2_dss_param_range,
  339. };
  340. /* OMAP3 DSS Features */
  341. static const struct omap_dss_features omap3430_dss_features = {
  342. .reg_fields = omap3_dss_reg_fields,
  343. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  344. .features = omap3430_dss_feat_list,
  345. .num_features = ARRAY_SIZE(omap3430_dss_feat_list),
  346. .num_mgrs = 2,
  347. .num_ovls = 3,
  348. .supported_outputs = omap3430_dss_supported_outputs,
  349. .dss_params = omap3_dss_param_range,
  350. };
  351. /*
  352. * AM35xx DSS Features. This is basically OMAP3 DSS Features without the
  353. * vdds_dsi regulator.
  354. */
  355. static const struct omap_dss_features am35xx_dss_features = {
  356. .reg_fields = omap3_dss_reg_fields,
  357. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  358. .features = am35xx_dss_feat_list,
  359. .num_features = ARRAY_SIZE(am35xx_dss_feat_list),
  360. .num_mgrs = 2,
  361. .num_ovls = 3,
  362. .supported_outputs = omap3430_dss_supported_outputs,
  363. .dss_params = omap3_dss_param_range,
  364. };
  365. static const struct omap_dss_features am43xx_dss_features = {
  366. .reg_fields = am43xx_dss_reg_fields,
  367. .num_reg_fields = ARRAY_SIZE(am43xx_dss_reg_fields),
  368. .features = am43xx_dss_feat_list,
  369. .num_features = ARRAY_SIZE(am43xx_dss_feat_list),
  370. .num_mgrs = 1,
  371. .num_ovls = 3,
  372. .supported_outputs = am43xx_dss_supported_outputs,
  373. .dss_params = am43xx_dss_param_range,
  374. };
  375. static const struct omap_dss_features omap3630_dss_features = {
  376. .reg_fields = omap3_dss_reg_fields,
  377. .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields),
  378. .features = omap3630_dss_feat_list,
  379. .num_features = ARRAY_SIZE(omap3630_dss_feat_list),
  380. .num_mgrs = 2,
  381. .num_ovls = 3,
  382. .supported_outputs = omap3630_dss_supported_outputs,
  383. .dss_params = omap3_dss_param_range,
  384. };
  385. /* OMAP4 DSS Features */
  386. /* For OMAP4430 ES 1.0 revision */
  387. static const struct omap_dss_features omap4430_es1_0_dss_features = {
  388. .reg_fields = omap4_dss_reg_fields,
  389. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  390. .features = omap4430_es1_0_dss_feat_list,
  391. .num_features = ARRAY_SIZE(omap4430_es1_0_dss_feat_list),
  392. .num_mgrs = 3,
  393. .num_ovls = 4,
  394. .supported_outputs = omap4_dss_supported_outputs,
  395. .dss_params = omap4_dss_param_range,
  396. };
  397. /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
  398. static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
  399. .reg_fields = omap4_dss_reg_fields,
  400. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  401. .features = omap4430_es2_0_1_2_dss_feat_list,
  402. .num_features = ARRAY_SIZE(omap4430_es2_0_1_2_dss_feat_list),
  403. .num_mgrs = 3,
  404. .num_ovls = 4,
  405. .supported_outputs = omap4_dss_supported_outputs,
  406. .dss_params = omap4_dss_param_range,
  407. };
  408. /* For all the other OMAP4 versions */
  409. static const struct omap_dss_features omap4_dss_features = {
  410. .reg_fields = omap4_dss_reg_fields,
  411. .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields),
  412. .features = omap4_dss_feat_list,
  413. .num_features = ARRAY_SIZE(omap4_dss_feat_list),
  414. .num_mgrs = 3,
  415. .num_ovls = 4,
  416. .supported_outputs = omap4_dss_supported_outputs,
  417. .dss_params = omap4_dss_param_range,
  418. };
  419. /* OMAP5 DSS Features */
  420. static const struct omap_dss_features omap5_dss_features = {
  421. .reg_fields = omap5_dss_reg_fields,
  422. .num_reg_fields = ARRAY_SIZE(omap5_dss_reg_fields),
  423. .features = omap5_dss_feat_list,
  424. .num_features = ARRAY_SIZE(omap5_dss_feat_list),
  425. .num_mgrs = 4,
  426. .num_ovls = 4,
  427. .supported_outputs = omap5_dss_supported_outputs,
  428. .dss_params = omap5_dss_param_range,
  429. };
  430. /* Functions returning values related to a DSS feature */
  431. int dss_feat_get_num_mgrs(void)
  432. {
  433. return omap_current_dss_features->num_mgrs;
  434. }
  435. int dss_feat_get_num_ovls(void)
  436. {
  437. return omap_current_dss_features->num_ovls;
  438. }
  439. unsigned long dss_feat_get_param_min(enum dss_range_param param)
  440. {
  441. return omap_current_dss_features->dss_params[param].min;
  442. }
  443. unsigned long dss_feat_get_param_max(enum dss_range_param param)
  444. {
  445. return omap_current_dss_features->dss_params[param].max;
  446. }
  447. enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel)
  448. {
  449. return omap_current_dss_features->supported_outputs[channel];
  450. }
  451. /* DSS has_feature check */
  452. bool dss_has_feature(enum dss_feat_id id)
  453. {
  454. int i;
  455. const enum dss_feat_id *features = omap_current_dss_features->features;
  456. const int num_features = omap_current_dss_features->num_features;
  457. for (i = 0; i < num_features; i++) {
  458. if (features[i] == id)
  459. return true;
  460. }
  461. return false;
  462. }
  463. void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
  464. {
  465. if (id >= omap_current_dss_features->num_reg_fields)
  466. BUG();
  467. *start = omap_current_dss_features->reg_fields[id].start;
  468. *end = omap_current_dss_features->reg_fields[id].end;
  469. }
  470. void dss_features_init(enum omapdss_version version)
  471. {
  472. switch (version) {
  473. case OMAPDSS_VER_OMAP24xx:
  474. omap_current_dss_features = &omap2_dss_features;
  475. break;
  476. case OMAPDSS_VER_OMAP34xx_ES1:
  477. case OMAPDSS_VER_OMAP34xx_ES3:
  478. omap_current_dss_features = &omap3430_dss_features;
  479. break;
  480. case OMAPDSS_VER_OMAP3630:
  481. omap_current_dss_features = &omap3630_dss_features;
  482. break;
  483. case OMAPDSS_VER_OMAP4430_ES1:
  484. omap_current_dss_features = &omap4430_es1_0_dss_features;
  485. break;
  486. case OMAPDSS_VER_OMAP4430_ES2:
  487. omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
  488. break;
  489. case OMAPDSS_VER_OMAP4:
  490. omap_current_dss_features = &omap4_dss_features;
  491. break;
  492. case OMAPDSS_VER_OMAP5:
  493. case OMAPDSS_VER_DRA7xx:
  494. omap_current_dss_features = &omap5_dss_features;
  495. break;
  496. case OMAPDSS_VER_AM35xx:
  497. omap_current_dss_features = &am35xx_dss_features;
  498. break;
  499. case OMAPDSS_VER_AM43xx:
  500. omap_current_dss_features = &am43xx_dss_features;
  501. break;
  502. default:
  503. DSSWARN("Unsupported OMAP version");
  504. break;
  505. }
  506. }