omapdss.h 22 KB

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