Lines Matching +full:long +full:- +full:term
1 // SPDX-License-Identifier: GPL-2.0
11 #include "dcss-dev.h"
101 #define PSC_PHASE_MASK (PSC_NUM_PHASES - 1)
103 #define PSC_Q_ROUND_OFFSET (1 << (PSC_Q_FRACTION - 1))
106 * mult_q() - Performs fixed-point multiplication.
122 * div_q() - Performs fixed-point division.
135 temp -= B / 2; in div_q()
142 * exp_approx_q() - Compute approximation to exp(x) function using Taylor
144 * @x: fixed-point argument of exp function
149 int term = 1 << PSC_Q_FRACTION; in exp_approx_q() local
151 term = mult_q(term, div_q(x, 1 << PSC_Q_FRACTION)); in exp_approx_q()
152 sum += term; in exp_approx_q()
153 term = mult_q(term, div_q(x, 2 << PSC_Q_FRACTION)); in exp_approx_q()
154 sum += term; in exp_approx_q()
155 term = mult_q(term, div_q(x, 3 << PSC_Q_FRACTION)); in exp_approx_q()
156 sum += term; in exp_approx_q()
157 term = mult_q(term, div_q(x, 4 << PSC_Q_FRACTION)); in exp_approx_q()
158 sum += term; in exp_approx_q()
164 * dcss_scaler_gaussian_filter() - Generate gaussian prototype filter.
165 * @fc_q: fixed-point cutoff frequency normalized to range [0, 1]
183 coef[phase][PSC_NUM_TAPS - 1] = 0; in dcss_scaler_gaussian_filter()
188 mid = (PSC_NUM_PHASES * taps) / 2 - 1; in dcss_scaler_gaussian_filter()
196 g1_q = exp_approx_q(div_q(-PSC_Q_ROUND_OFFSET, in dcss_scaler_gaussian_filter()
203 tap_cnt1--; in dcss_scaler_gaussian_filter()
213 if (((-phase_cnt) & PSC_PHASE_MASK) <= 8) { in dcss_scaler_gaussian_filter()
215 coef[(-phase_cnt) & PSC_PHASE_MASK][tap_idx] = g0_q; in dcss_scaler_gaussian_filter()
220 tap_cnt1--; in dcss_scaler_gaussian_filter()
247 * dcss_scaler_filter_design() - Compute filter coefficients using
272 struct dcss_scaler *scl = ch->scl; in dcss_scaler_write()
274 dcss_ctxld_write(scl->ctxld, scl->ctx_id, val, ch->base_ofs + ofs); in dcss_scaler_write()
278 unsigned long scaler_base) in dcss_scaler_ch_init_all()
284 ch = &scl->ch[i]; in dcss_scaler_ch_init_all()
286 ch->base_ofs = scaler_base + i * 0x400; in dcss_scaler_ch_init_all()
288 ch->base_reg = ioremap(ch->base_ofs, SZ_4K); in dcss_scaler_ch_init_all()
289 if (!ch->base_reg) { in dcss_scaler_ch_init_all()
290 dev_err(scl->dev, "scaler: unable to remap ch base\n"); in dcss_scaler_ch_init_all()
291 return -ENOMEM; in dcss_scaler_ch_init_all()
294 ch->scl = scl; in dcss_scaler_ch_init_all()
300 int dcss_scaler_init(struct dcss_dev *dcss, unsigned long scaler_base) in dcss_scaler_init()
306 return -ENOMEM; in dcss_scaler_init()
308 dcss->scaler = scaler; in dcss_scaler_init()
309 scaler->dev = dcss->dev; in dcss_scaler_init()
310 scaler->ctxld = dcss->ctxld; in dcss_scaler_init()
311 scaler->ctx_id = CTX_SB_HP; in dcss_scaler_init()
317 if (scaler->ch[i].base_reg) in dcss_scaler_init()
318 iounmap(scaler->ch[i].base_reg); in dcss_scaler_init()
323 return -ENOMEM; in dcss_scaler_init()
334 struct dcss_scaler_ch *ch = &scl->ch[ch_no]; in dcss_scaler_exit()
336 dcss_writel(0, ch->base_reg + DCSS_SCALER_CTRL); in dcss_scaler_exit()
338 if (ch->base_reg) in dcss_scaler_exit()
339 iounmap(ch->base_reg); in dcss_scaler_exit()
347 struct dcss_scaler_ch *ch = &scl->ch[ch_num]; in dcss_scaler_ch_enable()
353 dcss_scaler_write(ch, ch->sdata_ctrl, DCSS_SCALER_SDATA_CTRL); in dcss_scaler_ch_enable()
355 if (ch->scaler_ctrl != scaler_ctrl) in dcss_scaler_ch_enable()
356 ch->scaler_ctrl_chgd = true; in dcss_scaler_ch_enable()
358 ch->scaler_ctrl = scaler_ctrl; in dcss_scaler_ch_enable()
363 ch->sdata_ctrl &= ~YUV_EN; in dcss_scaler_yuv_enable()
364 ch->sdata_ctrl |= en ? YUV_EN : 0; in dcss_scaler_yuv_enable()
369 ch->sdata_ctrl &= ~RTRAM_8LINES; in dcss_scaler_rtr_8lines_enable()
370 ch->sdata_ctrl |= en ? RTRAM_8LINES : 0; in dcss_scaler_rtr_8lines_enable()
442 lsrc_yres--; in dcss_scaler_res_set()
443 csrc_yres--; in dcss_scaler_res_set()
446 dcss_scaler_write(ch, (((lsrc_yres - 1) << HEIGHT_POS) & HEIGHT_MASK) | in dcss_scaler_res_set()
447 (((lsrc_xres - 1) << WIDTH_POS) & WIDTH_MASK), in dcss_scaler_res_set()
449 dcss_scaler_write(ch, (((csrc_yres - 1) << HEIGHT_POS) & HEIGHT_MASK) | in dcss_scaler_res_set()
450 (((csrc_xres - 1) << WIDTH_POS) & WIDTH_MASK), in dcss_scaler_res_set()
452 dcss_scaler_write(ch, (((ldst_yres - 1) << HEIGHT_POS) & HEIGHT_MASK) | in dcss_scaler_res_set()
453 (((ldst_xres - 1) << WIDTH_POS) & WIDTH_MASK), in dcss_scaler_res_set()
455 dcss_scaler_write(ch, (((cdst_yres - 1) << HEIGHT_POS) & HEIGHT_MASK) | in dcss_scaler_res_set()
456 (((cdst_xres - 1) << WIDTH_POS) & WIDTH_MASK), in dcss_scaler_res_set()
500 c_vstart -= (1 << (PSC_PHASE_FRACTION_BITS - 2)); in dcss_scaler_fractions_set()
508 c_vstart -= (1 << (PSC_PHASE_FRACTION_BITS - 1)); in dcss_scaler_fractions_set()
519 c_hstart -= (1 << (PSC_PHASE_FRACTION_BITS - 2)); in dcss_scaler_fractions_set()
543 ch->c_vstart = c_vstart; in dcss_scaler_fractions_set()
544 ch->c_hstart = c_hstart; in dcss_scaler_fractions_set()
588 for (phase = (PSC_NUM_PHASES >> 1) - 1; in dcss_scaler_program_5_coef_set()
589 i < PSC_NUM_PHASES; i++, phase--) { in dcss_scaler_program_5_coef_set()
625 for (phase = (PSC_NUM_PHASES >> 1) - 1; in dcss_scaler_program_7_coef_set()
626 i < PSC_NUM_PHASES; i++, phase--) { in dcss_scaler_program_7_coef_set()
680 (src_xres == dst_xres) && (ch->c_hstart == 0), in dcss_scaler_yuv_coef_set()
687 (src_yres == dst_yres) && (ch->c_vstart == 0), in dcss_scaler_yuv_coef_set()
717 if (format->is_yuv) in dcss_scaler_set_rgb10_order()
720 ch->sdata_ctrl &= ~A2R10G10B10_FORMAT_MASK; in dcss_scaler_set_rgb10_order()
722 if (format->depth != 30) in dcss_scaler_set_rgb10_order()
725 switch (format->format) { in dcss_scaler_set_rgb10_order()
751 ch->sdata_ctrl |= a2r10g10b10_format << A2R10G10B10_FORMAT_POS; in dcss_scaler_set_rgb10_order()
759 struct dcss_scaler_ch *ch = &scl->ch[ch_num]; in dcss_scaler_setup()
765 u32 pix_format = format->format; in dcss_scaler_setup()
767 if (format->is_yuv) { in dcss_scaler_setup()
785 pixel_depth = format->depth; in dcss_scaler_setup()
792 if (format->is_yuv) in dcss_scaler_setup()
813 dcss_ctxld_assert_locked(scl->ctxld); in dcss_scaler_write_sclctrl()
816 struct dcss_scaler_ch *ch = &scl->ch[chnum]; in dcss_scaler_write_sclctrl()
818 if (ch->scaler_ctrl_chgd) { in dcss_scaler_write_sclctrl()
819 dcss_ctxld_write_irqsafe(scl->ctxld, scl->ctx_id, in dcss_scaler_write_sclctrl()
820 ch->scaler_ctrl, in dcss_scaler_write_sclctrl()
821 ch->base_ofs + in dcss_scaler_write_sclctrl()
823 ch->scaler_ctrl_chgd = false; in dcss_scaler_write_sclctrl()