Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2012 Russell King
 4 */
 5#ifndef ARMADA_DRM_H
 6#define ARMADA_DRM_H
 7
 8#include <linux/kfifo.h>
 9#include <linux/io.h>
10#include <linux/workqueue.h>
11
12#include <drm/drm_device.h>
13#include <drm/drm_mm.h>
14
15struct armada_crtc;
16struct armada_gem_object;
17struct clk;
18struct drm_display_mode;
19struct drm_fb_helper;
20struct drm_fb_helper_surface_size;
21
22static inline void
23armada_updatel(uint32_t val, uint32_t mask, void __iomem *ptr)
24{
25	uint32_t ov, v;
26
27	ov = v = readl_relaxed(ptr);
28	v = (v & ~mask) | val;
29	if (ov != v)
30		writel_relaxed(v, ptr);
31}
32
33static inline uint32_t armada_pitch(uint32_t width, uint32_t bpp)
34{
35	uint32_t pitch = bpp != 4 ? width * ((bpp + 7) / 8) : width / 2;
36
37	/* 88AP510 spec recommends pitch be a multiple of 128 */
38	return ALIGN(pitch, 128);
39}
40
41
42struct armada_private;
43
44struct armada_variant {
45	bool has_spu_adv_reg;
46	int (*init)(struct armada_crtc *, struct device *);
47	int (*compute_clock)(struct armada_crtc *,
48			     const struct drm_display_mode *,
49			     uint32_t *);
50	void (*disable)(struct armada_crtc *);
51	void (*enable)(struct armada_crtc *, const struct drm_display_mode *);
52};
53
54/* Variant ops */
55extern const struct armada_variant armada510_ops;
56
57struct armada_private {
58	struct drm_device	drm;
 
59	struct armada_crtc	*dcrtc[2];
60	struct drm_mm		linear; /* protected by linear_lock */
61	struct mutex		linear_lock;
62	struct drm_property	*colorkey_prop;
63	struct drm_property	*colorkey_min_prop;
64	struct drm_property	*colorkey_max_prop;
65	struct drm_property	*colorkey_val_prop;
66	struct drm_property	*colorkey_alpha_prop;
67	struct drm_property	*colorkey_mode_prop;
68	struct drm_property	*brightness_prop;
69	struct drm_property	*contrast_prop;
70	struct drm_property	*saturation_prop;
71#ifdef CONFIG_DEBUG_FS
72	struct dentry		*de;
73#endif
74};
75
76#define drm_to_armada_dev(dev) container_of(dev, struct armada_private, drm)
77
78#if defined(CONFIG_DRM_FBDEV_EMULATION)
79int armada_fbdev_driver_fbdev_probe(struct drm_fb_helper *fbh,
80				    struct drm_fb_helper_surface_size *sizes);
81#define ARMADA_FBDEV_DRIVER_OPS \
82	.fbdev_probe = armada_fbdev_driver_fbdev_probe
83#else
84#define ARMADA_FBDEV_DRIVER_OPS \
85	.fbdev_probe = NULL
86#endif
87
88int armada_overlay_plane_create(struct drm_device *, unsigned long);
89
90void armada_drm_crtc_debugfs_init(struct armada_crtc *dcrtc);
91int armada_drm_debugfs_init(struct drm_minor *);
92
93#endif
v5.4
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2012 Russell King
 4 */
 5#ifndef ARMADA_DRM_H
 6#define ARMADA_DRM_H
 7
 8#include <linux/kfifo.h>
 9#include <linux/io.h>
10#include <linux/workqueue.h>
11
12#include <drm/drm_device.h>
13#include <drm/drm_mm.h>
14
15struct armada_crtc;
16struct armada_gem_object;
17struct clk;
18struct drm_display_mode;
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
40
41struct armada_private;
42
43struct armada_variant {
44	bool has_spu_adv_reg;
45	int (*init)(struct armada_crtc *, struct device *);
46	int (*compute_clock)(struct armada_crtc *,
47			     const struct drm_display_mode *,
48			     uint32_t *);
49	void (*disable)(struct armada_crtc *);
50	void (*enable)(struct armada_crtc *, const struct drm_display_mode *);
51};
52
53/* Variant ops */
54extern const struct armada_variant armada510_ops;
55
56struct armada_private {
57	struct drm_device	drm;
58	struct drm_fb_helper	*fbdev;
59	struct armada_crtc	*dcrtc[2];
60	struct drm_mm		linear; /* protected by linear_lock */
61	struct mutex		linear_lock;
62	struct drm_property	*colorkey_prop;
63	struct drm_property	*colorkey_min_prop;
64	struct drm_property	*colorkey_max_prop;
65	struct drm_property	*colorkey_val_prop;
66	struct drm_property	*colorkey_alpha_prop;
67	struct drm_property	*colorkey_mode_prop;
68	struct drm_property	*brightness_prop;
69	struct drm_property	*contrast_prop;
70	struct drm_property	*saturation_prop;
71#ifdef CONFIG_DEBUG_FS
72	struct dentry		*de;
73#endif
74};
75
76int armada_fbdev_init(struct drm_device *);
77void armada_fbdev_fini(struct drm_device *);
 
 
 
 
 
 
 
 
 
78
79int armada_overlay_plane_create(struct drm_device *, unsigned long);
80
81void armada_drm_crtc_debugfs_init(struct armada_crtc *dcrtc);
82int armada_drm_debugfs_init(struct drm_minor *);
83
84#endif