Lines Matching +full:bypass +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright 2019-2020 NXP
11 #include "imx8-isi-core.h"
12 #include "imx8-isi-regs.h"
18 return readl(pipe->regs + reg); in mxc_isi_read()
23 writel(val, pipe->regs + reg); in mxc_isi_write()
26 /* -----------------------------------------------------------------------------
33 if (pipe->isi->pdata->has_36bit_dma) in mxc_isi_channel_set_inbuf()
53 if (pipe->isi->pdata->has_36bit_dma) { in mxc_isi_channel_set_outbuf()
69 if (pipe->isi->pdata->has_36bit_dma) { in mxc_isi_channel_set_outbuf()
97 /* -----------------------------------------------------------------------------
122 bool *bypass) in mxc_isi_channel_set_scaling() argument
128 dev_dbg(pipe->isi->dev, "input %ux%u, output %ux%u\n", in mxc_isi_channel_set_scaling()
129 in_size->width, in_size->height, in mxc_isi_channel_set_scaling()
130 out_size->width, out_size->height); in mxc_isi_channel_set_scaling()
132 xscale = mxc_isi_channel_scaling_ratio(in_size->width, out_size->width, in mxc_isi_channel_set_scaling()
134 yscale = mxc_isi_channel_scaling_ratio(in_size->height, out_size->height, in mxc_isi_channel_set_scaling()
162 CHNL_SCL_IMG_CFG_HEIGHT(out_size->height) | in mxc_isi_channel_set_scaling()
163 CHNL_SCL_IMG_CFG_WIDTH(out_size->width)); in mxc_isi_channel_set_scaling()
165 *bypass = in_size->height == out_size->height && in mxc_isi_channel_set_scaling()
166 in_size->width == out_size->width; in mxc_isi_channel_set_scaling()
178 if (src->height == dst->height && src->width == dst->width) { in mxc_isi_channel_set_crop()
184 val0 = CHNL_CROP_ULC_X(dst->left) | CHNL_CROP_ULC_Y(dst->top); in mxc_isi_channel_set_crop()
185 val1 = CHNL_CROP_LRC_X(dst->width) | CHNL_CROP_LRC_Y(dst->height); in mxc_isi_channel_set_crop()
197 /* YUV -> RGB */
203 /* RGB->YUV */
211 bool *bypass) in mxc_isi_channel_set_csc() argument
228 /* YCbCr enable??? */ in mxc_isi_channel_set_csc()
236 /* Bypass CSC */ in mxc_isi_channel_set_csc()
240 dev_dbg(pipe->isi->dev, "CSC: %s -> %s\n", in mxc_isi_channel_set_csc()
254 *bypass = !coeffs; in mxc_isi_channel_set_csc()
285 const struct mxc_isi_set_thd *set_thd = pipe->isi->pdata->set_thd; in mxc_isi_channel_set_panic_threshold()
290 val &= ~(set_thd->panic_set_thd_y.mask); in mxc_isi_channel_set_panic_threshold()
291 val |= set_thd->panic_set_thd_y.threshold << set_thd->panic_set_thd_y.offset; in mxc_isi_channel_set_panic_threshold()
293 val &= ~(set_thd->panic_set_thd_u.mask); in mxc_isi_channel_set_panic_threshold()
294 val |= set_thd->panic_set_thd_u.threshold << set_thd->panic_set_thd_u.offset; in mxc_isi_channel_set_panic_threshold()
296 val &= ~(set_thd->panic_set_thd_v.mask); in mxc_isi_channel_set_panic_threshold()
297 val |= set_thd->panic_set_thd_v.threshold << set_thd->panic_set_thd_v.offset; in mxc_isi_channel_set_panic_threshold()
304 bool bypass) in mxc_isi_channel_set_control() argument
308 mutex_lock(&pipe->lock); in mxc_isi_channel_set_control()
316 * If no scaling or color space conversion is needed, bypass the in mxc_isi_channel_set_control()
319 if (bypass) in mxc_isi_channel_set_control()
323 if (pipe->chained) in mxc_isi_channel_set_control()
328 /* Input source (including VC configuration for CSI-2) */ in mxc_isi_channel_set_control()
339 val |= CHNL_CTRL_SRC_INPUT(pipe->isi->pdata->num_ports); in mxc_isi_channel_set_control()
343 val |= CHNL_CTRL_MIPI_VC_ID(0); /* FIXME: For CSI-2 only */ in mxc_isi_channel_set_control()
348 mutex_unlock(&pipe->lock); in mxc_isi_channel_set_control()
364 CHNL_IMG_CFG_HEIGHT(in_size->height) | in mxc_isi_channel_config()
365 CHNL_IMG_CFG_WIDTH(in_size->width)); in mxc_isi_channel_config()
386 unsigned int bpl = format->plane_fmt[0].bytesperline; in mxc_isi_channel_set_input_format()
389 CHNL_MEM_RD_CTRL_IMG_TYPE(info->isi_in_format)); in mxc_isi_channel_set_input_format()
401 dev_dbg(pipe->isi->dev, "output format %p4cc", &format->pixelformat); in mxc_isi_channel_set_output_format()
405 val |= CHNL_IMG_CTRL_FORMAT(info->isi_out_format); in mxc_isi_channel_set_output_format()
410 format->plane_fmt[0].bytesperline); in mxc_isi_channel_set_output_format()
413 /* -----------------------------------------------------------------------------
435 const struct mxc_isi_ier_reg *ier_reg = pipe->isi->pdata->ier_reg; in mxc_isi_channel_irq_enable()
443 /* Y/U/V overflow enable */ in mxc_isi_channel_irq_enable()
444 val |= ier_reg->oflw_y_buf_en.mask | in mxc_isi_channel_irq_enable()
445 ier_reg->oflw_u_buf_en.mask | in mxc_isi_channel_irq_enable()
446 ier_reg->oflw_v_buf_en.mask; in mxc_isi_channel_irq_enable()
448 /* Y/U/V excess overflow enable */ in mxc_isi_channel_irq_enable()
449 val |= ier_reg->excs_oflw_y_buf_en.mask | in mxc_isi_channel_irq_enable()
450 ier_reg->excs_oflw_u_buf_en.mask | in mxc_isi_channel_irq_enable()
451 ier_reg->excs_oflw_v_buf_en.mask; in mxc_isi_channel_irq_enable()
453 /* Y/U/V panic enable */ in mxc_isi_channel_irq_enable()
454 val |= ier_reg->panic_y_buf_en.mask | in mxc_isi_channel_irq_enable()
455 ier_reg->panic_u_buf_en.mask | in mxc_isi_channel_irq_enable()
456 ier_reg->panic_v_buf_en.mask; in mxc_isi_channel_irq_enable()
467 /* -----------------------------------------------------------------------------
468 * Init, deinit, enable, disable
480 if (!pipe->use_count++) in __mxc_isi_channel_get()
486 mutex_lock(&pipe->lock); in mxc_isi_channel_get()
488 mutex_unlock(&pipe->lock); in mxc_isi_channel_get()
493 if (!--pipe->use_count) in __mxc_isi_channel_put()
499 mutex_lock(&pipe->lock); in mxc_isi_channel_put()
501 mutex_unlock(&pipe->lock); in mxc_isi_channel_put()
510 mutex_lock(&pipe->lock); in mxc_isi_channel_enable()
516 mutex_unlock(&pipe->lock); in mxc_isi_channel_enable()
525 mutex_lock(&pipe->lock); in mxc_isi_channel_disable()
531 mutex_unlock(&pipe->lock); in mxc_isi_channel_disable()
534 /* -----------------------------------------------------------------------------
538 mxc_isi_pipe_irq_t irq_handler, bool bypass) in mxc_isi_channel_acquire() argument
543 mutex_lock(&pipe->lock); in mxc_isi_channel_acquire()
545 if (pipe->irq_handler) { in mxc_isi_channel_acquire()
546 ret = -EBUSY; in mxc_isi_channel_acquire()
553 * when the channel isn't in bypass mode. in mxc_isi_channel_acquire()
556 | (!bypass ? MXC_ISI_CHANNEL_RES_LINE_BUF : 0); in mxc_isi_channel_acquire()
557 if ((pipe->available_res & resources) != resources) { in mxc_isi_channel_acquire()
558 ret = -EBUSY; in mxc_isi_channel_acquire()
563 pipe->acquired_res = resources; in mxc_isi_channel_acquire()
564 pipe->available_res &= ~resources; in mxc_isi_channel_acquire()
565 pipe->irq_handler = irq_handler; in mxc_isi_channel_acquire()
568 mutex_unlock(&pipe->lock); in mxc_isi_channel_acquire()
575 mutex_lock(&pipe->lock); in mxc_isi_channel_release()
577 pipe->irq_handler = NULL; in mxc_isi_channel_release()
578 pipe->available_res |= pipe->acquired_res; in mxc_isi_channel_release()
579 pipe->acquired_res = 0; in mxc_isi_channel_release()
581 mutex_unlock(&pipe->lock); in mxc_isi_channel_release()
590 int mxc_isi_channel_chain(struct mxc_isi_pipe *pipe, bool bypass) in mxc_isi_channel_chain() argument
604 if (WARN_ON(pipe->id == pipe->isi->pdata->num_channels - 1)) in mxc_isi_channel_chain()
605 return -EINVAL; in mxc_isi_channel_chain()
607 mutex_lock(&chained_pipe->lock); in mxc_isi_channel_chain()
610 if (WARN_ON(pipe->chained || chained_pipe->chained_res)) { in mxc_isi_channel_chain()
611 ret = -EINVAL; in mxc_isi_channel_chain()
615 if ((chained_pipe->available_res & resources) != resources) { in mxc_isi_channel_chain()
616 ret = -EBUSY; in mxc_isi_channel_chain()
620 pipe->chained = true; in mxc_isi_channel_chain()
621 chained_pipe->chained_res |= resources; in mxc_isi_channel_chain()
622 chained_pipe->available_res &= ~resources; in mxc_isi_channel_chain()
627 mutex_unlock(&chained_pipe->lock); in mxc_isi_channel_chain()
636 if (!pipe->chained) in mxc_isi_channel_unchain()
639 pipe->chained = false; in mxc_isi_channel_unchain()
641 mutex_lock(&chained_pipe->lock); in mxc_isi_channel_unchain()
643 chained_pipe->available_res |= chained_pipe->chained_res; in mxc_isi_channel_unchain()
644 chained_pipe->chained_res = 0; in mxc_isi_channel_unchain()
648 mutex_unlock(&chained_pipe->lock); in mxc_isi_channel_unchain()