1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2012 Russell King
8 #include <linux/kfifo.h>
10 #include <linux/workqueue.h>
12 #include <drm/drm_device.h>
13 #include <drm/drm_mm.h>
16 struct armada_gem_object;
18 struct drm_display_mode;
21 armada_updatel(uint32_t val, uint32_t mask, void __iomem *ptr)
25 ov = v = readl_relaxed(ptr);
26 v = (v & ~mask) | val;
28 writel_relaxed(v, ptr);
31 static inline uint32_t armada_pitch(uint32_t width, uint32_t bpp)
33 uint32_t pitch = bpp != 4 ? width * ((bpp + 7) / 8) : width / 2;
35 /* 88AP510 spec recommends pitch be a multiple of 128 */
36 return ALIGN(pitch, 128);
40 struct armada_private;
42 struct armada_variant {
44 int (*init)(struct armada_crtc *, struct device *);
45 int (*compute_clock)(struct armada_crtc *,
46 const struct drm_display_mode *,
48 void (*disable)(struct armada_crtc *);
49 void (*enable)(struct armada_crtc *, const struct drm_display_mode *);
53 extern const struct armada_variant armada510_ops;
55 struct armada_private {
56 struct drm_device drm;
57 struct armada_crtc *dcrtc[2];
58 struct drm_mm linear; /* protected by linear_lock */
59 struct mutex linear_lock;
60 struct drm_property *colorkey_prop;
61 struct drm_property *colorkey_min_prop;
62 struct drm_property *colorkey_max_prop;
63 struct drm_property *colorkey_val_prop;
64 struct drm_property *colorkey_alpha_prop;
65 struct drm_property *colorkey_mode_prop;
66 struct drm_property *brightness_prop;
67 struct drm_property *contrast_prop;
68 struct drm_property *saturation_prop;
69 #ifdef CONFIG_DEBUG_FS
74 #define drm_to_armada_dev(dev) container_of(dev, struct armada_private, drm)
76 #if defined(CONFIG_DRM_FBDEV_EMULATION)
77 void armada_fbdev_setup(struct drm_device *dev);
79 static inline void armada_fbdev_setup(struct drm_device *dev)
83 int armada_overlay_plane_create(struct drm_device *, unsigned long);
85 void armada_drm_crtc_debugfs_init(struct armada_crtc *dcrtc);
86 int armada_drm_debugfs_init(struct drm_minor *);