Lines Matching refs:ch
118 struct dcss_dpr_ch ch[3]; member
121 static void dcss_dpr_write(struct dcss_dpr_ch *ch, u32 val, u32 ofs) in dcss_dpr_write() argument
123 struct dcss_dpr *dpr = ch->dpr; in dcss_dpr_write()
125 dcss_ctxld_write(dpr->ctxld, dpr->ctx_id, val, ch->base_ofs + ofs); in dcss_dpr_write()
130 struct dcss_dpr_ch *ch; in dcss_dpr_ch_init_all() local
134 ch = &dpr->ch[i]; in dcss_dpr_ch_init_all()
136 ch->base_ofs = dpr_base + i * 0x1000; in dcss_dpr_ch_init_all()
138 ch->base_reg = ioremap(ch->base_ofs, SZ_4K); in dcss_dpr_ch_init_all()
139 if (!ch->base_reg) { in dcss_dpr_ch_init_all()
145 ch->dpr = dpr; in dcss_dpr_ch_init_all()
146 ch->ch_num = i; in dcss_dpr_ch_init_all()
148 dcss_writel(0xff, ch->base_reg + DCSS_DPR_IRQ_MASK); in dcss_dpr_ch_init_all()
171 if (dpr->ch[i].base_reg) in dcss_dpr_init()
172 iounmap(dpr->ch[i].base_reg); in dcss_dpr_init()
189 struct dcss_dpr_ch *ch = &dpr->ch[ch_no]; in dcss_dpr_exit() local
191 dcss_writel(0, ch->base_reg + DCSS_DPR_SYSTEM_CTRL0); in dcss_dpr_exit()
193 if (ch->base_reg) in dcss_dpr_exit()
194 iounmap(ch->base_reg); in dcss_dpr_exit()
200 static u32 dcss_dpr_x_pix_wide_adjust(struct dcss_dpr_ch *ch, u32 pix_wide, in dcss_dpr_x_pix_wide_adjust() argument
212 pix_in_64byte = pix_in_64byte_map[ch->pix_size][ch->tile]; in dcss_dpr_x_pix_wide_adjust()
220 static u32 dcss_dpr_y_pix_high_adjust(struct dcss_dpr_ch *ch, u32 pix_high, in dcss_dpr_y_pix_high_adjust() argument
223 u8 num_rows_buf = ch->rtram_4line_en ? 4 : 8; in dcss_dpr_y_pix_high_adjust()
234 struct dcss_dpr_ch *ch = &dpr->ch[ch_num]; in dcss_dpr_set_res() local
235 u32 pix_format = ch->format.format; in dcss_dpr_set_res()
247 pix_x_wide = dcss_dpr_x_pix_wide_adjust(ch, xres, pix_format); in dcss_dpr_set_res()
248 pix_y_high = dcss_dpr_y_pix_high_adjust(ch, yres, pix_format); in dcss_dpr_set_res()
250 dcss_dpr_write(ch, pix_x_wide, in dcss_dpr_set_res()
252 dcss_dpr_write(ch, pix_y_high, in dcss_dpr_set_res()
255 dcss_dpr_write(ch, 2, DCSS_DPR_FRAME_1P_CTRL0 + plane * gap); in dcss_dpr_set_res()
262 struct dcss_dpr_ch *ch = &dpr->ch[ch_num]; in dcss_dpr_addr_set() local
264 dcss_dpr_write(ch, luma_base_addr, DCSS_DPR_FRAME_1P_BASE_ADDR); in dcss_dpr_addr_set()
266 dcss_dpr_write(ch, chroma_base_addr, DCSS_DPR_FRAME_2P_BASE_ADDR); in dcss_dpr_addr_set()
268 ch->frame_ctrl &= ~PITCH_MASK; in dcss_dpr_addr_set()
269 ch->frame_ctrl |= (((u32)pitch << PITCH_POS) & PITCH_MASK); in dcss_dpr_addr_set()
272 static void dcss_dpr_argb_comp_sel(struct dcss_dpr_ch *ch, int a_sel, int r_sel, in dcss_dpr_argb_comp_sel() argument
282 ch->mode_ctrl &= ~(A_COMP_SEL_MASK | R_COMP_SEL_MASK | in dcss_dpr_argb_comp_sel()
284 ch->mode_ctrl |= sel; in dcss_dpr_argb_comp_sel()
287 static void dcss_dpr_pix_size_set(struct dcss_dpr_ch *ch, in dcss_dpr_pix_size_set() argument
310 ch->pix_size = val; in dcss_dpr_pix_size_set()
312 ch->mode_ctrl &= ~PIX_SIZE_MASK; in dcss_dpr_pix_size_set()
313 ch->mode_ctrl |= ((val << PIX_SIZE_POS) & PIX_SIZE_MASK); in dcss_dpr_pix_size_set()
316 static void dcss_dpr_uv_swap(struct dcss_dpr_ch *ch, bool swap) in dcss_dpr_uv_swap() argument
318 ch->mode_ctrl &= ~PIX_UV_SWAP; in dcss_dpr_uv_swap()
319 ch->mode_ctrl |= (swap ? PIX_UV_SWAP : 0); in dcss_dpr_uv_swap()
322 static void dcss_dpr_y_uv_swap(struct dcss_dpr_ch *ch, bool swap) in dcss_dpr_y_uv_swap() argument
324 ch->mode_ctrl &= ~PIX_LUMA_UV_SWAP; in dcss_dpr_y_uv_swap()
325 ch->mode_ctrl |= (swap ? PIX_LUMA_UV_SWAP : 0); in dcss_dpr_y_uv_swap()
328 static void dcss_dpr_2plane_en(struct dcss_dpr_ch *ch, bool en) in dcss_dpr_2plane_en() argument
330 ch->mode_ctrl &= ~COMP_2PLANE_EN; in dcss_dpr_2plane_en()
331 ch->mode_ctrl |= (en ? COMP_2PLANE_EN : 0); in dcss_dpr_2plane_en()
334 static void dcss_dpr_yuv_en(struct dcss_dpr_ch *ch, bool en) in dcss_dpr_yuv_en() argument
336 ch->mode_ctrl &= ~YUV_EN; in dcss_dpr_yuv_en()
337 ch->mode_ctrl |= (en ? YUV_EN : 0); in dcss_dpr_yuv_en()
342 struct dcss_dpr_ch *ch = &dpr->ch[ch_num]; in dcss_dpr_enable() local
348 dcss_dpr_write(ch, ch->mode_ctrl, DCSS_DPR_MODE_CTRL0); in dcss_dpr_enable()
349 dcss_dpr_write(ch, ch->frame_ctrl, DCSS_DPR_FRAME_CTRL0); in dcss_dpr_enable()
350 dcss_dpr_write(ch, ch->rtram_ctrl, DCSS_DPR_RTRAM_CTRL0); in dcss_dpr_enable()
353 if (ch->sys_ctrl != sys_ctrl) in dcss_dpr_enable()
354 ch->sys_ctrl_chgd = true; in dcss_dpr_enable()
356 ch->sys_ctrl = sys_ctrl; in dcss_dpr_enable()
397 static void dcss_dpr_rtram_set(struct dcss_dpr_ch *ch, u32 pix_format) in dcss_dpr_rtram_set() argument
404 ch->rtram_3buf_en = true; in dcss_dpr_rtram_set()
405 ch->rtram_4line_en = false; in dcss_dpr_rtram_set()
409 ch->rtram_3buf_en = true; in dcss_dpr_rtram_set()
410 ch->rtram_4line_en = true; in dcss_dpr_rtram_set()
414 val = (ch->rtram_4line_en ? RTR_4LINE_BUF_EN : 0); in dcss_dpr_rtram_set()
415 val |= (ch->rtram_3buf_en ? RTR_3BUF_EN : 0); in dcss_dpr_rtram_set()
418 ch->mode_ctrl &= ~mask; in dcss_dpr_rtram_set()
419 ch->mode_ctrl |= (val & mask); in dcss_dpr_rtram_set()
421 val = (ch->rtram_4line_en ? 0 : NUM_ROWS_ACTIVE); in dcss_dpr_rtram_set()
426 ch->rtram_ctrl &= ~mask; in dcss_dpr_rtram_set()
427 ch->rtram_ctrl |= (val & mask); in dcss_dpr_rtram_set()
430 static void dcss_dpr_setup_components(struct dcss_dpr_ch *ch, in dcss_dpr_setup_components() argument
459 dcss_dpr_uv_swap(ch, uv_swap); in dcss_dpr_setup_components()
461 dcss_dpr_y_uv_swap(ch, y_uv_swap); in dcss_dpr_setup_components()
466 dcss_dpr_argb_comp_sel(ch, a_sel, r_sel, g_sel, b_sel); in dcss_dpr_setup_components()
468 dcss_dpr_argb_comp_sel(ch, 3, 2, 1, 0); in dcss_dpr_setup_components()
471 dcss_dpr_argb_comp_sel(ch, 0, 0, 0, 0); in dcss_dpr_setup_components()
475 static void dcss_dpr_tile_set(struct dcss_dpr_ch *ch, uint64_t modifier) in dcss_dpr_tile_set() argument
477 switch (ch->ch_num) { in dcss_dpr_tile_set()
481 ch->tile = TILE_LINEAR; in dcss_dpr_tile_set()
484 ch->tile = TILE_GPU_STANDARD; in dcss_dpr_tile_set()
487 ch->tile = TILE_GPU_SUPER; in dcss_dpr_tile_set()
496 ch->tile = TILE_LINEAR; in dcss_dpr_tile_set()
503 ch->mode_ctrl &= ~TILE_TYPE_MASK; in dcss_dpr_tile_set()
504 ch->mode_ctrl |= ((ch->tile << TILE_TYPE_POS) & TILE_TYPE_MASK); in dcss_dpr_tile_set()
510 struct dcss_dpr_ch *ch = &dpr->ch[ch_num]; in dcss_dpr_format_set() local
512 ch->format = *format; in dcss_dpr_format_set()
514 dcss_dpr_yuv_en(ch, format->is_yuv); in dcss_dpr_format_set()
516 dcss_dpr_pix_size_set(ch, format); in dcss_dpr_format_set()
518 dcss_dpr_setup_components(ch, format); in dcss_dpr_format_set()
520 dcss_dpr_2plane_en(ch, format->num_planes == 2); in dcss_dpr_format_set()
522 dcss_dpr_rtram_set(ch, format->format); in dcss_dpr_format_set()
524 dcss_dpr_tile_set(ch, modifier); in dcss_dpr_format_set()
535 struct dcss_dpr_ch *ch = &dpr->ch[chnum]; in dcss_dpr_write_sysctrl() local
537 if (ch->sys_ctrl_chgd) { in dcss_dpr_write_sysctrl()
539 ch->sys_ctrl, in dcss_dpr_write_sysctrl()
540 ch->base_ofs + in dcss_dpr_write_sysctrl()
542 ch->sys_ctrl_chgd = false; in dcss_dpr_write_sysctrl()
549 struct dcss_dpr_ch *ch = &dpr->ch[ch_num]; in dcss_dpr_set_rotation() local
551 ch->frame_ctrl &= ~(HFLIP_EN | VFLIP_EN | ROT_ENC_MASK); in dcss_dpr_set_rotation()
553 ch->frame_ctrl |= rotation & DRM_MODE_REFLECT_X ? HFLIP_EN : 0; in dcss_dpr_set_rotation()
554 ch->frame_ctrl |= rotation & DRM_MODE_REFLECT_Y ? VFLIP_EN : 0; in dcss_dpr_set_rotation()
557 ch->frame_ctrl |= 1 << ROT_ENC_POS; in dcss_dpr_set_rotation()
559 ch->frame_ctrl |= 2 << ROT_ENC_POS; in dcss_dpr_set_rotation()
561 ch->frame_ctrl |= 3 << ROT_ENC_POS; in dcss_dpr_set_rotation()