omapdss.h 27 KB

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