aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/sun4i/sun8i_csc.c
diff options
context:
space:
mode:
authorJernej Skrabec <jernej.skrabec@siol.net>2019-07-13 14:03:45 +0200
committerMaxime Ripard <maxime.ripard@bootlin.com>2019-07-20 07:38:06 +0200
commitab38c3b7c3472a6626aceb12fc2a23828152daf3 (patch)
treea084260d8e1a0b54dfa5aec9ca259aabd33bda11 /drivers/gpu/drm/sun4i/sun8i_csc.c
parent5917e0bdbc90cae408561f713eaa7d60e512e599 (diff)
downloadlinux-ab38c3b7c3472a6626aceb12fc2a23828152daf3.tar.gz
drm/sun4i: sun8i_csc: Simplify register writes
It turns out addition of 0x200 to constant parts (+0.5) is not really necessary. Besides, we can consider that before and fix value in CSC matrix. This simplifies register writes quiet a bit. Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190713120346.30349-3-jernej.skrabec@siol.net
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun8i_csc.c')
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_csc.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.c b/drivers/gpu/drm/sun4i/sun8i_csc.c
index 00706a494c89..d0dd3edf1e2e 100644
--- a/drivers/gpu/drm/sun4i/sun8i_csc.c
+++ b/drivers/gpu/drm/sun4i/sun8i_csc.c
@@ -69,7 +69,7 @@ static void sun8i_csc_set_coefficients(struct regmap *map, u32 base,
enum sun8i_csc_mode mode)
{
const u32 *table;
- int i, data;
+ u32 base_reg;
switch (mode) {
case SUN8I_CSC_MODE_YUV2RGB:
@@ -83,13 +83,8 @@ static void sun8i_csc_set_coefficients(struct regmap *map, u32 base,
return;
}
- for (i = 0; i < 12; i++) {
- data = table[i];
- /* For some reason, 0x200 must be added to constant parts */
- if (((i + 1) & 3) == 0)
- data += 0x200;
- regmap_write(map, SUN8I_CSC_COEFF(base, i), data);
- }
+ base_reg = SUN8I_CSC_COEFF(base, 0);
+ regmap_bulk_write(map, base_reg, table, 12);
}
static void sun8i_de3_ccsc_set_coefficients(struct regmap *map, int layer,