xref: /linux/drivers/gpu/drm/pl111/pl111_drm.h (revision 6c7d091008d0d095adb3f65d667a234d372f4472)
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 <drm/drm_connector.h>
25 #include <drm/drm_encoder.h>
26 #include <drm/drm_panel.h>
27 #include <drm/drm_bridge.h>
28 #include <linux/clk-provider.h>
29 #include <linux/interrupt.h>
30 
31 #define CLCD_IRQ_NEXTBASE_UPDATE BIT(2)
32 
33 struct drm_minor;
34 
35 /**
36  * struct pl111_variant_data - encodes IP differences
37  * @name: the name of this variant
38  * @is_pl110: this is the early PL110 variant
39  * @external_bgr: this is the Versatile Pl110 variant with external
40  *	BGR/RGB routing
41  * @broken_clockdivider: the clock divider is broken and we need to
42  *	use the supplied clock directly
43  * @broken_vblank: the vblank IRQ is broken on this variant
44  * @formats: array of supported pixel formats on this variant
45  * @nformats: the length of the array of supported pixel formats
46  */
47 struct pl111_variant_data {
48 	const char *name;
49 	bool is_pl110;
50 	bool external_bgr;
51 	bool broken_clockdivider;
52 	bool broken_vblank;
53 	const u32 *formats;
54 	unsigned int nformats;
55 };
56 
57 struct pl111_drm_dev_private {
58 	struct drm_device *drm;
59 
60 	struct drm_connector *connector;
61 	struct drm_panel *panel;
62 	struct drm_bridge *bridge;
63 	struct drm_simple_display_pipe pipe;
64 
65 	void *regs;
66 	u32 ienb;
67 	u32 ctrl;
68 	/* The pixel clock (a reference to our clock divider off of CLCDCLK). */
69 	struct clk *clk;
70 	/* pl111's internal clock divider. */
71 	struct clk_hw clk_div;
72 	/* Lock to sync access to CLCD_TIM2 between the common clock
73 	 * subsystem and pl111_display_enable().
74 	 */
75 	spinlock_t tim2_lock;
76 	const struct pl111_variant_data *variant;
77 	void (*variant_display_enable) (struct drm_device *drm, u32 format);
78 	void (*variant_display_disable) (struct drm_device *drm);
79 };
80 
81 int pl111_display_init(struct drm_device *dev);
82 irqreturn_t pl111_irq(int irq, void *data);
83 int pl111_debugfs_init(struct drm_minor *minor);
84 
85 #endif /* _PL111_DRM_H_ */
86