Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/*
2 * Copyright (C) 2012 Russell King
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef ARMADA_DRM_H
9#define ARMADA_DRM_H
10
11#include <linux/kfifo.h>
12#include <linux/io.h>
13#include <linux/workqueue.h>
14#include <drm/drmP.h>
15
16struct armada_crtc;
17struct armada_gem_object;
18struct clk;
19struct drm_fb_helper;
20
21static inline void
22armada_updatel(uint32_t val, uint32_t mask, void __iomem *ptr)
23{
24 uint32_t ov, v;
25
26 ov = v = readl_relaxed(ptr);
27 v = (v & ~mask) | val;
28 if (ov != v)
29 writel_relaxed(v, ptr);
30}
31
32static inline uint32_t armada_pitch(uint32_t width, uint32_t bpp)
33{
34 uint32_t pitch = bpp != 4 ? width * ((bpp + 7) / 8) : width / 2;
35
36 /* 88AP510 spec recommends pitch be a multiple of 128 */
37 return ALIGN(pitch, 128);
38}
39
40struct armada_vbl_event {
41 struct list_head node;
42 void *data;
43 void (*fn)(struct armada_crtc *, void *);
44};
45void armada_drm_vbl_event_add(struct armada_crtc *,
46 struct armada_vbl_event *);
47void armada_drm_vbl_event_remove(struct armada_crtc *,
48 struct armada_vbl_event *);
49#define armada_drm_vbl_event_init(_e, _f, _d) do { \
50 struct armada_vbl_event *__e = _e; \
51 INIT_LIST_HEAD(&__e->node); \
52 __e->data = _d; \
53 __e->fn = _f; \
54} while (0)
55
56
57struct armada_private;
58
59struct armada_variant {
60 bool has_spu_adv_reg;
61 uint32_t spu_adv_reg;
62 int (*init)(struct armada_crtc *, struct device *);
63 int (*compute_clock)(struct armada_crtc *,
64 const struct drm_display_mode *,
65 uint32_t *);
66};
67
68/* Variant ops */
69extern const struct armada_variant armada510_ops;
70
71struct armada_private {
72 struct work_struct fb_unref_work;
73 DECLARE_KFIFO(fb_unref, struct drm_framebuffer *, 8);
74 struct drm_fb_helper *fbdev;
75 struct armada_crtc *dcrtc[2];
76 struct drm_mm linear;
77 struct drm_property *csc_yuv_prop;
78 struct drm_property *csc_rgb_prop;
79 struct drm_property *colorkey_prop;
80 struct drm_property *colorkey_min_prop;
81 struct drm_property *colorkey_max_prop;
82 struct drm_property *colorkey_val_prop;
83 struct drm_property *colorkey_alpha_prop;
84 struct drm_property *colorkey_mode_prop;
85 struct drm_property *brightness_prop;
86 struct drm_property *contrast_prop;
87 struct drm_property *saturation_prop;
88#ifdef CONFIG_DEBUG_FS
89 struct dentry *de;
90#endif
91};
92
93void __armada_drm_queue_unref_work(struct drm_device *,
94 struct drm_framebuffer *);
95void armada_drm_queue_unref_work(struct drm_device *,
96 struct drm_framebuffer *);
97
98extern const struct drm_mode_config_funcs armada_drm_mode_config_funcs;
99
100int armada_fbdev_init(struct drm_device *);
101void armada_fbdev_lastclose(struct drm_device *);
102void armada_fbdev_fini(struct drm_device *);
103
104int armada_overlay_plane_create(struct drm_device *, unsigned long);
105
106int armada_drm_debugfs_init(struct drm_minor *);
107void armada_drm_debugfs_cleanup(struct drm_minor *);
108
109#endif