Lines Matching refs:vfe

179 static u32 vfe_hw_version(struct vfe_device *vfe)  in vfe_hw_version()  argument
181 u32 hw_version = readl_relaxed(vfe->base + VFE_HW_VERSION); in vfe_hw_version()
187 dev_dbg(vfe->camss->dev, "VFE HW Version = %u.%u.%u\n", in vfe_hw_version()
193 static inline void vfe_reg_set(struct vfe_device *vfe, u32 reg, u32 set_bits) in vfe_reg_set() argument
195 u32 bits = readl_relaxed(vfe->base + reg); in vfe_reg_set()
197 writel_relaxed(bits | set_bits, vfe->base + reg); in vfe_reg_set()
200 static void vfe_global_reset(struct vfe_device *vfe) in vfe_global_reset() argument
215 writel_relaxed(BIT(31), vfe->base + VFE_IRQ_MASK_0); in vfe_global_reset()
220 writel_relaxed(reset_bits, vfe->base + VFE_GLOBAL_RESET_CMD); in vfe_global_reset()
223 static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line) in vfe_wm_start() argument
230 writel_relaxed(val, vfe->base + VFE_BUS_WM_DEBUG_STATUS_CFG); in vfe_wm_start()
233 writel_relaxed(0, vfe->base + VFE_BUS_WM_ADDR_SYNC_FRAME_HEADER); in vfe_wm_start()
237 writel_relaxed(val, vfe->base + VFE_BUS_WM_CGC_OVERRIDE); in vfe_wm_start()
239 writel_relaxed(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL); in vfe_wm_start()
243 writel_relaxed(val, vfe->base + VFE_BUS_WM_ADDR_SYNC_NO_SYNC); in vfe_wm_start()
245 writel_relaxed(0xf, vfe->base + VFE_BUS_WM_BURST_LIMIT(wm)); in vfe_wm_start()
248 writel_relaxed(val, vfe->base + VFE_BUS_WM_BUFFER_WIDTH_CFG(wm)); in vfe_wm_start()
251 writel_relaxed(val, vfe->base + VFE_BUS_WM_BUFFER_HEIGHT_CFG(wm)); in vfe_wm_start()
254 writel_relaxed(val, vfe->base + VFE_BUS_WM_PACKER_CFG(wm)); // XXX 1 for PLAIN8? in vfe_wm_start()
258 writel_relaxed(val, vfe->base + VFE_BUS_WM_STRIDE(wm)); in vfe_wm_start()
263 writel_relaxed(val, vfe->base + VFE_BUS_WM_CFG(wm)); in vfe_wm_start()
266 static void vfe_wm_stop(struct vfe_device *vfe, u8 wm) in vfe_wm_stop() argument
269 writel_relaxed(0, vfe->base + VFE_BUS_WM_CFG(wm)); in vfe_wm_stop()
272 static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr, in vfe_wm_update() argument
279 writel_relaxed(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm)); in vfe_wm_update()
280 writel_relaxed(stride * pix->height, vfe->base + VFE_BUS_WM_FRAME_INC(wm)); in vfe_wm_update()
283 static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id) in vfe_reg_update() argument
285 vfe->reg_update |= REG_UPDATE_RDI(line_id); in vfe_reg_update()
290 writel_relaxed(vfe->reg_update, vfe->base + VFE_REG_UPDATE_CMD); in vfe_reg_update()
296 static inline void vfe_reg_update_clear(struct vfe_device *vfe, in vfe_reg_update_clear() argument
299 vfe->reg_update &= ~REG_UPDATE_RDI(line_id); in vfe_reg_update_clear()
302 static void vfe_enable_irq_common(struct vfe_device *vfe) in vfe_enable_irq_common() argument
304 vfe_reg_set(vfe, VFE_IRQ_MASK_0, ~0u); in vfe_enable_irq_common()
305 vfe_reg_set(vfe, VFE_IRQ_MASK_1, ~0u); in vfe_enable_irq_common()
307 writel_relaxed(~0u, vfe->base + VFE_BUS_IRQ_MASK(0)); in vfe_enable_irq_common()
308 writel_relaxed(~0u, vfe->base + VFE_BUS_IRQ_MASK(1)); in vfe_enable_irq_common()
309 writel_relaxed(~0u, vfe->base + VFE_BUS_IRQ_MASK(2)); in vfe_enable_irq_common()
312 static void vfe_isr_halt_ack(struct vfe_device *vfe) in vfe_isr_halt_ack() argument
314 complete(&vfe->halt_complete); in vfe_isr_halt_ack()
317 static void vfe_isr_read(struct vfe_device *vfe, u32 *status0, u32 *status1) in vfe_isr_read() argument
319 *status0 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_0); in vfe_isr_read()
320 *status1 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_1); in vfe_isr_read()
322 writel_relaxed(*status0, vfe->base + VFE_IRQ_CLEAR_0); in vfe_isr_read()
323 writel_relaxed(*status1, vfe->base + VFE_IRQ_CLEAR_1); in vfe_isr_read()
327 writel_relaxed(CMD_GLOBAL_CLEAR, vfe->base + VFE_IRQ_CMD); in vfe_isr_read()
330 static void vfe_violation_read(struct vfe_device *vfe) in vfe_violation_read() argument
332 u32 violation = readl_relaxed(vfe->base + VFE_VIOLATION_STATUS); in vfe_violation_read()
346 struct vfe_device *vfe = dev; in vfe_isr() local
350 status0 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_0); in vfe_isr()
351 status1 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_1); in vfe_isr()
353 writel_relaxed(status0, vfe->base + VFE_IRQ_CLEAR_0); in vfe_isr()
354 writel_relaxed(status1, vfe->base + VFE_IRQ_CLEAR_1); in vfe_isr()
356 for (i = VFE_LINE_RDI0; i < vfe->res->line_num; i++) { in vfe_isr()
357 vfe_bus_status[i] = readl_relaxed(vfe->base + VFE_BUS_IRQ_STATUS(i)); in vfe_isr()
358 writel_relaxed(vfe_bus_status[i], vfe->base + VFE_BUS_IRQ_CLEAR(i)); in vfe_isr()
364 writel_relaxed(CMD_GLOBAL_CLEAR, vfe->base + VFE_IRQ_CMD); in vfe_isr()
365 writel_relaxed(1, vfe->base + VFE_BUS_IRQ_CLEAR_GLOBAL); in vfe_isr()
368 vfe->isr_ops.reset_ack(vfe); in vfe_isr()
370 for (i = VFE_LINE_RDI0; i < vfe->res->line_num; i++) in vfe_isr()
372 vfe->isr_ops.reg_update(vfe, i); in vfe_isr()
374 for (i = VFE_LINE_RDI0; i < vfe->res->line_num; i++) in vfe_isr()
376 vfe->isr_ops.sof(vfe, i); in vfe_isr()
380 vfe->isr_ops.comp_done(vfe, i); in vfe_isr()
385 vfe->isr_ops.wm_done(vfe, wm); in vfe_isr()
396 static int vfe_halt(struct vfe_device *vfe) in vfe_halt() argument
404 struct vfe_device *vfe = to_vfe(line); in vfe_get_output() local
409 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_get_output()
413 dev_err(vfe->camss->dev, "Output is running\n"); in vfe_get_output()
419 wm_idx = vfe_reserve_wm(vfe, line->id); in vfe_get_output()
421 dev_err(vfe->camss->dev, "Can not reserve wm\n"); in vfe_get_output()
428 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_get_output()
433 vfe_release_wm(vfe, output->wm_idx[0]); in vfe_get_output()
436 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_get_output()
443 struct vfe_device *vfe = to_vfe(line); in vfe_enable_output() local
445 const struct vfe_hw_ops *ops = vfe->res->hw_ops; in vfe_enable_output()
461 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_enable_output()
463 ops->reg_update_clear(vfe, line->id); in vfe_enable_output()
466 dev_err(vfe->camss->dev, "Output is not in reserved state %d\n", in vfe_enable_output()
468 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_enable_output()
480 vfe_wm_start(vfe, output->wm_idx[0], line); in vfe_enable_output()
487 vfe_wm_update(vfe, output->wm_idx[0], output->buf[i]->addr[0], line); in vfe_enable_output()
490 ops->reg_update(vfe, line->id); in vfe_enable_output()
492 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_enable_output()
505 struct vfe_device *vfe = to_vfe(line); in vfe_enable() local
508 mutex_lock(&vfe->stream_lock); in vfe_enable()
510 if (!vfe->stream_count) in vfe_enable()
511 vfe_enable_irq_common(vfe); in vfe_enable()
513 vfe->stream_count++; in vfe_enable()
515 mutex_unlock(&vfe->stream_lock); in vfe_enable()
525 vfe->was_streaming = 1; in vfe_enable()
533 mutex_lock(&vfe->stream_lock); in vfe_enable()
535 vfe->stream_count--; in vfe_enable()
537 mutex_unlock(&vfe->stream_lock); in vfe_enable()
547 static void vfe_isr_sof(struct vfe_device *vfe, enum vfe_line_id line_id) in vfe_isr_sof() argument
557 static void vfe_isr_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id) in vfe_isr_reg_update() argument
562 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_isr_reg_update()
563 vfe->res->hw_ops->reg_update_clear(vfe, line_id); in vfe_isr_reg_update()
565 output = &vfe->line[line_id].output; in vfe_isr_reg_update()
572 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_isr_reg_update()
580 static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm) in vfe_isr_wm_done() argument
582 struct vfe_line *line = &vfe->line[vfe->wm_output_map[wm]]; in vfe_isr_wm_done()
589 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_isr_wm_done()
591 if (vfe->wm_output_map[wm] == VFE_LINE_NONE) { in vfe_isr_wm_done()
592 dev_err_ratelimited(vfe->camss->dev, in vfe_isr_wm_done()
596 output = &vfe->line[vfe->wm_output_map[wm]].output; in vfe_isr_wm_done()
600 dev_err_ratelimited(vfe->camss->dev, in vfe_isr_wm_done()
616 vfe_wm_update(vfe, output->wm_idx[0], output->buf[index]->addr[0], line); in vfe_isr_wm_done()
620 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_isr_wm_done()
627 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_isr_wm_done()
644 struct vfe_device *vfe = to_vfe(line); in vfe_queue_buffer() local
650 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_queue_buffer()
654 vfe_wm_update(vfe, output->wm_idx[0], buf->addr[0], line); in vfe_queue_buffer()
659 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_queue_buffer()
678 static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) in vfe_subdev_init() argument
680 vfe->isr_ops = vfe_isr_ops_170; in vfe_subdev_init()
681 vfe->video_ops = vfe_video_ops_170; in vfe_subdev_init()