Lines Matching refs:ch

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