drm: mali-dp: enable gamma support
[linux-block.git] / drivers / gpu / drm / arm / malidp_drv.h
CommitLineData
ad49f860
LD
1/*
2 * (C) COPYRIGHT 2016 ARM Limited. All rights reserved.
3 * Author: Liviu Dudau <Liviu.Dudau@arm.com>
4 *
5 * This program is free software and is provided to you under the terms of the
6 * GNU General Public License version 2 as published by the Free Software
7 * Foundation, and any use by you of this program is subject to the terms
8 * of such GNU licence.
9 *
10 * ARM Mali DP500/DP550/DP650 KMS/DRM driver structures
11 */
12
13#ifndef __MALIDP_DRV_H__
14#define __MALIDP_DRV_H__
15
16#include <linux/mutex.h>
17#include <linux/wait.h>
cf4c8870 18#include <drm/drmP.h>
ad49f860
LD
19#include "malidp_hw.h"
20
21struct malidp_drm {
22 struct malidp_hw_device *dev;
23 struct drm_fbdev_cma *fbdev;
ad49f860
LD
24 struct drm_crtc crtc;
25 wait_queue_head_t wq;
26 atomic_t config_valid;
85f64218 27 struct drm_atomic_state *pm_state;
ad49f860
LD
28};
29
30#define crtc_to_malidp_device(x) container_of(x, struct malidp_drm, crtc)
31
32struct malidp_plane {
33 struct drm_plane base;
34 struct malidp_hw_device *hwdev;
35 const struct malidp_layer *layer;
36};
37
38struct malidp_plane_state {
39 struct drm_plane_state base;
40
41 /* size of the required rotation memory if plane is rotated */
42 u32 rotmem_size;
70c94a3c
BS
43 /* internal format ID */
44 u8 format;
45 u8 n_planes;
ad49f860
LD
46};
47
48#define to_malidp_plane(x) container_of(x, struct malidp_plane, base)
49#define to_malidp_plane_state(x) container_of(x, struct malidp_plane_state, base)
50
99665d07
MA
51struct malidp_crtc_state {
52 struct drm_crtc_state base;
02725d31 53 u32 gamma_coeffs[MALIDP_COEFFTAB_NUM_COEFFS];
99665d07
MA
54};
55
56#define to_malidp_crtc_state(x) container_of(x, struct malidp_crtc_state, base)
57
ad49f860
LD
58int malidp_de_planes_init(struct drm_device *drm);
59void malidp_de_planes_destroy(struct drm_device *drm);
60int malidp_crtc_init(struct drm_device *drm);
61
62/* often used combination of rotational bits */
31ad61e4 63#define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270)
ad49f860
LD
64
65#endif /* __MALIDP_DRV_H__ */