omapdss.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  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_dpi_ops {
  257. int (*connect)(struct omap_dss_device *dssdev,
  258. struct omap_dss_device *dst);
  259. void (*disconnect)(struct omap_dss_device *dssdev,
  260. struct omap_dss_device *dst);
  261. int (*enable)(struct omap_dss_device *dssdev);
  262. void (*disable)(struct omap_dss_device *dssdev);
  263. int (*check_timings)(struct omap_dss_device *dssdev,
  264. struct videomode *vm);
  265. void (*set_timings)(struct omap_dss_device *dssdev,
  266. struct videomode *vm);
  267. void (*get_timings)(struct omap_dss_device *dssdev,
  268. struct videomode *vm);
  269. };
  270. struct omapdss_sdi_ops {
  271. int (*connect)(struct omap_dss_device *dssdev,
  272. struct omap_dss_device *dst);
  273. void (*disconnect)(struct omap_dss_device *dssdev,
  274. struct omap_dss_device *dst);
  275. int (*enable)(struct omap_dss_device *dssdev);
  276. void (*disable)(struct omap_dss_device *dssdev);
  277. int (*check_timings)(struct omap_dss_device *dssdev,
  278. struct videomode *vm);
  279. void (*set_timings)(struct omap_dss_device *dssdev,
  280. struct videomode *vm);
  281. void (*get_timings)(struct omap_dss_device *dssdev,
  282. struct videomode *vm);
  283. };
  284. struct omapdss_dvi_ops {
  285. int (*connect)(struct omap_dss_device *dssdev,
  286. struct omap_dss_device *dst);
  287. void (*disconnect)(struct omap_dss_device *dssdev,
  288. struct omap_dss_device *dst);
  289. int (*enable)(struct omap_dss_device *dssdev);
  290. void (*disable)(struct omap_dss_device *dssdev);
  291. int (*check_timings)(struct omap_dss_device *dssdev,
  292. struct videomode *vm);
  293. void (*set_timings)(struct omap_dss_device *dssdev,
  294. struct videomode *vm);
  295. void (*get_timings)(struct omap_dss_device *dssdev,
  296. struct videomode *vm);
  297. };
  298. struct omapdss_atv_ops {
  299. int (*connect)(struct omap_dss_device *dssdev,
  300. struct omap_dss_device *dst);
  301. void (*disconnect)(struct omap_dss_device *dssdev,
  302. struct omap_dss_device *dst);
  303. int (*enable)(struct omap_dss_device *dssdev);
  304. void (*disable)(struct omap_dss_device *dssdev);
  305. int (*check_timings)(struct omap_dss_device *dssdev,
  306. struct videomode *vm);
  307. void (*set_timings)(struct omap_dss_device *dssdev,
  308. struct videomode *vm);
  309. void (*get_timings)(struct omap_dss_device *dssdev,
  310. struct videomode *vm);
  311. int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  312. u32 (*get_wss)(struct omap_dss_device *dssdev);
  313. };
  314. struct omapdss_hdmi_ops {
  315. int (*connect)(struct omap_dss_device *dssdev,
  316. struct omap_dss_device *dst);
  317. void (*disconnect)(struct omap_dss_device *dssdev,
  318. struct omap_dss_device *dst);
  319. int (*enable)(struct omap_dss_device *dssdev);
  320. void (*disable)(struct omap_dss_device *dssdev);
  321. int (*check_timings)(struct omap_dss_device *dssdev,
  322. struct videomode *vm);
  323. void (*set_timings)(struct omap_dss_device *dssdev,
  324. struct videomode *vm);
  325. void (*get_timings)(struct omap_dss_device *dssdev,
  326. struct videomode *vm);
  327. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  328. void (*lost_hotplug)(struct omap_dss_device *dssdev);
  329. bool (*detect)(struct omap_dss_device *dssdev);
  330. int (*register_hpd_cb)(struct omap_dss_device *dssdev,
  331. void (*cb)(void *cb_data,
  332. enum drm_connector_status status),
  333. void *cb_data);
  334. void (*unregister_hpd_cb)(struct omap_dss_device *dssdev);
  335. void (*enable_hpd)(struct omap_dss_device *dssdev);
  336. void (*disable_hpd)(struct omap_dss_device *dssdev);
  337. int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
  338. int (*set_infoframe)(struct omap_dss_device *dssdev,
  339. const struct hdmi_avi_infoframe *avi);
  340. };
  341. struct omapdss_dsi_ops {
  342. int (*connect)(struct omap_dss_device *dssdev,
  343. struct omap_dss_device *dst);
  344. void (*disconnect)(struct omap_dss_device *dssdev,
  345. struct omap_dss_device *dst);
  346. int (*enable)(struct omap_dss_device *dssdev);
  347. void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
  348. bool enter_ulps);
  349. /* bus configuration */
  350. int (*set_config)(struct omap_dss_device *dssdev,
  351. const struct omap_dss_dsi_config *cfg);
  352. int (*configure_pins)(struct omap_dss_device *dssdev,
  353. const struct omap_dsi_pin_config *pin_cfg);
  354. void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
  355. bool enable);
  356. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  357. int (*update)(struct omap_dss_device *dssdev, int channel,
  358. void (*callback)(int, void *), void *data);
  359. void (*bus_lock)(struct omap_dss_device *dssdev);
  360. void (*bus_unlock)(struct omap_dss_device *dssdev);
  361. int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
  362. void (*disable_video_output)(struct omap_dss_device *dssdev,
  363. int channel);
  364. int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
  365. int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
  366. int vc_id);
  367. void (*release_vc)(struct omap_dss_device *dssdev, int channel);
  368. /* data transfer */
  369. int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
  370. u8 *data, int len);
  371. int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
  372. u8 *data, int len);
  373. int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  374. u8 *data, int len);
  375. int (*gen_write)(struct omap_dss_device *dssdev, int channel,
  376. u8 *data, int len);
  377. int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
  378. u8 *data, int len);
  379. int (*gen_read)(struct omap_dss_device *dssdev, int channel,
  380. u8 *reqdata, int reqlen,
  381. u8 *data, int len);
  382. int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
  383. int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
  384. int channel, u16 plen);
  385. };
  386. struct omap_dss_device {
  387. struct kobject kobj;
  388. struct device *dev;
  389. struct module *owner;
  390. struct list_head panel_list;
  391. /* alias in the form of "display%d" */
  392. char alias[16];
  393. enum omap_display_type type;
  394. enum omap_display_type output_type;
  395. struct {
  396. struct videomode vm;
  397. enum omap_dss_dsi_pixel_format dsi_pix_fmt;
  398. enum omap_dss_dsi_mode dsi_mode;
  399. } panel;
  400. const char *name;
  401. struct omap_dss_driver *driver;
  402. union {
  403. const struct omapdss_dpi_ops *dpi;
  404. const struct omapdss_sdi_ops *sdi;
  405. const struct omapdss_dvi_ops *dvi;
  406. const struct omapdss_hdmi_ops *hdmi;
  407. const struct omapdss_atv_ops *atv;
  408. const struct omapdss_dsi_ops *dsi;
  409. } ops;
  410. /* helper variable for driver suspend/resume */
  411. bool activate_after_resume;
  412. enum omap_display_caps caps;
  413. struct omap_dss_device *src;
  414. enum omap_dss_display_state state;
  415. /* OMAP DSS output specific fields */
  416. struct list_head list;
  417. /* DISPC channel for this output */
  418. enum omap_channel dispc_channel;
  419. bool dispc_channel_connected;
  420. /* output instance */
  421. enum omap_dss_output_id id;
  422. /* the port number in the DT node */
  423. int port_num;
  424. /* dynamic fields */
  425. struct omap_dss_device *dst;
  426. };
  427. struct omap_dss_driver {
  428. int (*probe)(struct omap_dss_device *);
  429. void (*remove)(struct omap_dss_device *);
  430. int (*connect)(struct omap_dss_device *dssdev);
  431. void (*disconnect)(struct omap_dss_device *dssdev);
  432. int (*enable)(struct omap_dss_device *display);
  433. void (*disable)(struct omap_dss_device *display);
  434. int (*run_test)(struct omap_dss_device *display, int test);
  435. int (*update)(struct omap_dss_device *dssdev,
  436. u16 x, u16 y, u16 w, u16 h);
  437. int (*sync)(struct omap_dss_device *dssdev);
  438. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  439. int (*get_te)(struct omap_dss_device *dssdev);
  440. u8 (*get_rotate)(struct omap_dss_device *dssdev);
  441. int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
  442. bool (*get_mirror)(struct omap_dss_device *dssdev);
  443. int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
  444. int (*memory_read)(struct omap_dss_device *dssdev,
  445. void *buf, size_t size,
  446. u16 x, u16 y, u16 w, u16 h);
  447. int (*check_timings)(struct omap_dss_device *dssdev,
  448. struct videomode *vm);
  449. void (*set_timings)(struct omap_dss_device *dssdev,
  450. struct videomode *vm);
  451. void (*get_timings)(struct omap_dss_device *dssdev,
  452. struct videomode *vm);
  453. void (*get_size)(struct omap_dss_device *dssdev,
  454. unsigned int *width, unsigned int *height);
  455. int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  456. u32 (*get_wss)(struct omap_dss_device *dssdev);
  457. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  458. bool (*detect)(struct omap_dss_device *dssdev);
  459. int (*register_hpd_cb)(struct omap_dss_device *dssdev,
  460. void (*cb)(void *cb_data,
  461. enum drm_connector_status status),
  462. void *cb_data);
  463. void (*unregister_hpd_cb)(struct omap_dss_device *dssdev);
  464. void (*enable_hpd)(struct omap_dss_device *dssdev);
  465. void (*disable_hpd)(struct omap_dss_device *dssdev);
  466. int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
  467. int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev,
  468. const struct hdmi_avi_infoframe *avi);
  469. };
  470. struct dss_device *omapdss_get_dss(void);
  471. void omapdss_set_dss(struct dss_device *dss);
  472. static inline bool omapdss_is_initialized(void)
  473. {
  474. return !!omapdss_get_dss();
  475. }
  476. int omapdss_register_display(struct omap_dss_device *dssdev);
  477. void omapdss_unregister_display(struct omap_dss_device *dssdev);
  478. struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
  479. void omap_dss_put_device(struct omap_dss_device *dssdev);
  480. #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
  481. struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
  482. int omap_dss_get_num_overlay_managers(void);
  483. int omap_dss_get_num_overlays(void);
  484. int omapdss_register_output(struct omap_dss_device *output);
  485. void omapdss_unregister_output(struct omap_dss_device *output);
  486. struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
  487. struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *port);
  488. int omapdss_output_set_device(struct omap_dss_device *out,
  489. struct omap_dss_device *dssdev);
  490. int omapdss_output_unset_device(struct omap_dss_device *out);
  491. struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
  492. typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
  493. int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  494. int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  495. int omapdss_compat_init(void);
  496. void omapdss_compat_uninit(void);
  497. static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
  498. {
  499. return dssdev->src;
  500. }
  501. static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
  502. {
  503. return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
  504. }
  505. struct omap_dss_device *
  506. omapdss_of_find_source_for_first_ep(struct device_node *node);
  507. struct device_node *dss_of_port_get_parent_device(struct device_node *port);
  508. u32 dss_of_port_get_port_number(struct device_node *port);
  509. enum dss_writeback_channel {
  510. DSS_WB_LCD1_MGR = 0,
  511. DSS_WB_LCD2_MGR = 1,
  512. DSS_WB_TV_MGR = 2,
  513. DSS_WB_OVL0 = 3,
  514. DSS_WB_OVL1 = 4,
  515. DSS_WB_OVL2 = 5,
  516. DSS_WB_OVL3 = 6,
  517. DSS_WB_LCD3_MGR = 7,
  518. };
  519. struct dss_mgr_ops {
  520. int (*connect)(struct omap_drm_private *priv,
  521. enum omap_channel channel,
  522. struct omap_dss_device *dst);
  523. void (*disconnect)(struct omap_drm_private *priv,
  524. enum omap_channel channel,
  525. struct omap_dss_device *dst);
  526. void (*start_update)(struct omap_drm_private *priv,
  527. enum omap_channel channel);
  528. int (*enable)(struct omap_drm_private *priv,
  529. enum omap_channel channel);
  530. void (*disable)(struct omap_drm_private *priv,
  531. enum omap_channel channel);
  532. void (*set_timings)(struct omap_drm_private *priv,
  533. enum omap_channel channel,
  534. const struct videomode *vm);
  535. void (*set_lcd_config)(struct omap_drm_private *priv,
  536. enum omap_channel channel,
  537. const struct dss_lcd_mgr_config *config);
  538. int (*register_framedone_handler)(struct omap_drm_private *priv,
  539. enum omap_channel channel,
  540. void (*handler)(void *), void *data);
  541. void (*unregister_framedone_handler)(struct omap_drm_private *priv,
  542. enum omap_channel channel,
  543. void (*handler)(void *), void *data);
  544. };
  545. int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops,
  546. struct omap_drm_private *priv);
  547. void dss_uninstall_mgr_ops(void);
  548. int dss_mgr_connect(struct omap_dss_device *dssdev,
  549. struct omap_dss_device *dst);
  550. void dss_mgr_disconnect(struct omap_dss_device *dssdev,
  551. struct omap_dss_device *dst);
  552. void dss_mgr_set_timings(struct omap_dss_device *dssdev,
  553. const struct videomode *vm);
  554. void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
  555. const struct dss_lcd_mgr_config *config);
  556. int dss_mgr_enable(struct omap_dss_device *dssdev);
  557. void dss_mgr_disable(struct omap_dss_device *dssdev);
  558. void dss_mgr_start_update(struct omap_dss_device *dssdev);
  559. int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
  560. void (*handler)(void *), void *data);
  561. void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
  562. void (*handler)(void *), void *data);
  563. /* dispc ops */
  564. struct dispc_ops {
  565. u32 (*read_irqstatus)(struct dispc_device *dispc);
  566. void (*clear_irqstatus)(struct dispc_device *dispc, u32 mask);
  567. void (*write_irqenable)(struct dispc_device *dispc, u32 mask);
  568. int (*request_irq)(struct dispc_device *dispc, irq_handler_t handler,
  569. void *dev_id);
  570. void (*free_irq)(struct dispc_device *dispc, void *dev_id);
  571. int (*runtime_get)(struct dispc_device *dispc);
  572. void (*runtime_put)(struct dispc_device *dispc);
  573. int (*get_num_ovls)(struct dispc_device *dispc);
  574. int (*get_num_mgrs)(struct dispc_device *dispc);
  575. u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc);
  576. void (*mgr_enable)(struct dispc_device *dispc,
  577. enum omap_channel channel, bool enable);
  578. bool (*mgr_is_enabled)(struct dispc_device *dispc,
  579. enum omap_channel channel);
  580. u32 (*mgr_get_vsync_irq)(struct dispc_device *dispc,
  581. enum omap_channel channel);
  582. u32 (*mgr_get_framedone_irq)(struct dispc_device *dispc,
  583. enum omap_channel channel);
  584. u32 (*mgr_get_sync_lost_irq)(struct dispc_device *dispc,
  585. enum omap_channel channel);
  586. bool (*mgr_go_busy)(struct dispc_device *dispc,
  587. enum omap_channel channel);
  588. void (*mgr_go)(struct dispc_device *dispc, enum omap_channel channel);
  589. void (*mgr_set_lcd_config)(struct dispc_device *dispc,
  590. enum omap_channel channel,
  591. const struct dss_lcd_mgr_config *config);
  592. void (*mgr_set_timings)(struct dispc_device *dispc,
  593. enum omap_channel channel,
  594. const struct videomode *vm);
  595. void (*mgr_setup)(struct dispc_device *dispc, enum omap_channel channel,
  596. const struct omap_overlay_manager_info *info);
  597. enum omap_dss_output_id (*mgr_get_supported_outputs)(
  598. struct dispc_device *dispc, enum omap_channel channel);
  599. u32 (*mgr_gamma_size)(struct dispc_device *dispc,
  600. enum omap_channel channel);
  601. void (*mgr_set_gamma)(struct dispc_device *dispc,
  602. enum omap_channel channel,
  603. const struct drm_color_lut *lut,
  604. unsigned int length);
  605. int (*ovl_enable)(struct dispc_device *dispc, enum omap_plane_id plane,
  606. bool enable);
  607. int (*ovl_setup)(struct dispc_device *dispc, enum omap_plane_id plane,
  608. const struct omap_overlay_info *oi,
  609. const struct videomode *vm, bool mem_to_mem,
  610. enum omap_channel channel);
  611. const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc,
  612. enum omap_plane_id plane);
  613. u32 (*wb_get_framedone_irq)(struct dispc_device *dispc);
  614. int (*wb_setup)(struct dispc_device *dispc,
  615. const struct omap_dss_writeback_info *wi,
  616. bool mem_to_mem, const struct videomode *vm,
  617. enum dss_writeback_channel channel_in);
  618. bool (*has_writeback)(struct dispc_device *dispc);
  619. bool (*wb_go_busy)(struct dispc_device *dispc);
  620. void (*wb_go)(struct dispc_device *dispc);
  621. };
  622. struct dispc_device *dispc_get_dispc(struct dss_device *dss);
  623. const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
  624. bool omapdss_component_is_display(struct device_node *node);
  625. bool omapdss_component_is_output(struct device_node *node);
  626. bool omapdss_stack_is_ready(void);
  627. void omapdss_gather_components(struct device *dev);
  628. #endif /* __OMAP_DRM_DSS_H */