omapdss.h 21 KB

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