* Copyright (C) 2020 Renesas Electronics Corporation
*/
+#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/io.h>
vclkset = VCLKSET_CKEN;
rcar_mipi_dsi_write(dsi, VCLKSET, vclkset);
+ /* Output is always RGB, never YCbCr */
if (dsi_format == 24)
vclkset |= VCLKSET_BPP_24;
else if (dsi_format == 18)
return -EINVAL;
}
- vclkset |= VCLKSET_COLOR_RGB | VCLKSET_LANE(dsi->lanes - 1);
+ vclkset |= VCLKSET_LANE(dsi->lanes - 1);
switch (dsi->info->model) {
case RCAR_DSI_V3U:
#define VCLKSET 0x100c
#define VCLKSET_CKEN (1 << 16)
-#define VCLKSET_COLOR_RGB (0 << 8)
-#define VCLKSET_COLOR_YCC (1 << 8)
+#define VCLKSET_COLOR_YCC (1 << 8) /* 0:RGB 1:YCbCr */
#define VCLKSET_DIV_V3U(x) (((x) & 0x3) << 4)
#define VCLKSET_DIV_V4H(x) (((x) & 0x7) << 4)
-#define VCLKSET_BPP_16 (0 << 2)
-#define VCLKSET_BPP_18 (1 << 2)
-#define VCLKSET_BPP_18L (2 << 2)
-#define VCLKSET_BPP_24 (3 << 2)
+#define VCLKSET_BPP_MASK (3 << 2)
+#define VCLKSET_BPP_16 FIELD_PREP(VCLKSET_BPP_MASK, 0)
+#define VCLKSET_BPP_18 FIELD_PREP(VCLKSET_BPP_MASK, 1)
+#define VCLKSET_BPP_18L FIELD_PREP(VCLKSET_BPP_MASK, 2)
+#define VCLKSET_BPP_24 FIELD_PREP(VCLKSET_BPP_MASK, 3)
#define VCLKSET_LANE(x) (((x) & 0x3) << 0)
#define VCLKEN 0x1010