16 #include <linux/export.h>
17 #include <linux/module.h>
18 #include <linux/types.h>
19 #include <linux/errno.h>
26 #define DC_MAP_CONF_PTR(n) (0x108 + ((n) & ~0x1) * 2)
27 #define DC_MAP_CONF_VAL(n) (0x144 + ((n) & ~0x1) * 2)
32 #define DC_EVT_NFIELD 3
34 #define DC_EVT_EOFIELD 5
35 #define DC_EVT_NEW_ADDR 6
36 #define DC_EVT_NEW_CHAN 7
37 #define DC_EVT_NEW_DATA 8
39 #define DC_EVT_NEW_ADDR_W_0 0
40 #define DC_EVT_NEW_ADDR_W_1 1
41 #define DC_EVT_NEW_CHAN_W_0 2
42 #define DC_EVT_NEW_CHAN_W_1 3
43 #define DC_EVT_NEW_DATA_W_0 4
44 #define DC_EVT_NEW_DATA_W_1 5
45 #define DC_EVT_NEW_ADDR_R_0 6
46 #define DC_EVT_NEW_ADDR_R_1 7
47 #define DC_EVT_NEW_CHAN_R_0 8
48 #define DC_EVT_NEW_CHAN_R_1 9
49 #define DC_EVT_NEW_DATA_R_0 10
50 #define DC_EVT_NEW_DATA_R_1 11
52 #define DC_WR_CH_CONF 0x0
53 #define DC_WR_CH_ADDR 0x4
54 #define DC_RL_CH(evt) (8 + ((evt) & ~0x1) * 2)
57 #define DC_DISP_CONF1(disp) (0xd8 + (disp) * 4)
58 #define DC_DISP_CONF2(disp) (0xe8 + (disp) * 4)
61 #define WROD(lf) (0x18 | ((lf) << 1))
66 #define DC_GEN_SYNC_1_6_SYNC (2 << 1)
67 #define DC_GEN_SYNC_PRIORITY_1 (1 << 7)
69 #define DC_WR_CH_CONF_WORD_SIZE_8 (0 << 0)
70 #define DC_WR_CH_CONF_WORD_SIZE_16 (1 << 0)
71 #define DC_WR_CH_CONF_WORD_SIZE_24 (2 << 0)
72 #define DC_WR_CH_CONF_WORD_SIZE_32 (3 << 0)
73 #define DC_WR_CH_CONF_DISP_ID_PARALLEL(i) (((i) & 0x1) << 3)
74 #define DC_WR_CH_CONF_DISP_ID_SERIAL (2 << 3)
75 #define DC_WR_CH_CONF_DISP_ID_ASYNC (3 << 4)
76 #define DC_WR_CH_CONF_FIELD_MODE (1 << 9)
77 #define DC_WR_CH_CONF_PROG_TYPE_NORMAL (4 << 5)
78 #define DC_WR_CH_CONF_PROG_TYPE_MASK (7 << 5)
79 #define DC_WR_CH_CONF_PROG_DI_ID (1 << 2)
80 #define DC_WR_CH_CONF_PROG_DISP_ID(i) (((i) & 0x1) << 3)
82 #define IPU_DC_NUM_CHANNELS 10
114 reg &= ~(0xffff << (16 * (
event & 0x1)));
115 reg |= ((addr << 8) | priority) << (16 * (
event & 0x1));
120 int map,
int wave,
int glue,
int sync)
126 reg = sync | glue << 4 | ++wave << 11 | ++map << 15 | ((operand << 20) & 0xfff00000);
128 reg = operand >> 12 | opcode << 4 | stop << 9;
132 static int ipu_pixfmt_to_map(
u32 fmt)
152 map = ipu_pixfmt_to_map(pixel_fmt);
228 else if (dc->
chno == 5)
258 int ptr = map * 3 + byte_num;
262 reg &= ~(0xffff << (16 * (ptr & 0x1)));
263 reg |= ((offset << 8) | mask) << (16 * (ptr & 0x1));
267 reg &= ~(0x1f << ((16 * (map & 0x1)) + (5 * byte_num)));
268 reg |= ptr << ((16 * (map & 0x1)) + (5 * byte_num));
272 static void ipu_dc_map_clear(
struct ipu_dc_priv *priv,
int map)
276 writel(reg & ~(0xffff << (16 * (map & 0x1))),
294 return ERR_PTR(-
EBUSY);
316 unsigned long base,
unsigned long template_base)
319 static int channel_offsets[] = { 0, 0x1c, 0x38, 0x54, 0x58, 0x5c,
320 0x78, 0, 0x94, 0xb4};
352 dev_dbg(dev,
"DC base: 0x%08lx template base: 0x%08lx\n",
353 base, template_base);