omapdss.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. /*
  2. * Copyright (C) 2008 Nokia Corporation
  3. * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published by
  7. * the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef __OMAP_OMAPDSS_H
  18. #define __OMAP_OMAPDSS_H
  19. #include <linux/list.h>
  20. #include <linux/kobject.h>
  21. #include <linux/device.h>
  22. #define DISPC_IRQ_FRAMEDONE (1 << 0)
  23. #define DISPC_IRQ_VSYNC (1 << 1)
  24. #define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
  25. #define DISPC_IRQ_EVSYNC_ODD (1 << 3)
  26. #define DISPC_IRQ_ACBIAS_COUNT_STAT (1 << 4)
  27. #define DISPC_IRQ_PROG_LINE_NUM (1 << 5)
  28. #define DISPC_IRQ_GFX_FIFO_UNDERFLOW (1 << 6)
  29. #define DISPC_IRQ_GFX_END_WIN (1 << 7)
  30. #define DISPC_IRQ_PAL_GAMMA_MASK (1 << 8)
  31. #define DISPC_IRQ_OCP_ERR (1 << 9)
  32. #define DISPC_IRQ_VID1_FIFO_UNDERFLOW (1 << 10)
  33. #define DISPC_IRQ_VID1_END_WIN (1 << 11)
  34. #define DISPC_IRQ_VID2_FIFO_UNDERFLOW (1 << 12)
  35. #define DISPC_IRQ_VID2_END_WIN (1 << 13)
  36. #define DISPC_IRQ_SYNC_LOST (1 << 14)
  37. #define DISPC_IRQ_SYNC_LOST_DIGIT (1 << 15)
  38. #define DISPC_IRQ_WAKEUP (1 << 16)
  39. #define DISPC_IRQ_SYNC_LOST2 (1 << 17)
  40. #define DISPC_IRQ_VSYNC2 (1 << 18)
  41. #define DISPC_IRQ_VID3_END_WIN (1 << 19)
  42. #define DISPC_IRQ_VID3_FIFO_UNDERFLOW (1 << 20)
  43. #define DISPC_IRQ_ACBIAS_COUNT_STAT2 (1 << 21)
  44. #define DISPC_IRQ_FRAMEDONE2 (1 << 22)
  45. #define DISPC_IRQ_FRAMEDONEWB (1 << 23)
  46. #define DISPC_IRQ_FRAMEDONETV (1 << 24)
  47. #define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25)
  48. struct omap_dss_device;
  49. struct omap_overlay_manager;
  50. enum omap_display_type {
  51. OMAP_DISPLAY_TYPE_NONE = 0,
  52. OMAP_DISPLAY_TYPE_DPI = 1 << 0,
  53. OMAP_DISPLAY_TYPE_DBI = 1 << 1,
  54. OMAP_DISPLAY_TYPE_SDI = 1 << 2,
  55. OMAP_DISPLAY_TYPE_DSI = 1 << 3,
  56. OMAP_DISPLAY_TYPE_VENC = 1 << 4,
  57. OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
  58. };
  59. enum omap_plane {
  60. OMAP_DSS_GFX = 0,
  61. OMAP_DSS_VIDEO1 = 1,
  62. OMAP_DSS_VIDEO2 = 2,
  63. OMAP_DSS_VIDEO3 = 3,
  64. };
  65. enum omap_channel {
  66. OMAP_DSS_CHANNEL_LCD = 0,
  67. OMAP_DSS_CHANNEL_DIGIT = 1,
  68. OMAP_DSS_CHANNEL_LCD2 = 2,
  69. };
  70. enum omap_color_mode {
  71. OMAP_DSS_COLOR_CLUT1 = 1 << 0, /* BITMAP 1 */
  72. OMAP_DSS_COLOR_CLUT2 = 1 << 1, /* BITMAP 2 */
  73. OMAP_DSS_COLOR_CLUT4 = 1 << 2, /* BITMAP 4 */
  74. OMAP_DSS_COLOR_CLUT8 = 1 << 3, /* BITMAP 8 */
  75. OMAP_DSS_COLOR_RGB12U = 1 << 4, /* RGB12, 16-bit container */
  76. OMAP_DSS_COLOR_ARGB16 = 1 << 5, /* ARGB16 */
  77. OMAP_DSS_COLOR_RGB16 = 1 << 6, /* RGB16 */
  78. OMAP_DSS_COLOR_RGB24U = 1 << 7, /* RGB24, 32-bit container */
  79. OMAP_DSS_COLOR_RGB24P = 1 << 8, /* RGB24, 24-bit container */
  80. OMAP_DSS_COLOR_YUV2 = 1 << 9, /* YUV2 4:2:2 co-sited */
  81. OMAP_DSS_COLOR_UYVY = 1 << 10, /* UYVY 4:2:2 co-sited */
  82. OMAP_DSS_COLOR_ARGB32 = 1 << 11, /* ARGB32 */
  83. OMAP_DSS_COLOR_RGBA32 = 1 << 12, /* RGBA32 */
  84. OMAP_DSS_COLOR_RGBX32 = 1 << 13, /* RGBx32 */
  85. OMAP_DSS_COLOR_NV12 = 1 << 14, /* NV12 format: YUV 4:2:0 */
  86. OMAP_DSS_COLOR_RGBA16 = 1 << 15, /* RGBA16 - 4444 */
  87. OMAP_DSS_COLOR_RGBX16 = 1 << 16, /* RGBx16 - 4444 */
  88. OMAP_DSS_COLOR_ARGB16_1555 = 1 << 17, /* ARGB16 - 1555 */
  89. OMAP_DSS_COLOR_XRGB16_1555 = 1 << 18, /* xRGB16 - 1555 */
  90. };
  91. enum omap_lcd_display_type {
  92. OMAP_DSS_LCD_DISPLAY_STN,
  93. OMAP_DSS_LCD_DISPLAY_TFT,
  94. };
  95. enum omap_dss_load_mode {
  96. OMAP_DSS_LOAD_CLUT_AND_FRAME = 0,
  97. OMAP_DSS_LOAD_CLUT_ONLY = 1,
  98. OMAP_DSS_LOAD_FRAME_ONLY = 2,
  99. OMAP_DSS_LOAD_CLUT_ONCE_FRAME = 3,
  100. };
  101. enum omap_dss_trans_key_type {
  102. OMAP_DSS_COLOR_KEY_GFX_DST = 0,
  103. OMAP_DSS_COLOR_KEY_VID_SRC = 1,
  104. };
  105. enum omap_rfbi_te_mode {
  106. OMAP_DSS_RFBI_TE_MODE_1 = 1,
  107. OMAP_DSS_RFBI_TE_MODE_2 = 2,
  108. };
  109. enum omap_panel_config {
  110. OMAP_DSS_LCD_IVS = 1<<0,
  111. OMAP_DSS_LCD_IHS = 1<<1,
  112. OMAP_DSS_LCD_IPC = 1<<2,
  113. OMAP_DSS_LCD_IEO = 1<<3,
  114. OMAP_DSS_LCD_RF = 1<<4,
  115. OMAP_DSS_LCD_ONOFF = 1<<5,
  116. OMAP_DSS_LCD_TFT = 1<<20,
  117. };
  118. enum omap_dss_venc_type {
  119. OMAP_DSS_VENC_TYPE_COMPOSITE,
  120. OMAP_DSS_VENC_TYPE_SVIDEO,
  121. };
  122. enum omap_dss_dsi_pixel_format {
  123. OMAP_DSS_DSI_FMT_RGB888,
  124. OMAP_DSS_DSI_FMT_RGB666,
  125. OMAP_DSS_DSI_FMT_RGB666_PACKED,
  126. OMAP_DSS_DSI_FMT_RGB565,
  127. };
  128. enum omap_dss_dsi_mode {
  129. OMAP_DSS_DSI_CMD_MODE = 0,
  130. OMAP_DSS_DSI_VIDEO_MODE,
  131. };
  132. enum omap_display_caps {
  133. OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE = 1 << 0,
  134. OMAP_DSS_DISPLAY_CAP_TEAR_ELIM = 1 << 1,
  135. };
  136. enum omap_dss_display_state {
  137. OMAP_DSS_DISPLAY_DISABLED = 0,
  138. OMAP_DSS_DISPLAY_ACTIVE,
  139. OMAP_DSS_DISPLAY_SUSPENDED,
  140. };
  141. /* XXX perhaps this should be removed */
  142. enum omap_dss_overlay_managers {
  143. OMAP_DSS_OVL_MGR_LCD,
  144. OMAP_DSS_OVL_MGR_TV,
  145. OMAP_DSS_OVL_MGR_LCD2,
  146. };
  147. enum omap_dss_rotation_type {
  148. OMAP_DSS_ROT_DMA = 0,
  149. OMAP_DSS_ROT_VRFB = 1,
  150. };
  151. /* clockwise rotation angle */
  152. enum omap_dss_rotation_angle {
  153. OMAP_DSS_ROT_0 = 0,
  154. OMAP_DSS_ROT_90 = 1,
  155. OMAP_DSS_ROT_180 = 2,
  156. OMAP_DSS_ROT_270 = 3,
  157. };
  158. enum omap_overlay_caps {
  159. OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
  160. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
  161. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
  162. OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
  163. };
  164. enum omap_overlay_manager_caps {
  165. OMAP_DSS_DUMMY_VALUE, /* add a dummy value to prevent compiler error */
  166. };
  167. enum omap_dss_clk_source {
  168. OMAP_DSS_CLK_SRC_FCK = 0, /* OMAP2/3: DSS1_ALWON_FCLK
  169. * OMAP4: DSS_FCLK */
  170. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, /* OMAP3: DSI1_PLL_FCLK
  171. * OMAP4: PLL1_CLK1 */
  172. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK
  173. * OMAP4: PLL1_CLK2 */
  174. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC, /* OMAP4: PLL2_CLK1 */
  175. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */
  176. };
  177. /* RFBI */
  178. struct rfbi_timings {
  179. int cs_on_time;
  180. int cs_off_time;
  181. int we_on_time;
  182. int we_off_time;
  183. int re_on_time;
  184. int re_off_time;
  185. int we_cycle_time;
  186. int re_cycle_time;
  187. int cs_pulse_width;
  188. int access_time;
  189. int clk_div;
  190. u32 tim[5]; /* set by rfbi_convert_timings() */
  191. int converted;
  192. };
  193. void omap_rfbi_write_command(const void *buf, u32 len);
  194. void omap_rfbi_read_data(void *buf, u32 len);
  195. void omap_rfbi_write_data(const void *buf, u32 len);
  196. void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
  197. u16 x, u16 y,
  198. u16 w, u16 h);
  199. int omap_rfbi_enable_te(bool enable, unsigned line);
  200. int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
  201. unsigned hs_pulse_time, unsigned vs_pulse_time,
  202. int hs_pol_inv, int vs_pol_inv, int extif_div);
  203. void rfbi_bus_lock(void);
  204. void rfbi_bus_unlock(void);
  205. /* DSI */
  206. struct omap_dss_dsi_videomode_data {
  207. /* DSI video mode blanking data */
  208. /* Unit: byte clock cycles */
  209. u16 hsa;
  210. u16 hfp;
  211. u16 hbp;
  212. /* Unit: line clocks */
  213. u16 vsa;
  214. u16 vfp;
  215. u16 vbp;
  216. /* DSI blanking modes */
  217. int blanking_mode;
  218. int hsa_blanking_mode;
  219. int hbp_blanking_mode;
  220. int hfp_blanking_mode;
  221. /* Video port sync events */
  222. int vp_de_pol;
  223. int vp_hsync_pol;
  224. int vp_vsync_pol;
  225. bool vp_vsync_end;
  226. bool vp_hsync_end;
  227. bool ddr_clk_always_on;
  228. int window_sync;
  229. };
  230. void dsi_bus_lock(struct omap_dss_device *dssdev);
  231. void dsi_bus_unlock(struct omap_dss_device *dssdev);
  232. int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
  233. int len);
  234. int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
  235. int len);
  236. int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd);
  237. int dsi_vc_generic_write_0(struct omap_dss_device *dssdev, int channel);
  238. int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  239. u8 param);
  240. int dsi_vc_generic_write_1(struct omap_dss_device *dssdev, int channel,
  241. u8 param);
  242. int dsi_vc_generic_write_2(struct omap_dss_device *dssdev, int channel,
  243. u8 param1, u8 param2);
  244. int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
  245. u8 *data, int len);
  246. int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
  247. u8 *data, int len);
  248. int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  249. u8 *buf, int buflen);
  250. int dsi_vc_generic_read_0(struct omap_dss_device *dssdev, int channel, u8 *buf,
  251. int buflen);
  252. int dsi_vc_generic_read_1(struct omap_dss_device *dssdev, int channel, u8 param,
  253. u8 *buf, int buflen);
  254. int dsi_vc_generic_read_2(struct omap_dss_device *dssdev, int channel,
  255. u8 param1, u8 param2, u8 *buf, int buflen);
  256. int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
  257. u16 len);
  258. int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel);
  259. int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
  260. int dsi_video_mode_enable(struct omap_dss_device *dssdev, int channel);
  261. void dsi_video_mode_disable(struct omap_dss_device *dssdev, int channel);
  262. /* Board specific data */
  263. struct omap_dss_board_info {
  264. int (*get_context_loss_count)(struct device *dev);
  265. int num_devices;
  266. struct omap_dss_device **devices;
  267. struct omap_dss_device *default_device;
  268. int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
  269. void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
  270. };
  271. #if defined(CONFIG_OMAP2_DSS_MODULE) || defined(CONFIG_OMAP2_DSS)
  272. /* Init with the board info */
  273. extern int omap_display_init(struct omap_dss_board_info *board_data);
  274. #else
  275. static inline int omap_display_init(struct omap_dss_board_info *board_data)
  276. {
  277. return 0;
  278. }
  279. #endif
  280. struct omap_display_platform_data {
  281. struct omap_dss_board_info *board_data;
  282. /* TODO: Additional members to be added when PM is considered */
  283. };
  284. struct omap_video_timings {
  285. /* Unit: pixels */
  286. u16 x_res;
  287. /* Unit: pixels */
  288. u16 y_res;
  289. /* Unit: KHz */
  290. u32 pixel_clock;
  291. /* Unit: pixel clocks */
  292. u16 hsw; /* Horizontal synchronization pulse width */
  293. /* Unit: pixel clocks */
  294. u16 hfp; /* Horizontal front porch */
  295. /* Unit: pixel clocks */
  296. u16 hbp; /* Horizontal back porch */
  297. /* Unit: line clocks */
  298. u16 vsw; /* Vertical synchronization pulse width */
  299. /* Unit: line clocks */
  300. u16 vfp; /* Vertical front porch */
  301. /* Unit: line clocks */
  302. u16 vbp; /* Vertical back porch */
  303. };
  304. #ifdef CONFIG_OMAP2_DSS_VENC
  305. /* Hardcoded timings for tv modes. Venc only uses these to
  306. * identify the mode, and does not actually use the configs
  307. * itself. However, the configs should be something that
  308. * a normal monitor can also show */
  309. extern const struct omap_video_timings omap_dss_pal_timings;
  310. extern const struct omap_video_timings omap_dss_ntsc_timings;
  311. #endif
  312. struct omap_dss_cpr_coefs {
  313. s16 rr, rg, rb;
  314. s16 gr, gg, gb;
  315. s16 br, bg, bb;
  316. };
  317. struct omap_overlay_info {
  318. bool enabled;
  319. u32 paddr;
  320. u32 p_uv_addr; /* for NV12 format */
  321. u16 screen_width;
  322. u16 width;
  323. u16 height;
  324. enum omap_color_mode color_mode;
  325. u8 rotation;
  326. enum omap_dss_rotation_type rotation_type;
  327. bool mirror;
  328. u16 pos_x;
  329. u16 pos_y;
  330. u16 out_width; /* if 0, out_width == width */
  331. u16 out_height; /* if 0, out_height == height */
  332. u8 global_alpha;
  333. u8 pre_mult_alpha;
  334. u8 zorder;
  335. };
  336. struct omap_overlay {
  337. struct kobject kobj;
  338. struct list_head list;
  339. /* static fields */
  340. const char *name;
  341. enum omap_plane id;
  342. enum omap_color_mode supported_modes;
  343. enum omap_overlay_caps caps;
  344. /* dynamic fields */
  345. struct omap_overlay_manager *manager;
  346. struct omap_overlay_info info;
  347. bool manager_changed;
  348. /* if true, info has been changed, but not applied() yet */
  349. bool info_dirty;
  350. int (*set_manager)(struct omap_overlay *ovl,
  351. struct omap_overlay_manager *mgr);
  352. int (*unset_manager)(struct omap_overlay *ovl);
  353. int (*set_overlay_info)(struct omap_overlay *ovl,
  354. struct omap_overlay_info *info);
  355. void (*get_overlay_info)(struct omap_overlay *ovl,
  356. struct omap_overlay_info *info);
  357. int (*wait_for_go)(struct omap_overlay *ovl);
  358. };
  359. struct omap_overlay_manager_info {
  360. u32 default_color;
  361. enum omap_dss_trans_key_type trans_key_type;
  362. u32 trans_key;
  363. bool trans_enabled;
  364. bool partial_alpha_enabled;
  365. bool cpr_enable;
  366. struct omap_dss_cpr_coefs cpr_coefs;
  367. };
  368. struct omap_overlay_manager {
  369. struct kobject kobj;
  370. struct list_head list;
  371. /* static fields */
  372. const char *name;
  373. enum omap_channel id;
  374. enum omap_overlay_manager_caps caps;
  375. int num_overlays;
  376. struct omap_overlay **overlays;
  377. enum omap_display_type supported_displays;
  378. /* dynamic fields */
  379. struct omap_dss_device *device;
  380. struct omap_overlay_manager_info info;
  381. bool device_changed;
  382. /* if true, info has been changed but not applied() yet */
  383. bool info_dirty;
  384. int (*set_device)(struct omap_overlay_manager *mgr,
  385. struct omap_dss_device *dssdev);
  386. int (*unset_device)(struct omap_overlay_manager *mgr);
  387. int (*set_manager_info)(struct omap_overlay_manager *mgr,
  388. struct omap_overlay_manager_info *info);
  389. void (*get_manager_info)(struct omap_overlay_manager *mgr,
  390. struct omap_overlay_manager_info *info);
  391. int (*apply)(struct omap_overlay_manager *mgr);
  392. int (*wait_for_go)(struct omap_overlay_manager *mgr);
  393. int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
  394. int (*enable)(struct omap_overlay_manager *mgr);
  395. int (*disable)(struct omap_overlay_manager *mgr);
  396. };
  397. struct omap_dss_device {
  398. struct device dev;
  399. enum omap_display_type type;
  400. enum omap_channel channel;
  401. union {
  402. struct {
  403. u8 data_lines;
  404. } dpi;
  405. struct {
  406. u8 channel;
  407. u8 data_lines;
  408. } rfbi;
  409. struct {
  410. u8 datapairs;
  411. } sdi;
  412. struct {
  413. u8 clk_lane;
  414. u8 clk_pol;
  415. u8 data1_lane;
  416. u8 data1_pol;
  417. u8 data2_lane;
  418. u8 data2_pol;
  419. u8 data3_lane;
  420. u8 data3_pol;
  421. u8 data4_lane;
  422. u8 data4_pol;
  423. int module;
  424. bool ext_te;
  425. u8 ext_te_gpio;
  426. } dsi;
  427. struct {
  428. enum omap_dss_venc_type type;
  429. bool invert_polarity;
  430. } venc;
  431. } phy;
  432. struct {
  433. struct {
  434. struct {
  435. u16 lck_div;
  436. u16 pck_div;
  437. enum omap_dss_clk_source lcd_clk_src;
  438. } channel;
  439. enum omap_dss_clk_source dispc_fclk_src;
  440. } dispc;
  441. struct {
  442. /* regn is one greater than TRM's REGN value */
  443. u16 regn;
  444. u16 regm;
  445. u16 regm_dispc;
  446. u16 regm_dsi;
  447. u16 lp_clk_div;
  448. enum omap_dss_clk_source dsi_fclk_src;
  449. } dsi;
  450. struct {
  451. /* regn is one greater than TRM's REGN value */
  452. u16 regn;
  453. u16 regm2;
  454. } hdmi;
  455. } clocks;
  456. struct {
  457. struct omap_video_timings timings;
  458. int acbi; /* ac-bias pin transitions per interrupt */
  459. /* Unit: line clocks */
  460. int acb; /* ac-bias pin frequency */
  461. enum omap_panel_config config;
  462. enum omap_dss_dsi_pixel_format dsi_pix_fmt;
  463. enum omap_dss_dsi_mode dsi_mode;
  464. struct omap_dss_dsi_videomode_data dsi_vm_data;
  465. } panel;
  466. struct {
  467. u8 pixel_size;
  468. struct rfbi_timings rfbi_timings;
  469. } ctrl;
  470. int reset_gpio;
  471. int max_backlight_level;
  472. const char *name;
  473. /* used to match device to driver */
  474. const char *driver_name;
  475. void *data;
  476. struct omap_dss_driver *driver;
  477. /* helper variable for driver suspend/resume */
  478. bool activate_after_resume;
  479. enum omap_display_caps caps;
  480. struct omap_overlay_manager *manager;
  481. enum omap_dss_display_state state;
  482. /* platform specific */
  483. int (*platform_enable)(struct omap_dss_device *dssdev);
  484. void (*platform_disable)(struct omap_dss_device *dssdev);
  485. int (*set_backlight)(struct omap_dss_device *dssdev, int level);
  486. int (*get_backlight)(struct omap_dss_device *dssdev);
  487. };
  488. struct omap_dss_driver {
  489. struct device_driver driver;
  490. int (*probe)(struct omap_dss_device *);
  491. void (*remove)(struct omap_dss_device *);
  492. int (*enable)(struct omap_dss_device *display);
  493. void (*disable)(struct omap_dss_device *display);
  494. int (*suspend)(struct omap_dss_device *display);
  495. int (*resume)(struct omap_dss_device *display);
  496. int (*run_test)(struct omap_dss_device *display, int test);
  497. int (*update)(struct omap_dss_device *dssdev,
  498. u16 x, u16 y, u16 w, u16 h);
  499. int (*sync)(struct omap_dss_device *dssdev);
  500. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  501. int (*get_te)(struct omap_dss_device *dssdev);
  502. u8 (*get_rotate)(struct omap_dss_device *dssdev);
  503. int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
  504. bool (*get_mirror)(struct omap_dss_device *dssdev);
  505. int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
  506. int (*memory_read)(struct omap_dss_device *dssdev,
  507. void *buf, size_t size,
  508. u16 x, u16 y, u16 w, u16 h);
  509. void (*get_resolution)(struct omap_dss_device *dssdev,
  510. u16 *xres, u16 *yres);
  511. void (*get_dimensions)(struct omap_dss_device *dssdev,
  512. u32 *width, u32 *height);
  513. int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
  514. int (*check_timings)(struct omap_dss_device *dssdev,
  515. struct omap_video_timings *timings);
  516. void (*set_timings)(struct omap_dss_device *dssdev,
  517. struct omap_video_timings *timings);
  518. void (*get_timings)(struct omap_dss_device *dssdev,
  519. struct omap_video_timings *timings);
  520. int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  521. u32 (*get_wss)(struct omap_dss_device *dssdev);
  522. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  523. bool (*detect)(struct omap_dss_device *dssdev);
  524. };
  525. int omap_dss_register_driver(struct omap_dss_driver *);
  526. void omap_dss_unregister_driver(struct omap_dss_driver *);
  527. void omap_dss_get_device(struct omap_dss_device *dssdev);
  528. void omap_dss_put_device(struct omap_dss_device *dssdev);
  529. #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
  530. struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
  531. struct omap_dss_device *omap_dss_find_device(void *data,
  532. int (*match)(struct omap_dss_device *dssdev, void *data));
  533. int omap_dss_start_device(struct omap_dss_device *dssdev);
  534. void omap_dss_stop_device(struct omap_dss_device *dssdev);
  535. int omap_dss_get_num_overlay_managers(void);
  536. struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
  537. int omap_dss_get_num_overlays(void);
  538. struct omap_overlay *omap_dss_get_overlay(int num);
  539. void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
  540. u16 *xres, u16 *yres);
  541. int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
  542. typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
  543. int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  544. int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  545. int omap_dispc_wait_for_irq_timeout(u32 irqmask, unsigned long timeout);
  546. int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask,
  547. unsigned long timeout);
  548. #define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
  549. #define to_dss_device(x) container_of((x), struct omap_dss_device, dev)
  550. void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
  551. bool enable);
  552. int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
  553. int omap_dsi_prepare_update(struct omap_dss_device *dssdev,
  554. u16 *x, u16 *y, u16 *w, u16 *h,
  555. bool enlarge_update_area);
  556. int omap_dsi_update(struct omap_dss_device *dssdev,
  557. int channel,
  558. u16 x, u16 y, u16 w, u16 h,
  559. void (*callback)(int, void *), void *data);
  560. int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
  561. int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
  562. void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
  563. int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
  564. void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
  565. bool disconnect_lanes, bool enter_ulps);
  566. int omapdss_dpi_display_enable(struct omap_dss_device *dssdev);
  567. void omapdss_dpi_display_disable(struct omap_dss_device *dssdev);
  568. void dpi_set_timings(struct omap_dss_device *dssdev,
  569. struct omap_video_timings *timings);
  570. int dpi_check_timings(struct omap_dss_device *dssdev,
  571. struct omap_video_timings *timings);
  572. int omapdss_sdi_display_enable(struct omap_dss_device *dssdev);
  573. void omapdss_sdi_display_disable(struct omap_dss_device *dssdev);
  574. int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev);
  575. void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev);
  576. int omap_rfbi_prepare_update(struct omap_dss_device *dssdev,
  577. u16 *x, u16 *y, u16 *w, u16 *h);
  578. int omap_rfbi_update(struct omap_dss_device *dssdev,
  579. u16 x, u16 y, u16 w, u16 h,
  580. void (*callback)(void *), void *data);
  581. int omap_rfbi_configure(struct omap_dss_device *dssdev, int pixel_size,
  582. int data_lines);
  583. #endif