xref: /openbmc/linux/drivers/gpu/drm/sun4i/sun8i_csc.h (revision ba61bb17)
1 /*
2  * Copyright (C) Jernej Skrabec <jernej.skrabec@siol.net>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  */
9 
10 #ifndef _SUN8I_CSC_H_
11 #define _SUN8I_CSC_H_
12 
13 struct sun8i_mixer;
14 
15 /* VI channel CSC units offsets */
16 #define CCSC00_OFFSET 0xAA050
17 #define CCSC01_OFFSET 0xFA000
18 #define CCSC10_OFFSET 0xA0000
19 #define CCSC11_OFFSET 0xF0000
20 
21 #define SUN8I_CSC_CTRL(base)		(base + 0x0)
22 #define SUN8I_CSC_COEFF(base, i)	(base + 0x10 + 4 * i)
23 
24 #define SUN8I_CSC_CTRL_EN		BIT(0)
25 
26 enum sun8i_csc_mode {
27 	SUN8I_CSC_MODE_OFF,
28 	SUN8I_CSC_MODE_YUV2RGB,
29 	SUN8I_CSC_MODE_YVU2RGB,
30 };
31 
32 void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer,
33 				     enum sun8i_csc_mode mode);
34 void sun8i_csc_enable_ccsc(struct sun8i_mixer *mixer, int layer, bool enable);
35 
36 #endif
37