blob: e66d4bb468bb7fe76e98bd229e8c71dfccef548e [file] [log] [blame]
Tomi Valkeinen35a339a2016-02-19 16:54:36 +02001/*
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
18#ifndef __OMAP_DRM_DSS_H
19#define __OMAP_DRM_DSS_H
20
21#include <video/omapdss.h>
22
23u32 dispc_read_irqstatus(void);
24void dispc_clear_irqstatus(u32 mask);
25u32 dispc_read_irqenable(void);
26void dispc_write_irqenable(u32 mask);
27
28int dispc_request_irq(irq_handler_t handler, void *dev_id);
29void dispc_free_irq(void *dev_id);
30
31int dispc_runtime_get(void);
32void dispc_runtime_put(void);
33
34void dispc_mgr_enable(enum omap_channel channel, bool enable);
35bool dispc_mgr_is_enabled(enum omap_channel channel);
36u32 dispc_mgr_get_vsync_irq(enum omap_channel channel);
37u32 dispc_mgr_get_framedone_irq(enum omap_channel channel);
38u32 dispc_mgr_get_sync_lost_irq(enum omap_channel channel);
39bool dispc_mgr_go_busy(enum omap_channel channel);
40void dispc_mgr_go(enum omap_channel channel);
41void dispc_mgr_set_lcd_config(enum omap_channel channel,
42 const struct dss_lcd_mgr_config *config);
43void dispc_mgr_set_timings(enum omap_channel channel,
44 const struct omap_video_timings *timings);
45void dispc_mgr_setup(enum omap_channel channel,
46 const struct omap_overlay_manager_info *info);
47
48int dispc_ovl_check(enum omap_plane plane, enum omap_channel channel,
49 const struct omap_overlay_info *oi,
50 const struct omap_video_timings *timings,
51 int *x_predecim, int *y_predecim);
52
53int dispc_ovl_enable(enum omap_plane plane, bool enable);
54bool dispc_ovl_enabled(enum omap_plane plane);
55void dispc_ovl_set_channel_out(enum omap_plane plane,
56 enum omap_channel channel);
57int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
58 bool replication, const struct omap_video_timings *mgr_timings,
59 bool mem_to_mem);
60
Tomi Valkeinen7b9cb5e2015-11-04 15:11:25 +020061enum omap_dss_output_id dispc_mgr_get_supported_outputs(enum omap_channel channel);
62
Tomi Valkeinen564c7c72016-02-19 17:19:41 +020063struct dss_mgr_ops {
Tomi Valkeinene5cbb6e2015-11-04 19:36:26 +020064 int (*connect)(enum omap_channel channel,
Tomi Valkeinen564c7c72016-02-19 17:19:41 +020065 struct omap_dss_device *dst);
Tomi Valkeinene5cbb6e2015-11-04 19:36:26 +020066 void (*disconnect)(enum omap_channel channel,
Tomi Valkeinen564c7c72016-02-19 17:19:41 +020067 struct omap_dss_device *dst);
68
Tomi Valkeinene5cbb6e2015-11-04 19:36:26 +020069 void (*start_update)(enum omap_channel channel);
70 int (*enable)(enum omap_channel channel);
71 void (*disable)(enum omap_channel channel);
72 void (*set_timings)(enum omap_channel channel,
Tomi Valkeinen564c7c72016-02-19 17:19:41 +020073 const struct omap_video_timings *timings);
Tomi Valkeinene5cbb6e2015-11-04 19:36:26 +020074 void (*set_lcd_config)(enum omap_channel channel,
Tomi Valkeinen564c7c72016-02-19 17:19:41 +020075 const struct dss_lcd_mgr_config *config);
Tomi Valkeinene5cbb6e2015-11-04 19:36:26 +020076 int (*register_framedone_handler)(enum omap_channel channel,
Tomi Valkeinen564c7c72016-02-19 17:19:41 +020077 void (*handler)(void *), void *data);
Tomi Valkeinene5cbb6e2015-11-04 19:36:26 +020078 void (*unregister_framedone_handler)(enum omap_channel channel,
Tomi Valkeinen564c7c72016-02-19 17:19:41 +020079 void (*handler)(void *), void *data);
80};
81
82int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
83void dss_uninstall_mgr_ops(void);
84
Tomi Valkeinen1b07b062015-11-04 20:21:48 +020085int dss_mgr_connect(enum omap_channel channel,
Tomi Valkeinencaaecd92016-02-19 17:37:09 +020086 struct omap_dss_device *dst);
Tomi Valkeinenbdac3bb2015-11-04 20:23:37 +020087void dss_mgr_disconnect(enum omap_channel channel,
Tomi Valkeinencaaecd92016-02-19 17:37:09 +020088 struct omap_dss_device *dst);
Tomi Valkeinen5c6ff3c2015-11-04 20:25:05 +020089void dss_mgr_set_timings(enum omap_channel channel,
Tomi Valkeinencaaecd92016-02-19 17:37:09 +020090 const struct omap_video_timings *timings);
91void dss_mgr_set_lcd_config(struct omap_overlay_manager *mgr,
92 const struct dss_lcd_mgr_config *config);
93int dss_mgr_enable(struct omap_overlay_manager *mgr);
94void dss_mgr_disable(struct omap_overlay_manager *mgr);
95void dss_mgr_start_update(struct omap_overlay_manager *mgr);
96int dss_mgr_register_framedone_handler(struct omap_overlay_manager *mgr,
97 void (*handler)(void *), void *data);
98void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr,
99 void (*handler)(void *), void *data);
100
Tomi Valkeinen35a339a2016-02-19 16:54:36 +0200101#endif /* __OMAP_DRM_DSS_H */