omapdss.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. /*
  2. * Copyright (C) 2008 Nokia Corporation
  3. * Author: Tomi Valkeinen <tomi.valkeinen@nokia.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_OMAPDSS_H
  18. #define __OMAP_OMAPDSS_H
  19. #include <linux/list.h>
  20. #include <linux/kobject.h>
  21. #include <linux/device.h>
  22. #define DISPC_IRQ_FRAMEDONE (1 << 0)
  23. #define DISPC_IRQ_VSYNC (1 << 1)
  24. #define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
  25. #define DISPC_IRQ_EVSYNC_ODD (1 << 3)
  26. #define DISPC_IRQ_ACBIAS_COUNT_STAT (1 << 4)
  27. #define DISPC_IRQ_PROG_LINE_NUM (1 << 5)
  28. #define DISPC_IRQ_GFX_FIFO_UNDERFLOW (1 << 6)
  29. #define DISPC_IRQ_GFX_END_WIN (1 << 7)
  30. #define DISPC_IRQ_PAL_GAMMA_MASK (1 << 8)
  31. #define DISPC_IRQ_OCP_ERR (1 << 9)
  32. #define DISPC_IRQ_VID1_FIFO_UNDERFLOW (1 << 10)
  33. #define DISPC_IRQ_VID1_END_WIN (1 << 11)
  34. #define DISPC_IRQ_VID2_FIFO_UNDERFLOW (1 << 12)
  35. #define DISPC_IRQ_VID2_END_WIN (1 << 13)
  36. #define DISPC_IRQ_SYNC_LOST (1 << 14)
  37. #define DISPC_IRQ_SYNC_LOST_DIGIT (1 << 15)
  38. #define DISPC_IRQ_WAKEUP (1 << 16)
  39. #define DISPC_IRQ_SYNC_LOST2 (1 << 17)
  40. #define DISPC_IRQ_VSYNC2 (1 << 18)
  41. #define DISPC_IRQ_VID3_END_WIN (1 << 19)
  42. #define DISPC_IRQ_VID3_FIFO_UNDERFLOW (1 << 20)
  43. #define DISPC_IRQ_ACBIAS_COUNT_STAT2 (1 << 21)
  44. #define DISPC_IRQ_FRAMEDONE2 (1 << 22)
  45. #define DISPC_IRQ_FRAMEDONEWB (1 << 23)
  46. #define DISPC_IRQ_FRAMEDONETV (1 << 24)
  47. #define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25)
  48. struct omap_dss_device;
  49. struct omap_overlay_manager;
  50. struct snd_aes_iec958;
  51. struct snd_cea_861_aud_if;
  52. enum omap_display_type {
  53. OMAP_DISPLAY_TYPE_NONE = 0,
  54. OMAP_DISPLAY_TYPE_DPI = 1 << 0,
  55. OMAP_DISPLAY_TYPE_DBI = 1 << 1,
  56. OMAP_DISPLAY_TYPE_SDI = 1 << 2,
  57. OMAP_DISPLAY_TYPE_DSI = 1 << 3,
  58. OMAP_DISPLAY_TYPE_VENC = 1 << 4,
  59. OMAP_DISPLAY_TYPE_HDMI = 1 << 5,
  60. };
  61. enum omap_plane {
  62. OMAP_DSS_GFX = 0,
  63. OMAP_DSS_VIDEO1 = 1,
  64. OMAP_DSS_VIDEO2 = 2,
  65. OMAP_DSS_VIDEO3 = 3,
  66. };
  67. enum omap_channel {
  68. OMAP_DSS_CHANNEL_LCD = 0,
  69. OMAP_DSS_CHANNEL_DIGIT = 1,
  70. OMAP_DSS_CHANNEL_LCD2 = 2,
  71. };
  72. enum omap_color_mode {
  73. OMAP_DSS_COLOR_CLUT1 = 1 << 0, /* BITMAP 1 */
  74. OMAP_DSS_COLOR_CLUT2 = 1 << 1, /* BITMAP 2 */
  75. OMAP_DSS_COLOR_CLUT4 = 1 << 2, /* BITMAP 4 */
  76. OMAP_DSS_COLOR_CLUT8 = 1 << 3, /* BITMAP 8 */
  77. OMAP_DSS_COLOR_RGB12U = 1 << 4, /* RGB12, 16-bit container */
  78. OMAP_DSS_COLOR_ARGB16 = 1 << 5, /* ARGB16 */
  79. OMAP_DSS_COLOR_RGB16 = 1 << 6, /* RGB16 */
  80. OMAP_DSS_COLOR_RGB24U = 1 << 7, /* RGB24, 32-bit container */
  81. OMAP_DSS_COLOR_RGB24P = 1 << 8, /* RGB24, 24-bit container */
  82. OMAP_DSS_COLOR_YUV2 = 1 << 9, /* YUV2 4:2:2 co-sited */
  83. OMAP_DSS_COLOR_UYVY = 1 << 10, /* UYVY 4:2:2 co-sited */
  84. OMAP_DSS_COLOR_ARGB32 = 1 << 11, /* ARGB32 */
  85. OMAP_DSS_COLOR_RGBA32 = 1 << 12, /* RGBA32 */
  86. OMAP_DSS_COLOR_RGBX32 = 1 << 13, /* RGBx32 */
  87. OMAP_DSS_COLOR_NV12 = 1 << 14, /* NV12 format: YUV 4:2:0 */
  88. OMAP_DSS_COLOR_RGBA16 = 1 << 15, /* RGBA16 - 4444 */
  89. OMAP_DSS_COLOR_RGBX16 = 1 << 16, /* RGBx16 - 4444 */
  90. OMAP_DSS_COLOR_ARGB16_1555 = 1 << 17, /* ARGB16 - 1555 */
  91. OMAP_DSS_COLOR_XRGB16_1555 = 1 << 18, /* xRGB16 - 1555 */
  92. };
  93. enum omap_lcd_display_type {
  94. OMAP_DSS_LCD_DISPLAY_STN,
  95. OMAP_DSS_LCD_DISPLAY_TFT,
  96. };
  97. enum omap_dss_load_mode {
  98. OMAP_DSS_LOAD_CLUT_AND_FRAME = 0,
  99. OMAP_DSS_LOAD_CLUT_ONLY = 1,
  100. OMAP_DSS_LOAD_FRAME_ONLY = 2,
  101. OMAP_DSS_LOAD_CLUT_ONCE_FRAME = 3,
  102. };
  103. enum omap_dss_trans_key_type {
  104. OMAP_DSS_COLOR_KEY_GFX_DST = 0,
  105. OMAP_DSS_COLOR_KEY_VID_SRC = 1,
  106. };
  107. enum omap_rfbi_te_mode {
  108. OMAP_DSS_RFBI_TE_MODE_1 = 1,
  109. OMAP_DSS_RFBI_TE_MODE_2 = 2,
  110. };
  111. enum omap_panel_config {
  112. OMAP_DSS_LCD_IVS = 1<<0,
  113. OMAP_DSS_LCD_IHS = 1<<1,
  114. OMAP_DSS_LCD_IPC = 1<<2,
  115. OMAP_DSS_LCD_IEO = 1<<3,
  116. OMAP_DSS_LCD_RF = 1<<4,
  117. OMAP_DSS_LCD_ONOFF = 1<<5,
  118. OMAP_DSS_LCD_TFT = 1<<20,
  119. };
  120. enum omap_dss_venc_type {
  121. OMAP_DSS_VENC_TYPE_COMPOSITE,
  122. OMAP_DSS_VENC_TYPE_SVIDEO,
  123. };
  124. enum omap_dss_dsi_pixel_format {
  125. OMAP_DSS_DSI_FMT_RGB888,
  126. OMAP_DSS_DSI_FMT_RGB666,
  127. OMAP_DSS_DSI_FMT_RGB666_PACKED,
  128. OMAP_DSS_DSI_FMT_RGB565,
  129. };
  130. enum omap_dss_dsi_mode {
  131. OMAP_DSS_DSI_CMD_MODE = 0,
  132. OMAP_DSS_DSI_VIDEO_MODE,
  133. };
  134. enum omap_display_caps {
  135. OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE = 1 << 0,
  136. OMAP_DSS_DISPLAY_CAP_TEAR_ELIM = 1 << 1,
  137. };
  138. enum omap_dss_display_state {
  139. OMAP_DSS_DISPLAY_DISABLED = 0,
  140. OMAP_DSS_DISPLAY_ACTIVE,
  141. OMAP_DSS_DISPLAY_SUSPENDED,
  142. };
  143. enum omap_dss_audio_state {
  144. OMAP_DSS_AUDIO_DISABLED = 0,
  145. OMAP_DSS_AUDIO_ENABLED,
  146. OMAP_DSS_AUDIO_CONFIGURED,
  147. OMAP_DSS_AUDIO_PLAYING,
  148. };
  149. enum omap_dss_rotation_type {
  150. OMAP_DSS_ROT_DMA = 1 << 0,
  151. OMAP_DSS_ROT_VRFB = 1 << 1,
  152. OMAP_DSS_ROT_TILER = 1 << 2,
  153. };
  154. /* clockwise rotation angle */
  155. enum omap_dss_rotation_angle {
  156. OMAP_DSS_ROT_0 = 0,
  157. OMAP_DSS_ROT_90 = 1,
  158. OMAP_DSS_ROT_180 = 2,
  159. OMAP_DSS_ROT_270 = 3,
  160. };
  161. enum omap_overlay_caps {
  162. OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
  163. OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
  164. OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
  165. OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
  166. };
  167. enum omap_overlay_manager_caps {
  168. OMAP_DSS_DUMMY_VALUE, /* add a dummy value to prevent compiler error */
  169. };
  170. enum omap_dss_clk_source {
  171. OMAP_DSS_CLK_SRC_FCK = 0, /* OMAP2/3: DSS1_ALWON_FCLK
  172. * OMAP4: DSS_FCLK */
  173. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, /* OMAP3: DSI1_PLL_FCLK
  174. * OMAP4: PLL1_CLK1 */
  175. OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK
  176. * OMAP4: PLL1_CLK2 */
  177. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC, /* OMAP4: PLL2_CLK1 */
  178. OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */
  179. };
  180. enum omap_hdmi_flags {
  181. OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
  182. };
  183. /* RFBI */
  184. struct rfbi_timings {
  185. int cs_on_time;
  186. int cs_off_time;
  187. int we_on_time;
  188. int we_off_time;
  189. int re_on_time;
  190. int re_off_time;
  191. int we_cycle_time;
  192. int re_cycle_time;
  193. int cs_pulse_width;
  194. int access_time;
  195. int clk_div;
  196. u32 tim[5]; /* set by rfbi_convert_timings() */
  197. int converted;
  198. };
  199. void omap_rfbi_write_command(const void *buf, u32 len);
  200. void omap_rfbi_read_data(void *buf, u32 len);
  201. void omap_rfbi_write_data(const void *buf, u32 len);
  202. void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
  203. u16 x, u16 y,
  204. u16 w, u16 h);
  205. int omap_rfbi_enable_te(bool enable, unsigned line);
  206. int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
  207. unsigned hs_pulse_time, unsigned vs_pulse_time,
  208. int hs_pol_inv, int vs_pol_inv, int extif_div);
  209. void rfbi_bus_lock(void);
  210. void rfbi_bus_unlock(void);
  211. /* DSI */
  212. struct omap_dss_dsi_videomode_data {
  213. /* DSI video mode blanking data */
  214. /* Unit: byte clock cycles */
  215. u16 hsa;
  216. u16 hfp;
  217. u16 hbp;
  218. /* Unit: line clocks */
  219. u16 vsa;
  220. u16 vfp;
  221. u16 vbp;
  222. /* DSI blanking modes */
  223. int blanking_mode;
  224. int hsa_blanking_mode;
  225. int hbp_blanking_mode;
  226. int hfp_blanking_mode;
  227. /* Video port sync events */
  228. int vp_de_pol;
  229. int vp_hsync_pol;
  230. int vp_vsync_pol;
  231. bool vp_vsync_end;
  232. bool vp_hsync_end;
  233. bool ddr_clk_always_on;
  234. int window_sync;
  235. };
  236. void dsi_bus_lock(struct omap_dss_device *dssdev);
  237. void dsi_bus_unlock(struct omap_dss_device *dssdev);
  238. int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
  239. int len);
  240. int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
  241. int len);
  242. int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd);
  243. int dsi_vc_generic_write_0(struct omap_dss_device *dssdev, int channel);
  244. int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  245. u8 param);
  246. int dsi_vc_generic_write_1(struct omap_dss_device *dssdev, int channel,
  247. u8 param);
  248. int dsi_vc_generic_write_2(struct omap_dss_device *dssdev, int channel,
  249. u8 param1, u8 param2);
  250. int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
  251. u8 *data, int len);
  252. int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
  253. u8 *data, int len);
  254. int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
  255. u8 *buf, int buflen);
  256. int dsi_vc_generic_read_0(struct omap_dss_device *dssdev, int channel, u8 *buf,
  257. int buflen);
  258. int dsi_vc_generic_read_1(struct omap_dss_device *dssdev, int channel, u8 param,
  259. u8 *buf, int buflen);
  260. int dsi_vc_generic_read_2(struct omap_dss_device *dssdev, int channel,
  261. u8 param1, u8 param2, u8 *buf, int buflen);
  262. int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
  263. u16 len);
  264. int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel);
  265. int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
  266. int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel);
  267. void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel);
  268. /* Board specific data */
  269. struct omap_dss_board_info {
  270. int (*get_context_loss_count)(struct device *dev);
  271. int num_devices;
  272. struct omap_dss_device **devices;
  273. struct omap_dss_device *default_device;
  274. int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
  275. void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
  276. int (*set_min_bus_tput)(struct device *dev, unsigned long r);
  277. };
  278. /* Init with the board info */
  279. extern int omap_display_init(struct omap_dss_board_info *board_data);
  280. /* HDMI mux init*/
  281. extern int omap_hdmi_init(enum omap_hdmi_flags flags);
  282. struct omap_video_timings {
  283. /* Unit: pixels */
  284. u16 x_res;
  285. /* Unit: pixels */
  286. u16 y_res;
  287. /* Unit: KHz */
  288. u32 pixel_clock;
  289. /* Unit: pixel clocks */
  290. u16 hsw; /* Horizontal synchronization pulse width */
  291. /* Unit: pixel clocks */
  292. u16 hfp; /* Horizontal front porch */
  293. /* Unit: pixel clocks */
  294. u16 hbp; /* Horizontal back porch */
  295. /* Unit: line clocks */
  296. u16 vsw; /* Vertical synchronization pulse width */
  297. /* Unit: line clocks */
  298. u16 vfp; /* Vertical front porch */
  299. /* Unit: line clocks */
  300. u16 vbp; /* Vertical back porch */
  301. };
  302. #ifdef CONFIG_OMAP2_DSS_VENC
  303. /* Hardcoded timings for tv modes. Venc only uses these to
  304. * identify the mode, and does not actually use the configs
  305. * itself. However, the configs should be something that
  306. * a normal monitor can also show */
  307. extern const struct omap_video_timings omap_dss_pal_timings;
  308. extern const struct omap_video_timings omap_dss_ntsc_timings;
  309. #endif
  310. struct omap_dss_cpr_coefs {
  311. s16 rr, rg, rb;
  312. s16 gr, gg, gb;
  313. s16 br, bg, bb;
  314. };
  315. struct omap_overlay_info {
  316. u32 paddr;
  317. u32 p_uv_addr; /* for NV12 format */
  318. u16 screen_width;
  319. u16 width;
  320. u16 height;
  321. enum omap_color_mode color_mode;
  322. u8 rotation;
  323. enum omap_dss_rotation_type rotation_type;
  324. bool mirror;
  325. u16 pos_x;
  326. u16 pos_y;
  327. u16 out_width; /* if 0, out_width == width */
  328. u16 out_height; /* if 0, out_height == height */
  329. u8 global_alpha;
  330. u8 pre_mult_alpha;
  331. u8 zorder;
  332. };
  333. struct omap_overlay {
  334. struct kobject kobj;
  335. struct list_head list;
  336. /* static fields */
  337. const char *name;
  338. enum omap_plane id;
  339. enum omap_color_mode supported_modes;
  340. enum omap_overlay_caps caps;
  341. /* dynamic fields */
  342. struct omap_overlay_manager *manager;
  343. /*
  344. * The following functions do not block:
  345. *
  346. * is_enabled
  347. * set_overlay_info
  348. * get_overlay_info
  349. *
  350. * The rest of the functions may block and cannot be called from
  351. * interrupt context
  352. */
  353. int (*enable)(struct omap_overlay *ovl);
  354. int (*disable)(struct omap_overlay *ovl);
  355. bool (*is_enabled)(struct omap_overlay *ovl);
  356. int (*set_manager)(struct omap_overlay *ovl,
  357. struct omap_overlay_manager *mgr);
  358. int (*unset_manager)(struct omap_overlay *ovl);
  359. int (*set_overlay_info)(struct omap_overlay *ovl,
  360. struct omap_overlay_info *info);
  361. void (*get_overlay_info)(struct omap_overlay *ovl,
  362. struct omap_overlay_info *info);
  363. int (*wait_for_go)(struct omap_overlay *ovl);
  364. };
  365. struct omap_overlay_manager_info {
  366. u32 default_color;
  367. enum omap_dss_trans_key_type trans_key_type;
  368. u32 trans_key;
  369. bool trans_enabled;
  370. bool partial_alpha_enabled;
  371. bool cpr_enable;
  372. struct omap_dss_cpr_coefs cpr_coefs;
  373. };
  374. struct omap_overlay_manager {
  375. struct kobject kobj;
  376. /* static fields */
  377. const char *name;
  378. enum omap_channel id;
  379. enum omap_overlay_manager_caps caps;
  380. struct list_head overlays;
  381. enum omap_display_type supported_displays;
  382. /* dynamic fields */
  383. struct omap_dss_device *device;
  384. /*
  385. * The following functions do not block:
  386. *
  387. * set_manager_info
  388. * get_manager_info
  389. * apply
  390. *
  391. * The rest of the functions may block and cannot be called from
  392. * interrupt context
  393. */
  394. int (*set_device)(struct omap_overlay_manager *mgr,
  395. struct omap_dss_device *dssdev);
  396. int (*unset_device)(struct omap_overlay_manager *mgr);
  397. int (*set_manager_info)(struct omap_overlay_manager *mgr,
  398. struct omap_overlay_manager_info *info);
  399. void (*get_manager_info)(struct omap_overlay_manager *mgr,
  400. struct omap_overlay_manager_info *info);
  401. int (*apply)(struct omap_overlay_manager *mgr);
  402. int (*wait_for_go)(struct omap_overlay_manager *mgr);
  403. int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
  404. };
  405. /* 22 pins means 1 clk lane and 10 data lanes */
  406. #define OMAP_DSS_MAX_DSI_PINS 22
  407. struct omap_dsi_pin_config {
  408. int num_pins;
  409. /*
  410. * pin numbers in the following order:
  411. * clk+, clk-
  412. * data1+, data1-
  413. * data2+, data2-
  414. * ...
  415. */
  416. int pins[OMAP_DSS_MAX_DSI_PINS];
  417. };
  418. struct omap_dss_device {
  419. struct device dev;
  420. enum omap_display_type type;
  421. enum omap_channel channel;
  422. union {
  423. struct {
  424. u8 data_lines;
  425. } dpi;
  426. struct {
  427. u8 channel;
  428. u8 data_lines;
  429. } rfbi;
  430. struct {
  431. u8 datapairs;
  432. } sdi;
  433. struct {
  434. int module;
  435. bool ext_te;
  436. u8 ext_te_gpio;
  437. } dsi;
  438. struct {
  439. enum omap_dss_venc_type type;
  440. bool invert_polarity;
  441. } venc;
  442. } phy;
  443. struct {
  444. struct {
  445. struct {
  446. u16 lck_div;
  447. u16 pck_div;
  448. enum omap_dss_clk_source lcd_clk_src;
  449. } channel;
  450. enum omap_dss_clk_source dispc_fclk_src;
  451. } dispc;
  452. struct {
  453. /* regn is one greater than TRM's REGN value */
  454. u16 regn;
  455. u16 regm;
  456. u16 regm_dispc;
  457. u16 regm_dsi;
  458. u16 lp_clk_div;
  459. enum omap_dss_clk_source dsi_fclk_src;
  460. } dsi;
  461. struct {
  462. /* regn is one greater than TRM's REGN value */
  463. u16 regn;
  464. u16 regm2;
  465. } hdmi;
  466. } clocks;
  467. struct {
  468. struct omap_video_timings timings;
  469. int acbi; /* ac-bias pin transitions per interrupt */
  470. /* Unit: line clocks */
  471. int acb; /* ac-bias pin frequency */
  472. enum omap_panel_config config;
  473. enum omap_dss_dsi_pixel_format dsi_pix_fmt;
  474. enum omap_dss_dsi_mode dsi_mode;
  475. struct omap_dss_dsi_videomode_data dsi_vm_data;
  476. } panel;
  477. struct {
  478. u8 pixel_size;
  479. struct rfbi_timings rfbi_timings;
  480. } ctrl;
  481. int reset_gpio;
  482. int max_backlight_level;
  483. const char *name;
  484. /* used to match device to driver */
  485. const char *driver_name;
  486. void *data;
  487. struct omap_dss_driver *driver;
  488. /* helper variable for driver suspend/resume */
  489. bool activate_after_resume;
  490. enum omap_display_caps caps;
  491. struct omap_overlay_manager *manager;
  492. enum omap_dss_display_state state;
  493. enum omap_dss_audio_state audio_state;
  494. /* platform specific */
  495. int (*platform_enable)(struct omap_dss_device *dssdev);
  496. void (*platform_disable)(struct omap_dss_device *dssdev);
  497. int (*set_backlight)(struct omap_dss_device *dssdev, int level);
  498. int (*get_backlight)(struct omap_dss_device *dssdev);
  499. };
  500. struct omap_dss_hdmi_data
  501. {
  502. int hpd_gpio;
  503. };
  504. struct omap_dss_audio {
  505. struct snd_aes_iec958 *iec;
  506. struct snd_cea_861_aud_if *cea;
  507. };
  508. struct omap_dss_driver {
  509. struct device_driver driver;
  510. int (*probe)(struct omap_dss_device *);
  511. void (*remove)(struct omap_dss_device *);
  512. int (*enable)(struct omap_dss_device *display);
  513. void (*disable)(struct omap_dss_device *display);
  514. int (*suspend)(struct omap_dss_device *display);
  515. int (*resume)(struct omap_dss_device *display);
  516. int (*run_test)(struct omap_dss_device *display, int test);
  517. int (*update)(struct omap_dss_device *dssdev,
  518. u16 x, u16 y, u16 w, u16 h);
  519. int (*sync)(struct omap_dss_device *dssdev);
  520. int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
  521. int (*get_te)(struct omap_dss_device *dssdev);
  522. u8 (*get_rotate)(struct omap_dss_device *dssdev);
  523. int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
  524. bool (*get_mirror)(struct omap_dss_device *dssdev);
  525. int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
  526. int (*memory_read)(struct omap_dss_device *dssdev,
  527. void *buf, size_t size,
  528. u16 x, u16 y, u16 w, u16 h);
  529. void (*get_resolution)(struct omap_dss_device *dssdev,
  530. u16 *xres, u16 *yres);
  531. void (*get_dimensions)(struct omap_dss_device *dssdev,
  532. u32 *width, u32 *height);
  533. int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
  534. int (*check_timings)(struct omap_dss_device *dssdev,
  535. struct omap_video_timings *timings);
  536. void (*set_timings)(struct omap_dss_device *dssdev,
  537. struct omap_video_timings *timings);
  538. void (*get_timings)(struct omap_dss_device *dssdev,
  539. struct omap_video_timings *timings);
  540. int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
  541. u32 (*get_wss)(struct omap_dss_device *dssdev);
  542. int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
  543. bool (*detect)(struct omap_dss_device *dssdev);
  544. /*
  545. * For display drivers that support audio. This encompasses
  546. * HDMI and DisplayPort at the moment.
  547. */
  548. /*
  549. * Note: These functions might sleep. Do not call while
  550. * holding a spinlock/readlock.
  551. */
  552. int (*audio_enable)(struct omap_dss_device *dssdev);
  553. void (*audio_disable)(struct omap_dss_device *dssdev);
  554. bool (*audio_supported)(struct omap_dss_device *dssdev);
  555. int (*audio_config)(struct omap_dss_device *dssdev,
  556. struct omap_dss_audio *audio);
  557. /* Note: These functions may not sleep */
  558. int (*audio_start)(struct omap_dss_device *dssdev);
  559. void (*audio_stop)(struct omap_dss_device *dssdev);
  560. };
  561. int omap_dss_register_driver(struct omap_dss_driver *);
  562. void omap_dss_unregister_driver(struct omap_dss_driver *);
  563. void omap_dss_get_device(struct omap_dss_device *dssdev);
  564. void omap_dss_put_device(struct omap_dss_device *dssdev);
  565. #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
  566. struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
  567. struct omap_dss_device *omap_dss_find_device(void *data,
  568. int (*match)(struct omap_dss_device *dssdev, void *data));
  569. int omap_dss_start_device(struct omap_dss_device *dssdev);
  570. void omap_dss_stop_device(struct omap_dss_device *dssdev);
  571. int omap_dss_get_num_overlay_managers(void);
  572. struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
  573. int omap_dss_get_num_overlays(void);
  574. struct omap_overlay *omap_dss_get_overlay(int num);
  575. void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
  576. u16 *xres, u16 *yres);
  577. int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
  578. void omapdss_default_get_timings(struct omap_dss_device *dssdev,
  579. struct omap_video_timings *timings);
  580. typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
  581. int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  582. int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
  583. int omap_dispc_wait_for_irq_timeout(u32 irqmask, unsigned long timeout);
  584. int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask,
  585. unsigned long timeout);
  586. #define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
  587. #define to_dss_device(x) container_of((x), struct omap_dss_device, dev)
  588. void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
  589. bool enable);
  590. int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
  591. int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
  592. void (*callback)(int, void *), void *data);
  593. int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
  594. int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
  595. void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
  596. int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
  597. const struct omap_dsi_pin_config *pin_cfg);
  598. int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
  599. void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
  600. bool disconnect_lanes, bool enter_ulps);
  601. int omapdss_dpi_display_enable(struct omap_dss_device *dssdev);
  602. void omapdss_dpi_display_disable(struct omap_dss_device *dssdev);
  603. void dpi_set_timings(struct omap_dss_device *dssdev,
  604. struct omap_video_timings *timings);
  605. int dpi_check_timings(struct omap_dss_device *dssdev,
  606. struct omap_video_timings *timings);
  607. int omapdss_sdi_display_enable(struct omap_dss_device *dssdev);
  608. void omapdss_sdi_display_disable(struct omap_dss_device *dssdev);
  609. int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev);
  610. void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev);
  611. int omap_rfbi_prepare_update(struct omap_dss_device *dssdev,
  612. u16 *x, u16 *y, u16 *w, u16 *h);
  613. int omap_rfbi_update(struct omap_dss_device *dssdev,
  614. u16 x, u16 y, u16 w, u16 h,
  615. void (*callback)(void *), void *data);
  616. int omap_rfbi_configure(struct omap_dss_device *dssdev, int pixel_size,
  617. int data_lines);
  618. #endif