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
221 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_csc()
240 dev_dbg(pipe->isi->dev, "CSC: %s -> %s\n", in mxc_isi_channel_set_csc()
244 mxc_isi_write(pipe, CHNL_CSC_COEFF0, coeffs[0]); in mxc_isi_channel_set_csc()
245 mxc_isi_write(pipe, CHNL_CSC_COEFF1, coeffs[1]); in mxc_isi_channel_set_csc()
246 mxc_isi_write(pipe, CHNL_CSC_COEFF2, coeffs[2]); in mxc_isi_channel_set_csc()
247 mxc_isi_write(pipe, CHNL_CSC_COEFF3, coeffs[3]); in mxc_isi_channel_set_csc()
248 mxc_isi_write(pipe, CHNL_CSC_COEFF4, coeffs[4]); in mxc_isi_channel_set_csc()
249 mxc_isi_write(pipe, CHNL_CSC_COEFF5, coeffs[5]); in mxc_isi_channel_set_csc()
252 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_csc()
257 void mxc_isi_channel_set_alpha(struct mxc_isi_pipe *pipe, u8 alpha) in mxc_isi_channel_set_alpha() argument
261 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_alpha()
265 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_alpha()
268 void mxc_isi_channel_set_flip(struct mxc_isi_pipe *pipe, bool hflip, bool vflip) in mxc_isi_channel_set_flip() argument
272 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_flip()
280 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_flip()
283 static void mxc_isi_channel_set_panic_threshold(struct mxc_isi_pipe *pipe) in mxc_isi_channel_set_panic_threshold() argument
285 const struct mxc_isi_set_thd *set_thd = pipe->isi->pdata->set_thd; in mxc_isi_channel_set_panic_threshold()
288 val = mxc_isi_read(pipe, CHNL_OUT_BUF_CTRL); in mxc_isi_channel_set_panic_threshold()
299 mxc_isi_write(pipe, CHNL_OUT_BUF_CTRL, val); in mxc_isi_channel_set_panic_threshold()
302 static void mxc_isi_channel_set_control(struct mxc_isi_pipe *pipe, in mxc_isi_channel_set_control() argument
308 mutex_lock(&pipe->lock); in mxc_isi_channel_set_control()
310 val = mxc_isi_read(pipe, CHNL_CTRL); in mxc_isi_channel_set_control()
323 if (pipe->chained) in mxc_isi_channel_set_control()
339 val |= CHNL_CTRL_SRC_INPUT(pipe->isi->pdata->num_ports); in mxc_isi_channel_set_control()
346 mxc_isi_write(pipe, CHNL_CTRL, val); in mxc_isi_channel_set_control()
348 mutex_unlock(&pipe->lock); in mxc_isi_channel_set_control()
351 void mxc_isi_channel_config(struct mxc_isi_pipe *pipe, in mxc_isi_channel_config() argument
363 mxc_isi_write(pipe, CHNL_IMG_CFG, in mxc_isi_channel_config()
368 mxc_isi_channel_set_scaling(pipe, in_encoding, in_size, scale, in mxc_isi_channel_config()
370 mxc_isi_channel_set_crop(pipe, scale, crop); in mxc_isi_channel_config()
373 mxc_isi_channel_set_csc(pipe, in_encoding, out_encoding, &csc_bypass); in mxc_isi_channel_config()
376 mxc_isi_channel_set_panic_threshold(pipe); in mxc_isi_channel_config()
379 mxc_isi_channel_set_control(pipe, input, csc_bypass && scaler_bypass); in mxc_isi_channel_config()
382 void mxc_isi_channel_set_input_format(struct mxc_isi_pipe *pipe, in mxc_isi_channel_set_input_format() argument
388 mxc_isi_write(pipe, CHNL_MEM_RD_CTRL, in mxc_isi_channel_set_input_format()
390 mxc_isi_write(pipe, CHNL_IN_BUF_PITCH, in mxc_isi_channel_set_input_format()
394 void mxc_isi_channel_set_output_format(struct mxc_isi_pipe *pipe, in mxc_isi_channel_set_output_format() argument
401 dev_dbg(pipe->isi->dev, "output format %p4cc", &format->pixelformat); in mxc_isi_channel_set_output_format()
403 val = mxc_isi_read(pipe, CHNL_IMG_CTRL); in mxc_isi_channel_set_output_format()
406 mxc_isi_write(pipe, CHNL_IMG_CTRL, val); in mxc_isi_channel_set_output_format()
409 mxc_isi_write(pipe, CHNL_OUT_BUF_PITCH, in mxc_isi_channel_set_output_format()
417 u32 mxc_isi_channel_irq_status(struct mxc_isi_pipe *pipe, bool clear) in mxc_isi_channel_irq_status() argument
421 status = mxc_isi_read(pipe, CHNL_STS); in mxc_isi_channel_irq_status()
423 mxc_isi_write(pipe, CHNL_STS, status); in mxc_isi_channel_irq_status()
428 void mxc_isi_channel_irq_clear(struct mxc_isi_pipe *pipe) in mxc_isi_channel_irq_clear() argument
430 mxc_isi_write(pipe, CHNL_STS, 0xffffffff); in mxc_isi_channel_irq_clear()
433 static void mxc_isi_channel_irq_enable(struct mxc_isi_pipe *pipe) in mxc_isi_channel_irq_enable() argument
435 const struct mxc_isi_ier_reg *ier_reg = pipe->isi->pdata->ier_reg; in mxc_isi_channel_irq_enable()
458 mxc_isi_channel_irq_clear(pipe); in mxc_isi_channel_irq_enable()
459 mxc_isi_write(pipe, CHNL_IER, val); in mxc_isi_channel_irq_enable()
462 static void mxc_isi_channel_irq_disable(struct mxc_isi_pipe *pipe) in mxc_isi_channel_irq_disable() argument
464 mxc_isi_write(pipe, CHNL_IER, 0); in mxc_isi_channel_irq_disable()
471 static void mxc_isi_channel_sw_reset(struct mxc_isi_pipe *pipe, bool enable_clk) in mxc_isi_channel_sw_reset() argument
473 mxc_isi_write(pipe, CHNL_CTRL, CHNL_CTRL_SW_RST); in mxc_isi_channel_sw_reset()
475 mxc_isi_write(pipe, CHNL_CTRL, enable_clk ? CHNL_CTRL_CLK_EN : 0); in mxc_isi_channel_sw_reset()
478 static void __mxc_isi_channel_get(struct mxc_isi_pipe *pipe) in __mxc_isi_channel_get() argument
480 if (!pipe->use_count++) in __mxc_isi_channel_get()
481 mxc_isi_channel_sw_reset(pipe, true); in __mxc_isi_channel_get()
484 void mxc_isi_channel_get(struct mxc_isi_pipe *pipe) in mxc_isi_channel_get() argument
486 mutex_lock(&pipe->lock); in mxc_isi_channel_get()
487 __mxc_isi_channel_get(pipe); in mxc_isi_channel_get()
488 mutex_unlock(&pipe->lock); in mxc_isi_channel_get()
491 static void __mxc_isi_channel_put(struct mxc_isi_pipe *pipe) in __mxc_isi_channel_put() argument
493 if (!--pipe->use_count) in __mxc_isi_channel_put()
494 mxc_isi_channel_sw_reset(pipe, false); in __mxc_isi_channel_put()
497 void mxc_isi_channel_put(struct mxc_isi_pipe *pipe) in mxc_isi_channel_put() argument
499 mutex_lock(&pipe->lock); in mxc_isi_channel_put()
500 __mxc_isi_channel_put(pipe); in mxc_isi_channel_put()
501 mutex_unlock(&pipe->lock); in mxc_isi_channel_put()
504 void mxc_isi_channel_enable(struct mxc_isi_pipe *pipe) in mxc_isi_channel_enable() argument
508 mxc_isi_channel_irq_enable(pipe); in mxc_isi_channel_enable()
510 mutex_lock(&pipe->lock); in mxc_isi_channel_enable()
512 val = mxc_isi_read(pipe, CHNL_CTRL); in mxc_isi_channel_enable()
514 mxc_isi_write(pipe, CHNL_CTRL, val); in mxc_isi_channel_enable()
516 mutex_unlock(&pipe->lock); in mxc_isi_channel_enable()
519 void mxc_isi_channel_disable(struct mxc_isi_pipe *pipe) in mxc_isi_channel_disable() argument
523 mxc_isi_channel_irq_disable(pipe); in mxc_isi_channel_disable()
525 mutex_lock(&pipe->lock); in mxc_isi_channel_disable()
527 val = mxc_isi_read(pipe, CHNL_CTRL); in mxc_isi_channel_disable()
529 mxc_isi_write(pipe, CHNL_CTRL, val); in mxc_isi_channel_disable()
531 mutex_unlock(&pipe->lock); in mxc_isi_channel_disable()
537 int mxc_isi_channel_acquire(struct mxc_isi_pipe *pipe, 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()
557 if ((pipe->available_res & resources) != resources) { 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()
573 void mxc_isi_channel_release(struct mxc_isi_pipe *pipe) in mxc_isi_channel_release() argument
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
595 struct mxc_isi_pipe *chained_pipe = pipe + 1; in mxc_isi_channel_chain()
604 if (WARN_ON(pipe->id == pipe->isi->pdata->num_channels - 1)) in mxc_isi_channel_chain()
610 if (WARN_ON(pipe->chained || chained_pipe->chained_res)) { in mxc_isi_channel_chain()
620 pipe->chained = true; in mxc_isi_channel_chain()
632 void mxc_isi_channel_unchain(struct mxc_isi_pipe *pipe) in mxc_isi_channel_unchain() argument
634 struct mxc_isi_pipe *chained_pipe = pipe + 1; in mxc_isi_channel_unchain()
636 if (!pipe->chained) in mxc_isi_channel_unchain()
639 pipe->chained = false; in mxc_isi_channel_unchain()