dss_features.c 15 KB

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