omapdss.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  1. /*
  2. * Copyright (C) 2016 Texas Instruments
  3. * Author: Tomi Valkeinen <tomi.valkeinen@ti.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_DRM_DSS_H
  18. #define __OMAP_DRM_DSS_H
  19. #include <linux/list.h>
  20. #include <linux/kobject.h>
  21. #include <linux/device.h>
  22. #include <linux/interrupt.h>
  23. #include <video/videomode.h>
  24. #include <linux/platform_data/omapdss.h>
  25. #include <uapi/drm/drm_mode.h>
  26. #define DISPC_IRQ_FRAMEDONE (1 << 0)
  27. #define DISPC_IRQ_VSYNC (1 << 1)
  28. #define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
  29. #define DISPC_IRQ_EVSYNC_ODD (1 << 3)
  30. #define DISPC_IRQ_ACBIAS_COUNT_STAT (1 << 4)
  31. #define DISPC_IRQ_PROG_LINE_NUM (1 << 5)
  32. #define DISPC_IRQ_GFX_FIFO_UNDERFLOW (1 << 6)
  33. #define DISPC_IRQ_GFX_END_WIN (1 << 7)
  34. #define DISPC_IRQ_PAL_GAMMA_MASK (1 << 8)
  35. #define DISPC_IRQ_OCP_ERR (1 << 9)
  36. #define DISPC_IRQ_VID1_FIFO_UNDERFLOW (1 << 10)
  37. #define DISPC_IRQ_VID1_END_WIN (1 << 11)
  38. #define DISPC_IRQ_VID2_FIFO_UNDERFLOW (1 << 12)
  39. #define DISPC_IRQ_VID2_END_WIN (1 << 13)
  40. #define DISPC_IRQ_SYNC_LOST (1 << 14)
  41. #define DISPC_IRQ_SYNC_LOST_DIGIT (1 << 15)
  42. #define DISPC_IRQ_WAKEUP (1 << 16)
  43. #define DISPC_IRQ_SYNC_LOST2 (1 << 17)
  44. #define DISPC_IRQ_VSYNC2 (1 << 18)
  45. #define DISPC_IRQ_VID3_END_WIN (1 << 19)
  46. #define DISPC_IRQ_VID3_FIFO_UNDERFLOW (1 << 20)
  47. #define DISPC_IRQ_ACBIAS_COUNT_STAT2 (1 << 21)
  48. #define DISPC_IRQ_FRAMEDONE2 (1 << 22)
  49. #define DISPC_IRQ_FRAMEDONEWB (1 << 23)
  50. #define DISPC_IRQ_FRAMEDONETV (1 << 24)
  51. #define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25)
  52. #define DISPC_IRQ_WBUNCOMPLETEERROR (1 << 26)
  53. #define DISPC_IRQ_SYNC_LOST3 (1 << 27)
  54. #define DISPC_IRQ_VSYNC3 (1 << 28)
  55. #define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)
  56. #define DISPC_IRQ_FRAMEDONE3 (1 << 30)
  57. struct omap_dss_device;
  58. struct omap_overlay_manager;
  59. struct dss_lcd_mgr_config;
  60. struct snd_aes_iec958;
  61. struct snd_cea_861_aud_if;
  62. struct hdmi_avi_infoframe;
  63. enum omap_display_type {
  64. OMAP_DISPLAY_TYPE_NONE = 0,
  65. OMAP_DISPLAY_TYPE_DPI = 1 << 0,
  66. OMAP_DISPLAY_TYPE_DBI = 1 << 1,
  67. OMAP_DISPLAY_TYPE_SDI = 1 << 2,
  68. OMAP_DISPLAY_TYPE_DSI = 1 << 3,
  69. OMAP_DISPLAY_TYPE_VENC = 1 << 4,
  70. OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
  71. OMAP_DISPLAY_TYPE_DVI = 1 << 6,
  72. };
  73. enum omap_plane_id {
  74. OMAP_DSS_GFX = 0,
  75. OMAP_DSS_VIDEO1 = 1,
  76. OMAP_DSS_VIDEO2 = 2,
  77. OMAP_DSS_VIDEO3 = 3,
  78. OMAP_DSS_WB = 4,
  79. };
  80. enum omap_channel {
  81. OMAP_DSS_CHANNEL_LCD = 0,
  82. OMAP_DSS_CHANNEL_DIGIT = 1,
  83. OMAP_DSS_CHANNEL_LCD2 = 2,
  84. OMAP_DSS_CHANNEL_LCD3 = 3,
  85. OMAP_DSS_CHANNEL_WB = 4,
  86. };
  87. enum omap_color_mode {
  88. OMAP_DSS_COLOR_CLUT1 = 1 << 0, /* BITMAP 1 */
  89. OMAP_DSS_COLOR_CLUT2 = 1 << 1, /* BITMAP 2 */
  90. OMAP_DSS_COLOR_CLUT4 = 1 << 2, /* BITMAP 4 */
  91. OMAP_DSS_COLOR_CLUT8 = 1 << 3, /* BITMAP 8 */
  92. OMAP_DSS_COLOR_RGB12U = 1 << 4, /* RGB12, 16-bit container */
  93. OMAP_DSS_COLOR_ARGB16 = 1 << 5, /* ARGB16 */
  94. OMAP_DSS_COLOR_RGB16 = 1 << 6, /* RGB16 */
  95. OMAP_DSS_COLOR_RGB24U = 1 << 7, /* RGB24, 32-bit container */
  96. OMAP_DSS_COLOR_RGB24P = 1 << 8, /* RGB24, 24-bit container */
  97. OMAP_DSS_COLOR_YUV2 = 1 << 9, /* YUV2 4:2:2 co-sited */
  98. OMAP_DSS_COLOR_UYVY = 1 << 10, /* UYVY 4:2:2 co-sited */
  99. OMAP_DSS_COLOR_ARGB32 = 1 << 11, /* ARGB32 */
  100. OMAP_DSS_COLOR_RGBA32 = 1 << 12, /* RGBA32 */
  101. OMAP_DSS_COLOR_RGBX32 = 1 << 13, /* RGBx32 */
  102. OMAP_DSS_COLOR_NV12 = 1 << 14, /* NV12 format: YUV 4:2:0 */
  103. OMAP_DSS_COLOR_RGBA16 = 1 << 15, /* RGBA16 - 4444 */
  104. OMAP_DSS_COLOR_RGBX16 = 1 << 16, /* RGBx16 - 4444 */
  105. OMAP_DSS_COLOR_ARGB16_1555 = 1 << 17, /* ARGB16 - 1555 */
  106. OMAP_DSS_COLOR_XRGB16_1555 = 1 << 18, /* xRGB16 - 1555 */
  107. };
  108. enum omap_dss_load_mode {
  109. OMAP_DSS_LOAD_CLUT_AND_FRAME = 0,
  110. OMAP_DSS_LOAD_CLUT_ONLY = 1,
  111. OMAP_DSS_LOAD_FRAME_ONLY = 2,
  112. OMAP_DSS_LOAD_CLUT_ONCE_FRAME = 3,
  113. };
  114. enum omap_dss_trans_key_type {
  115. OMAP_DSS_COLOR_KEY_GFX_DST = 0,
  116. OMAP_DSS_COLOR_KEY_VID_SRC = 1,
  117. };
  118. enum omap_dss_signal_level {
  119. OMAPDSS_SIG_ACTIVE_LOW,
  120. OMAPDSS_SIG_ACTIVE_HIGH,
  121. };
  122. enum omap_dss_signal_edge {
  123. OMAPDSS_DRIVE_SIG_FALLING_EDGE,
  124. OMAPDSS_DRIVE_SIG_RISING_EDGE,
  125. };
  126. enum omap_dss_venc_type {
  127. OMAP_DSS_VENC_TYPE_COMPOSITE,
  128. OMAP_DSS_VENC_TYPE_SVIDEO,
  129. };
  130. enum omap_dss_dsi_pixel_format {
  131. OMAP_DSS_DSI_FMT_RGB888,
  132. OMAP_DSS_DSI_FMT_RGB666,
  133. OMAP_DSS_DSI_FMT_RGB666_PACKED,
  134. OMAP_DSS_DSI_FMT_RGB565,
  135. };
  136. enum omap_dss_dsi_mode {
  137. OMAP_DSS_DSI_CMD_MODE = 0,
  138. OMAP_DSS_DSI_VIDEO_MODE,
  139. };
  140. enum omap_display_caps {
  141. OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE = 1 << 0,
  142. OMAP_DSS_DISPLAY_CAP_TEAR_ELIM = 1 << 1,
  143. };
  144. enum omap_dss_display_state {
  145. OMAP_DSS_DISPLAY_DISABLED = 0,
  146. OMAP_DSS_DISPLAY_ACTIVE,
  147. };
  148. enum omap_dss_rotation_type {
  149. OMAP_DSS_ROT_DMA = 1 << 0,
  150. OMAP_DSS_ROT_VRFB = 1 << 1,
  151. OMAP_DSS_ROT_TILER = 1 << 2,
  152. };
  153. /* clockwise rotation angle */
  154. enum omap_dss_rotation_angle {
  155. OMAP_DSS_ROT_0 = 0,
  156. OMAP_DSS_ROT_90 = 1,
  157. OMAP_DSS_ROT_180 = 2,
  158. OMAP_DSS_ROT_270 = 3,
  159. };
  160. enum omap_overlay_caps {
  161. OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
  162. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
  163. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
  164. OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
  165. OMAP_DSS_OVL_CAP_POS = 1 << 4,
  166. OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
  167. };
  168. enum omap_overlay_manager_caps {
  169. OMAP_DSS_DUMMY_VALUE, /* add a dummy value to prevent compiler error */
  170. };
  171. enum omap_dss_clk_source {
  172. OMAP_DSS_CLK_SRC_FCK = 0, /* OMAP2/3: DSS1_ALWON_FCLK
  173. * OMAP4: DSS_FCLK */
  174. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, /* OMAP3: DSI1_PLL_FCLK
  175. * OMAP4: PLL1_CLK1 */
  176. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK
  177. * OMAP4: PLL1_CLK2 */
  178. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC, /* OMAP4: PLL2_CLK1 */
  179. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */
  180. };
  181. enum omap_hdmi_flags {
  182. OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
  183. };
  184. enum omap_dss_output_id {
  185. OMAP_DSS_OUTPUT_DPI = 1 << 0,
  186. OMAP_DSS_OUTPUT_DBI = 1 << 1,
  187. OMAP_DSS_OUTPUT_SDI = 1 << 2,
  188. OMAP_DSS_OUTPUT_DSI1 = 1 << 3,
  189. OMAP_DSS_OUTPUT_DSI2 = 1 << 4,
  190. OMAP_DSS_OUTPUT_VENC = 1 << 5,
  191. OMAP_DSS_OUTPUT_HDMI = 1 << 6,
  192. };
  193. /* DSI */
  194. enum omap_dss_dsi_trans_mode {
  195. /* Sync Pulses: both sync start and end packets sent */
  196. OMAP_DSS_DSI_PULSE_MODE,
  197. /* Sync Events: only sync start packets sent */
  198. OMAP_DSS_DSI_EVENT_MODE,
  199. /* Burst: only sync start packets sent, pixels are time compressed */
  200. OMAP_DSS_DSI_BURST_MODE,
  201. };
  202. struct omap_dss_dsi_videomode_timings {
  203. unsigned long hsclk;
  204. unsigned ndl;
  205. unsigned bitspp;
  206. /* pixels */
  207. u16 hact;
  208. /* lines */
  209. u16 vact;
  210. /* DSI video mode blanking data */
  211. /* Unit: byte clock cycles */
  212. u16 hss;
  213. u16 hsa;
  214. u16 hse;
  215. u16 hfp;
  216. u16 hbp;
  217. /* Unit: line clocks */
  218. u16 vsa;
  219. u16 vfp;
  220. u16 vbp;
  221. /* DSI blanking modes */
  222. int blanking_mode;
  223. int hsa_blanking_mode;
  224. int hbp_blanking_mode;
  225. int hfp_blanking_mode;
  226. enum omap_dss_dsi_trans_mode trans_mode;
  227. bool ddr_clk_always_on;
  228. int window_sync;
  229. };
  230. struct omap_dss_dsi_config {
  231. enum omap_dss_dsi_mode mode;
  232. enum omap_dss_dsi_pixel_format pixel_format;
  233. const struct videomode *vm;
  234. unsigned long hs_clk_min, hs_clk_max;
  235. unsigned long lp_clk_min, lp_clk_max;
  236. bool ddr_clk_always_on;
  237. enum omap_dss_dsi_trans_mode trans_mode;
  238. };
  239. /* Hardcoded videomodes for tv. Venc only uses these to
  240. * identify the mode, and does not actually use the configs
  241. * itself. However, the configs should be something that
  242. * a normal monitor can also show */
  243. extern const struct videomode omap_dss_pal_vm;
  244. extern const struct videomode omap_dss_ntsc_vm;
  245. struct omap_dss_cpr_coefs {
  246. s16 rr, rg, rb;
  247. s16 gr, gg, gb;
  248. s16 br, bg, bb;
  249. };
  250. struct omap_overlay_info {
  251. dma_addr_t paddr;
  252. dma_addr_t p_uv_addr; /* for NV12 format */
  253. u16 screen_width;
  254. u16 width;
  255. u16 height;
  256. enum omap_color_mode color_mode;
  257. u8 rotation;
  258. enum omap_dss_rotation_type rotation_type;
  259. bool mirror;
  260. u16 pos_x;
  261. u16 pos_y;
  262. u16 out_width; /* if 0, out_width == width */
  263. u16 out_height; /* if 0, out_height == height */
  264. u8 global_alpha;
  265. u8 pre_mult_alpha;
  266. u8 zorder;
  267. };
  268. struct omap_overlay {
  269. struct kobject kobj;
  270. struct list_head list;
  271. /* static fields */
  272. const char *name;
  273. enum omap_plane_id id;
  274. enum omap_color_mode supported_modes;
  275. enum omap_overlay_caps caps;
  276. /* dynamic fields */
  277. struct omap_overlay_manager *manager;
  278. /*
  279. * The following functions do not block:
  280. *
  281. * is_enabled
  282. * set_overlay_info
  283. * get_overlay_info
  284. *
  285. * The rest of the functions may block and cannot be called from
  286. * interrupt context
  287. */
  288. int (*enable)(struct omap_overlay *ovl);
  289. int (*disable)(struct omap_overlay *ovl);
  290. bool (*is_enabled)(struct omap_overlay *ovl);
  291. int (*set_manager)(struct omap_overlay *ovl,
  292. struct omap_overlay_manager *mgr);
  293. int (*unset_manager)(struct omap_overlay *ovl);
  294. int (*set_overlay_info)(struct omap_overlay *ovl,
  295. struct omap_overlay_info *info);
  296. void (*get_overlay_info)(struct omap_overlay *ovl,
  297. struct omap_overlay_info *info);
  298. int (*wait_for_go)(struct omap_overlay *ovl);
  299. struct omap_dss_device *(*get_device)(struct omap_overlay *ovl);
  300. };
  301. struct omap_overlay_manager_info {
  302. u32 default_color;
  303. enum omap_dss_trans_key_type trans_key_type;
  304. u32 trans_key;
  305. bool trans_enabled;
  306. bool partial_alpha_enabled;
  307. bool cpr_enable;
  308. struct omap_dss_cpr_coefs cpr_coefs;
  309. };
  310. struct omap_overlay_manager {
  311. struct kobject kobj;
  312. /* static fields */
  313. const char *name;
  314. enum omap_channel id;
  315. enum omap_overlay_manager_caps caps;
  316. struct list_head overlays;
  317. enum omap_display_type supported_displays;
  318. enum omap_dss_output_id supported_outputs;
  319. /* dynamic fields */
  320. struct omap_dss_device *output;
  321. /*
  322. * The following functions do not block:
  323. *
  324. * set_manager_info
  325. * get_manager_info
  326. * apply
  327. *
  328. * The rest of the functions may block and cannot be called from
  329. * interrupt context
  330. */
  331. int (*set_output)(struct omap_overlay_manager *mgr,
  332. struct omap_dss_device *output);
  333. int (*unset_output)(struct omap_overlay_manager *mgr);
  334. int (*set_manager_info)(struct omap_overlay_manager *mgr,
  335. struct omap_overlay_manager_info *info);
  336. void (*get_manager_info)(struct omap_overlay_manager *mgr,
  337. struct omap_overlay_manager_info *info);
  338. int (*apply)(struct omap_overlay_manager *mgr);
  339. int (*wait_for_go)(struct omap_overlay_manager *mgr);
  340. int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
  341. struct omap_dss_device *(*get_device)(struct omap_overlay_manager *mgr);
  342. };
  343. /* 22 pins means 1 clk lane and 10 data lanes */
  344. #define OMAP_DSS_MAX_DSI_PINS 22
  345. struct omap_dsi_pin_config {
  346. int num_pins;
  347. /*
  348. * pin numbers in the following order:
  349. * clk+, clk-
  350. * data1+, data1-
  351. * data2+, data2-
  352. * ...
  353. */
  354. int pins[OMAP_DSS_MAX_DSI_PINS];
  355. };
  356. struct omap_dss_writeback_info {
  357. u32 paddr;
  358. u32 p_uv_addr;
  359. u16 buf_width;
  360. u16 width;
  361. u16 height;
  362. enum omap_color_mode color_mode;
  363. u8 rotation;
  364. enum omap_dss_rotation_type rotation_type;
  365. bool mirror;
  366. u8 pre_mult_alpha;
  367. };
  368. struct omapdss_dpi_ops {
  369. int (*connect)(struct omap_dss_device *dssdev,
  370. struct omap_dss_device *dst);
  371. void (*disconnect)(struct omap_dss_device *dssdev,
  372. struct omap_dss_device *dst);
  373. int (*enable)(struct omap_dss_device *dssdev);
  374. void (*disable)(struct omap_dss_device *dssdev);
  375. int (*check_timings)(struct omap_dss_device *dssdev,
  376. struct videomode *vm);
  377. void (*set_timings)(struct omap_dss_device *dssdev,
  378. struct videomode *vm);
  379. void (*get_timings)(struct omap_dss_device *dssdev,
  380. struct videomode *vm);
  381. };
  382. struct omapdss_sdi_ops {
  383. int (*connect)(struct omap_dss_device *dssdev,
  384. struct omap_dss_device *dst);
  385. void (*disconnect)(struct omap_dss_device *dssdev,
  386. struct omap_dss_device *dst);
  387. int (*enable)(struct omap_dss_device *dssdev);
  388. void (*disable)(struct omap_dss_device *dssdev);
  389. int (*check_timings)(struct omap_dss_device *dssdev,
  390. struct videomode *vm);
  391. void (*set_timings)(struct omap_dss_device *dssdev,
  392. struct videomode *vm);
  393. void (*get_timings)(struct omap_dss_device *dssdev,
  394. struct videomode *vm);
  395. };
  396. struct omapdss_dvi_ops {
  397. int (*connect)(struct omap_dss_device *dssdev,
  398. struct omap_dss_device *dst);
  399. void (*disconnect)(struct omap_dss_device *dssdev,
  400. struct omap_dss_device *dst);
  401. int (*enable)(struct omap_dss_device *dssdev);
  402. void (*disable)(struct omap_dss_device *dssdev);
  403. int (*check_timings)(struct omap_dss_device *dssdev,
  404. struct videomode *vm);
  405. void (*set_timings)(struct omap_dss_device *dssdev,
  406. struct videomode *vm);
  407. void (*get_timings)(struct omap_dss_device *dssdev,
  408. struct videomode *vm);
  409. };
  410. struct omapdss_atv_ops {
  411. int (*connect)(struct omap_dss_device *dssdev,
  412. struct omap_dss_device *dst);
  413. void (*disconnect)(struct omap_dss_device *dssdev,
  414. struct omap_dss_device *dst);
  415. int (*enable)(struct omap_dss_device *dssdev);
  416. void (*disable)(struct omap_dss_device *dssdev);
  417. int (*check_timings)(struct omap_dss_device *dssdev,
  418. struct videomode *vm);
  419. void (*set_timings)(struct omap_dss_device *dssdev,
  420. struct videomode *vm);
  421. void (*get_timings)(struct omap_dss_device *dssdev,
  422. struct videomode *vm);
  423. int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  424. u32 (*get_wss)(struct omap_dss_device *dssdev);
  425. };
  426. struct omapdss_hdmi_ops {
  427. int (*connect)(struct omap_dss_device *dssdev,
  428. struct omap_dss_device *dst);
  429. void (*disconnect)(struct omap_dss_device *dssdev,
  430. struct omap_dss_device *dst);
  431. int (*enable)(struct omap_dss_device *dssdev);
  432. void (*disable)(struct omap_dss_device *dssdev);
  433. int (*check_timings)(struct omap_dss_device *dssdev,
  434. struct videomode *vm);
  435. void (*set_timings)(struct omap_dss_device *dssdev,
  436. struct videomode *vm);
  437. void (*get_timings)(struct omap_dss_device *dssdev,
  438. struct videomode *vm);
  439. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  440. bool (*detect)(struct omap_dss_device *dssdev);
  441. int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
  442. int (*set_infoframe)(struct omap_dss_device *dssdev,
  443. const struct hdmi_avi_infoframe *avi);
  444. };
  445. struct omapdss_dsi_ops {
  446. int (*connect)(struct omap_dss_device *dssdev,
  447. struct omap_dss_device *dst);
  448. void (*disconnect)(struct omap_dss_device *dssdev,
  449. struct omap_dss_device *dst);
  450. int (*enable)(struct omap_dss_device *dssdev);
  451. void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
  452. bool enter_ulps);
  453. /* bus configuration */
  454. int (*set_config)(struct omap_dss_device *dssdev,
  455. const struct omap_dss_dsi_config *cfg);
  456. int (*configure_pins)(struct omap_dss_device *dssdev,
  457. const struct omap_dsi_pin_config *pin_cfg);
  458. void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
  459. bool enable);
  460. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  461. int (*update)(struct omap_dss_device *dssdev, int channel,
  462. void (*callback)(int, void *), void *data);
  463. void (*bus_lock)(struct omap_dss_device *dssdev);
  464. void (*bus_unlock)(struct omap_dss_device *dssdev);
  465. int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
  466. void (*disable_video_output)(struct omap_dss_device *dssdev,
  467. int channel);
  468. int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
  469. int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
  470. int vc_id);
  471. void (*release_vc)(struct omap_dss_device *dssdev, int channel);
  472. /* data transfer */
  473. int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
  474. u8 *data, int len);
  475. int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
  476. u8 *data, int len);
  477. int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  478. u8 *data, int len);
  479. int (*gen_write)(struct omap_dss_device *dssdev, int channel,
  480. u8 *data, int len);
  481. int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
  482. u8 *data, int len);
  483. int (*gen_read)(struct omap_dss_device *dssdev, int channel,
  484. u8 *reqdata, int reqlen,
  485. u8 *data, int len);
  486. int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
  487. int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
  488. int channel, u16 plen);
  489. };
  490. struct omap_dss_device {
  491. struct kobject kobj;
  492. struct device *dev;
  493. struct module *owner;
  494. struct list_head panel_list;
  495. /* alias in the form of "display%d" */
  496. char alias[16];
  497. enum omap_display_type type;
  498. enum omap_display_type output_type;
  499. union {
  500. struct {
  501. int module;
  502. } dsi;
  503. } phy;
  504. struct {
  505. struct videomode vm;
  506. enum omap_dss_dsi_pixel_format dsi_pix_fmt;
  507. enum omap_dss_dsi_mode dsi_mode;
  508. } panel;
  509. struct {
  510. u8 pixel_size;
  511. } ctrl;
  512. const char *name;
  513. /* used to match device to driver */
  514. const char *driver_name;
  515. void *data;
  516. struct omap_dss_driver *driver;
  517. union {
  518. const struct omapdss_dpi_ops *dpi;
  519. const struct omapdss_sdi_ops *sdi;
  520. const struct omapdss_dvi_ops *dvi;
  521. const struct omapdss_hdmi_ops *hdmi;
  522. const struct omapdss_atv_ops *atv;
  523. const struct omapdss_dsi_ops *dsi;
  524. } ops;
  525. /* helper variable for driver suspend/resume */
  526. bool activate_after_resume;
  527. enum omap_display_caps caps;
  528. struct omap_dss_device *src;
  529. enum omap_dss_display_state state;
  530. /* OMAP DSS output specific fields */
  531. struct list_head list;
  532. /* DISPC channel for this output */
  533. enum omap_channel dispc_channel;
  534. bool dispc_channel_connected;
  535. /* output instance */
  536. enum omap_dss_output_id id;
  537. /* the port number in the DT node */
  538. int port_num;
  539. /* dynamic fields */
  540. struct omap_overlay_manager *manager;
  541. struct omap_dss_device *dst;
  542. };
  543. struct omap_dss_driver {
  544. int (*probe)(struct omap_dss_device *);
  545. void (*remove)(struct omap_dss_device *);
  546. int (*connect)(struct omap_dss_device *dssdev);
  547. void (*disconnect)(struct omap_dss_device *dssdev);
  548. int (*enable)(struct omap_dss_device *display);
  549. void (*disable)(struct omap_dss_device *display);
  550. int (*run_test)(struct omap_dss_device *display, int test);
  551. int (*update)(struct omap_dss_device *dssdev,
  552. u16 x, u16 y, u16 w, u16 h);
  553. int (*sync)(struct omap_dss_device *dssdev);
  554. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  555. int (*get_te)(struct omap_dss_device *dssdev);
  556. u8 (*get_rotate)(struct omap_dss_device *dssdev);
  557. int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
  558. bool (*get_mirror)(struct omap_dss_device *dssdev);
  559. int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
  560. int (*memory_read)(struct omap_dss_device *dssdev,
  561. void *buf, size_t size,
  562. u16 x, u16 y, u16 w, u16 h);
  563. int (*check_timings)(struct omap_dss_device *dssdev,
  564. struct videomode *vm);
  565. void (*set_timings)(struct omap_dss_device *dssdev,
  566. struct videomode *vm);
  567. void (*get_timings)(struct omap_dss_device *dssdev,
  568. struct videomode *vm);
  569. int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  570. u32 (*get_wss)(struct omap_dss_device *dssdev);
  571. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  572. bool (*detect)(struct omap_dss_device *dssdev);
  573. int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
  574. int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev,
  575. const struct hdmi_avi_infoframe *avi);
  576. };
  577. enum omapdss_version omapdss_get_version(void);
  578. bool omapdss_is_initialized(void);
  579. int omap_dss_register_driver(struct omap_dss_driver *);
  580. void omap_dss_unregister_driver(struct omap_dss_driver *);
  581. int omapdss_register_display(struct omap_dss_device *dssdev);
  582. void omapdss_unregister_display(struct omap_dss_device *dssdev);
  583. struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
  584. void omap_dss_put_device(struct omap_dss_device *dssdev);
  585. #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
  586. struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
  587. struct omap_dss_device *omap_dss_find_device(void *data,
  588. int (*match)(struct omap_dss_device *dssdev, void *data));
  589. int dss_feat_get_num_mgrs(void);
  590. int dss_feat_get_num_ovls(void);
  591. enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane_id plane);
  592. int omap_dss_get_num_overlay_managers(void);
  593. struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
  594. int omap_dss_get_num_overlays(void);
  595. struct omap_overlay *omap_dss_get_overlay(int num);
  596. int omapdss_register_output(struct omap_dss_device *output);
  597. void omapdss_unregister_output(struct omap_dss_device *output);
  598. struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
  599. struct omap_dss_device *omap_dss_find_output(const char *name);
  600. struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *port);
  601. int omapdss_output_set_device(struct omap_dss_device *out,
  602. struct omap_dss_device *dssdev);
  603. int omapdss_output_unset_device(struct omap_dss_device *out);
  604. struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
  605. struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev);
  606. void omapdss_default_get_timings(struct omap_dss_device *dssdev,
  607. struct videomode *vm);
  608. typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
  609. int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  610. int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  611. int omapdss_compat_init(void);
  612. void omapdss_compat_uninit(void);
  613. static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
  614. {
  615. return dssdev->src;
  616. }
  617. static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
  618. {
  619. return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
  620. }
  621. struct omap_dss_device *
  622. omapdss_of_find_source_for_first_ep(struct device_node *node);
  623. void omapdss_set_is_initialized(bool set);
  624. struct device_node *dss_of_port_get_parent_device(struct device_node *port);
  625. u32 dss_of_port_get_port_number(struct device_node *port);
  626. struct dss_mgr_ops {
  627. int (*connect)(enum omap_channel channel,
  628. struct omap_dss_device *dst);
  629. void (*disconnect)(enum omap_channel channel,
  630. struct omap_dss_device *dst);
  631. void (*start_update)(enum omap_channel channel);
  632. int (*enable)(enum omap_channel channel);
  633. void (*disable)(enum omap_channel channel);
  634. void (*set_timings)(enum omap_channel channel,
  635. const struct videomode *vm);
  636. void (*set_lcd_config)(enum omap_channel channel,
  637. const struct dss_lcd_mgr_config *config);
  638. int (*register_framedone_handler)(enum omap_channel channel,
  639. void (*handler)(void *), void *data);
  640. void (*unregister_framedone_handler)(enum omap_channel channel,
  641. void (*handler)(void *), void *data);
  642. };
  643. int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
  644. void dss_uninstall_mgr_ops(void);
  645. int dss_mgr_connect(enum omap_channel channel,
  646. struct omap_dss_device *dst);
  647. void dss_mgr_disconnect(enum omap_channel channel,
  648. struct omap_dss_device *dst);
  649. void dss_mgr_set_timings(enum omap_channel channel,
  650. const struct videomode *vm);
  651. void dss_mgr_set_lcd_config(enum omap_channel channel,
  652. const struct dss_lcd_mgr_config *config);
  653. int dss_mgr_enable(enum omap_channel channel);
  654. void dss_mgr_disable(enum omap_channel channel);
  655. void dss_mgr_start_update(enum omap_channel channel);
  656. int dss_mgr_register_framedone_handler(enum omap_channel channel,
  657. void (*handler)(void *), void *data);
  658. void dss_mgr_unregister_framedone_handler(enum omap_channel channel,
  659. void (*handler)(void *), void *data);
  660. /* dispc ops */
  661. struct dispc_ops {
  662. u32 (*read_irqstatus)(void);
  663. void (*clear_irqstatus)(u32 mask);
  664. void (*write_irqenable)(u32 mask);
  665. int (*request_irq)(irq_handler_t handler, void *dev_id);
  666. void (*free_irq)(void *dev_id);
  667. int (*runtime_get)(void);
  668. void (*runtime_put)(void);
  669. int (*get_num_ovls)(void);
  670. int (*get_num_mgrs)(void);
  671. void (*mgr_enable)(enum omap_channel channel, bool enable);
  672. bool (*mgr_is_enabled)(enum omap_channel channel);
  673. u32 (*mgr_get_vsync_irq)(enum omap_channel channel);
  674. u32 (*mgr_get_framedone_irq)(enum omap_channel channel);
  675. u32 (*mgr_get_sync_lost_irq)(enum omap_channel channel);
  676. bool (*mgr_go_busy)(enum omap_channel channel);
  677. void (*mgr_go)(enum omap_channel channel);
  678. void (*mgr_set_lcd_config)(enum omap_channel channel,
  679. const struct dss_lcd_mgr_config *config);
  680. void (*mgr_set_timings)(enum omap_channel channel,
  681. const struct videomode *vm);
  682. void (*mgr_setup)(enum omap_channel channel,
  683. const struct omap_overlay_manager_info *info);
  684. enum omap_dss_output_id (*mgr_get_supported_outputs)(enum omap_channel channel);
  685. u32 (*mgr_gamma_size)(enum omap_channel channel);
  686. void (*mgr_set_gamma)(enum omap_channel channel,
  687. const struct drm_color_lut *lut,
  688. unsigned int length);
  689. int (*ovl_enable)(enum omap_plane_id plane, bool enable);
  690. int (*ovl_setup)(enum omap_plane_id plane,
  691. const struct omap_overlay_info *oi,
  692. const struct videomode *vm, bool mem_to_mem,
  693. enum omap_channel channel);
  694. enum omap_color_mode (*ovl_get_color_modes)(enum omap_plane_id plane);
  695. };
  696. void dispc_set_ops(const struct dispc_ops *o);
  697. const struct dispc_ops *dispc_get_ops(void);
  698. bool omapdss_component_is_display(struct device_node *node);
  699. bool omapdss_component_is_output(struct device_node *node);
  700. bool omapdss_stack_is_ready(void);
  701. void omapdss_gather_components(struct device *dev);
  702. #endif /* __OMAP_DRM_DSS_H */