omapdss.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. /*
  2. * Copyright (C) 2016 Texas Instruments
  3. * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published by
  7. * the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef __OMAP_DRM_DSS_H
  18. #define __OMAP_DRM_DSS_H
  19. #include <linux/list.h>
  20. #include <linux/kobject.h>
  21. #include <linux/device.h>
  22. #include <linux/interrupt.h>
  23. #include <video/videomode.h>
  24. #include <linux/platform_data/omapdss.h>
  25. #include <uapi/drm/drm_mode.h>
  26. #define DISPC_IRQ_FRAMEDONE (1 << 0)
  27. #define DISPC_IRQ_VSYNC (1 << 1)
  28. #define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
  29. #define DISPC_IRQ_EVSYNC_ODD (1 << 3)
  30. #define DISPC_IRQ_ACBIAS_COUNT_STAT (1 << 4)
  31. #define DISPC_IRQ_PROG_LINE_NUM (1 << 5)
  32. #define DISPC_IRQ_GFX_FIFO_UNDERFLOW (1 << 6)
  33. #define DISPC_IRQ_GFX_END_WIN (1 << 7)
  34. #define DISPC_IRQ_PAL_GAMMA_MASK (1 << 8)
  35. #define DISPC_IRQ_OCP_ERR (1 << 9)
  36. #define DISPC_IRQ_VID1_FIFO_UNDERFLOW (1 << 10)
  37. #define DISPC_IRQ_VID1_END_WIN (1 << 11)
  38. #define DISPC_IRQ_VID2_FIFO_UNDERFLOW (1 << 12)
  39. #define DISPC_IRQ_VID2_END_WIN (1 << 13)
  40. #define DISPC_IRQ_SYNC_LOST (1 << 14)
  41. #define DISPC_IRQ_SYNC_LOST_DIGIT (1 << 15)
  42. #define DISPC_IRQ_WAKEUP (1 << 16)
  43. #define DISPC_IRQ_SYNC_LOST2 (1 << 17)
  44. #define DISPC_IRQ_VSYNC2 (1 << 18)
  45. #define DISPC_IRQ_VID3_END_WIN (1 << 19)
  46. #define DISPC_IRQ_VID3_FIFO_UNDERFLOW (1 << 20)
  47. #define DISPC_IRQ_ACBIAS_COUNT_STAT2 (1 << 21)
  48. #define DISPC_IRQ_FRAMEDONE2 (1 << 22)
  49. #define DISPC_IRQ_FRAMEDONEWB (1 << 23)
  50. #define DISPC_IRQ_FRAMEDONETV (1 << 24)
  51. #define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25)
  52. #define DISPC_IRQ_WBUNCOMPLETEERROR (1 << 26)
  53. #define DISPC_IRQ_SYNC_LOST3 (1 << 27)
  54. #define DISPC_IRQ_VSYNC3 (1 << 28)
  55. #define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)
  56. #define DISPC_IRQ_FRAMEDONE3 (1 << 30)
  57. struct omap_dss_device;
  58. struct dss_lcd_mgr_config;
  59. struct snd_aes_iec958;
  60. struct snd_cea_861_aud_if;
  61. struct hdmi_avi_infoframe;
  62. enum omap_display_type {
  63. OMAP_DISPLAY_TYPE_NONE = 0,
  64. OMAP_DISPLAY_TYPE_DPI = 1 << 0,
  65. OMAP_DISPLAY_TYPE_DBI = 1 << 1,
  66. OMAP_DISPLAY_TYPE_SDI = 1 << 2,
  67. OMAP_DISPLAY_TYPE_DSI = 1 << 3,
  68. OMAP_DISPLAY_TYPE_VENC = 1 << 4,
  69. OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
  70. OMAP_DISPLAY_TYPE_DVI = 1 << 6,
  71. };
  72. enum omap_plane_id {
  73. OMAP_DSS_GFX = 0,
  74. OMAP_DSS_VIDEO1 = 1,
  75. OMAP_DSS_VIDEO2 = 2,
  76. OMAP_DSS_VIDEO3 = 3,
  77. OMAP_DSS_WB = 4,
  78. };
  79. enum omap_channel {
  80. OMAP_DSS_CHANNEL_LCD = 0,
  81. OMAP_DSS_CHANNEL_DIGIT = 1,
  82. OMAP_DSS_CHANNEL_LCD2 = 2,
  83. OMAP_DSS_CHANNEL_LCD3 = 3,
  84. OMAP_DSS_CHANNEL_WB = 4,
  85. };
  86. enum omap_color_mode {
  87. _UNUSED_,
  88. };
  89. enum omap_dss_load_mode {
  90. OMAP_DSS_LOAD_CLUT_AND_FRAME = 0,
  91. OMAP_DSS_LOAD_CLUT_ONLY = 1,
  92. OMAP_DSS_LOAD_FRAME_ONLY = 2,
  93. OMAP_DSS_LOAD_CLUT_ONCE_FRAME = 3,
  94. };
  95. enum omap_dss_trans_key_type {
  96. OMAP_DSS_COLOR_KEY_GFX_DST = 0,
  97. OMAP_DSS_COLOR_KEY_VID_SRC = 1,
  98. };
  99. enum omap_dss_signal_level {
  100. OMAPDSS_SIG_ACTIVE_LOW,
  101. OMAPDSS_SIG_ACTIVE_HIGH,
  102. };
  103. enum omap_dss_signal_edge {
  104. OMAPDSS_DRIVE_SIG_FALLING_EDGE,
  105. OMAPDSS_DRIVE_SIG_RISING_EDGE,
  106. };
  107. enum omap_dss_venc_type {
  108. OMAP_DSS_VENC_TYPE_COMPOSITE,
  109. OMAP_DSS_VENC_TYPE_SVIDEO,
  110. };
  111. enum omap_dss_dsi_pixel_format {
  112. OMAP_DSS_DSI_FMT_RGB888,
  113. OMAP_DSS_DSI_FMT_RGB666,
  114. OMAP_DSS_DSI_FMT_RGB666_PACKED,
  115. OMAP_DSS_DSI_FMT_RGB565,
  116. };
  117. enum omap_dss_dsi_mode {
  118. OMAP_DSS_DSI_CMD_MODE = 0,
  119. OMAP_DSS_DSI_VIDEO_MODE,
  120. };
  121. enum omap_display_caps {
  122. OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE = 1 << 0,
  123. OMAP_DSS_DISPLAY_CAP_TEAR_ELIM = 1 << 1,
  124. };
  125. enum omap_dss_display_state {
  126. OMAP_DSS_DISPLAY_DISABLED = 0,
  127. OMAP_DSS_DISPLAY_ACTIVE,
  128. };
  129. enum omap_dss_rotation_type {
  130. OMAP_DSS_ROT_NONE = 0,
  131. OMAP_DSS_ROT_TILER = 1 << 0,
  132. };
  133. enum omap_overlay_caps {
  134. OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
  135. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
  136. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
  137. OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
  138. OMAP_DSS_OVL_CAP_POS = 1 << 4,
  139. OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
  140. };
  141. enum omap_dss_clk_source {
  142. OMAP_DSS_CLK_SRC_FCK = 0, /* OMAP2/3: DSS1_ALWON_FCLK
  143. * OMAP4: DSS_FCLK */
  144. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, /* OMAP3: DSI1_PLL_FCLK
  145. * OMAP4: PLL1_CLK1 */
  146. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK
  147. * OMAP4: PLL1_CLK2 */
  148. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC, /* OMAP4: PLL2_CLK1 */
  149. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */
  150. };
  151. enum omap_hdmi_flags {
  152. OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
  153. };
  154. enum omap_dss_output_id {
  155. OMAP_DSS_OUTPUT_DPI = 1 << 0,
  156. OMAP_DSS_OUTPUT_DBI = 1 << 1,
  157. OMAP_DSS_OUTPUT_SDI = 1 << 2,
  158. OMAP_DSS_OUTPUT_DSI1 = 1 << 3,
  159. OMAP_DSS_OUTPUT_DSI2 = 1 << 4,
  160. OMAP_DSS_OUTPUT_VENC = 1 << 5,
  161. OMAP_DSS_OUTPUT_HDMI = 1 << 6,
  162. };
  163. /* DSI */
  164. enum omap_dss_dsi_trans_mode {
  165. /* Sync Pulses: both sync start and end packets sent */
  166. OMAP_DSS_DSI_PULSE_MODE,
  167. /* Sync Events: only sync start packets sent */
  168. OMAP_DSS_DSI_EVENT_MODE,
  169. /* Burst: only sync start packets sent, pixels are time compressed */
  170. OMAP_DSS_DSI_BURST_MODE,
  171. };
  172. struct omap_dss_dsi_videomode_timings {
  173. unsigned long hsclk;
  174. unsigned ndl;
  175. unsigned bitspp;
  176. /* pixels */
  177. u16 hact;
  178. /* lines */
  179. u16 vact;
  180. /* DSI video mode blanking data */
  181. /* Unit: byte clock cycles */
  182. u16 hss;
  183. u16 hsa;
  184. u16 hse;
  185. u16 hfp;
  186. u16 hbp;
  187. /* Unit: line clocks */
  188. u16 vsa;
  189. u16 vfp;
  190. u16 vbp;
  191. /* DSI blanking modes */
  192. int blanking_mode;
  193. int hsa_blanking_mode;
  194. int hbp_blanking_mode;
  195. int hfp_blanking_mode;
  196. enum omap_dss_dsi_trans_mode trans_mode;
  197. bool ddr_clk_always_on;
  198. int window_sync;
  199. };
  200. struct omap_dss_dsi_config {
  201. enum omap_dss_dsi_mode mode;
  202. enum omap_dss_dsi_pixel_format pixel_format;
  203. const struct videomode *vm;
  204. unsigned long hs_clk_min, hs_clk_max;
  205. unsigned long lp_clk_min, lp_clk_max;
  206. bool ddr_clk_always_on;
  207. enum omap_dss_dsi_trans_mode trans_mode;
  208. };
  209. /* Hardcoded videomodes for tv. Venc only uses these to
  210. * identify the mode, and does not actually use the configs
  211. * itself. However, the configs should be something that
  212. * a normal monitor can also show */
  213. extern const struct videomode omap_dss_pal_vm;
  214. extern const struct videomode omap_dss_ntsc_vm;
  215. struct omap_dss_cpr_coefs {
  216. s16 rr, rg, rb;
  217. s16 gr, gg, gb;
  218. s16 br, bg, bb;
  219. };
  220. struct omap_overlay_info {
  221. dma_addr_t paddr;
  222. dma_addr_t p_uv_addr; /* for NV12 format */
  223. u16 screen_width;
  224. u16 width;
  225. u16 height;
  226. u32 fourcc;
  227. u8 rotation;
  228. enum omap_dss_rotation_type rotation_type;
  229. u16 pos_x;
  230. u16 pos_y;
  231. u16 out_width; /* if 0, out_width == width */
  232. u16 out_height; /* if 0, out_height == height */
  233. u8 global_alpha;
  234. u8 pre_mult_alpha;
  235. u8 zorder;
  236. };
  237. struct omap_overlay_manager_info {
  238. u32 default_color;
  239. enum omap_dss_trans_key_type trans_key_type;
  240. u32 trans_key;
  241. bool trans_enabled;
  242. bool partial_alpha_enabled;
  243. bool cpr_enable;
  244. struct omap_dss_cpr_coefs cpr_coefs;
  245. };
  246. /* 22 pins means 1 clk lane and 10 data lanes */
  247. #define OMAP_DSS_MAX_DSI_PINS 22
  248. struct omap_dsi_pin_config {
  249. int num_pins;
  250. /*
  251. * pin numbers in the following order:
  252. * clk+, clk-
  253. * data1+, data1-
  254. * data2+, data2-
  255. * ...
  256. */
  257. int pins[OMAP_DSS_MAX_DSI_PINS];
  258. };
  259. struct omap_dss_writeback_info {
  260. u32 paddr;
  261. u32 p_uv_addr;
  262. u16 buf_width;
  263. u16 width;
  264. u16 height;
  265. u32 fourcc;
  266. u8 rotation;
  267. enum omap_dss_rotation_type rotation_type;
  268. u8 pre_mult_alpha;
  269. };
  270. struct omapdss_dpi_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_sdi_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_dvi_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. };
  312. struct omapdss_atv_ops {
  313. int (*connect)(struct omap_dss_device *dssdev,
  314. struct omap_dss_device *dst);
  315. void (*disconnect)(struct omap_dss_device *dssdev,
  316. struct omap_dss_device *dst);
  317. int (*enable)(struct omap_dss_device *dssdev);
  318. void (*disable)(struct omap_dss_device *dssdev);
  319. int (*check_timings)(struct omap_dss_device *dssdev,
  320. struct videomode *vm);
  321. void (*set_timings)(struct omap_dss_device *dssdev,
  322. struct videomode *vm);
  323. void (*get_timings)(struct omap_dss_device *dssdev,
  324. struct videomode *vm);
  325. int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  326. u32 (*get_wss)(struct omap_dss_device *dssdev);
  327. };
  328. struct omapdss_hdmi_ops {
  329. int (*connect)(struct omap_dss_device *dssdev,
  330. struct omap_dss_device *dst);
  331. void (*disconnect)(struct omap_dss_device *dssdev,
  332. struct omap_dss_device *dst);
  333. int (*enable)(struct omap_dss_device *dssdev);
  334. void (*disable)(struct omap_dss_device *dssdev);
  335. int (*check_timings)(struct omap_dss_device *dssdev,
  336. struct videomode *vm);
  337. void (*set_timings)(struct omap_dss_device *dssdev,
  338. struct videomode *vm);
  339. void (*get_timings)(struct omap_dss_device *dssdev,
  340. struct videomode *vm);
  341. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  342. bool (*detect)(struct omap_dss_device *dssdev);
  343. int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
  344. int (*set_infoframe)(struct omap_dss_device *dssdev,
  345. const struct hdmi_avi_infoframe *avi);
  346. };
  347. struct omapdss_dsi_ops {
  348. int (*connect)(struct omap_dss_device *dssdev,
  349. struct omap_dss_device *dst);
  350. void (*disconnect)(struct omap_dss_device *dssdev,
  351. struct omap_dss_device *dst);
  352. int (*enable)(struct omap_dss_device *dssdev);
  353. void (*disable)(struct omap_dss_device *dssdev, bool disconnect_lanes,
  354. bool enter_ulps);
  355. /* bus configuration */
  356. int (*set_config)(struct omap_dss_device *dssdev,
  357. const struct omap_dss_dsi_config *cfg);
  358. int (*configure_pins)(struct omap_dss_device *dssdev,
  359. const struct omap_dsi_pin_config *pin_cfg);
  360. void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
  361. bool enable);
  362. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  363. int (*update)(struct omap_dss_device *dssdev, int channel,
  364. void (*callback)(int, void *), void *data);
  365. void (*bus_lock)(struct omap_dss_device *dssdev);
  366. void (*bus_unlock)(struct omap_dss_device *dssdev);
  367. int (*enable_video_output)(struct omap_dss_device *dssdev, int channel);
  368. void (*disable_video_output)(struct omap_dss_device *dssdev,
  369. int channel);
  370. int (*request_vc)(struct omap_dss_device *dssdev, int *channel);
  371. int (*set_vc_id)(struct omap_dss_device *dssdev, int channel,
  372. int vc_id);
  373. void (*release_vc)(struct omap_dss_device *dssdev, int channel);
  374. /* data transfer */
  375. int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
  376. u8 *data, int len);
  377. int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
  378. u8 *data, int len);
  379. int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  380. u8 *data, int len);
  381. int (*gen_write)(struct omap_dss_device *dssdev, int channel,
  382. u8 *data, int len);
  383. int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
  384. u8 *data, int len);
  385. int (*gen_read)(struct omap_dss_device *dssdev, int channel,
  386. u8 *reqdata, int reqlen,
  387. u8 *data, int len);
  388. int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
  389. int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
  390. int channel, u16 plen);
  391. };
  392. struct omap_dss_device {
  393. struct kobject kobj;
  394. struct device *dev;
  395. struct module *owner;
  396. struct list_head panel_list;
  397. /* alias in the form of "display%d" */
  398. char alias[16];
  399. enum omap_display_type type;
  400. enum omap_display_type output_type;
  401. struct {
  402. struct videomode vm;
  403. enum omap_dss_dsi_pixel_format dsi_pix_fmt;
  404. enum omap_dss_dsi_mode dsi_mode;
  405. } panel;
  406. const char *name;
  407. struct omap_dss_driver *driver;
  408. union {
  409. const struct omapdss_dpi_ops *dpi;
  410. const struct omapdss_sdi_ops *sdi;
  411. const struct omapdss_dvi_ops *dvi;
  412. const struct omapdss_hdmi_ops *hdmi;
  413. const struct omapdss_atv_ops *atv;
  414. const struct omapdss_dsi_ops *dsi;
  415. } ops;
  416. /* helper variable for driver suspend/resume */
  417. bool activate_after_resume;
  418. enum omap_display_caps caps;
  419. struct omap_dss_device *src;
  420. enum omap_dss_display_state state;
  421. /* OMAP DSS output specific fields */
  422. struct list_head list;
  423. /* DISPC channel for this output */
  424. enum omap_channel dispc_channel;
  425. bool dispc_channel_connected;
  426. /* output instance */
  427. enum omap_dss_output_id id;
  428. /* the port number in the DT node */
  429. int port_num;
  430. /* dynamic fields */
  431. struct omap_dss_device *dst;
  432. };
  433. struct omap_dss_driver {
  434. int (*probe)(struct omap_dss_device *);
  435. void (*remove)(struct omap_dss_device *);
  436. int (*connect)(struct omap_dss_device *dssdev);
  437. void (*disconnect)(struct omap_dss_device *dssdev);
  438. int (*enable)(struct omap_dss_device *display);
  439. void (*disable)(struct omap_dss_device *display);
  440. int (*run_test)(struct omap_dss_device *display, int test);
  441. int (*update)(struct omap_dss_device *dssdev,
  442. u16 x, u16 y, u16 w, u16 h);
  443. int (*sync)(struct omap_dss_device *dssdev);
  444. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  445. int (*get_te)(struct omap_dss_device *dssdev);
  446. u8 (*get_rotate)(struct omap_dss_device *dssdev);
  447. int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
  448. bool (*get_mirror)(struct omap_dss_device *dssdev);
  449. int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
  450. int (*memory_read)(struct omap_dss_device *dssdev,
  451. void *buf, size_t size,
  452. u16 x, u16 y, u16 w, u16 h);
  453. int (*check_timings)(struct omap_dss_device *dssdev,
  454. struct videomode *vm);
  455. void (*set_timings)(struct omap_dss_device *dssdev,
  456. struct videomode *vm);
  457. void (*get_timings)(struct omap_dss_device *dssdev,
  458. struct videomode *vm);
  459. int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  460. u32 (*get_wss)(struct omap_dss_device *dssdev);
  461. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  462. bool (*detect)(struct omap_dss_device *dssdev);
  463. int (*set_hdmi_mode)(struct omap_dss_device *dssdev, bool hdmi_mode);
  464. int (*set_hdmi_infoframe)(struct omap_dss_device *dssdev,
  465. const struct hdmi_avi_infoframe *avi);
  466. };
  467. enum omapdss_version omapdss_get_version(void);
  468. bool omapdss_is_initialized(void);
  469. int omap_dss_register_driver(struct omap_dss_driver *);
  470. void omap_dss_unregister_driver(struct omap_dss_driver *);
  471. int omapdss_register_display(struct omap_dss_device *dssdev);
  472. void omapdss_unregister_display(struct omap_dss_device *dssdev);
  473. struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
  474. void omap_dss_put_device(struct omap_dss_device *dssdev);
  475. #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
  476. struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
  477. struct omap_dss_device *omap_dss_find_device(void *data,
  478. int (*match)(struct omap_dss_device *dssdev, void *data));
  479. int omap_dss_get_num_overlay_managers(void);
  480. int omap_dss_get_num_overlays(void);
  481. int omapdss_register_output(struct omap_dss_device *output);
  482. void omapdss_unregister_output(struct omap_dss_device *output);
  483. struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
  484. struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *port);
  485. int omapdss_output_set_device(struct omap_dss_device *out,
  486. struct omap_dss_device *dssdev);
  487. int omapdss_output_unset_device(struct omap_dss_device *out);
  488. struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
  489. void omapdss_default_get_timings(struct omap_dss_device *dssdev,
  490. struct videomode *vm);
  491. typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
  492. int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  493. int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  494. int omapdss_compat_init(void);
  495. void omapdss_compat_uninit(void);
  496. static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
  497. {
  498. return dssdev->src;
  499. }
  500. static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
  501. {
  502. return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
  503. }
  504. struct omap_dss_device *
  505. omapdss_of_find_source_for_first_ep(struct device_node *node);
  506. void omapdss_set_is_initialized(bool set);
  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. struct dss_mgr_ops {
  510. int (*connect)(enum omap_channel channel,
  511. struct omap_dss_device *dst);
  512. void (*disconnect)(enum omap_channel channel,
  513. struct omap_dss_device *dst);
  514. void (*start_update)(enum omap_channel channel);
  515. int (*enable)(enum omap_channel channel);
  516. void (*disable)(enum omap_channel channel);
  517. void (*set_timings)(enum omap_channel channel,
  518. const struct videomode *vm);
  519. void (*set_lcd_config)(enum omap_channel channel,
  520. const struct dss_lcd_mgr_config *config);
  521. int (*register_framedone_handler)(enum omap_channel channel,
  522. void (*handler)(void *), void *data);
  523. void (*unregister_framedone_handler)(enum omap_channel channel,
  524. void (*handler)(void *), void *data);
  525. };
  526. int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
  527. void dss_uninstall_mgr_ops(void);
  528. int dss_mgr_connect(enum omap_channel channel,
  529. struct omap_dss_device *dst);
  530. void dss_mgr_disconnect(enum omap_channel channel,
  531. struct omap_dss_device *dst);
  532. void dss_mgr_set_timings(enum omap_channel channel,
  533. const struct videomode *vm);
  534. void dss_mgr_set_lcd_config(enum omap_channel channel,
  535. const struct dss_lcd_mgr_config *config);
  536. int dss_mgr_enable(enum omap_channel channel);
  537. void dss_mgr_disable(enum omap_channel channel);
  538. void dss_mgr_start_update(enum omap_channel channel);
  539. int dss_mgr_register_framedone_handler(enum omap_channel channel,
  540. void (*handler)(void *), void *data);
  541. void dss_mgr_unregister_framedone_handler(enum omap_channel channel,
  542. void (*handler)(void *), void *data);
  543. /* dispc ops */
  544. struct dispc_ops {
  545. u32 (*read_irqstatus)(void);
  546. void (*clear_irqstatus)(u32 mask);
  547. void (*write_irqenable)(u32 mask);
  548. int (*request_irq)(irq_handler_t handler, void *dev_id);
  549. void (*free_irq)(void *dev_id);
  550. int (*runtime_get)(void);
  551. void (*runtime_put)(void);
  552. int (*get_num_ovls)(void);
  553. int (*get_num_mgrs)(void);
  554. void (*mgr_enable)(enum omap_channel channel, bool enable);
  555. bool (*mgr_is_enabled)(enum omap_channel channel);
  556. u32 (*mgr_get_vsync_irq)(enum omap_channel channel);
  557. u32 (*mgr_get_framedone_irq)(enum omap_channel channel);
  558. u32 (*mgr_get_sync_lost_irq)(enum omap_channel channel);
  559. bool (*mgr_go_busy)(enum omap_channel channel);
  560. void (*mgr_go)(enum omap_channel channel);
  561. void (*mgr_set_lcd_config)(enum omap_channel channel,
  562. const struct dss_lcd_mgr_config *config);
  563. void (*mgr_set_timings)(enum omap_channel channel,
  564. const struct videomode *vm);
  565. void (*mgr_setup)(enum omap_channel channel,
  566. const struct omap_overlay_manager_info *info);
  567. enum omap_dss_output_id (*mgr_get_supported_outputs)(enum omap_channel channel);
  568. u32 (*mgr_gamma_size)(enum omap_channel channel);
  569. void (*mgr_set_gamma)(enum omap_channel channel,
  570. const struct drm_color_lut *lut,
  571. unsigned int length);
  572. int (*ovl_enable)(enum omap_plane_id plane, bool enable);
  573. int (*ovl_setup)(enum omap_plane_id plane,
  574. const struct omap_overlay_info *oi,
  575. const struct videomode *vm, bool mem_to_mem,
  576. enum omap_channel channel);
  577. const u32 *(*ovl_get_color_modes)(enum omap_plane_id plane);
  578. };
  579. void dispc_set_ops(const struct dispc_ops *o);
  580. const struct dispc_ops *dispc_get_ops(void);
  581. bool omapdss_component_is_display(struct device_node *node);
  582. bool omapdss_component_is_output(struct device_node *node);
  583. bool omapdss_stack_is_ready(void);
  584. void omapdss_gather_components(struct device *dev);
  585. #endif /* __OMAP_DRM_DSS_H */