xref: /openbmc/linux/drivers/gpu/drm/pl111/pl111_drm.h (revision 6aa7de05)
1 /*
2  *
3  * (C) COPYRIGHT 2012-2013 ARM Limited. All rights reserved.
4  *
5  *
6  * Parts of this file were based on sources as follows:
7  *
8  * Copyright (c) 2006-2008 Intel Corporation
9  * Copyright (c) 2007 Dave Airlie <airlied@linux.ie>
10  * Copyright (C) 2011 Texas Instruments
11  *
12  * This program is free software and is provided to you under the terms of the
13  * GNU General Public License version 2 as published by the Free Software
14  * Foundation, and any use by you of this program is subject to the terms of
15  * such GNU licence.
16  *
17  */
18 
19 #ifndef _PL111_DRM_H_
20 #define _PL111_DRM_H_
21 
22 #include <drm/drm_gem.h>
23 #include <drm/drm_simple_kms_helper.h>
24 #include <linux/clk-provider.h>
25 
26 #define CLCD_IRQ_NEXTBASE_UPDATE BIT(2)
27 
28 struct drm_minor;
29 
30 struct pl111_drm_connector {
31 	struct drm_connector connector;
32 	struct drm_panel *panel;
33 };
34 
35 struct pl111_drm_dev_private {
36 	struct drm_device *drm;
37 
38 	struct pl111_drm_connector connector;
39 	struct drm_simple_display_pipe pipe;
40 	struct drm_fbdev_cma *fbdev;
41 
42 	void *regs;
43 	/* The pixel clock (a reference to our clock divider off of CLCDCLK). */
44 	struct clk *clk;
45 	/* pl111's internal clock divider. */
46 	struct clk_hw clk_div;
47 	/* Lock to sync access to CLCD_TIM2 between the common clock
48 	 * subsystem and pl111_display_enable().
49 	 */
50 	spinlock_t tim2_lock;
51 };
52 
53 #define to_pl111_connector(x) \
54 	container_of(x, struct pl111_drm_connector, connector)
55 
56 int pl111_display_init(struct drm_device *dev);
57 int pl111_enable_vblank(struct drm_device *drm, unsigned int crtc);
58 void pl111_disable_vblank(struct drm_device *drm, unsigned int crtc);
59 irqreturn_t pl111_irq(int irq, void *data);
60 int pl111_connector_init(struct drm_device *dev);
61 int pl111_encoder_init(struct drm_device *dev);
62 int pl111_dumb_create(struct drm_file *file_priv,
63 		      struct drm_device *dev,
64 		      struct drm_mode_create_dumb *args);
65 int pl111_debugfs_init(struct drm_minor *minor);
66 
67 #endif /* _PL111_DRM_H_ */
68