omapdss.h 21 KB

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