blob: ea3eb6b0e7f17b6ef148df53c5d3a5362412af14 [file] [log] [blame]
Tomi Valkeinen559d6702009-11-03 11:23:50 +02001/*
Tomi Valkeinen559d6702009-11-03 11:23:50 +02002 * Copyright (C) 2009 Nokia Corporation
3 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
4 *
5 * Some code and ideas taken from drivers/video/omap/ driver
6 * by Imre Deak.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published by
10 * the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __OMAP2_DSS_H
22#define __OMAP2_DSS_H
23
Tomi Valkeinen96e2e632012-10-10 15:55:19 +030024#include <linux/interrupt.h>
25
Tomi Valkeinen35a339a2016-02-19 16:54:36 +020026#include "omapdss.h"
27
Laurent Pinchartd874b3a2017-08-05 01:44:19 +030028#define MAX_DSS_LCD_MANAGERS 3
29#define MAX_NUM_DSI 2
30
Chandrabhanu Mahapatra702d2672012-09-24 17:12:58 +053031#ifdef pr_fmt
32#undef pr_fmt
Tomi Valkeinen559d6702009-11-03 11:23:50 +020033#endif
34
35#ifdef DSS_SUBSYS_NAME
Chandrabhanu Mahapatra702d2672012-09-24 17:12:58 +053036#define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
Tomi Valkeinen559d6702009-11-03 11:23:50 +020037#else
Chandrabhanu Mahapatra702d2672012-09-24 17:12:58 +053038#define pr_fmt(fmt) fmt
Tomi Valkeinen559d6702009-11-03 11:23:50 +020039#endif
40
Chandrabhanu Mahapatra702d2672012-09-24 17:12:58 +053041#define DSSDBG(format, ...) \
42 pr_debug(format, ## __VA_ARGS__)
Tomi Valkeinen559d6702009-11-03 11:23:50 +020043
44#ifdef DSS_SUBSYS_NAME
45#define DSSERR(format, ...) \
Joe Perches8dfe1622017-02-28 04:55:54 -080046 pr_err("omapdss " DSS_SUBSYS_NAME " error: " format, ##__VA_ARGS__)
Tomi Valkeinen559d6702009-11-03 11:23:50 +020047#else
48#define DSSERR(format, ...) \
Joe Perches8dfe1622017-02-28 04:55:54 -080049 pr_err("omapdss error: " format, ##__VA_ARGS__)
Tomi Valkeinen559d6702009-11-03 11:23:50 +020050#endif
51
52#ifdef DSS_SUBSYS_NAME
53#define DSSINFO(format, ...) \
Joe Perches8dfe1622017-02-28 04:55:54 -080054 pr_info("omapdss " DSS_SUBSYS_NAME ": " format, ##__VA_ARGS__)
Tomi Valkeinen559d6702009-11-03 11:23:50 +020055#else
56#define DSSINFO(format, ...) \
Joe Perches8dfe1622017-02-28 04:55:54 -080057 pr_info("omapdss: " format, ## __VA_ARGS__)
Tomi Valkeinen559d6702009-11-03 11:23:50 +020058#endif
59
60#ifdef DSS_SUBSYS_NAME
61#define DSSWARN(format, ...) \
Joe Perches8dfe1622017-02-28 04:55:54 -080062 pr_warn("omapdss " DSS_SUBSYS_NAME ": " format, ##__VA_ARGS__)
Tomi Valkeinen559d6702009-11-03 11:23:50 +020063#else
64#define DSSWARN(format, ...) \
Joe Perches8dfe1622017-02-28 04:55:54 -080065 pr_warn("omapdss: " format, ##__VA_ARGS__)
Tomi Valkeinen559d6702009-11-03 11:23:50 +020066#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
Laurent Pinchartb8dab2b2017-08-05 01:43:56 +030076enum dss_model {
77 DSS_MODEL_OMAP2,
78 DSS_MODEL_OMAP3,
79 DSS_MODEL_OMAP4,
80 DSS_MODEL_OMAP5,
81 DSS_MODEL_DRA7,
82};
83
Archit Taneja569969d2011-08-22 17:41:57 +053084enum dss_io_pad_mode {
85 DSS_IO_PAD_MODE_RESET,
86 DSS_IO_PAD_MODE_RFBI,
87 DSS_IO_PAD_MODE_BYPASS,
Tomi Valkeinen559d6702009-11-03 11:23:50 +020088};
89
Mythri P K7ed024a2011-03-09 16:31:38 +053090enum dss_hdmi_venc_clk_source_select {
91 DSS_VENC_TV_CLK = 0,
92 DSS_HDMI_M_PCLK = 1,
93};
94
Archit Taneja6ff8aa32011-08-25 18:35:58 +053095enum dss_dsi_content_type {
96 DSS_DSI_CONTENT_DCS,
97 DSS_DSI_CONTENT_GENERIC,
98};
99
Archit Tanejad9ac7732012-09-22 12:38:19 +0530100enum dss_writeback_channel {
101 DSS_WB_LCD1_MGR = 0,
102 DSS_WB_LCD2_MGR = 1,
103 DSS_WB_TV_MGR = 2,
104 DSS_WB_OVL0 = 3,
105 DSS_WB_OVL1 = 4,
106 DSS_WB_OVL2 = 5,
107 DSS_WB_OVL3 = 6,
108 DSS_WB_LCD3_MGR = 7,
109};
110
Tomi Valkeinendc0352d2016-05-17 13:45:09 +0300111enum dss_clk_source {
Tomi Valkeinen3b63ca72016-05-17 14:01:10 +0300112 DSS_CLK_SRC_FCK = 0,
113
114 DSS_CLK_SRC_PLL1_1,
115 DSS_CLK_SRC_PLL1_2,
Tomi Valkeinenb5d8c752016-05-17 14:12:35 +0300116 DSS_CLK_SRC_PLL1_3,
Tomi Valkeinen3b63ca72016-05-17 14:01:10 +0300117
118 DSS_CLK_SRC_PLL2_1,
119 DSS_CLK_SRC_PLL2_2,
Tomi Valkeinenb5d8c752016-05-17 14:12:35 +0300120 DSS_CLK_SRC_PLL2_3,
121
122 DSS_CLK_SRC_HDMI_PLL,
Tomi Valkeinenbe5d7312016-05-17 13:31:14 +0300123};
124
Tomi Valkeinen64e22ff2015-01-02 10:05:33 +0200125enum dss_pll_id {
126 DSS_PLL_DSI1,
127 DSS_PLL_DSI2,
128 DSS_PLL_HDMI,
Tomi Valkeinen6d817882014-12-31 11:23:31 +0200129 DSS_PLL_VIDEO1,
130 DSS_PLL_VIDEO2,
Tomi Valkeinen64e22ff2015-01-02 10:05:33 +0200131};
132
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300133struct dss_pll;
134
135#define DSS_PLL_MAX_HSDIVS 4
136
Tomi Valkeinen06ede3d2016-05-18 10:48:44 +0300137enum dss_pll_type {
138 DSS_PLL_TYPE_A,
139 DSS_PLL_TYPE_B,
140};
141
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300142/*
143 * Type-A PLLs: clkout[]/mX[] refer to hsdiv outputs m4, m5, m6, m7.
144 * Type-B PLLs: clkout[0] refers to m2.
145 */
146struct dss_pll_clock_info {
147 /* rates that we get with dividers below */
148 unsigned long fint;
149 unsigned long clkdco;
150 unsigned long clkout[DSS_PLL_MAX_HSDIVS];
151
152 /* dividers */
153 u16 n;
154 u16 m;
155 u32 mf;
156 u16 mX[DSS_PLL_MAX_HSDIVS];
157 u16 sd;
158};
159
160struct dss_pll_ops {
161 int (*enable)(struct dss_pll *pll);
162 void (*disable)(struct dss_pll *pll);
163 int (*set_config)(struct dss_pll *pll,
164 const struct dss_pll_clock_info *cinfo);
165};
166
167struct dss_pll_hw {
Tomi Valkeinen06ede3d2016-05-18 10:48:44 +0300168 enum dss_pll_type type;
169
Laurent Pinchartd11e5c82018-02-11 15:07:34 +0200170 unsigned int n_max;
171 unsigned int m_min;
172 unsigned int m_max;
173 unsigned int mX_max;
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300174
175 unsigned long fint_min, fint_max;
176 unsigned long clkdco_min, clkdco_low, clkdco_max;
177
178 u8 n_msb, n_lsb;
179 u8 m_msb, m_lsb;
180 u8 mX_msb[DSS_PLL_MAX_HSDIVS], mX_lsb[DSS_PLL_MAX_HSDIVS];
181
182 bool has_stopmode;
183 bool has_freqsel;
184 bool has_selfreqdco;
185 bool has_refsel;
Tomi Valkeinen0c43f1e02017-06-13 12:02:10 +0300186
187 /* DRA7 errata i886: use high N & M to avoid jitter */
188 bool errata_i886;
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300189};
190
191struct dss_pll {
192 const char *name;
Tomi Valkeinen64e22ff2015-01-02 10:05:33 +0200193 enum dss_pll_id id;
Laurent Pinchart7b295252018-02-13 14:00:21 +0200194 struct dss_device *dss;
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300195
196 struct clk *clkin;
197 struct regulator *regulator;
198
199 void __iomem *base;
200
201 const struct dss_pll_hw *hw;
202
203 const struct dss_pll_ops *ops;
204
205 struct dss_pll_clock_info cinfo;
206};
207
Laurent Pinchart6d85d4a2017-08-05 01:44:07 +0300208/* Defines a generic omap register field */
209struct dss_reg_field {
210 u8 start, end;
211};
212
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200213struct dispc_clock_info {
214 /* rates that we get with dividers below */
215 unsigned long lck;
216 unsigned long pck;
217
218 /* dividers */
219 u16 lck_div;
220 u16 pck_div;
221};
222
Archit Tanejac56fb3e2012-06-29 14:03:48 +0530223struct dss_lcd_mgr_config {
224 enum dss_io_pad_mode io_pad_mode;
225
226 bool stallmode;
227 bool fifohandcheck;
228
229 struct dispc_clock_info clock_info;
230
231 int video_port_width;
232
233 int lcden_sig_polarity;
234};
235
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200236struct seq_file;
237struct platform_device;
238
Laurent Pinchart0e546df2018-02-13 14:00:20 +0200239#define DSS_SZ_REGS SZ_512
240
241struct dss_device {
242 struct platform_device *pdev;
243 void __iomem *base;
244 struct regmap *syscon_pll_ctrl;
245 u32 syscon_pll_ctrl_offset;
246
247 struct clk *parent_clk;
248 struct clk *dss_clk;
249 unsigned long dss_clk_rate;
250
251 unsigned long cache_req_pck;
252 unsigned long cache_prate;
253 struct dispc_clock_info cache_dispc_cinfo;
254
255 enum dss_clk_source dsi_clk_source[MAX_NUM_DSI];
256 enum dss_clk_source dispc_clk_source;
257 enum dss_clk_source lcd_clk_source[MAX_DSS_LCD_MANAGERS];
258
259 bool ctx_valid;
260 u32 ctx[DSS_SZ_REGS / sizeof(u32)];
261
262 const struct dss_features *feat;
263
264 struct dss_pll *video1_pll;
265 struct dss_pll *video2_pll;
266};
267
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200268/* core */
Laurent Pinchart493b6832017-08-05 01:43:54 +0300269static inline int dss_set_min_bus_tput(struct device *dev, unsigned long tput)
270{
271 /* To be implemented when the OMAP platform will provide this feature */
272 return 0;
273}
274
Archit Tanejaf476ae92012-06-29 14:37:03 +0530275static inline bool dss_mgr_is_lcd(enum omap_channel id)
276{
277 if (id == OMAP_DSS_CHANNEL_LCD || id == OMAP_DSS_CHANNEL_LCD2 ||
278 id == OMAP_DSS_CHANNEL_LCD3)
279 return true;
280 else
281 return false;
282}
283
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200284/* DSS */
Laurent Pinchart11765d12017-08-05 01:44:01 +0300285#if defined(CONFIG_OMAP2_DSS_DEBUGFS)
286int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *));
287#else
288static inline int dss_debugfs_create_file(const char *name,
289 void (*write)(struct seq_file *))
290{
291 return 0;
292}
293#endif /* CONFIG_OMAP2_DSS_DEBUGFS */
294
Laurent Pinchart7b295252018-02-13 14:00:21 +0200295struct dss_device *dss_get_device(struct device *dev);
296
297int dss_runtime_get(struct dss_device *dss);
298void dss_runtime_put(struct dss_device *dss);
Tomi Valkeinen99767542014-07-04 13:38:27 +0530299
Tomi Valkeinen5aaee692012-12-12 10:37:03 +0200300unsigned long dss_get_dispc_clk_rate(void);
Laurent Pinchart9f0fbae2017-08-05 01:44:17 +0300301unsigned long dss_get_max_fck_rate(void);
Laurent Pinchart51919572017-08-05 01:44:18 +0300302enum omap_dss_output_id dss_get_supported_outputs(enum omap_channel channel);
Archit Taneja064c2a42014-04-23 18:00:18 +0530303int dss_dpi_select_source(int port, enum omap_channel channel);
Mythri P K7ed024a2011-03-09 16:31:38 +0530304void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select);
Tomi Valkeinen407bd562016-05-17 13:50:55 +0300305const char *dss_get_clk_source_name(enum dss_clk_source clk_src);
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200306
Tomi Valkeinen99767542014-07-04 13:38:27 +0530307/* DSS VIDEO PLL */
Laurent Pinchart7b295252018-02-13 14:00:21 +0200308struct dss_pll *dss_video_pll_init(struct dss_device *dss,
309 struct platform_device *pdev, int id,
310 struct regulator *regulator);
Tomi Valkeinen99767542014-07-04 13:38:27 +0530311void dss_video_pll_uninit(struct dss_pll *pll);
312
Laurent Pinchart27260992018-02-13 14:00:22 +0200313void dss_ctrl_pll_enable(struct dss_pll *pll, bool enable);
Tomi Valkeinenbe40eec2014-07-04 13:37:15 +0530314
Archit Taneja889b4fd2012-07-20 17:18:49 +0530315void dss_sdi_init(int datapairs);
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200316int dss_sdi_enable(void);
317void dss_sdi_disable(void);
318
Archit Taneja5a8b5722011-05-12 17:26:29 +0530319void dss_select_dsi_clk_source(int dsi_module,
Tomi Valkeinendc0352d2016-05-17 13:45:09 +0300320 enum dss_clk_source clk_src);
Taneja, Architea751592011-03-08 05:50:35 -0600321void dss_select_lcd_clk_source(enum omap_channel channel,
Tomi Valkeinendc0352d2016-05-17 13:45:09 +0300322 enum dss_clk_source clk_src);
323enum dss_clk_source dss_get_dispc_clk_source(void);
324enum dss_clk_source dss_get_dsi_clk_source(int dsi_module);
325enum dss_clk_source dss_get_lcd_clk_source(enum omap_channel channel);
Tomi Valkeinen2f18c4d2010-01-08 18:00:36 +0200326
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200327void dss_set_venc_output(enum omap_dss_venc_type type);
328void dss_set_dac_pwrdn_bgz(bool enable);
329
Tomi Valkeinend0f58bd2013-10-31 14:44:23 +0200330int dss_set_fck_rate(unsigned long rate);
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200331
Tomi Valkeinend0f58bd2013-10-31 14:44:23 +0200332typedef bool (*dss_div_calc_func)(unsigned long fck, void *data);
Tomi Valkeinen688af022013-10-31 16:41:57 +0200333bool dss_div_calc(unsigned long pck, unsigned long fck_min,
334 dss_div_calc_func func, void *data);
Tomi Valkeinen43417822013-03-05 16:34:05 +0200335
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200336/* SDI */
Archit Taneja387ce9f2014-05-22 17:01:57 +0530337#ifdef CONFIG_OMAP2_DSS_SDI
Tomi Valkeinenede92692015-06-04 14:12:16 +0300338int sdi_init_port(struct platform_device *pdev, struct device_node *port);
339void sdi_uninit_port(struct device_node *port);
Archit Taneja387ce9f2014-05-22 17:01:57 +0530340#else
Tomi Valkeinenede92692015-06-04 14:12:16 +0300341static inline int sdi_init_port(struct platform_device *pdev,
Archit Taneja387ce9f2014-05-22 17:01:57 +0530342 struct device_node *port)
343{
344 return 0;
345}
Tomi Valkeinenede92692015-06-04 14:12:16 +0300346static inline void sdi_uninit_port(struct device_node *port)
Archit Taneja387ce9f2014-05-22 17:01:57 +0530347{
348}
349#endif
Tomi Valkeinen2ecef242013-12-16 15:13:24 +0200350
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200351/* DSI */
Tomi Valkeinen989c79a2013-04-18 12:16:39 +0300352
Jani Nikula368a1482010-05-07 11:58:41 +0200353#ifdef CONFIG_OMAP2_DSS_DSI
Archit Taneja5a8b5722011-05-12 17:26:29 +0530354
355struct dentry;
356struct file_operations;
357
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200358void dsi_dump_clocks(struct seq_file *s);
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200359
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200360void dsi_irq_handler(void);
Archit Tanejaa3b3cc22011-09-08 18:42:16 +0530361
Jani Nikula368a1482010-05-07 11:58:41 +0200362#endif
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200363
364/* DPI */
Archit Taneja387ce9f2014-05-22 17:01:57 +0530365#ifdef CONFIG_OMAP2_DSS_DPI
Laurent Pinchartb8dab2b2017-08-05 01:43:56 +0300366int dpi_init_port(struct platform_device *pdev, struct device_node *port,
367 enum dss_model dss_model);
Tomi Valkeinenede92692015-06-04 14:12:16 +0300368void dpi_uninit_port(struct device_node *port);
Archit Taneja387ce9f2014-05-22 17:01:57 +0530369#else
Tomi Valkeinenede92692015-06-04 14:12:16 +0300370static inline int dpi_init_port(struct platform_device *pdev,
Laurent Pinchartb8dab2b2017-08-05 01:43:56 +0300371 struct device_node *port, enum dss_model dss_model)
Archit Taneja387ce9f2014-05-22 17:01:57 +0530372{
373 return 0;
374}
Tomi Valkeinenede92692015-06-04 14:12:16 +0300375static inline void dpi_uninit_port(struct device_node *port)
Archit Taneja387ce9f2014-05-22 17:01:57 +0530376{
377}
378#endif
Tomi Valkeinen2ecef242013-12-16 15:13:24 +0200379
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200380/* DISPC */
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200381void dispc_dump_clocks(struct seq_file *s);
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200382
Tomi Valkeinen5034b1f2015-11-05 20:06:06 +0200383int dispc_runtime_get(void);
384void dispc_runtime_put(void);
385
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200386void dispc_enable_sidle(void);
387void dispc_disable_sidle(void);
388
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200389void dispc_lcd_enable_signal(bool enable);
390void dispc_pck_free_enable(bool enable);
Tomi Valkeinencd295ae2011-08-16 13:49:15 +0300391void dispc_enable_fifomerge(bool enable);
Tomi Valkeinencd295ae2011-08-16 13:49:15 +0300392
Tomi Valkeinen7c284e62013-03-05 16:32:08 +0200393typedef bool (*dispc_div_calc_func)(int lckd, int pckd, unsigned long lck,
394 unsigned long pck, void *data);
395bool dispc_div_calc(unsigned long dispc,
396 unsigned long pck_min, unsigned long pck_max,
397 dispc_div_calc_func func, void *data);
398
Peter Ujfalusida11bbbb2016-09-22 14:07:04 +0300399bool dispc_mgr_timings_ok(enum omap_channel channel, const struct videomode *vm);
Tomi Valkeinencd295ae2011-08-16 13:49:15 +0300400int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
401 struct dispc_clock_info *cinfo);
402
403
Jyri Sarha864050c2017-03-24 16:47:52 +0200404void dispc_ovl_set_fifo_threshold(enum omap_plane_id plane, u32 low,
405 u32 high);
406void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane,
Tomi Valkeinen3568f2a2012-05-15 15:31:01 +0300407 u32 *fifo_low, u32 *fifo_high, bool use_fifomerge,
408 bool manual_update);
Tomi Valkeinencd295ae2011-08-16 13:49:15 +0300409
Archit Tanejaf0d08f82012-06-29 14:00:54 +0530410void dispc_mgr_set_clock_div(enum omap_channel channel,
Tomi Valkeinena8f3fcd2012-10-03 09:09:11 +0200411 const struct dispc_clock_info *cinfo);
Tomi Valkeinen26d9dd02011-08-16 13:45:15 +0300412int dispc_mgr_get_clock_div(enum omap_channel channel,
Sumit Semwalff1b2cd2010-12-02 11:27:11 +0000413 struct dispc_clock_info *cinfo);
Tomi Valkeinen5391e872013-05-16 10:44:13 +0300414void dispc_set_tv_pclk(unsigned long pclk);
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200415
Archit Taneja0b23e5b2012-09-22 12:39:33 +0530416u32 dispc_wb_get_framedone_irq(void);
417bool dispc_wb_go_busy(void);
418void dispc_wb_go(void);
Archit Tanejad9ac7732012-09-22 12:38:19 +0530419void dispc_wb_set_channel_in(enum dss_writeback_channel channel);
Archit Taneja749feff2012-08-31 12:32:52 +0530420int dispc_wb_setup(const struct omap_dss_writeback_info *wi,
Peter Ujfalusida11bbbb2016-09-22 14:07:04 +0300421 bool mem_to_mem, const struct videomode *vm);
Archit Tanejad9ac7732012-09-22 12:38:19 +0530422
Tomi Valkeinendfc0fd82009-12-17 14:35:21 +0200423#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
Laurent Pinchartd11e5c82018-02-11 15:07:34 +0200424static inline void dss_collect_irq_stats(u32 irqstatus, unsigned int *irq_arr)
Tomi Valkeinendfc0fd82009-12-17 14:35:21 +0200425{
426 int b;
427 for (b = 0; b < 32; ++b) {
428 if (irqstatus & (1 << b))
429 irq_arr[b]++;
430 }
431}
432#endif
433
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300434/* PLL */
435typedef bool (*dss_pll_calc_func)(int n, int m, unsigned long fint,
436 unsigned long clkdco, void *data);
437typedef bool (*dss_hsdiv_calc_func)(int m_dispc, unsigned long dispc,
438 void *data);
439
440int dss_pll_register(struct dss_pll *pll);
441void dss_pll_unregister(struct dss_pll *pll);
442struct dss_pll *dss_pll_find(const char *name);
Tomi Valkeinen5670bd72016-05-18 12:42:09 +0300443struct dss_pll *dss_pll_find_by_src(enum dss_clk_source src);
Laurent Pinchartd11e5c82018-02-11 15:07:34 +0200444unsigned int dss_pll_get_clkout_idx_for_src(enum dss_clk_source src);
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300445int dss_pll_enable(struct dss_pll *pll);
446void dss_pll_disable(struct dss_pll *pll);
447int dss_pll_set_config(struct dss_pll *pll,
448 const struct dss_pll_clock_info *cinfo);
449
Tomi Valkeinencd0715f2016-05-17 21:23:37 +0300450bool dss_pll_hsdiv_calc_a(const struct dss_pll *pll, unsigned long clkdco,
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300451 unsigned long out_min, unsigned long out_max,
452 dss_hsdiv_calc_func func, void *data);
Tomi Valkeinencd0715f2016-05-17 21:23:37 +0300453bool dss_pll_calc_a(const struct dss_pll *pll, unsigned long clkin,
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300454 unsigned long pll_min, unsigned long pll_max,
455 dss_pll_calc_func func, void *data);
Tomi Valkeinenc17dc0e2016-05-18 10:45:20 +0300456
457bool dss_pll_calc_b(const struct dss_pll *pll, unsigned long clkin,
Tomi Valkeinenc1077512016-05-18 11:15:21 +0300458 unsigned long target_clkout, struct dss_pll_clock_info *cinfo);
Tomi Valkeinenc17dc0e2016-05-18 10:45:20 +0300459
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300460int dss_pll_write_config_type_a(struct dss_pll *pll,
461 const struct dss_pll_clock_info *cinfo);
462int dss_pll_write_config_type_b(struct dss_pll *pll,
463 const struct dss_pll_clock_info *cinfo);
Tomi Valkeineneb301992014-12-31 14:22:42 +0200464int dss_pll_wait_reset_done(struct dss_pll *pll);
Tomi Valkeinen0a201702014-10-22 14:21:59 +0300465
Andrew F. Davisd66c36a2017-12-05 14:29:32 -0600466extern struct platform_driver omap_dsshw_driver;
467extern struct platform_driver omap_dispchw_driver;
468#ifdef CONFIG_OMAP2_DSS_DSI
469extern struct platform_driver omap_dsihw_driver;
470#endif
471#ifdef CONFIG_OMAP2_DSS_VENC
472extern struct platform_driver omap_venchw_driver;
473#endif
474#ifdef CONFIG_OMAP4_DSS_HDMI
475extern struct platform_driver omapdss_hdmi4hw_driver;
476#endif
477#ifdef CONFIG_OMAP5_DSS_HDMI
478extern struct platform_driver omapdss_hdmi5hw_driver;
479#endif
480
Tomi Valkeinen559d6702009-11-03 11:23:50 +0200481#endif