summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sun4i/sun8i_csc.h
diff options
context:
space:
mode:
authorJernej Skrabec2017-12-01 07:05:46 +0100
committerMaxime Ripard2017-12-05 13:22:44 +0100
commit8830293905504dba3a50bf34287697c5fe088f9b (patch)
tree90ba1ced298fc31a17ba871f3616c755948da430 /drivers/gpu/drm/sun4i/sun8i_csc.h
parentdrm/sun4i: Add CCSC property to DE2 configuration (diff)
downloadkernel-qcow2-linux-8830293905504dba3a50bf34287697c5fe088f9b.tar.gz
kernel-qcow2-linux-8830293905504dba3a50bf34287697c5fe088f9b.tar.xz
kernel-qcow2-linux-8830293905504dba3a50bf34287697c5fe088f9b.zip
drm/sun4i: Add DE2 CSC library
DE2 have many CSC units - channel input CSC, channel output CSC and mixer output CSC and maybe more. Fortunately, they have all same register layout, only base offsets differs. Add support only for channel output CSC for now. Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171201060550.10392-24-jernej.skrabec@siol.net
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun8i_csc.h')
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_csc.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.h b/drivers/gpu/drm/sun4i/sun8i_csc.h
new file mode 100644
index 000000000000..880e8fbb0855
--- /dev/null
+++ b/drivers/gpu/drm/sun4i/sun8i_csc.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) Jernej Skrabec <jernej.skrabec@siol.net>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#ifndef _SUN8I_CSC_H_
+#define _SUN8I_CSC_H_
+
+struct sun8i_mixer;
+
+/* VI channel CSC units offsets */
+#define CCSC00_OFFSET 0xAA050
+#define CCSC01_OFFSET 0xFA000
+#define CCSC10_OFFSET 0xA0000
+#define CCSC11_OFFSET 0xF0000
+
+#define SUN8I_CSC_CTRL(base) (base + 0x0)
+#define SUN8I_CSC_COEFF(base, i) (base + 0x10 + 4 * i)
+
+#define SUN8I_CSC_CTRL_EN BIT(0)
+
+enum sun8i_csc_mode {
+ SUN8I_CSC_MODE_OFF,
+ SUN8I_CSC_MODE_YUV2RGB,
+ SUN8I_CSC_MODE_YVU2RGB,
+};
+
+void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer,
+ enum sun8i_csc_mode mode);
+void sun8i_csc_enable_ccsc(struct sun8i_mixer *mixer, int layer, bool enable);
+
+#endif