Lines Matching full:pipe
16 static inline u32 mxc_isi_read(struct mxc_isi_pipe *pipe, u32 reg) in mxc_isi_read() argument
18 return readl(pipe->regs + reg); in mxc_isi_read()
21 static inline void mxc_isi_write(struct mxc_isi_pipe *pipe, u32 reg, u32 val) in mxc_isi_write() argument
23 writel(val, pipe->regs + reg); in mxc_isi_write()
30 void mxc_isi_channel_set_inbuf(struct mxc_isi_pipe *pipe, dma_addr_t dma_addr) in mxc_isi_channel_set_inbuf() argument
32 mxc_isi_write(pipe, CHNL_IN_BUF_ADDR, lower_32_bits(dma_addr)); in mxc_isi_channel_set_inbuf()
33 if (pipe->isi->pdata->has_36bit_dma) in mxc_isi_channel_set_inbuf()
34 mxc_isi_write(pipe, CHNL_IN_BUF_XTND_ADDR, in mxc_isi_channel_set_inbuf()
38 void mxc_isi_channel_set_outbuf(struct mxc_isi_pipe *pipe, in mxc_isi_channel_set_outbuf() argument
44 val = mxc_isi_read(pipe, CHNL_OUT_BUF_CTRL); in mxc_isi_channel_set_outbuf()
47 mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_Y, in mxc_isi_channel_set_outbuf()
49 mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_U, in mxc_isi_channel_set_outbuf()
51 mxc_isi_write(pipe, CHNL_OUT_BUF1_ADDR_V, in mxc_isi_channel_set_outbuf()
53 if (pipe->isi->pdata->has_36bit_dma) { in mxc_isi_channel_set_outbuf()
54 mxc_isi_write(pipe, CHNL_Y_BUF1_XTND_ADDR, in mxc_isi_channel_set_outbuf()
56 mxc_isi_write(pipe, CHNL_U_BUF1_XTND_ADDR, in mxc_isi_channel_set_outbuf()
58 mxc_isi_write(pipe, CHNL_V_BUF1_XTND_ADDR, in mxc_isi_channel_set_outbuf()
63 mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_Y, in mxc_isi_channel_set_outbuf()
65 mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_U, in mxc_isi_channel_set_outbuf()
67 mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_V, in mxc_isi_channel_set_outbuf()
69 if (pipe->isi->pdata->has_36bit_dma) { in mxc_isi_channel_set_outbuf()
70 mxc_isi_write(pipe, CHNL_Y_BUF2_XTND_ADDR, in mxc_isi_channel_set_outbuf()
72 mxc_isi_write(pipe, CHNL_U_BUF2_XTND_ADDR, in mxc_isi_channel_set_outbuf()
74 mxc_isi_write(pipe, CHNL_V_BUF2_XTND_ADDR, in mxc_isi_channel_set_outbuf()
80 mxc_isi_write(pipe, CHNL_OUT_BUF_CTRL, val); in mxc_isi_channel_set_outbuf()
83 void mxc_isi_channel_m2m_start(struct mxc_isi_pipe *pipe) in mxc_isi_channel_m2m_start() argument
87 val = mxc_isi_read(pipe, CHNL_MEM_RD_CTRL); in mxc_isi_channel_m2m_start()
89 mxc_isi_write(pipe, CHNL_MEM_RD_CTRL, val); in mxc_isi_channel_m2m_start()
94 mxc_isi_write(pipe, CHNL_MEM_RD_CTRL, val); in mxc_isi_channel_m2m_start()
118 static void mxc_isi_channel_set_scaling(struct mxc_isi_pipe *pipe, 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()
137 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_scaling()
153 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_scaling()
155 mxc_isi_write(pipe, CHNL_SCALE_FACTOR, in mxc_isi_channel_set_scaling()
159 mxc_isi_write(pipe, CHNL_SCALE_OFFSET, 0); in mxc_isi_channel_set_scaling()
161 mxc_isi_write(pipe, CHNL_SCL_IMG_CFG, in mxc_isi_channel_set_scaling()
169 static void mxc_isi_channel_set_crop(struct mxc_isi_pipe *pipe, in mxc_isi_channel_set_crop() argument
175 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_crop()
179 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_crop()
187 mxc_isi_write(pipe, CHNL_CROP_ULC, val0); in mxc_isi_channel_set_crop()
188 mxc_isi_write(pipe, CHNL_CROP_LRC, val1 + val0); in mxc_isi_channel_set_crop()
189 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_crop()
208 static void mxc_isi_channel_set_csc(struct mxc_isi_pipe *pipe, in mxc_isi_channel_set_csc() argument
222 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_csc()
242 dev_dbg(pipe->isi->dev, "CSC: %s -> %s\n", in mxc_isi_channel_set_csc()
246 mxc_isi_write(pipe, CHNL_CSC_COEFF0, coeffs[0]); in mxc_isi_channel_set_csc()
247 mxc_isi_write(pipe, CHNL_CSC_COEFF1, coeffs[1]); in mxc_isi_channel_set_csc()
248 mxc_isi_write(pipe, CHNL_CSC_COEFF2, coeffs[2]); in mxc_isi_channel_set_csc()
249 mxc_isi_write(pipe, CHNL_CSC_COEFF3, coeffs[3]); in mxc_isi_channel_set_csc()
250 mxc_isi_write(pipe, CHNL_CSC_COEFF4, coeffs[4]); in mxc_isi_channel_set_csc()
251 mxc_isi_write(pipe, CHNL_CSC_COEFF5, coeffs[5]); in mxc_isi_channel_set_csc()
254 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_csc()
259 void mxc_isi_channel_set_alpha(struct mxc_isi_pipe *pipe, u8 alpha) in mxc_isi_channel_set_alpha() argument
263 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_alpha()
267 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_alpha()
270 void mxc_isi_channel_set_flip(struct mxc_isi_pipe *pipe, bool hflip, bool vflip) in mxc_isi_channel_set_flip() argument
274 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_flip()
282 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_flip()
285 static void mxc_isi_channel_set_panic_threshold(struct mxc_isi_pipe *pipe) in mxc_isi_channel_set_panic_threshold() argument
287 const struct mxc_isi_set_thd *set_thd = pipe->isi->pdata->set_thd; in mxc_isi_channel_set_panic_threshold()
290 val = mxc_isi_read(pipe, CHNL_OUT_BUF_CTRL); in mxc_isi_channel_set_panic_threshold()
301 mxc_isi_write(pipe, CHNL_OUT_BUF_CTRL, val); in mxc_isi_channel_set_panic_threshold()
304 static void mxc_isi_channel_set_control(struct mxc_isi_pipe *pipe, in mxc_isi_channel_set_control() argument
310 mutex_lock(&pipe->lock); in mxc_isi_channel_set_control()
312 val = mxc_isi_read(pipe, CHNL_CTRL); in mxc_isi_channel_set_control()
325 if (pipe->chained) in mxc_isi_channel_set_control()
341 val |= CHNL_CTRL_SRC_INPUT(pipe->isi->pdata->num_ports); in mxc_isi_channel_set_control()
348 mxc_isi_write(pipe, CHNL_CTRL, val); in mxc_isi_channel_set_control()
350 mutex_unlock(&pipe->lock); in mxc_isi_channel_set_control()
353 void mxc_isi_channel_config(struct mxc_isi_pipe *pipe, in mxc_isi_channel_config() argument
365 mxc_isi_write(pipe, CHNL_IMG_CFG, in mxc_isi_channel_config()
370 mxc_isi_channel_set_scaling(pipe, in_encoding, in_size, scale, in mxc_isi_channel_config()
372 mxc_isi_channel_set_crop(pipe, scale, crop); in mxc_isi_channel_config()
375 mxc_isi_channel_set_csc(pipe, in_encoding, out_encoding, &csc_bypass); in mxc_isi_channel_config()
378 mxc_isi_channel_set_panic_threshold(pipe); in mxc_isi_channel_config()
381 mxc_isi_channel_set_control(pipe, input, csc_bypass && scaler_bypass); in mxc_isi_channel_config()
384 void mxc_isi_channel_set_input_format(struct mxc_isi_pipe *pipe, in mxc_isi_channel_set_input_format() argument
390 mxc_isi_write(pipe, CHNL_MEM_RD_CTRL, in mxc_isi_channel_set_input_format()
392 mxc_isi_write(pipe, CHNL_IN_BUF_PITCH, in mxc_isi_channel_set_input_format()
396 void mxc_isi_channel_set_output_format(struct mxc_isi_pipe *pipe, in mxc_isi_channel_set_output_format() argument
403 dev_dbg(pipe->isi->dev, "output format %p4cc", &format->pixelformat); in mxc_isi_channel_set_output_format()
405 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_output_format()
408 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_output_format()
411 mxc_isi_write(pipe, CHNL_OUT_BUF_PITCH, in mxc_isi_channel_set_output_format()
419 u32 mxc_isi_channel_irq_status(struct mxc_isi_pipe *pipe, bool clear) in mxc_isi_channel_irq_status() argument
423 status = mxc_isi_read(pipe, CHNL_STS); in mxc_isi_channel_irq_status()
425 mxc_isi_write(pipe, CHNL_STS, status); in mxc_isi_channel_irq_status()
430 void mxc_isi_channel_irq_clear(struct mxc_isi_pipe *pipe) in mxc_isi_channel_irq_clear() argument
432 mxc_isi_write(pipe, CHNL_STS, 0xffffffff); in mxc_isi_channel_irq_clear()
435 static void mxc_isi_channel_irq_enable(struct mxc_isi_pipe *pipe) in mxc_isi_channel_irq_enable() argument
437 const struct mxc_isi_ier_reg *ier_reg = pipe->isi->pdata->ier_reg; in mxc_isi_channel_irq_enable()
460 mxc_isi_channel_irq_clear(pipe); in mxc_isi_channel_irq_enable()
461 mxc_isi_write(pipe, CHNL_IER, val); in mxc_isi_channel_irq_enable()
464 static void mxc_isi_channel_irq_disable(struct mxc_isi_pipe *pipe) in mxc_isi_channel_irq_disable() argument
466 mxc_isi_write(pipe, CHNL_IER, 0); in mxc_isi_channel_irq_disable()
473 static void mxc_isi_channel_sw_reset(struct mxc_isi_pipe *pipe, bool enable_clk) in mxc_isi_channel_sw_reset() argument
475 mxc_isi_write(pipe, CHNL_CTRL, CHNL_CTRL_SW_RST); in mxc_isi_channel_sw_reset()
477 mxc_isi_write(pipe, CHNL_CTRL, enable_clk ? CHNL_CTRL_CLK_EN : 0); in mxc_isi_channel_sw_reset()
480 static void __mxc_isi_channel_get(struct mxc_isi_pipe *pipe) in __mxc_isi_channel_get() argument
482 if (!pipe->use_count++) in __mxc_isi_channel_get()
483 mxc_isi_channel_sw_reset(pipe, true); in __mxc_isi_channel_get()
486 void mxc_isi_channel_get(struct mxc_isi_pipe *pipe) in mxc_isi_channel_get() argument
488 mutex_lock(&pipe->lock); in mxc_isi_channel_get()
489 __mxc_isi_channel_get(pipe); in mxc_isi_channel_get()
490 mutex_unlock(&pipe->lock); in mxc_isi_channel_get()
493 static void __mxc_isi_channel_put(struct mxc_isi_pipe *pipe) in __mxc_isi_channel_put() argument
495 if (!--pipe->use_count) in __mxc_isi_channel_put()
496 mxc_isi_channel_sw_reset(pipe, false); in __mxc_isi_channel_put()
499 void mxc_isi_channel_put(struct mxc_isi_pipe *pipe) in mxc_isi_channel_put() argument
501 mutex_lock(&pipe->lock); in mxc_isi_channel_put()
502 __mxc_isi_channel_put(pipe); in mxc_isi_channel_put()
503 mutex_unlock(&pipe->lock); in mxc_isi_channel_put()
506 void mxc_isi_channel_enable(struct mxc_isi_pipe *pipe) in mxc_isi_channel_enable() argument
510 mxc_isi_channel_irq_enable(pipe); in mxc_isi_channel_enable()
512 mutex_lock(&pipe->lock); in mxc_isi_channel_enable()
514 val = mxc_isi_read(pipe, CHNL_CTRL); in mxc_isi_channel_enable()
516 mxc_isi_write(pipe, CHNL_CTRL, val); in mxc_isi_channel_enable()
518 mutex_unlock(&pipe->lock); in mxc_isi_channel_enable()
521 void mxc_isi_channel_disable(struct mxc_isi_pipe *pipe) in mxc_isi_channel_disable() argument
525 mxc_isi_channel_irq_disable(pipe); in mxc_isi_channel_disable()
527 mutex_lock(&pipe->lock); in mxc_isi_channel_disable()
529 val = mxc_isi_read(pipe, CHNL_CTRL); in mxc_isi_channel_disable()
531 mxc_isi_write(pipe, CHNL_CTRL, val); in mxc_isi_channel_disable()
533 mutex_unlock(&pipe->lock); in mxc_isi_channel_disable()
539 int mxc_isi_channel_acquire(struct mxc_isi_pipe *pipe, in mxc_isi_channel_acquire() argument
545 mutex_lock(&pipe->lock); in mxc_isi_channel_acquire()
547 if (pipe->irq_handler) { in mxc_isi_channel_acquire()
559 if ((pipe->available_res & resources) != resources) { in mxc_isi_channel_acquire()
565 pipe->acquired_res = resources; in mxc_isi_channel_acquire()
566 pipe->available_res &= ~resources; in mxc_isi_channel_acquire()
567 pipe->irq_handler = irq_handler; in mxc_isi_channel_acquire()
570 mutex_unlock(&pipe->lock); in mxc_isi_channel_acquire()
575 void mxc_isi_channel_release(struct mxc_isi_pipe *pipe) in mxc_isi_channel_release() argument
577 mutex_lock(&pipe->lock); in mxc_isi_channel_release()
579 pipe->irq_handler = NULL; in mxc_isi_channel_release()
580 pipe->available_res |= pipe->acquired_res; in mxc_isi_channel_release()
581 pipe->acquired_res = 0; in mxc_isi_channel_release()
583 mutex_unlock(&pipe->lock); in mxc_isi_channel_release()
592 int mxc_isi_channel_chain(struct mxc_isi_pipe *pipe, bool bypass) in mxc_isi_channel_chain() argument
597 struct mxc_isi_pipe *chained_pipe = pipe + 1; in mxc_isi_channel_chain()
606 if (WARN_ON(pipe->id == pipe->isi->pdata->num_channels - 1)) in mxc_isi_channel_chain()
612 if (WARN_ON(pipe->chained || chained_pipe->chained_res)) { in mxc_isi_channel_chain()
622 pipe->chained = true; in mxc_isi_channel_chain()
634 void mxc_isi_channel_unchain(struct mxc_isi_pipe *pipe) in mxc_isi_channel_unchain() argument
636 struct mxc_isi_pipe *chained_pipe = pipe + 1; in mxc_isi_channel_unchain()
638 if (!pipe->chained) in mxc_isi_channel_unchain()
641 pipe->chained = false; in mxc_isi_channel_unchain()