2 * Copyright (C) 2012 Russell King
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.
11 #include <linux/kfifo.h>
13 #include <linux/workqueue.h>
17 struct armada_gem_object
;
22 armada_updatel(uint32_t val
, uint32_t mask
, void __iomem
*ptr
)
26 ov
= v
= readl_relaxed(ptr
);
27 v
= (v
& ~mask
) | val
;
29 writel_relaxed(v
, ptr
);
32 static inline uint32_t armada_pitch(uint32_t width
, uint32_t bpp
)
34 uint32_t pitch
= bpp
!= 4 ? width
* ((bpp
+ 7) / 8) : width
/ 2;
36 /* 88AP510 spec recommends pitch be a multiple of 128 */
37 return ALIGN(pitch
, 128);
40 struct armada_vbl_event
{
41 struct list_head node
;
43 void (*fn
)(struct armada_crtc
*, void *);
45 void armada_drm_vbl_event_add(struct armada_crtc
*,
46 struct armada_vbl_event
*);
47 void armada_drm_vbl_event_remove(struct armada_crtc
*,
48 struct armada_vbl_event
*);
49 void armada_drm_vbl_event_remove_unlocked(struct armada_crtc
*,
50 struct armada_vbl_event
*);
51 #define armada_drm_vbl_event_init(_e, _f, _d) do { \
52 struct armada_vbl_event *__e = _e; \
53 INIT_LIST_HEAD(&__e->node); \
59 struct armada_private
;
61 struct armada_variant
{
64 int (*init
)(struct armada_crtc
*, struct device
*);
65 int (*compute_clock
)(struct armada_crtc
*,
66 const struct drm_display_mode
*,
71 extern const struct armada_variant armada510_ops
;
73 struct armada_private
{
74 struct work_struct fb_unref_work
;
75 DECLARE_KFIFO(fb_unref
, struct drm_framebuffer
*, 8);
76 struct drm_fb_helper
*fbdev
;
77 struct armada_crtc
*dcrtc
[2];
79 struct drm_property
*csc_yuv_prop
;
80 struct drm_property
*csc_rgb_prop
;
81 struct drm_property
*colorkey_prop
;
82 struct drm_property
*colorkey_min_prop
;
83 struct drm_property
*colorkey_max_prop
;
84 struct drm_property
*colorkey_val_prop
;
85 struct drm_property
*colorkey_alpha_prop
;
86 struct drm_property
*colorkey_mode_prop
;
87 struct drm_property
*brightness_prop
;
88 struct drm_property
*contrast_prop
;
89 struct drm_property
*saturation_prop
;
90 #ifdef CONFIG_DEBUG_FS
95 void __armada_drm_queue_unref_work(struct drm_device
*,
96 struct drm_framebuffer
*);
97 void armada_drm_queue_unref_work(struct drm_device
*,
98 struct drm_framebuffer
*);
100 extern const struct drm_mode_config_funcs armada_drm_mode_config_funcs
;
102 int armada_fbdev_init(struct drm_device
*);
103 void armada_fbdev_lastclose(struct drm_device
*);
104 void armada_fbdev_fini(struct drm_device
*);
106 int armada_overlay_plane_create(struct drm_device
*, unsigned long);
108 int armada_drm_debugfs_init(struct drm_minor
*);
109 void armada_drm_debugfs_cleanup(struct drm_minor
*);