omapdss.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. /*
  2. * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/
  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. #include <drm/drm_crtc.h>
  27. #define DISPC_IRQ_FRAMEDONE (1 << 0)
  28. #define DISPC_IRQ_VSYNC (1 << 1)
  29. #define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
  30. #define DISPC_IRQ_EVSYNC_ODD (1 << 3)
  31. #define DISPC_IRQ_ACBIAS_COUNT_STAT (1 << 4)
  32. #define DISPC_IRQ_PROG_LINE_NUM (1 << 5)
  33. #define DISPC_IRQ_GFX_FIFO_UNDERFLOW (1 << 6)
  34. #define DISPC_IRQ_GFX_END_WIN (1 << 7)
  35. #define DISPC_IRQ_PAL_GAMMA_MASK (1 << 8)
  36. #define DISPC_IRQ_OCP_ERR (1 << 9)
  37. #define DISPC_IRQ_VID1_FIFO_UNDERFLOW (1 << 10)
  38. #define DISPC_IRQ_VID1_END_WIN (1 << 11)
  39. #define DISPC_IRQ_VID2_FIFO_UNDERFLOW (1 << 12)
  40. #define DISPC_IRQ_VID2_END_WIN (1 << 13)
  41. #define DISPC_IRQ_SYNC_LOST (1 << 14)
  42. #define DISPC_IRQ_SYNC_LOST_DIGIT (1 << 15)
  43. #define DISPC_IRQ_WAKEUP (1 << 16)
  44. #define DISPC_IRQ_SYNC_LOST2 (1 << 17)
  45. #define DISPC_IRQ_VSYNC2 (1 << 18)
  46. #define DISPC_IRQ_VID3_END_WIN (1 << 19)
  47. #define DISPC_IRQ_VID3_FIFO_UNDERFLOW (1 << 20)
  48. #define DISPC_IRQ_ACBIAS_COUNT_STAT2 (1 << 21)
  49. #define DISPC_IRQ_FRAMEDONE2 (1 << 22)
  50. #define DISPC_IRQ_FRAMEDONEWB (1 << 23)
  51. #define DISPC_IRQ_FRAMEDONETV (1 << 24)
  52. #define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25)
  53. #define DISPC_IRQ_WBUNCOMPLETEERROR (1 << 26)
  54. #define DISPC_IRQ_SYNC_LOST3 (1 << 27)
  55. #define DISPC_IRQ_VSYNC3 (1 << 28)
  56. #define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)
  57. #define DISPC_IRQ_FRAMEDONE3 (1 << 30)
  58. struct dss_device;
  59. struct omap_drm_private;
  60. struct omap_dss_device;
  61. struct dispc_device;
  62. struct dss_device;
  63. struct dss_lcd_mgr_config;
  64. struct snd_aes_iec958;
  65. struct snd_cea_861_aud_if;
  66. struct hdmi_avi_infoframe;
  67. enum omap_display_type {
  68. OMAP_DISPLAY_TYPE_NONE = 0,
  69. OMAP_DISPLAY_TYPE_DPI = 1 << 0,
  70. OMAP_DISPLAY_TYPE_DBI = 1 << 1,
  71. OMAP_DISPLAY_TYPE_SDI = 1 << 2,
  72. OMAP_DISPLAY_TYPE_DSI = 1 << 3,
  73. OMAP_DISPLAY_TYPE_VENC = 1 << 4,
  74. OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
  75. OMAP_DISPLAY_TYPE_DVI = 1 << 6,
  76. };
  77. enum omap_plane_id {
  78. OMAP_DSS_GFX = 0,
  79. OMAP_DSS_VIDEO1 = 1,
  80. OMAP_DSS_VIDEO2 = 2,
  81. OMAP_DSS_VIDEO3 = 3,
  82. OMAP_DSS_WB = 4,
  83. };
  84. enum omap_channel {
  85. OMAP_DSS_CHANNEL_LCD = 0,
  86. OMAP_DSS_CHANNEL_DIGIT = 1,
  87. OMAP_DSS_CHANNEL_LCD2 = 2,
  88. OMAP_DSS_CHANNEL_LCD3 = 3,
  89. OMAP_DSS_CHANNEL_WB = 4,
  90. };
  91. enum omap_color_mode {
  92. _UNUSED_,
  93. };
  94. enum omap_dss_load_mode {
  95. OMAP_DSS_LOAD_CLUT_AND_FRAME = 0,
  96. OMAP_DSS_LOAD_CLUT_ONLY = 1,
  97. OMAP_DSS_LOAD_FRAME_ONLY = 2,
  98. OMAP_DSS_LOAD_CLUT_ONCE_FRAME = 3,
  99. };
  100. enum omap_dss_trans_key_type {
  101. OMAP_DSS_COLOR_KEY_GFX_DST = 0,
  102. OMAP_DSS_COLOR_KEY_VID_SRC = 1,
  103. };
  104. enum omap_dss_signal_level {
  105. OMAPDSS_SIG_ACTIVE_LOW,
  106. OMAPDSS_SIG_ACTIVE_HIGH,
  107. };
  108. enum omap_dss_signal_edge {
  109. OMAPDSS_DRIVE_SIG_FALLING_EDGE,
  110. OMAPDSS_DRIVE_SIG_RISING_EDGE,
  111. };
  112. enum omap_dss_venc_type {
  113. OMAP_DSS_VENC_TYPE_COMPOSITE,
  114. OMAP_DSS_VENC_TYPE_SVIDEO,
  115. };
  116. enum omap_dss_dsi_pixel_format {
  117. OMAP_DSS_DSI_FMT_RGB888,
  118. OMAP_DSS_DSI_FMT_RGB666,
  119. OMAP_DSS_DSI_FMT_RGB666_PACKED,
  120. OMAP_DSS_DSI_FMT_RGB565,
  121. };
  122. enum omap_dss_dsi_mode {
  123. OMAP_DSS_DSI_CMD_MODE = 0,
  124. OMAP_DSS_DSI_VIDEO_MODE,
  125. };
  126. enum omap_display_caps {
  127. OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE = 1 << 0,
  128. OMAP_DSS_DISPLAY_CAP_TEAR_ELIM = 1 << 1,
  129. };
  130. enum omap_dss_display_state {
  131. OMAP_DSS_DISPLAY_DISABLED = 0,
  132. OMAP_DSS_DISPLAY_ACTIVE,
  133. };
  134. enum omap_dss_rotation_type {
  135. OMAP_DSS_ROT_NONE = 0,
  136. OMAP_DSS_ROT_TILER = 1 << 0,
  137. };
  138. enum omap_overlay_caps {
  139. OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
  140. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
  141. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
  142. OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
  143. OMAP_DSS_OVL_CAP_POS = 1 << 4,
  144. OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
  145. };
  146. enum omap_dss_output_id {
  147. OMAP_DSS_OUTPUT_DPI = 1 << 0,
  148. OMAP_DSS_OUTPUT_DBI = 1 << 1,
  149. OMAP_DSS_OUTPUT_SDI = 1 << 2,
  150. OMAP_DSS_OUTPUT_DSI1 = 1 << 3,
  151. OMAP_DSS_OUTPUT_DSI2 = 1 << 4,
  152. OMAP_DSS_OUTPUT_VENC = 1 << 5,
  153. OMAP_DSS_OUTPUT_HDMI = 1 << 6,
  154. };
  155. /* DSI */
  156. enum omap_dss_dsi_trans_mode {
  157. /* Sync Pulses: both sync start and end packets sent */
  158. OMAP_DSS_DSI_PULSE_MODE,
  159. /* Sync Events: only sync start packets sent */
  160. OMAP_DSS_DSI_EVENT_MODE,
  161. /* Burst: only sync start packets sent, pixels are time compressed */
  162. OMAP_DSS_DSI_BURST_MODE,
  163. };
  164. struct omap_dss_dsi_videomode_timings {
  165. unsigned long hsclk;
  166. unsigned int ndl;
  167. unsigned int bitspp;
  168. /* pixels */
  169. u16 hact;
  170. /* lines */
  171. u16 vact;
  172. /* DSI video mode blanking data */
  173. /* Unit: byte clock cycles */
  174. u16 hss;
  175. u16 hsa;
  176. u16 hse;
  177. u16 hfp;
  178. u16 hbp;
  179. /* Unit: line clocks */
  180. u16 vsa;
  181. u16 vfp;
  182. u16 vbp;
  183. /* DSI blanking modes */
  184. int blanking_mode;
  185. int hsa_blanking_mode;
  186. int hbp_blanking_mode;
  187. int hfp_blanking_mode;
  188. enum omap_dss_dsi_trans_mode trans_mode;
  189. bool ddr_clk_always_on;
  190. int window_sync;
  191. };
  192. struct omap_dss_dsi_config {
  193. enum omap_dss_dsi_mode mode;
  194. enum omap_dss_dsi_pixel_format pixel_format;
  195. const struct videomode *vm;
  196. unsigned long hs_clk_min, hs_clk_max;
  197. unsigned long lp_clk_min, lp_clk_max;
  198. bool ddr_clk_always_on;
  199. enum omap_dss_dsi_trans_mode trans_mode;
  200. };
  201. struct omap_dss_cpr_coefs {
  202. s16 rr, rg, rb;
  203. s16 gr, gg, gb;
  204. s16 br, bg, bb;
  205. };
  206. struct omap_overlay_info {
  207. dma_addr_t paddr;
  208. dma_addr_t p_uv_addr; /* for NV12 format */
  209. u16 screen_width;
  210. u16 width;
  211. u16 height;
  212. u32 fourcc;
  213. u8 rotation;
  214. enum omap_dss_rotation_type rotation_type;
  215. u16 pos_x;
  216. u16 pos_y;
  217. u16 out_width; /* if 0, out_width == width */
  218. u16 out_height; /* if 0, out_height == height */
  219. u8 global_alpha;
  220. u8 pre_mult_alpha;
  221. u8 zorder;
  222. };
  223. struct omap_overlay_manager_info {
  224. u32 default_color;
  225. enum omap_dss_trans_key_type trans_key_type;
  226. u32 trans_key;
  227. bool trans_enabled;
  228. bool partial_alpha_enabled;
  229. bool cpr_enable;
  230. struct omap_dss_cpr_coefs cpr_coefs;
  231. };
  232. /* 22 pins means 1 clk lane and 10 data lanes */
  233. #define OMAP_DSS_MAX_DSI_PINS 22
  234. struct omap_dsi_pin_config {
  235. int num_pins;
  236. /*
  237. * pin numbers in the following order:
  238. * clk+, clk-
  239. * data1+, data1-
  240. * data2+, data2-
  241. * ...
  242. */
  243. int pins[OMAP_DSS_MAX_DSI_PINS];
  244. };
  245. struct omap_dss_writeback_info {
  246. u32 paddr;
  247. u32 p_uv_addr;
  248. u16 buf_width;
  249. u16 width;
  250. u16 height;
  251. u32 fourcc;
  252. u8 rotation;
  253. enum omap_dss_rotation_type rotation_type;
  254. u8 pre_mult_alpha;
  255. };
  256. struct omapdss_hdmi_ops {
  257. void (*lost_hotplug)(struct omap_dss_device *dssdev);
  258. int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
  259. int (*set_infoframe)(struct omap_dss_device *dssdev,
  260. const struct hdmi_avi_infoframe *avi);
  261. };
  262. struct omapdss_dsi_ops {
  263. void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
  264. bool enter_ulps);
  265. /* bus configuration */
  266. int (*set_config)(struct omap_dss_device *dssdev,
  267. const struct omap_dss_dsi_config *cfg);
  268. int (*configure_pins)(struct omap_dss_device *dssdev,
  269. const struct omap_dsi_pin_config *pin_cfg);
  270. void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
  271. bool enable);
  272. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  273. int (*update)(struct omap_dss_device *dssdev, int channel,
  274. void (*callback)(int, void *), void *data);
  275. void (*bus_lock)(struct omap_dss_device *dssdev);
  276. void (*bus_unlock)(struct omap_dss_device *dssdev);
  277. int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
  278. void (*disable_video_output)(struct omap_dss_device *dssdev,
  279. int channel);
  280. int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
  281. int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
  282. int vc_id);
  283. void (*release_vc)(struct omap_dss_device *dssdev, int channel);
  284. /* data transfer */
  285. int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
  286. u8 *data, int len);
  287. int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
  288. u8 *data, int len);
  289. int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  290. u8 *data, int len);
  291. int (*gen_write)(struct omap_dss_device *dssdev, int channel,
  292. u8 *data, int len);
  293. int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
  294. u8 *data, int len);
  295. int (*gen_read)(struct omap_dss_device *dssdev, int channel,
  296. u8 *reqdata, int reqlen,
  297. u8 *data, int len);
  298. int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
  299. int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
  300. int channel, u16 plen);
  301. };
  302. struct omap_dss_device_ops {
  303. int (*connect)(struct omap_dss_device *dssdev,
  304. struct omap_dss_device *dst);
  305. void (*disconnect)(struct omap_dss_device *dssdev,
  306. struct omap_dss_device *dst);
  307. int (*enable)(struct omap_dss_device *dssdev);
  308. void (*disable)(struct omap_dss_device *dssdev);
  309. int (*check_timings)(struct omap_dss_device *dssdev,
  310. struct videomode *vm);
  311. void (*get_timings)(struct omap_dss_device *dssdev,
  312. struct videomode *vm);
  313. void (*set_timings)(struct omap_dss_device *dssdev,
  314. const struct videomode *vm);
  315. bool (*detect)(struct omap_dss_device *dssdev);
  316. void (*register_hpd_cb)(struct omap_dss_device *dssdev,
  317. void (*cb)(void *cb_data,
  318. enum drm_connector_status status),
  319. void *cb_data);
  320. void (*unregister_hpd_cb)(struct omap_dss_device *dssdev);
  321. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  322. union {
  323. const struct omapdss_hdmi_ops hdmi;
  324. const struct omapdss_dsi_ops dsi;
  325. };
  326. };
  327. /**
  328. * enum omap_dss_device_ops_flag - Indicates which device ops are supported
  329. * @OMAP_DSS_DEVICE_OP_DETECT: The device supports output connection detection
  330. * @OMAP_DSS_DEVICE_OP_HPD: The device supports all hot-plug-related operations
  331. * @OMAP_DSS_DEVICE_OP_EDID: The device supports readind EDID
  332. */
  333. enum omap_dss_device_ops_flag {
  334. OMAP_DSS_DEVICE_OP_DETECT = BIT(0),
  335. OMAP_DSS_DEVICE_OP_HPD = BIT(1),
  336. OMAP_DSS_DEVICE_OP_EDID = BIT(2),
  337. };
  338. enum omap_dss_device_type {
  339. OMAP_DSS_DEVICE_TYPE_OUTPUT = (1 << 0),
  340. OMAP_DSS_DEVICE_TYPE_DISPLAY = (1 << 1),
  341. };
  342. struct omap_dss_device {
  343. struct kobject kobj;
  344. struct device *dev;
  345. struct module *owner;
  346. struct dss_device *dss;
  347. struct omap_dss_device *src;
  348. struct omap_dss_device *dst;
  349. struct omap_dss_device *next;
  350. struct list_head list;
  351. unsigned int alias_id;
  352. enum omap_display_type type;
  353. /*
  354. * DSS output type that this device generates (for DSS internal devices)
  355. * or requires (for external encoders). Must be OMAP_DISPLAY_TYPE_NONE
  356. * for display devices (connectors and panels) and to non-zero value for
  357. * all other devices.
  358. */
  359. enum omap_display_type output_type;
  360. const char *name;
  361. const struct omap_dss_driver *driver;
  362. const struct omap_dss_device_ops *ops;
  363. unsigned long ops_flags;
  364. u32 bus_flags;
  365. /* helper variable for driver suspend/resume */
  366. bool activate_after_resume;
  367. enum omap_display_caps caps;
  368. enum omap_dss_display_state state;
  369. /* OMAP DSS output specific fields */
  370. /* DISPC channel for this output */
  371. enum omap_channel dispc_channel;
  372. bool dispc_channel_connected;
  373. /* output instance */
  374. enum omap_dss_output_id id;
  375. /* bitmask of port numbers in DT */
  376. unsigned int of_ports;
  377. };
  378. struct omap_dss_driver {
  379. int (*update)(struct omap_dss_device *dssdev,
  380. u16 x, u16 y, u16 w, u16 h);
  381. int (*sync)(struct omap_dss_device *dssdev);
  382. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  383. int (*get_te)(struct omap_dss_device *dssdev);
  384. int (*memory_read)(struct omap_dss_device *dssdev,
  385. void *buf, size_t size,
  386. u16 x, u16 y, u16 w, u16 h);
  387. void (*get_size)(struct omap_dss_device *dssdev,
  388. unsigned int *width, unsigned int *height);
  389. };
  390. struct dss_device *omapdss_get_dss(void);
  391. void omapdss_set_dss(struct dss_device *dss);
  392. static inline bool omapdss_is_initialized(void)
  393. {
  394. return !!omapdss_get_dss();
  395. }
  396. #define for_each_dss_display(d) \
  397. while ((d = omapdss_device_get_next(d, OMAP_DSS_DEVICE_TYPE_DISPLAY)) != NULL)
  398. void omapdss_display_init(struct omap_dss_device *dssdev);
  399. struct omap_dss_device *omapdss_display_get(struct omap_dss_device *output);
  400. void omapdss_device_register(struct omap_dss_device *dssdev);
  401. void omapdss_device_unregister(struct omap_dss_device *dssdev);
  402. struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev);
  403. void omapdss_device_put(struct omap_dss_device *dssdev);
  404. struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
  405. unsigned int port);
  406. struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
  407. enum omap_dss_device_type type);
  408. int omapdss_device_connect(struct dss_device *dss,
  409. struct omap_dss_device *src,
  410. struct omap_dss_device *dst);
  411. void omapdss_device_disconnect(struct omap_dss_device *src,
  412. struct omap_dss_device *dst);
  413. int omap_dss_get_num_overlay_managers(void);
  414. int omap_dss_get_num_overlays(void);
  415. #define for_each_dss_output(d) \
  416. while ((d = omapdss_device_get_next(d, OMAP_DSS_DEVICE_TYPE_OUTPUT)) != NULL)
  417. int omapdss_output_validate(struct omap_dss_device *out);
  418. typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
  419. int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  420. int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  421. int omapdss_compat_init(void);
  422. void omapdss_compat_uninit(void);
  423. static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
  424. {
  425. return dssdev->src;
  426. }
  427. static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
  428. {
  429. return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
  430. }
  431. struct omap_dss_device *
  432. omapdss_of_find_connected_device(struct device_node *node, unsigned int port);
  433. enum dss_writeback_channel {
  434. DSS_WB_LCD1_MGR = 0,
  435. DSS_WB_LCD2_MGR = 1,
  436. DSS_WB_TV_MGR = 2,
  437. DSS_WB_OVL0 = 3,
  438. DSS_WB_OVL1 = 4,
  439. DSS_WB_OVL2 = 5,
  440. DSS_WB_OVL3 = 6,
  441. DSS_WB_LCD3_MGR = 7,
  442. };
  443. struct dss_mgr_ops {
  444. void (*start_update)(struct omap_drm_private *priv,
  445. enum omap_channel channel);
  446. int (*enable)(struct omap_drm_private *priv,
  447. enum omap_channel channel);
  448. void (*disable)(struct omap_drm_private *priv,
  449. enum omap_channel channel);
  450. void (*set_timings)(struct omap_drm_private *priv,
  451. enum omap_channel channel,
  452. const struct videomode *vm);
  453. void (*set_lcd_config)(struct omap_drm_private *priv,
  454. enum omap_channel channel,
  455. const struct dss_lcd_mgr_config *config);
  456. int (*register_framedone_handler)(struct omap_drm_private *priv,
  457. enum omap_channel channel,
  458. void (*handler)(void *), void *data);
  459. void (*unregister_framedone_handler)(struct omap_drm_private *priv,
  460. enum omap_channel channel,
  461. void (*handler)(void *), void *data);
  462. };
  463. int dss_install_mgr_ops(struct dss_device *dss,
  464. const struct dss_mgr_ops *mgr_ops,
  465. struct omap_drm_private *priv);
  466. void dss_uninstall_mgr_ops(struct dss_device *dss);
  467. void dss_mgr_set_timings(struct omap_dss_device *dssdev,
  468. const struct videomode *vm);
  469. void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
  470. const struct dss_lcd_mgr_config *config);
  471. int dss_mgr_enable(struct omap_dss_device *dssdev);
  472. void dss_mgr_disable(struct omap_dss_device *dssdev);
  473. void dss_mgr_start_update(struct omap_dss_device *dssdev);
  474. int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
  475. void (*handler)(void *), void *data);
  476. void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
  477. void (*handler)(void *), void *data);
  478. /* dispc ops */
  479. struct dispc_ops {
  480. u32 (*read_irqstatus)(struct dispc_device *dispc);
  481. void (*clear_irqstatus)(struct dispc_device *dispc, u32 mask);
  482. void (*write_irqenable)(struct dispc_device *dispc, u32 mask);
  483. int (*request_irq)(struct dispc_device *dispc, irq_handler_t handler,
  484. void *dev_id);
  485. void (*free_irq)(struct dispc_device *dispc, void *dev_id);
  486. int (*runtime_get)(struct dispc_device *dispc);
  487. void (*runtime_put)(struct dispc_device *dispc);
  488. int (*get_num_ovls)(struct dispc_device *dispc);
  489. int (*get_num_mgrs)(struct dispc_device *dispc);
  490. u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc);
  491. void (*mgr_enable)(struct dispc_device *dispc,
  492. enum omap_channel channel, bool enable);
  493. bool (*mgr_is_enabled)(struct dispc_device *dispc,
  494. enum omap_channel channel);
  495. u32 (*mgr_get_vsync_irq)(struct dispc_device *dispc,
  496. enum omap_channel channel);
  497. u32 (*mgr_get_framedone_irq)(struct dispc_device *dispc,
  498. enum omap_channel channel);
  499. u32 (*mgr_get_sync_lost_irq)(struct dispc_device *dispc,
  500. enum omap_channel channel);
  501. bool (*mgr_go_busy)(struct dispc_device *dispc,
  502. enum omap_channel channel);
  503. void (*mgr_go)(struct dispc_device *dispc, enum omap_channel channel);
  504. void (*mgr_set_lcd_config)(struct dispc_device *dispc,
  505. enum omap_channel channel,
  506. const struct dss_lcd_mgr_config *config);
  507. int (*mgr_check_timings)(struct dispc_device *dispc,
  508. enum omap_channel channel,
  509. const struct videomode *vm);
  510. void (*mgr_set_timings)(struct dispc_device *dispc,
  511. enum omap_channel channel,
  512. const struct videomode *vm);
  513. void (*mgr_setup)(struct dispc_device *dispc, enum omap_channel channel,
  514. const struct omap_overlay_manager_info *info);
  515. u32 (*mgr_gamma_size)(struct dispc_device *dispc,
  516. enum omap_channel channel);
  517. void (*mgr_set_gamma)(struct dispc_device *dispc,
  518. enum omap_channel channel,
  519. const struct drm_color_lut *lut,
  520. unsigned int length);
  521. int (*ovl_enable)(struct dispc_device *dispc, enum omap_plane_id plane,
  522. bool enable);
  523. int (*ovl_setup)(struct dispc_device *dispc, enum omap_plane_id plane,
  524. const struct omap_overlay_info *oi,
  525. const struct videomode *vm, bool mem_to_mem,
  526. enum omap_channel channel);
  527. const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc,
  528. enum omap_plane_id plane);
  529. u32 (*wb_get_framedone_irq)(struct dispc_device *dispc);
  530. int (*wb_setup)(struct dispc_device *dispc,
  531. const struct omap_dss_writeback_info *wi,
  532. bool mem_to_mem, const struct videomode *vm,
  533. enum dss_writeback_channel channel_in);
  534. bool (*has_writeback)(struct dispc_device *dispc);
  535. bool (*wb_go_busy)(struct dispc_device *dispc);
  536. void (*wb_go)(struct dispc_device *dispc);
  537. };
  538. struct dispc_device *dispc_get_dispc(struct dss_device *dss);
  539. const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
  540. bool omapdss_stack_is_ready(void);
  541. void omapdss_gather_components(struct device *dev);
  542. #endif /* __OMAP_DRM_DSS_H */