Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 1 | /* |
| 2 | * linux/drivers/video/omap2/dss/dss.h |
| 3 | * |
| 4 | * Copyright (C) 2009 Nokia Corporation |
| 5 | * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com> |
| 6 | * |
| 7 | * Some code and ideas taken from drivers/video/omap/ driver |
| 8 | * by Imre Deak. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License version 2 as published by |
| 12 | * the Free Software Foundation. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 17 | * more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License along with |
| 20 | * this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | */ |
| 22 | |
| 23 | #ifndef __OMAP2_DSS_H |
| 24 | #define __OMAP2_DSS_H |
| 25 | |
Tomi Valkeinen | 96e2e63 | 2012-10-10 15:55:19 +0300 | [diff] [blame] | 26 | #include <linux/interrupt.h> |
| 27 | |
Chandrabhanu Mahapatra | 702d267 | 2012-09-24 17:12:58 +0530 | [diff] [blame] | 28 | #ifdef pr_fmt |
| 29 | #undef pr_fmt |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 30 | #endif |
| 31 | |
| 32 | #ifdef DSS_SUBSYS_NAME |
Chandrabhanu Mahapatra | 702d267 | 2012-09-24 17:12:58 +0530 | [diff] [blame] | 33 | #define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 34 | #else |
Chandrabhanu Mahapatra | 702d267 | 2012-09-24 17:12:58 +0530 | [diff] [blame] | 35 | #define pr_fmt(fmt) fmt |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 36 | #endif |
| 37 | |
Chandrabhanu Mahapatra | 702d267 | 2012-09-24 17:12:58 +0530 | [diff] [blame] | 38 | #define DSSDBG(format, ...) \ |
| 39 | pr_debug(format, ## __VA_ARGS__) |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 40 | |
| 41 | #ifdef DSS_SUBSYS_NAME |
| 42 | #define DSSERR(format, ...) \ |
| 43 | printk(KERN_ERR "omapdss " DSS_SUBSYS_NAME " error: " format, \ |
| 44 | ## __VA_ARGS__) |
| 45 | #else |
| 46 | #define DSSERR(format, ...) \ |
| 47 | printk(KERN_ERR "omapdss error: " format, ## __VA_ARGS__) |
| 48 | #endif |
| 49 | |
| 50 | #ifdef DSS_SUBSYS_NAME |
| 51 | #define DSSINFO(format, ...) \ |
| 52 | printk(KERN_INFO "omapdss " DSS_SUBSYS_NAME ": " format, \ |
| 53 | ## __VA_ARGS__) |
| 54 | #else |
| 55 | #define DSSINFO(format, ...) \ |
| 56 | printk(KERN_INFO "omapdss: " format, ## __VA_ARGS__) |
| 57 | #endif |
| 58 | |
| 59 | #ifdef DSS_SUBSYS_NAME |
| 60 | #define DSSWARN(format, ...) \ |
| 61 | printk(KERN_WARNING "omapdss " DSS_SUBSYS_NAME ": " format, \ |
| 62 | ## __VA_ARGS__) |
| 63 | #else |
| 64 | #define DSSWARN(format, ...) \ |
| 65 | printk(KERN_WARNING "omapdss: " format, ## __VA_ARGS__) |
| 66 | #endif |
| 67 | |
| 68 | /* OMAP TRM gives bitfields as start:end, where start is the higher bit |
| 69 | number. For example 7:0 */ |
| 70 | #define FLD_MASK(start, end) (((1 << ((start) - (end) + 1)) - 1) << (end)) |
| 71 | #define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end)) |
| 72 | #define FLD_GET(val, start, end) (((val) & FLD_MASK(start, end)) >> (end)) |
| 73 | #define FLD_MOD(orig, val, start, end) \ |
| 74 | (((orig) & ~FLD_MASK(start, end)) | FLD_VAL(val, start, end)) |
| 75 | |
Archit Taneja | 569969d | 2011-08-22 17:41:57 +0530 | [diff] [blame] | 76 | enum dss_io_pad_mode { |
| 77 | DSS_IO_PAD_MODE_RESET, |
| 78 | DSS_IO_PAD_MODE_RFBI, |
| 79 | DSS_IO_PAD_MODE_BYPASS, |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 80 | }; |
| 81 | |
Mythri P K | 7ed024a | 2011-03-09 16:31:38 +0530 | [diff] [blame] | 82 | enum dss_hdmi_venc_clk_source_select { |
| 83 | DSS_VENC_TV_CLK = 0, |
| 84 | DSS_HDMI_M_PCLK = 1, |
| 85 | }; |
| 86 | |
Archit Taneja | 6ff8aa3 | 2011-08-25 18:35:58 +0530 | [diff] [blame] | 87 | enum dss_dsi_content_type { |
| 88 | DSS_DSI_CONTENT_DCS, |
| 89 | DSS_DSI_CONTENT_GENERIC, |
| 90 | }; |
| 91 | |
Archit Taneja | d9ac773 | 2012-09-22 12:38:19 +0530 | [diff] [blame] | 92 | enum dss_writeback_channel { |
| 93 | DSS_WB_LCD1_MGR = 0, |
| 94 | DSS_WB_LCD2_MGR = 1, |
| 95 | DSS_WB_TV_MGR = 2, |
| 96 | DSS_WB_OVL0 = 3, |
| 97 | DSS_WB_OVL1 = 4, |
| 98 | DSS_WB_OVL2 = 5, |
| 99 | DSS_WB_OVL3 = 6, |
| 100 | DSS_WB_LCD3_MGR = 7, |
| 101 | }; |
| 102 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 103 | struct dss_clock_info { |
| 104 | /* rates that we get with dividers below */ |
| 105 | unsigned long fck; |
| 106 | |
| 107 | /* dividers */ |
| 108 | u16 fck_div; |
| 109 | }; |
| 110 | |
| 111 | struct dispc_clock_info { |
| 112 | /* rates that we get with dividers below */ |
| 113 | unsigned long lck; |
| 114 | unsigned long pck; |
| 115 | |
| 116 | /* dividers */ |
| 117 | u16 lck_div; |
| 118 | u16 pck_div; |
| 119 | }; |
| 120 | |
| 121 | struct dsi_clock_info { |
| 122 | /* rates that we get with dividers below */ |
| 123 | unsigned long fint; |
| 124 | unsigned long clkin4ddr; |
| 125 | unsigned long clkin; |
Taneja, Archit | ea75159 | 2011-03-08 05:50:35 -0600 | [diff] [blame] | 126 | unsigned long dsi_pll_hsdiv_dispc_clk; /* OMAP3: DSI1_PLL_CLK |
| 127 | * OMAP4: PLLx_CLK1 */ |
| 128 | unsigned long dsi_pll_hsdiv_dsi_clk; /* OMAP3: DSI2_PLL_CLK |
| 129 | * OMAP4: PLLx_CLK2 */ |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 130 | unsigned long lp_clk; |
| 131 | |
| 132 | /* dividers */ |
| 133 | u16 regn; |
| 134 | u16 regm; |
Taneja, Archit | ea75159 | 2011-03-08 05:50:35 -0600 | [diff] [blame] | 135 | u16 regm_dispc; /* OMAP3: REGM3 |
| 136 | * OMAP4: REGM4 */ |
| 137 | u16 regm_dsi; /* OMAP3: REGM4 |
| 138 | * OMAP4: REGM5 */ |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 139 | u16 lp_clk_div; |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 140 | }; |
| 141 | |
Chandrabhanu Mahapatra | efa70b3 | 2012-06-21 11:07:44 +0530 | [diff] [blame] | 142 | struct reg_field { |
| 143 | u16 reg; |
| 144 | u8 high; |
| 145 | u8 low; |
| 146 | }; |
| 147 | |
Archit Taneja | c56fb3e | 2012-06-29 14:03:48 +0530 | [diff] [blame] | 148 | struct dss_lcd_mgr_config { |
| 149 | enum dss_io_pad_mode io_pad_mode; |
| 150 | |
| 151 | bool stallmode; |
| 152 | bool fifohandcheck; |
| 153 | |
| 154 | struct dispc_clock_info clock_info; |
| 155 | |
| 156 | int video_port_width; |
| 157 | |
| 158 | int lcden_sig_polarity; |
| 159 | }; |
| 160 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 161 | struct seq_file; |
| 162 | struct platform_device; |
| 163 | |
| 164 | /* core */ |
Tomi Valkeinen | 8f46efa | 2012-10-10 10:46:06 +0300 | [diff] [blame] | 165 | struct platform_device *dss_get_core_pdev(void); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 166 | struct bus_type *dss_get_bus(void); |
Tomi Valkeinen | 8a2cfea | 2010-02-04 17:03:41 +0200 | [diff] [blame] | 167 | struct regulator *dss_get_vdds_dsi(void); |
| 168 | struct regulator *dss_get_vdds_sdi(void); |
Tomi Valkeinen | 00928ea | 2012-02-20 11:50:06 +0200 | [diff] [blame] | 169 | int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask); |
| 170 | void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask); |
Tomi Valkeinen | a8081d3 | 2012-03-08 12:52:38 +0200 | [diff] [blame] | 171 | int dss_set_min_bus_tput(struct device *dev, unsigned long tput); |
Tomi Valkeinen | e40402c | 2012-03-02 18:01:07 +0200 | [diff] [blame] | 172 | int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 173 | |
Tomi Valkeinen | 5274484 | 2012-09-10 13:58:29 +0300 | [diff] [blame] | 174 | struct omap_dss_device *dss_alloc_and_init_device(struct device *parent); |
| 175 | int dss_add_device(struct omap_dss_device *dssdev); |
| 176 | void dss_unregister_device(struct omap_dss_device *dssdev); |
| 177 | void dss_unregister_child_devices(struct device *parent); |
| 178 | void dss_put_device(struct omap_dss_device *dssdev); |
| 179 | void dss_copy_device_pdata(struct omap_dss_device *dst, |
| 180 | const struct omap_dss_device *src); |
Tomi Valkeinen | 35deca3 | 2012-03-01 15:45:53 +0200 | [diff] [blame] | 181 | |
Archit Taneja | 484dc40 | 2012-09-07 17:38:00 +0530 | [diff] [blame] | 182 | /* output */ |
| 183 | void dss_register_output(struct omap_dss_output *out); |
| 184 | void dss_unregister_output(struct omap_dss_output *out); |
| 185 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 186 | /* display */ |
| 187 | int dss_suspend_all_devices(void); |
| 188 | int dss_resume_all_devices(void); |
| 189 | void dss_disable_all_devices(void); |
| 190 | |
Tomi Valkeinen | 3f30b8c | 2012-11-08 13:13:02 +0200 | [diff] [blame] | 191 | int display_init_sysfs(struct platform_device *pdev, |
| 192 | struct omap_dss_device *dssdev); |
| 193 | void display_uninit_sysfs(struct platform_device *pdev, |
| 194 | struct omap_dss_device *dssdev); |
| 195 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 196 | /* manager */ |
| 197 | int dss_init_overlay_managers(struct platform_device *pdev); |
| 198 | void dss_uninit_overlay_managers(struct platform_device *pdev); |
Tomi Valkeinen | 54540d4 | 2011-12-13 13:18:52 +0200 | [diff] [blame] | 199 | int dss_mgr_simple_check(struct omap_overlay_manager *mgr, |
| 200 | const struct omap_overlay_manager_info *info); |
Archit Taneja | b917fa3 | 2012-04-27 01:07:28 +0530 | [diff] [blame] | 201 | int dss_mgr_check_timings(struct omap_overlay_manager *mgr, |
| 202 | const struct omap_video_timings *timings); |
Tomi Valkeinen | 6ac48d1 | 2011-12-08 10:32:37 +0200 | [diff] [blame] | 203 | int dss_mgr_check(struct omap_overlay_manager *mgr, |
Tomi Valkeinen | 6ac48d1 | 2011-12-08 10:32:37 +0200 | [diff] [blame] | 204 | struct omap_overlay_manager_info *info, |
Archit Taneja | 228b213 | 2012-04-27 01:22:28 +0530 | [diff] [blame] | 205 | const struct omap_video_timings *mgr_timings, |
Archit Taneja | 6e54359 | 2012-05-23 17:01:35 +0530 | [diff] [blame] | 206 | const struct dss_lcd_mgr_config *config, |
Tomi Valkeinen | 6ac48d1 | 2011-12-08 10:32:37 +0200 | [diff] [blame] | 207 | struct omap_overlay_info **overlay_infos); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 208 | |
Archit Taneja | f476ae9 | 2012-06-29 14:37:03 +0530 | [diff] [blame] | 209 | static inline bool dss_mgr_is_lcd(enum omap_channel id) |
| 210 | { |
| 211 | if (id == OMAP_DSS_CHANNEL_LCD || id == OMAP_DSS_CHANNEL_LCD2 || |
| 212 | id == OMAP_DSS_CHANNEL_LCD3) |
| 213 | return true; |
| 214 | else |
| 215 | return false; |
| 216 | } |
| 217 | |
Tomi Valkeinen | f6a0492 | 2012-08-06 14:44:09 +0300 | [diff] [blame] | 218 | int dss_manager_kobj_init(struct omap_overlay_manager *mgr, |
| 219 | struct platform_device *pdev); |
| 220 | void dss_manager_kobj_uninit(struct omap_overlay_manager *mgr); |
| 221 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 222 | /* overlay */ |
| 223 | void dss_init_overlays(struct platform_device *pdev); |
| 224 | void dss_uninit_overlays(struct platform_device *pdev); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 225 | void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr); |
Tomi Valkeinen | 54540d4 | 2011-12-13 13:18:52 +0200 | [diff] [blame] | 226 | int dss_ovl_simple_check(struct omap_overlay *ovl, |
| 227 | const struct omap_overlay_info *info); |
Archit Taneja | 228b213 | 2012-04-27 01:22:28 +0530 | [diff] [blame] | 228 | int dss_ovl_check(struct omap_overlay *ovl, struct omap_overlay_info *info, |
| 229 | const struct omap_video_timings *mgr_timings); |
Archit Taneja | 6c6f510 | 2012-06-25 14:58:48 +0530 | [diff] [blame] | 230 | bool dss_ovl_use_replication(struct dss_lcd_mgr_config config, |
| 231 | enum omap_color_mode mode); |
Tomi Valkeinen | 9169151 | 2012-08-06 14:40:00 +0300 | [diff] [blame] | 232 | int dss_overlay_kobj_init(struct omap_overlay *ovl, |
| 233 | struct platform_device *pdev); |
| 234 | void dss_overlay_kobj_uninit(struct omap_overlay *ovl); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 235 | |
| 236 | /* DSS */ |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 237 | int dss_init_platform_driver(void) __init; |
Senthilvadivu Guruswamy | 96c401b | 2011-01-24 06:21:57 +0000 | [diff] [blame] | 238 | void dss_uninit_platform_driver(void); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 239 | |
Tomi Valkeinen | 5aaee69 | 2012-12-12 10:37:03 +0200 | [diff] [blame] | 240 | unsigned long dss_get_dispc_clk_rate(void); |
Tomi Valkeinen | de09e45 | 2012-09-21 12:09:54 +0300 | [diff] [blame] | 241 | int dss_dpi_select_source(enum omap_channel channel); |
Mythri P K | 7ed024a | 2011-03-09 16:31:38 +0530 | [diff] [blame] | 242 | void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); |
Tomi Valkeinen | 4a61e26 | 2011-08-31 14:33:31 +0300 | [diff] [blame] | 243 | enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); |
Archit Taneja | 89a35e5 | 2011-04-12 13:52:23 +0530 | [diff] [blame] | 244 | const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); |
Senthilvadivu Guruswamy | 8b9cb3a | 2011-01-24 06:21:58 +0000 | [diff] [blame] | 245 | void dss_dump_clocks(struct seq_file *s); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 246 | |
Chandrabhanu Mahapatra | 1b3bcb3 | 2012-09-29 11:25:42 +0530 | [diff] [blame] | 247 | #if defined(CONFIG_OMAP2_DSS_DEBUGFS) |
Senthilvadivu Guruswamy | 8b9cb3a | 2011-01-24 06:21:58 +0000 | [diff] [blame] | 248 | void dss_debug_dump_clocks(struct seq_file *s); |
| 249 | #endif |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 250 | |
Archit Taneja | bdb736a | 2012-11-28 17:01:39 +0530 | [diff] [blame] | 251 | int dss_get_ctx_loss_count(void); |
| 252 | |
Archit Taneja | 889b4fd | 2012-07-20 17:18:49 +0530 | [diff] [blame] | 253 | void dss_sdi_init(int datapairs); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 254 | int dss_sdi_enable(void); |
| 255 | void dss_sdi_disable(void); |
| 256 | |
Archit Taneja | 5a8b572 | 2011-05-12 17:26:29 +0530 | [diff] [blame] | 257 | void dss_select_dsi_clk_source(int dsi_module, |
| 258 | enum omap_dss_clk_source clk_src); |
Taneja, Archit | ea75159 | 2011-03-08 05:50:35 -0600 | [diff] [blame] | 259 | void dss_select_lcd_clk_source(enum omap_channel channel, |
Archit Taneja | 89a35e5 | 2011-04-12 13:52:23 +0530 | [diff] [blame] | 260 | enum omap_dss_clk_source clk_src); |
| 261 | enum omap_dss_clk_source dss_get_dispc_clk_source(void); |
Archit Taneja | 5a8b572 | 2011-05-12 17:26:29 +0530 | [diff] [blame] | 262 | enum omap_dss_clk_source dss_get_dsi_clk_source(int dsi_module); |
Archit Taneja | 89a35e5 | 2011-04-12 13:52:23 +0530 | [diff] [blame] | 263 | enum omap_dss_clk_source dss_get_lcd_clk_source(enum omap_channel channel); |
Tomi Valkeinen | 2f18c4d | 2010-01-08 18:00:36 +0200 | [diff] [blame] | 264 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 265 | void dss_set_venc_output(enum omap_dss_venc_type type); |
| 266 | void dss_set_dac_pwrdn_bgz(bool enable); |
| 267 | |
| 268 | unsigned long dss_get_dpll4_rate(void); |
Tomi Valkeinen | 930b027 | 2012-10-15 13:27:04 +0300 | [diff] [blame] | 269 | int dss_calc_clock_rates(struct dss_clock_info *cinfo); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 270 | int dss_set_clock_div(struct dss_clock_info *cinfo); |
Archit Taneja | 6d523e7 | 2012-06-21 09:33:55 +0530 | [diff] [blame] | 271 | int dss_calc_clock_div(unsigned long req_pck, struct dss_clock_info *dss_cinfo, |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 272 | struct dispc_clock_info *dispc_cinfo); |
| 273 | |
| 274 | /* SDI */ |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 275 | int sdi_init_platform_driver(void) __init; |
| 276 | void sdi_uninit_platform_driver(void) __exit; |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 277 | |
| 278 | /* DSI */ |
Jani Nikula | 368a148 | 2010-05-07 11:58:41 +0200 | [diff] [blame] | 279 | #ifdef CONFIG_OMAP2_DSS_DSI |
Archit Taneja | 5a8b572 | 2011-05-12 17:26:29 +0530 | [diff] [blame] | 280 | |
| 281 | struct dentry; |
| 282 | struct file_operations; |
| 283 | |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 284 | int dsi_init_platform_driver(void) __init; |
| 285 | void dsi_uninit_platform_driver(void) __exit; |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 286 | |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 287 | int dsi_runtime_get(struct platform_device *dsidev); |
| 288 | void dsi_runtime_put(struct platform_device *dsidev); |
| 289 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 290 | void dsi_dump_clocks(struct seq_file *s); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 291 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 292 | void dsi_irq_handler(void); |
Archit Taneja | a3b3cc2 | 2011-09-08 18:42:16 +0530 | [diff] [blame] | 293 | u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt); |
| 294 | |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 295 | unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev); |
| 296 | int dsi_pll_set_clock_div(struct platform_device *dsidev, |
| 297 | struct dsi_clock_info *cinfo); |
Archit Taneja | 6d523e7 | 2012-06-21 09:33:55 +0530 | [diff] [blame] | 298 | int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev, |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 299 | unsigned long req_pck, struct dsi_clock_info *cinfo, |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 300 | struct dispc_clock_info *dispc_cinfo); |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 301 | int dsi_pll_init(struct platform_device *dsidev, bool enable_hsclk, |
| 302 | bool enable_hsdiv); |
| 303 | void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes); |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 304 | void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev); |
| 305 | void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev); |
| 306 | struct platform_device *dsi_get_dsidev_from_id(int module); |
Jani Nikula | 368a148 | 2010-05-07 11:58:41 +0200 | [diff] [blame] | 307 | #else |
Tomi Valkeinen | 4fbafaf | 2011-05-27 10:52:19 +0300 | [diff] [blame] | 308 | static inline int dsi_runtime_get(struct platform_device *dsidev) |
| 309 | { |
| 310 | return 0; |
| 311 | } |
| 312 | static inline void dsi_runtime_put(struct platform_device *dsidev) |
| 313 | { |
| 314 | } |
Archit Taneja | a3b3cc2 | 2011-09-08 18:42:16 +0530 | [diff] [blame] | 315 | static inline u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt) |
| 316 | { |
| 317 | WARN("%s: DSI not compiled in, returning pixel_size as 0\n", __func__); |
| 318 | return 0; |
| 319 | } |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 320 | static inline unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev) |
Taneja, Archit | 66534e8 | 2011-03-08 05:50:34 -0600 | [diff] [blame] | 321 | { |
| 322 | WARN("%s: DSI not compiled in, returning rate as 0\n", __func__); |
| 323 | return 0; |
| 324 | } |
Tomi Valkeinen | 943e445 | 2011-04-30 15:38:15 +0300 | [diff] [blame] | 325 | static inline int dsi_pll_set_clock_div(struct platform_device *dsidev, |
| 326 | struct dsi_clock_info *cinfo) |
| 327 | { |
| 328 | WARN("%s: DSI not compiled in\n", __func__); |
| 329 | return -ENODEV; |
| 330 | } |
| 331 | static inline int dsi_pll_calc_clock_div_pck(struct platform_device *dsidev, |
Archit Taneja | 6d523e7 | 2012-06-21 09:33:55 +0530 | [diff] [blame] | 332 | unsigned long req_pck, |
Tomi Valkeinen | 943e445 | 2011-04-30 15:38:15 +0300 | [diff] [blame] | 333 | struct dsi_clock_info *dsi_cinfo, |
| 334 | struct dispc_clock_info *dispc_cinfo) |
| 335 | { |
| 336 | WARN("%s: DSI not compiled in\n", __func__); |
| 337 | return -ENODEV; |
| 338 | } |
| 339 | static inline int dsi_pll_init(struct platform_device *dsidev, |
| 340 | bool enable_hsclk, bool enable_hsdiv) |
| 341 | { |
| 342 | WARN("%s: DSI not compiled in\n", __func__); |
| 343 | return -ENODEV; |
| 344 | } |
| 345 | static inline void dsi_pll_uninit(struct platform_device *dsidev, |
| 346 | bool disconnect_lanes) |
| 347 | { |
| 348 | } |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 349 | static inline void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev) |
Tomi Valkeinen | e406f90 | 2010-06-09 15:28:12 +0300 | [diff] [blame] | 350 | { |
| 351 | } |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 352 | static inline void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev) |
Tomi Valkeinen | e406f90 | 2010-06-09 15:28:12 +0300 | [diff] [blame] | 353 | { |
| 354 | } |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 355 | static inline struct platform_device *dsi_get_dsidev_from_id(int module) |
| 356 | { |
Archit Taneja | a72b64b | 2011-05-12 17:26:26 +0530 | [diff] [blame] | 357 | return NULL; |
| 358 | } |
Jani Nikula | 368a148 | 2010-05-07 11:58:41 +0200 | [diff] [blame] | 359 | #endif |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 360 | |
| 361 | /* DPI */ |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 362 | int dpi_init_platform_driver(void) __init; |
| 363 | void dpi_uninit_platform_driver(void) __exit; |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 364 | |
| 365 | /* DISPC */ |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 366 | int dispc_init_platform_driver(void) __init; |
| 367 | void dispc_uninit_platform_driver(void) __exit; |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 368 | void dispc_dump_clocks(struct seq_file *s); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 369 | |
| 370 | void dispc_enable_sidle(void); |
| 371 | void dispc_disable_sidle(void); |
| 372 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 373 | void dispc_lcd_enable_signal(bool enable); |
| 374 | void dispc_pck_free_enable(bool enable); |
Tomi Valkeinen | cd295ae | 2011-08-16 13:49:15 +0300 | [diff] [blame] | 375 | void dispc_enable_fifomerge(bool enable); |
| 376 | void dispc_enable_gamma_table(bool enable); |
| 377 | void dispc_set_loadmode(enum omap_dss_load_mode mode); |
| 378 | |
Archit Taneja | 8f36616 | 2012-04-16 12:53:44 +0530 | [diff] [blame] | 379 | bool dispc_mgr_timings_ok(enum omap_channel channel, |
Archit Taneja | b917fa3 | 2012-04-27 01:07:28 +0530 | [diff] [blame] | 380 | const struct omap_video_timings *timings); |
Tomi Valkeinen | cd295ae | 2011-08-16 13:49:15 +0300 | [diff] [blame] | 381 | unsigned long dispc_fclk_rate(void); |
Archit Taneja | 6d523e7 | 2012-06-21 09:33:55 +0530 | [diff] [blame] | 382 | void dispc_find_clk_divs(unsigned long req_pck, unsigned long fck, |
Tomi Valkeinen | cd295ae | 2011-08-16 13:49:15 +0300 | [diff] [blame] | 383 | struct dispc_clock_info *cinfo); |
| 384 | int dispc_calc_clock_rates(unsigned long dispc_fclk_rate, |
| 385 | struct dispc_clock_info *cinfo); |
| 386 | |
| 387 | |
Tomi Valkeinen | 6f04e1b | 2011-10-31 08:58:52 +0200 | [diff] [blame] | 388 | void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high); |
Tomi Valkeinen | 83fa2f2 | 2012-01-13 13:17:01 +0200 | [diff] [blame] | 389 | void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane, |
Tomi Valkeinen | 3568f2a | 2012-05-15 15:31:01 +0300 | [diff] [blame] | 390 | u32 *fifo_low, u32 *fifo_high, bool use_fifomerge, |
| 391 | bool manual_update); |
Tomi Valkeinen | cd295ae | 2011-08-16 13:49:15 +0300 | [diff] [blame] | 392 | |
Tomi Valkeinen | cd295ae | 2011-08-16 13:49:15 +0300 | [diff] [blame] | 393 | unsigned long dispc_mgr_lclk_rate(enum omap_channel channel); |
| 394 | unsigned long dispc_mgr_pclk_rate(enum omap_channel channel); |
Chandrabhanu Mahapatra | 8b53d99 | 2012-04-23 12:16:50 +0530 | [diff] [blame] | 395 | unsigned long dispc_core_clk_rate(void); |
Archit Taneja | f0d08f8 | 2012-06-29 14:00:54 +0530 | [diff] [blame] | 396 | void dispc_mgr_set_clock_div(enum omap_channel channel, |
Tomi Valkeinen | a8f3fcd | 2012-10-03 09:09:11 +0200 | [diff] [blame] | 397 | const struct dispc_clock_info *cinfo); |
Tomi Valkeinen | 26d9dd0 | 2011-08-16 13:45:15 +0300 | [diff] [blame] | 398 | int dispc_mgr_get_clock_div(enum omap_channel channel, |
Sumit Semwal | ff1b2cd | 2010-12-02 11:27:11 +0000 | [diff] [blame] | 399 | struct dispc_clock_info *cinfo); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 400 | |
Archit Taneja | 0b23e5b | 2012-09-22 12:39:33 +0530 | [diff] [blame] | 401 | u32 dispc_wb_get_framedone_irq(void); |
| 402 | bool dispc_wb_go_busy(void); |
| 403 | void dispc_wb_go(void); |
| 404 | void dispc_wb_enable(bool enable); |
| 405 | bool dispc_wb_is_enabled(void); |
Archit Taneja | d9ac773 | 2012-09-22 12:38:19 +0530 | [diff] [blame] | 406 | void dispc_wb_set_channel_in(enum dss_writeback_channel channel); |
Archit Taneja | 749feff | 2012-08-31 12:32:52 +0530 | [diff] [blame] | 407 | int dispc_wb_setup(const struct omap_dss_writeback_info *wi, |
Archit Taneja | 9e4a0fc | 2012-08-24 16:59:26 +0530 | [diff] [blame] | 408 | bool mem_to_mem, const struct omap_video_timings *timings); |
Archit Taneja | d9ac773 | 2012-09-22 12:38:19 +0530 | [diff] [blame] | 409 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 410 | /* VENC */ |
Jani Nikula | 368a148 | 2010-05-07 11:58:41 +0200 | [diff] [blame] | 411 | #ifdef CONFIG_OMAP2_DSS_VENC |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 412 | int venc_init_platform_driver(void) __init; |
| 413 | void venc_uninit_platform_driver(void) __exit; |
Archit Taneja | c3dc6a7 | 2011-09-13 18:28:41 +0530 | [diff] [blame] | 414 | unsigned long venc_get_pixel_clock(void); |
Jani Nikula | 368a148 | 2010-05-07 11:58:41 +0200 | [diff] [blame] | 415 | #else |
Archit Taneja | c3dc6a7 | 2011-09-13 18:28:41 +0530 | [diff] [blame] | 416 | static inline unsigned long venc_get_pixel_clock(void) |
| 417 | { |
| 418 | WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__); |
| 419 | return 0; |
| 420 | } |
Jani Nikula | 368a148 | 2010-05-07 11:58:41 +0200 | [diff] [blame] | 421 | #endif |
Archit Taneja | 156fd99 | 2012-07-06 20:52:37 +0530 | [diff] [blame] | 422 | int omapdss_venc_display_enable(struct omap_dss_device *dssdev); |
| 423 | void omapdss_venc_display_disable(struct omap_dss_device *dssdev); |
| 424 | void omapdss_venc_set_timings(struct omap_dss_device *dssdev, |
| 425 | struct omap_video_timings *timings); |
| 426 | int omapdss_venc_check_timings(struct omap_dss_device *dssdev, |
| 427 | struct omap_video_timings *timings); |
| 428 | u32 omapdss_venc_get_wss(struct omap_dss_device *dssdev); |
| 429 | int omapdss_venc_set_wss(struct omap_dss_device *dssdev, u32 wss); |
Archit Taneja | febe290 | 2012-08-16 11:55:15 +0530 | [diff] [blame] | 430 | void omapdss_venc_set_type(struct omap_dss_device *dssdev, |
| 431 | enum omap_dss_venc_type type); |
Archit Taneja | 89e7195 | 2012-08-16 11:56:31 +0530 | [diff] [blame] | 432 | void omapdss_venc_invert_vid_out_polarity(struct omap_dss_device *dssdev, |
| 433 | bool invert_polarity); |
Archit Taneja | 156fd99 | 2012-07-06 20:52:37 +0530 | [diff] [blame] | 434 | int venc_panel_init(void); |
| 435 | void venc_panel_exit(void); |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 436 | |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 437 | /* HDMI */ |
| 438 | #ifdef CONFIG_OMAP4_DSS_HDMI |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 439 | int hdmi_init_platform_driver(void) __init; |
| 440 | void hdmi_uninit_platform_driver(void) __exit; |
Archit Taneja | c3dc6a7 | 2011-09-13 18:28:41 +0530 | [diff] [blame] | 441 | unsigned long hdmi_get_pixel_clock(void); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 442 | #else |
Archit Taneja | c3dc6a7 | 2011-09-13 18:28:41 +0530 | [diff] [blame] | 443 | static inline unsigned long hdmi_get_pixel_clock(void) |
| 444 | { |
| 445 | WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__); |
| 446 | return 0; |
| 447 | } |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 448 | #endif |
| 449 | int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev); |
| 450 | void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev); |
Tomi Valkeinen | 4489823 | 2012-10-19 17:42:27 +0300 | [diff] [blame] | 451 | int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev); |
| 452 | void omapdss_hdmi_core_disable(struct omap_dss_device *dssdev); |
Archit Taneja | 7849398 | 2012-08-08 16:50:42 +0530 | [diff] [blame] | 453 | void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev, |
| 454 | struct omap_video_timings *timings); |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 455 | int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev, |
| 456 | struct omap_video_timings *timings); |
Tomi Valkeinen | 4702456 | 2011-08-25 17:12:56 +0300 | [diff] [blame] | 457 | int omapdss_hdmi_read_edid(u8 *buf, int len); |
Tomi Valkeinen | 759593f | 2011-08-29 18:10:20 +0300 | [diff] [blame] | 458 | bool omapdss_hdmi_detect(void); |
Mythri P K | 70be832 | 2011-03-10 15:48:48 +0530 | [diff] [blame] | 459 | int hdmi_panel_init(void); |
| 460 | void hdmi_panel_exit(void); |
Ricardo Neri | f3a97491 | 2012-05-09 21:09:50 -0500 | [diff] [blame] | 461 | #ifdef CONFIG_OMAP4_DSS_HDMI_AUDIO |
| 462 | int hdmi_audio_enable(void); |
| 463 | void hdmi_audio_disable(void); |
| 464 | int hdmi_audio_start(void); |
| 465 | void hdmi_audio_stop(void); |
| 466 | bool hdmi_mode_has_audio(void); |
| 467 | int hdmi_audio_config(struct omap_dss_audio *audio); |
| 468 | #endif |
Mythri P K | c3198a5 | 2011-03-12 12:04:27 +0530 | [diff] [blame] | 469 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 470 | /* RFBI */ |
Tomi Valkeinen | 6e7e8f0 | 2012-02-17 17:41:13 +0200 | [diff] [blame] | 471 | int rfbi_init_platform_driver(void) __init; |
| 472 | void rfbi_uninit_platform_driver(void) __exit; |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 473 | |
Tomi Valkeinen | dfc0fd8 | 2009-12-17 14:35:21 +0200 | [diff] [blame] | 474 | |
| 475 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
| 476 | static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr) |
| 477 | { |
| 478 | int b; |
| 479 | for (b = 0; b < 32; ++b) { |
| 480 | if (irqstatus & (1 << b)) |
| 481 | irq_arr[b]++; |
| 482 | } |
| 483 | } |
| 484 | #endif |
| 485 | |
Tomi Valkeinen | 559d670 | 2009-11-03 11:23:50 +0200 | [diff] [blame] | 486 | #endif |