omapdss.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  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. #define DISPC_IRQ_SYNC_LOST3 (1 << 27)
  49. #define DISPC_IRQ_VSYNC3 (1 << 28)
  50. #define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)
  51. #define DISPC_IRQ_FRAMEDONE3 (1 << 30)
  52. struct omap_dss_device;
  53. struct omap_overlay_manager;
  54. struct snd_aes_iec958;
  55. struct snd_cea_861_aud_if;
  56. enum omap_display_type {
  57. OMAP_DISPLAY_TYPE_NONE = 0,
  58. OMAP_DISPLAY_TYPE_DPI = 1 << 0,
  59. OMAP_DISPLAY_TYPE_DBI = 1 << 1,
  60. OMAP_DISPLAY_TYPE_SDI = 1 << 2,
  61. OMAP_DISPLAY_TYPE_DSI = 1 << 3,
  62. OMAP_DISPLAY_TYPE_VENC = 1 << 4,
  63. OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
  64. };
  65. enum omap_plane {
  66. OMAP_DSS_GFX = 0,
  67. OMAP_DSS_VIDEO1 = 1,
  68. OMAP_DSS_VIDEO2 = 2,
  69. OMAP_DSS_VIDEO3 = 3,
  70. OMAP_DSS_WB = 4,
  71. };
  72. enum omap_channel {
  73. OMAP_DSS_CHANNEL_LCD = 0,
  74. OMAP_DSS_CHANNEL_DIGIT = 1,
  75. OMAP_DSS_CHANNEL_LCD2 = 2,
  76. OMAP_DSS_CHANNEL_LCD3 = 3,
  77. };
  78. enum omap_color_mode {
  79. OMAP_DSS_COLOR_CLUT1 = 1 << 0, /* BITMAP 1 */
  80. OMAP_DSS_COLOR_CLUT2 = 1 << 1, /* BITMAP 2 */
  81. OMAP_DSS_COLOR_CLUT4 = 1 << 2, /* BITMAP 4 */
  82. OMAP_DSS_COLOR_CLUT8 = 1 << 3, /* BITMAP 8 */
  83. OMAP_DSS_COLOR_RGB12U = 1 << 4, /* RGB12, 16-bit container */
  84. OMAP_DSS_COLOR_ARGB16 = 1 << 5, /* ARGB16 */
  85. OMAP_DSS_COLOR_RGB16 = 1 << 6, /* RGB16 */
  86. OMAP_DSS_COLOR_RGB24U = 1 << 7, /* RGB24, 32-bit container */
  87. OMAP_DSS_COLOR_RGB24P = 1 << 8, /* RGB24, 24-bit container */
  88. OMAP_DSS_COLOR_YUV2 = 1 << 9, /* YUV2 4:2:2 co-sited */
  89. OMAP_DSS_COLOR_UYVY = 1 << 10, /* UYVY 4:2:2 co-sited */
  90. OMAP_DSS_COLOR_ARGB32 = 1 << 11, /* ARGB32 */
  91. OMAP_DSS_COLOR_RGBA32 = 1 << 12, /* RGBA32 */
  92. OMAP_DSS_COLOR_RGBX32 = 1 << 13, /* RGBx32 */
  93. OMAP_DSS_COLOR_NV12 = 1 << 14, /* NV12 format: YUV 4:2:0 */
  94. OMAP_DSS_COLOR_RGBA16 = 1 << 15, /* RGBA16 - 4444 */
  95. OMAP_DSS_COLOR_RGBX16 = 1 << 16, /* RGBx16 - 4444 */
  96. OMAP_DSS_COLOR_ARGB16_1555 = 1 << 17, /* ARGB16 - 1555 */
  97. OMAP_DSS_COLOR_XRGB16_1555 = 1 << 18, /* xRGB16 - 1555 */
  98. };
  99. enum omap_dss_load_mode {
  100. OMAP_DSS_LOAD_CLUT_AND_FRAME = 0,
  101. OMAP_DSS_LOAD_CLUT_ONLY = 1,
  102. OMAP_DSS_LOAD_FRAME_ONLY = 2,
  103. OMAP_DSS_LOAD_CLUT_ONCE_FRAME = 3,
  104. };
  105. enum omap_dss_trans_key_type {
  106. OMAP_DSS_COLOR_KEY_GFX_DST = 0,
  107. OMAP_DSS_COLOR_KEY_VID_SRC = 1,
  108. };
  109. enum omap_rfbi_te_mode {
  110. OMAP_DSS_RFBI_TE_MODE_1 = 1,
  111. OMAP_DSS_RFBI_TE_MODE_2 = 2,
  112. };
  113. enum omap_dss_signal_level {
  114. OMAPDSS_SIG_ACTIVE_HIGH = 0,
  115. OMAPDSS_SIG_ACTIVE_LOW = 1,
  116. };
  117. enum omap_dss_signal_edge {
  118. OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
  119. OMAPDSS_DRIVE_SIG_RISING_EDGE,
  120. OMAPDSS_DRIVE_SIG_FALLING_EDGE,
  121. };
  122. enum omap_dss_venc_type {
  123. OMAP_DSS_VENC_TYPE_COMPOSITE,
  124. OMAP_DSS_VENC_TYPE_SVIDEO,
  125. };
  126. enum omap_dss_dsi_pixel_format {
  127. OMAP_DSS_DSI_FMT_RGB888,
  128. OMAP_DSS_DSI_FMT_RGB666,
  129. OMAP_DSS_DSI_FMT_RGB666_PACKED,
  130. OMAP_DSS_DSI_FMT_RGB565,
  131. };
  132. enum omap_dss_dsi_mode {
  133. OMAP_DSS_DSI_CMD_MODE = 0,
  134. OMAP_DSS_DSI_VIDEO_MODE,
  135. };
  136. enum omap_display_caps {
  137. OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE = 1 << 0,
  138. OMAP_DSS_DISPLAY_CAP_TEAR_ELIM = 1 << 1,
  139. };
  140. enum omap_dss_display_state {
  141. OMAP_DSS_DISPLAY_DISABLED = 0,
  142. OMAP_DSS_DISPLAY_ACTIVE,
  143. OMAP_DSS_DISPLAY_SUSPENDED,
  144. };
  145. enum omap_dss_audio_state {
  146. OMAP_DSS_AUDIO_DISABLED = 0,
  147. OMAP_DSS_AUDIO_ENABLED,
  148. OMAP_DSS_AUDIO_CONFIGURED,
  149. OMAP_DSS_AUDIO_PLAYING,
  150. };
  151. enum omap_dss_rotation_type {
  152. OMAP_DSS_ROT_DMA = 1 << 0,
  153. OMAP_DSS_ROT_VRFB = 1 << 1,
  154. OMAP_DSS_ROT_TILER = 1 << 2,
  155. };
  156. /* clockwise rotation angle */
  157. enum omap_dss_rotation_angle {
  158. OMAP_DSS_ROT_0 = 0,
  159. OMAP_DSS_ROT_90 = 1,
  160. OMAP_DSS_ROT_180 = 2,
  161. OMAP_DSS_ROT_270 = 3,
  162. };
  163. enum omap_overlay_caps {
  164. OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
  165. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
  166. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
  167. OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
  168. OMAP_DSS_OVL_CAP_POS = 1 << 4,
  169. OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
  170. };
  171. enum omap_overlay_manager_caps {
  172. OMAP_DSS_DUMMY_VALUE, /* add a dummy value to prevent compiler error */
  173. };
  174. enum omap_dss_clk_source {
  175. OMAP_DSS_CLK_SRC_FCK = 0, /* OMAP2/3: DSS1_ALWON_FCLK
  176. * OMAP4: DSS_FCLK */
  177. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, /* OMAP3: DSI1_PLL_FCLK
  178. * OMAP4: PLL1_CLK1 */
  179. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK
  180. * OMAP4: PLL1_CLK2 */
  181. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC, /* OMAP4: PLL2_CLK1 */
  182. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */
  183. };
  184. enum omap_hdmi_flags {
  185. OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
  186. };
  187. enum omap_dss_output_id {
  188. OMAP_DSS_OUTPUT_DPI = 1 << 0,
  189. OMAP_DSS_OUTPUT_DBI = 1 << 1,
  190. OMAP_DSS_OUTPUT_SDI = 1 << 2,
  191. OMAP_DSS_OUTPUT_DSI1 = 1 << 3,
  192. OMAP_DSS_OUTPUT_DSI2 = 1 << 4,
  193. OMAP_DSS_OUTPUT_VENC = 1 << 5,
  194. OMAP_DSS_OUTPUT_HDMI = 1 << 6,
  195. };
  196. /* RFBI */
  197. struct rfbi_timings {
  198. int cs_on_time;
  199. int cs_off_time;
  200. int we_on_time;
  201. int we_off_time;
  202. int re_on_time;
  203. int re_off_time;
  204. int we_cycle_time;
  205. int re_cycle_time;
  206. int cs_pulse_width;
  207. int access_time;
  208. int clk_div;
  209. u32 tim[5]; /* set by rfbi_convert_timings() */
  210. int converted;
  211. };
  212. void omap_rfbi_write_command(const void *buf, u32 len);
  213. void omap_rfbi_read_data(void *buf, u32 len);
  214. void omap_rfbi_write_data(const void *buf, u32 len);
  215. void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
  216. u16 x, u16 y,
  217. u16 w, u16 h);
  218. int omap_rfbi_enable_te(bool enable, unsigned line);
  219. int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
  220. unsigned hs_pulse_time, unsigned vs_pulse_time,
  221. int hs_pol_inv, int vs_pol_inv, int extif_div);
  222. void rfbi_bus_lock(void);
  223. void rfbi_bus_unlock(void);
  224. /* DSI */
  225. struct omap_dss_dsi_videomode_timings {
  226. /* DSI video mode blanking data */
  227. /* Unit: byte clock cycles */
  228. u16 hsa;
  229. u16 hfp;
  230. u16 hbp;
  231. /* Unit: line clocks */
  232. u16 vsa;
  233. u16 vfp;
  234. u16 vbp;
  235. /* DSI blanking modes */
  236. int blanking_mode;
  237. int hsa_blanking_mode;
  238. int hbp_blanking_mode;
  239. int hfp_blanking_mode;
  240. /* Video port sync events */
  241. bool vp_vsync_end;
  242. bool vp_hsync_end;
  243. bool ddr_clk_always_on;
  244. int window_sync;
  245. };
  246. void dsi_bus_lock(struct omap_dss_device *dssdev);
  247. void dsi_bus_unlock(struct omap_dss_device *dssdev);
  248. int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
  249. int len);
  250. int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
  251. int len);
  252. int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd);
  253. int dsi_vc_generic_write_0(struct omap_dss_device *dssdev, int channel);
  254. int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  255. u8 param);
  256. int dsi_vc_generic_write_1(struct omap_dss_device *dssdev, int channel,
  257. u8 param);
  258. int dsi_vc_generic_write_2(struct omap_dss_device *dssdev, int channel,
  259. u8 param1, u8 param2);
  260. int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
  261. u8 *data, int len);
  262. int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
  263. u8 *data, int len);
  264. int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  265. u8 *buf, int buflen);
  266. int dsi_vc_generic_read_0(struct omap_dss_device *dssdev, int channel, u8 *buf,
  267. int buflen);
  268. int dsi_vc_generic_read_1(struct omap_dss_device *dssdev, int channel, u8 param,
  269. u8 *buf, int buflen);
  270. int dsi_vc_generic_read_2(struct omap_dss_device *dssdev, int channel,
  271. u8 param1, u8 param2, u8 *buf, int buflen);
  272. int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
  273. u16 len);
  274. int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel);
  275. int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
  276. int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel);
  277. void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel);
  278. enum omapdss_version {
  279. OMAPDSS_VER_UNKNOWN = 0,
  280. OMAPDSS_VER_OMAP24xx,
  281. OMAPDSS_VER_OMAP34xx_ES1, /* OMAP3430 ES1.0, 2.0 */
  282. OMAPDSS_VER_OMAP34xx_ES3, /* OMAP3430 ES3.0+ */
  283. OMAPDSS_VER_OMAP3630,
  284. OMAPDSS_VER_AM35xx,
  285. OMAPDSS_VER_OMAP4430_ES1, /* OMAP4430 ES1.0 */
  286. OMAPDSS_VER_OMAP4430_ES2, /* OMAP4430 ES2.0, 2.1, 2.2 */
  287. OMAPDSS_VER_OMAP4, /* All other OMAP4s */
  288. OMAPDSS_VER_OMAP5,
  289. };
  290. /* Board specific data */
  291. struct omap_dss_board_info {
  292. int (*get_context_loss_count)(struct device *dev);
  293. int num_devices;
  294. struct omap_dss_device **devices;
  295. struct omap_dss_device *default_device;
  296. int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
  297. void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
  298. int (*set_min_bus_tput)(struct device *dev, unsigned long r);
  299. enum omapdss_version version;
  300. };
  301. /* Init with the board info */
  302. extern int omap_display_init(struct omap_dss_board_info *board_data);
  303. /* HDMI mux init*/
  304. extern int omap_hdmi_init(enum omap_hdmi_flags flags);
  305. struct omap_video_timings {
  306. /* Unit: pixels */
  307. u16 x_res;
  308. /* Unit: pixels */
  309. u16 y_res;
  310. /* Unit: KHz */
  311. u32 pixel_clock;
  312. /* Unit: pixel clocks */
  313. u16 hsw; /* Horizontal synchronization pulse width */
  314. /* Unit: pixel clocks */
  315. u16 hfp; /* Horizontal front porch */
  316. /* Unit: pixel clocks */
  317. u16 hbp; /* Horizontal back porch */
  318. /* Unit: line clocks */
  319. u16 vsw; /* Vertical synchronization pulse width */
  320. /* Unit: line clocks */
  321. u16 vfp; /* Vertical front porch */
  322. /* Unit: line clocks */
  323. u16 vbp; /* Vertical back porch */
  324. /* Vsync logic level */
  325. enum omap_dss_signal_level vsync_level;
  326. /* Hsync logic level */
  327. enum omap_dss_signal_level hsync_level;
  328. /* Interlaced or Progressive timings */
  329. bool interlace;
  330. /* Pixel clock edge to drive LCD data */
  331. enum omap_dss_signal_edge data_pclk_edge;
  332. /* Data enable logic level */
  333. enum omap_dss_signal_level de_level;
  334. /* Pixel clock edges to drive HSYNC and VSYNC signals */
  335. enum omap_dss_signal_edge sync_pclk_edge;
  336. };
  337. #ifdef CONFIG_OMAP2_DSS_VENC
  338. /* Hardcoded timings for tv modes. Venc only uses these to
  339. * identify the mode, and does not actually use the configs
  340. * itself. However, the configs should be something that
  341. * a normal monitor can also show */
  342. extern const struct omap_video_timings omap_dss_pal_timings;
  343. extern const struct omap_video_timings omap_dss_ntsc_timings;
  344. #endif
  345. struct omap_dss_cpr_coefs {
  346. s16 rr, rg, rb;
  347. s16 gr, gg, gb;
  348. s16 br, bg, bb;
  349. };
  350. struct omap_overlay_info {
  351. u32 paddr;
  352. u32 p_uv_addr; /* for NV12 format */
  353. u16 screen_width;
  354. u16 width;
  355. u16 height;
  356. enum omap_color_mode color_mode;
  357. u8 rotation;
  358. enum omap_dss_rotation_type rotation_type;
  359. bool mirror;
  360. u16 pos_x;
  361. u16 pos_y;
  362. u16 out_width; /* if 0, out_width == width */
  363. u16 out_height; /* if 0, out_height == height */
  364. u8 global_alpha;
  365. u8 pre_mult_alpha;
  366. u8 zorder;
  367. };
  368. struct omap_overlay {
  369. struct kobject kobj;
  370. struct list_head list;
  371. /* static fields */
  372. const char *name;
  373. enum omap_plane id;
  374. enum omap_color_mode supported_modes;
  375. enum omap_overlay_caps caps;
  376. /* dynamic fields */
  377. struct omap_overlay_manager *manager;
  378. /*
  379. * The following functions do not block:
  380. *
  381. * is_enabled
  382. * set_overlay_info
  383. * get_overlay_info
  384. *
  385. * The rest of the functions may block and cannot be called from
  386. * interrupt context
  387. */
  388. int (*enable)(struct omap_overlay *ovl);
  389. int (*disable)(struct omap_overlay *ovl);
  390. bool (*is_enabled)(struct omap_overlay *ovl);
  391. int (*set_manager)(struct omap_overlay *ovl,
  392. struct omap_overlay_manager *mgr);
  393. int (*unset_manager)(struct omap_overlay *ovl);
  394. int (*set_overlay_info)(struct omap_overlay *ovl,
  395. struct omap_overlay_info *info);
  396. void (*get_overlay_info)(struct omap_overlay *ovl,
  397. struct omap_overlay_info *info);
  398. int (*wait_for_go)(struct omap_overlay *ovl);
  399. struct omap_dss_device *(*get_device)(struct omap_overlay *ovl);
  400. };
  401. struct omap_overlay_manager_info {
  402. u32 default_color;
  403. enum omap_dss_trans_key_type trans_key_type;
  404. u32 trans_key;
  405. bool trans_enabled;
  406. bool partial_alpha_enabled;
  407. bool cpr_enable;
  408. struct omap_dss_cpr_coefs cpr_coefs;
  409. };
  410. struct omap_overlay_manager {
  411. struct kobject kobj;
  412. /* static fields */
  413. const char *name;
  414. enum omap_channel id;
  415. enum omap_overlay_manager_caps caps;
  416. struct list_head overlays;
  417. enum omap_display_type supported_displays;
  418. enum omap_dss_output_id supported_outputs;
  419. /* dynamic fields */
  420. struct omap_dss_output *output;
  421. /*
  422. * The following functions do not block:
  423. *
  424. * set_manager_info
  425. * get_manager_info
  426. * apply
  427. *
  428. * The rest of the functions may block and cannot be called from
  429. * interrupt context
  430. */
  431. int (*set_output)(struct omap_overlay_manager *mgr,
  432. struct omap_dss_output *output);
  433. int (*unset_output)(struct omap_overlay_manager *mgr);
  434. int (*set_manager_info)(struct omap_overlay_manager *mgr,
  435. struct omap_overlay_manager_info *info);
  436. void (*get_manager_info)(struct omap_overlay_manager *mgr,
  437. struct omap_overlay_manager_info *info);
  438. int (*apply)(struct omap_overlay_manager *mgr);
  439. int (*wait_for_go)(struct omap_overlay_manager *mgr);
  440. int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
  441. struct omap_dss_device *(*get_device)(struct omap_overlay_manager *mgr);
  442. };
  443. /* 22 pins means 1 clk lane and 10 data lanes */
  444. #define OMAP_DSS_MAX_DSI_PINS 22
  445. struct omap_dsi_pin_config {
  446. int num_pins;
  447. /*
  448. * pin numbers in the following order:
  449. * clk+, clk-
  450. * data1+, data1-
  451. * data2+, data2-
  452. * ...
  453. */
  454. int pins[OMAP_DSS_MAX_DSI_PINS];
  455. };
  456. struct omap_dss_writeback_info {
  457. u32 paddr;
  458. u32 p_uv_addr;
  459. u16 buf_width;
  460. u16 width;
  461. u16 height;
  462. enum omap_color_mode color_mode;
  463. u8 rotation;
  464. enum omap_dss_rotation_type rotation_type;
  465. bool mirror;
  466. u8 pre_mult_alpha;
  467. };
  468. struct omap_dss_output {
  469. struct list_head list;
  470. /* display type supported by the output */
  471. enum omap_display_type type;
  472. /* output instance */
  473. enum omap_dss_output_id id;
  474. /* output's platform device pointer */
  475. struct platform_device *pdev;
  476. /* dynamic fields */
  477. struct omap_overlay_manager *manager;
  478. struct omap_dss_device *device;
  479. };
  480. struct omap_dss_device {
  481. struct device dev;
  482. enum omap_display_type type;
  483. enum omap_channel channel;
  484. union {
  485. struct {
  486. u8 data_lines;
  487. } dpi;
  488. struct {
  489. u8 channel;
  490. u8 data_lines;
  491. } rfbi;
  492. struct {
  493. u8 datapairs;
  494. } sdi;
  495. struct {
  496. int module;
  497. bool ext_te;
  498. u8 ext_te_gpio;
  499. } dsi;
  500. struct {
  501. enum omap_dss_venc_type type;
  502. bool invert_polarity;
  503. } venc;
  504. } phy;
  505. struct {
  506. struct {
  507. struct {
  508. u16 lck_div;
  509. u16 pck_div;
  510. enum omap_dss_clk_source lcd_clk_src;
  511. } channel;
  512. enum omap_dss_clk_source dispc_fclk_src;
  513. } dispc;
  514. struct {
  515. /* regn is one greater than TRM's REGN value */
  516. u16 regn;
  517. u16 regm;
  518. u16 regm_dispc;
  519. u16 regm_dsi;
  520. u16 lp_clk_div;
  521. enum omap_dss_clk_source dsi_fclk_src;
  522. } dsi;
  523. struct {
  524. /* regn is one greater than TRM's REGN value */
  525. u16 regn;
  526. u16 regm2;
  527. } hdmi;
  528. } clocks;
  529. struct {
  530. struct omap_video_timings timings;
  531. int acbi; /* ac-bias pin transitions per interrupt */
  532. /* Unit: line clocks */
  533. int acb; /* ac-bias pin frequency */
  534. enum omap_dss_dsi_pixel_format dsi_pix_fmt;
  535. enum omap_dss_dsi_mode dsi_mode;
  536. struct omap_dss_dsi_videomode_timings dsi_vm_timings;
  537. } panel;
  538. struct {
  539. u8 pixel_size;
  540. struct rfbi_timings rfbi_timings;
  541. } ctrl;
  542. int reset_gpio;
  543. int max_backlight_level;
  544. const char *name;
  545. /* used to match device to driver */
  546. const char *driver_name;
  547. void *data;
  548. struct omap_dss_driver *driver;
  549. /* helper variable for driver suspend/resume */
  550. bool activate_after_resume;
  551. enum omap_display_caps caps;
  552. struct omap_dss_output *output;
  553. enum omap_dss_display_state state;
  554. enum omap_dss_audio_state audio_state;
  555. /* platform specific */
  556. int (*platform_enable)(struct omap_dss_device *dssdev);
  557. void (*platform_disable)(struct omap_dss_device *dssdev);
  558. int (*set_backlight)(struct omap_dss_device *dssdev, int level);
  559. int (*get_backlight)(struct omap_dss_device *dssdev);
  560. };
  561. struct omap_dss_hdmi_data
  562. {
  563. int ct_cp_hpd_gpio;
  564. int ls_oe_gpio;
  565. int hpd_gpio;
  566. };
  567. struct omap_dss_audio {
  568. struct snd_aes_iec958 *iec;
  569. struct snd_cea_861_aud_if *cea;
  570. };
  571. struct omap_dss_driver {
  572. struct device_driver driver;
  573. int (*probe)(struct omap_dss_device *);
  574. void (*remove)(struct omap_dss_device *);
  575. int (*enable)(struct omap_dss_device *display);
  576. void (*disable)(struct omap_dss_device *display);
  577. int (*suspend)(struct omap_dss_device *display);
  578. int (*resume)(struct omap_dss_device *display);
  579. int (*run_test)(struct omap_dss_device *display, int test);
  580. int (*update)(struct omap_dss_device *dssdev,
  581. u16 x, u16 y, u16 w, u16 h);
  582. int (*sync)(struct omap_dss_device *dssdev);
  583. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  584. int (*get_te)(struct omap_dss_device *dssdev);
  585. u8 (*get_rotate)(struct omap_dss_device *dssdev);
  586. int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
  587. bool (*get_mirror)(struct omap_dss_device *dssdev);
  588. int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
  589. int (*memory_read)(struct omap_dss_device *dssdev,
  590. void *buf, size_t size,
  591. u16 x, u16 y, u16 w, u16 h);
  592. void (*get_resolution)(struct omap_dss_device *dssdev,
  593. u16 *xres, u16 *yres);
  594. void (*get_dimensions)(struct omap_dss_device *dssdev,
  595. u32 *width, u32 *height);
  596. int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
  597. int (*check_timings)(struct omap_dss_device *dssdev,
  598. struct omap_video_timings *timings);
  599. void (*set_timings)(struct omap_dss_device *dssdev,
  600. struct omap_video_timings *timings);
  601. void (*get_timings)(struct omap_dss_device *dssdev,
  602. struct omap_video_timings *timings);
  603. int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  604. u32 (*get_wss)(struct omap_dss_device *dssdev);
  605. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  606. bool (*detect)(struct omap_dss_device *dssdev);
  607. /*
  608. * For display drivers that support audio. This encompasses
  609. * HDMI and DisplayPort at the moment.
  610. */
  611. /*
  612. * Note: These functions might sleep. Do not call while
  613. * holding a spinlock/readlock.
  614. */
  615. int (*audio_enable)(struct omap_dss_device *dssdev);
  616. void (*audio_disable)(struct omap_dss_device *dssdev);
  617. bool (*audio_supported)(struct omap_dss_device *dssdev);
  618. int (*audio_config)(struct omap_dss_device *dssdev,
  619. struct omap_dss_audio *audio);
  620. /* Note: These functions may not sleep */
  621. int (*audio_start)(struct omap_dss_device *dssdev);
  622. void (*audio_stop)(struct omap_dss_device *dssdev);
  623. };
  624. int omap_dss_register_driver(struct omap_dss_driver *);
  625. void omap_dss_unregister_driver(struct omap_dss_driver *);
  626. void omap_dss_get_device(struct omap_dss_device *dssdev);
  627. void omap_dss_put_device(struct omap_dss_device *dssdev);
  628. #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
  629. struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
  630. struct omap_dss_device *omap_dss_find_device(void *data,
  631. int (*match)(struct omap_dss_device *dssdev, void *data));
  632. int omap_dss_start_device(struct omap_dss_device *dssdev);
  633. void omap_dss_stop_device(struct omap_dss_device *dssdev);
  634. int omap_dss_get_num_overlay_managers(void);
  635. struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
  636. int omap_dss_get_num_overlays(void);
  637. struct omap_overlay *omap_dss_get_overlay(int num);
  638. struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id);
  639. int omapdss_output_set_device(struct omap_dss_output *out,
  640. struct omap_dss_device *dssdev);
  641. int omapdss_output_unset_device(struct omap_dss_output *out);
  642. void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
  643. u16 *xres, u16 *yres);
  644. int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
  645. void omapdss_default_get_timings(struct omap_dss_device *dssdev,
  646. struct omap_video_timings *timings);
  647. typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
  648. int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  649. int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  650. int omap_dispc_wait_for_irq_timeout(u32 irqmask, unsigned long timeout);
  651. int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask,
  652. unsigned long timeout);
  653. #define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
  654. #define to_dss_device(x) container_of((x), struct omap_dss_device, dev)
  655. void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
  656. bool enable);
  657. int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
  658. void omapdss_dsi_set_timings(struct omap_dss_device *dssdev,
  659. struct omap_video_timings *timings);
  660. void omapdss_dsi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h);
  661. void omapdss_dsi_set_pixel_format(struct omap_dss_device *dssdev,
  662. enum omap_dss_dsi_pixel_format fmt);
  663. void omapdss_dsi_set_operation_mode(struct omap_dss_device *dssdev,
  664. enum omap_dss_dsi_mode mode);
  665. void omapdss_dsi_set_videomode_timings(struct omap_dss_device *dssdev,
  666. struct omap_dss_dsi_videomode_timings *timings);
  667. int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
  668. void (*callback)(int, void *), void *data);
  669. int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
  670. int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
  671. void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
  672. int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
  673. const struct omap_dsi_pin_config *pin_cfg);
  674. int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
  675. unsigned long ddr_clk, unsigned long lp_clk);
  676. int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
  677. void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
  678. bool disconnect_lanes, bool enter_ulps);
  679. int omapdss_dpi_display_enable(struct omap_dss_device *dssdev);
  680. void omapdss_dpi_display_disable(struct omap_dss_device *dssdev);
  681. void omapdss_dpi_set_timings(struct omap_dss_device *dssdev,
  682. struct omap_video_timings *timings);
  683. int dpi_check_timings(struct omap_dss_device *dssdev,
  684. struct omap_video_timings *timings);
  685. void omapdss_dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines);
  686. int omapdss_sdi_display_enable(struct omap_dss_device *dssdev);
  687. void omapdss_sdi_display_disable(struct omap_dss_device *dssdev);
  688. void omapdss_sdi_set_timings(struct omap_dss_device *dssdev,
  689. struct omap_video_timings *timings);
  690. void omapdss_sdi_set_datapairs(struct omap_dss_device *dssdev, int datapairs);
  691. int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev);
  692. void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev);
  693. int omap_rfbi_update(struct omap_dss_device *dssdev, void (*callback)(void *),
  694. void *data);
  695. int omap_rfbi_configure(struct omap_dss_device *dssdev);
  696. void omapdss_rfbi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h);
  697. void omapdss_rfbi_set_pixel_size(struct omap_dss_device *dssdev,
  698. int pixel_size);
  699. void omapdss_rfbi_set_data_lines(struct omap_dss_device *dssdev,
  700. int data_lines);
  701. void omapdss_rfbi_set_interface_timings(struct omap_dss_device *dssdev,
  702. struct rfbi_timings *timings);
  703. #endif