xref: /openbmc/linux/drivers/gpu/drm/sun4i/sun8i_csc.h (revision 113094f7)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (C) Jernej Skrabec <jernej.skrabec@siol.net>
4  */
5 
6 #ifndef _SUN8I_CSC_H_
7 #define _SUN8I_CSC_H_
8 
9 struct sun8i_mixer;
10 
11 /* VI channel CSC units offsets */
12 #define CCSC00_OFFSET 0xAA050
13 #define CCSC01_OFFSET 0xFA000
14 #define CCSC10_OFFSET 0xA0000
15 #define CCSC11_OFFSET 0xF0000
16 
17 #define SUN8I_CSC_CTRL(base)		(base + 0x0)
18 #define SUN8I_CSC_COEFF(base, i)	(base + 0x10 + 4 * i)
19 
20 #define SUN8I_CSC_CTRL_EN		BIT(0)
21 
22 enum sun8i_csc_mode {
23 	SUN8I_CSC_MODE_OFF,
24 	SUN8I_CSC_MODE_YUV2RGB,
25 	SUN8I_CSC_MODE_YVU2RGB,
26 };
27 
28 void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer,
29 				     enum sun8i_csc_mode mode);
30 void sun8i_csc_enable_ccsc(struct sun8i_mixer *mixer, int layer, bool enable);
31 
32 #endif
33