xref: /linux/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * shmob_drm.h  --  SH Mobile DRM driver
4  *
5  * Copyright (C) 2012 Renesas Electronics Corporation
6  *
7  * Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8  */
9 
10 #ifndef __SHMOB_DRM_DRV_H__
11 #define __SHMOB_DRM_DRV_H__
12 
13 #include <linux/kernel.h>
14 #include <linux/platform_data/shmob_drm.h>
15 #include <linux/spinlock.h>
16 
17 #include "shmob_drm_crtc.h"
18 
19 struct clk;
20 struct device;
21 struct drm_device;
22 
23 struct shmob_drm_config {
24 	enum shmob_drm_clk_source clk_source;
25 	unsigned int clk_div;
26 };
27 
28 struct shmob_drm_device {
29 	struct device *dev;
30 	const struct shmob_drm_platform_data *pdata;
31 	struct shmob_drm_config config;
32 
33 	void __iomem *mmio;
34 	struct clk *clock;
35 	u32 lddckr;
36 
37 	unsigned int irq;
38 	spinlock_t irq_lock;		/* Protects hardware LDINTR register */
39 
40 	struct drm_device ddev;
41 
42 	struct shmob_drm_crtc crtc;
43 	struct drm_encoder encoder;
44 	struct drm_connector *connector;
45 };
46 
to_shmob_device(struct drm_device * dev)47 static inline struct shmob_drm_device *to_shmob_device(struct drm_device *dev)
48 {
49 	return container_of(dev, struct shmob_drm_device, ddev);
50 }
51 
52 #endif /* __SHMOB_DRM_DRV_H__ */
53