• Home
  • Raw
  • Download

Lines Matching refs:vfe

179 static void vfe_hw_version_read(struct vfe_device *vfe, struct device *dev)  in vfe_hw_version_read()  argument
181 u32 hw_version = readl_relaxed(vfe->base + VFE_HW_VERSION); in vfe_hw_version_read()
190 static inline void vfe_reg_clr(struct vfe_device *vfe, u32 reg, u32 clr_bits) in vfe_reg_clr() argument
192 u32 bits = readl_relaxed(vfe->base + reg); in vfe_reg_clr()
194 writel_relaxed(bits & ~clr_bits, vfe->base + reg); in vfe_reg_clr()
197 static inline void vfe_reg_set(struct vfe_device *vfe, u32 reg, u32 set_bits) in vfe_reg_set() argument
199 u32 bits = readl_relaxed(vfe->base + reg); in vfe_reg_set()
201 writel_relaxed(bits | set_bits, vfe->base + reg); in vfe_reg_set()
204 static void vfe_global_reset(struct vfe_device *vfe) in vfe_global_reset() argument
218 writel_relaxed(BIT(31), vfe->base + VFE_IRQ_MASK_0); in vfe_global_reset()
223 writel_relaxed(reset_bits, vfe->base + VFE_GLOBAL_RESET_CMD); in vfe_global_reset()
226 static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line) in vfe_wm_start() argument
233 writel_relaxed(val, vfe->base + VFE_BUS_WM_DEBUG_STATUS_CFG); in vfe_wm_start()
236 writel_relaxed(0, vfe->base + VFE_BUS_WM_ADDR_SYNC_FRAME_HEADER); in vfe_wm_start()
240 writel_relaxed(val, vfe->base + VFE_BUS_WM_CGC_OVERRIDE); in vfe_wm_start()
242 writel_relaxed(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL); in vfe_wm_start()
246 writel_relaxed(val, vfe->base + VFE_BUS_WM_ADDR_SYNC_NO_SYNC); in vfe_wm_start()
248 writel_relaxed(0xf, vfe->base + VFE_BUS_WM_BURST_LIMIT(wm)); in vfe_wm_start()
251 writel_relaxed(val, vfe->base + VFE_BUS_WM_BUFFER_WIDTH_CFG(wm)); in vfe_wm_start()
254 writel_relaxed(val, vfe->base + VFE_BUS_WM_BUFFER_HEIGHT_CFG(wm)); in vfe_wm_start()
257 writel_relaxed(val, vfe->base + VFE_BUS_WM_PACKER_CFG(wm)); // XXX 1 for PLAIN8? in vfe_wm_start()
261 writel_relaxed(val, vfe->base + VFE_BUS_WM_STRIDE(wm)); in vfe_wm_start()
266 writel_relaxed(val, vfe->base + VFE_BUS_WM_CFG(wm)); in vfe_wm_start()
269 static void vfe_wm_stop(struct vfe_device *vfe, u8 wm) in vfe_wm_stop() argument
272 writel_relaxed(0, vfe->base + VFE_BUS_WM_CFG(wm)); in vfe_wm_stop()
275 static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr, in vfe_wm_update() argument
282 writel_relaxed(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm)); in vfe_wm_update()
283 writel_relaxed(stride * pix->height, vfe->base + VFE_BUS_WM_FRAME_INC(wm)); in vfe_wm_update()
286 static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id) in vfe_reg_update() argument
288 vfe->reg_update |= REG_UPDATE_RDI(line_id); in vfe_reg_update()
293 writel_relaxed(vfe->reg_update, vfe->base + VFE_REG_UPDATE_CMD); in vfe_reg_update()
299 static inline void vfe_reg_update_clear(struct vfe_device *vfe, in vfe_reg_update_clear() argument
302 vfe->reg_update &= ~REG_UPDATE_RDI(line_id); in vfe_reg_update_clear()
305 static void vfe_enable_irq_common(struct vfe_device *vfe) in vfe_enable_irq_common() argument
307 vfe_reg_set(vfe, VFE_IRQ_MASK_0, ~0u); in vfe_enable_irq_common()
308 vfe_reg_set(vfe, VFE_IRQ_MASK_1, ~0u); in vfe_enable_irq_common()
310 writel_relaxed(~0u, vfe->base + VFE_BUS_IRQ_MASK(0)); in vfe_enable_irq_common()
311 writel_relaxed(~0u, vfe->base + VFE_BUS_IRQ_MASK(1)); in vfe_enable_irq_common()
312 writel_relaxed(~0u, vfe->base + VFE_BUS_IRQ_MASK(2)); in vfe_enable_irq_common()
315 static void vfe_isr_halt_ack(struct vfe_device *vfe) in vfe_isr_halt_ack() argument
317 complete(&vfe->halt_complete); in vfe_isr_halt_ack()
320 static void vfe_isr_read(struct vfe_device *vfe, u32 *status0, u32 *status1) in vfe_isr_read() argument
322 *status0 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_0); in vfe_isr_read()
323 *status1 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_1); in vfe_isr_read()
325 writel_relaxed(*status0, vfe->base + VFE_IRQ_CLEAR_0); in vfe_isr_read()
326 writel_relaxed(*status1, vfe->base + VFE_IRQ_CLEAR_1); in vfe_isr_read()
330 writel_relaxed(CMD_GLOBAL_CLEAR, vfe->base + VFE_IRQ_CMD); in vfe_isr_read()
333 static void vfe_violation_read(struct vfe_device *vfe) in vfe_violation_read() argument
335 u32 violation = readl_relaxed(vfe->base + VFE_VIOLATION_STATUS); in vfe_violation_read()
349 struct vfe_device *vfe = dev; in vfe_isr() local
353 status0 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_0); in vfe_isr()
354 status1 = readl_relaxed(vfe->base + VFE_IRQ_STATUS_1); in vfe_isr()
356 writel_relaxed(status0, vfe->base + VFE_IRQ_CLEAR_0); in vfe_isr()
357 writel_relaxed(status1, vfe->base + VFE_IRQ_CLEAR_1); in vfe_isr()
360 vfe_bus_status[i] = readl_relaxed(vfe->base + VFE_BUS_IRQ_STATUS(i)); in vfe_isr()
361 writel_relaxed(vfe_bus_status[i], vfe->base + VFE_BUS_IRQ_CLEAR(i)); in vfe_isr()
367 writel_relaxed(CMD_GLOBAL_CLEAR, vfe->base + VFE_IRQ_CMD); in vfe_isr()
368 writel_relaxed(1, vfe->base + VFE_BUS_IRQ_CLEAR_GLOBAL); in vfe_isr()
371 vfe->isr_ops.reset_ack(vfe); in vfe_isr()
375 vfe->isr_ops.reg_update(vfe, i); in vfe_isr()
379 vfe->isr_ops.sof(vfe, i); in vfe_isr()
383 vfe->isr_ops.comp_done(vfe, i); in vfe_isr()
388 vfe->isr_ops.wm_done(vfe, wm); in vfe_isr()
399 static int vfe_halt(struct vfe_device *vfe) in vfe_halt() argument
407 struct vfe_device *vfe = to_vfe(line); in vfe_get_output() local
412 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_get_output()
416 dev_err(vfe->camss->dev, "Output is running\n"); in vfe_get_output()
422 wm_idx = vfe_reserve_wm(vfe, line->id); in vfe_get_output()
424 dev_err(vfe->camss->dev, "Can not reserve wm\n"); in vfe_get_output()
431 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_get_output()
436 vfe_release_wm(vfe, output->wm_idx[0]); in vfe_get_output()
439 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_get_output()
446 struct vfe_device *vfe = to_vfe(line); in vfe_enable_output() local
448 const struct vfe_hw_ops *ops = vfe->ops; in vfe_enable_output()
464 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_enable_output()
466 ops->reg_update_clear(vfe, line->id); in vfe_enable_output()
469 dev_err(vfe->camss->dev, "Output is not in reserved state %d\n", in vfe_enable_output()
471 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_enable_output()
483 vfe_wm_start(vfe, output->wm_idx[0], line); in vfe_enable_output()
490 vfe_wm_update(vfe, output->wm_idx[0], output->buf[i]->addr[0], line); in vfe_enable_output()
493 ops->reg_update(vfe, line->id); in vfe_enable_output()
495 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_enable_output()
502 struct vfe_device *vfe = to_vfe(line); in vfe_disable_output() local
507 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_disable_output()
509 vfe_wm_stop(vfe, output->wm_idx[i]); in vfe_disable_output()
511 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_disable_output()
513 vfe_reset(vfe); in vfe_disable_output()
524 struct vfe_device *vfe = to_vfe(line); in vfe_enable() local
527 mutex_lock(&vfe->stream_lock); in vfe_enable()
529 if (!vfe->stream_count) in vfe_enable()
530 vfe_enable_irq_common(vfe); in vfe_enable()
532 vfe->stream_count++; in vfe_enable()
534 mutex_unlock(&vfe->stream_lock); in vfe_enable()
544 vfe->was_streaming = 1; in vfe_enable()
552 mutex_lock(&vfe->stream_lock); in vfe_enable()
554 vfe->stream_count--; in vfe_enable()
556 mutex_unlock(&vfe->stream_lock); in vfe_enable()
569 struct vfe_device *vfe = to_vfe(line); in vfe_disable() local
575 mutex_lock(&vfe->stream_lock); in vfe_disable()
577 vfe->stream_count--; in vfe_disable()
579 mutex_unlock(&vfe->stream_lock); in vfe_disable()
589 static void vfe_isr_sof(struct vfe_device *vfe, enum vfe_line_id line_id) in vfe_isr_sof() argument
599 static void vfe_isr_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id) in vfe_isr_reg_update() argument
604 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_isr_reg_update()
605 vfe->ops->reg_update_clear(vfe, line_id); in vfe_isr_reg_update()
607 output = &vfe->line[line_id].output; in vfe_isr_reg_update()
614 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_isr_reg_update()
622 static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm) in vfe_isr_wm_done() argument
624 struct vfe_line *line = &vfe->line[vfe->wm_output_map[wm]]; in vfe_isr_wm_done()
631 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_isr_wm_done()
633 if (vfe->wm_output_map[wm] == VFE_LINE_NONE) { in vfe_isr_wm_done()
634 dev_err_ratelimited(vfe->camss->dev, in vfe_isr_wm_done()
638 output = &vfe->line[vfe->wm_output_map[wm]].output; in vfe_isr_wm_done()
642 dev_err_ratelimited(vfe->camss->dev, in vfe_isr_wm_done()
658 vfe_wm_update(vfe, output->wm_idx[0], output->buf[index]->addr[0], line); in vfe_isr_wm_done()
662 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_isr_wm_done()
669 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_isr_wm_done()
676 static void vfe_pm_domain_off(struct vfe_device *vfe) in vfe_pm_domain_off() argument
685 static int vfe_pm_domain_on(struct vfe_device *vfe) in vfe_pm_domain_on() argument
704 struct vfe_device *vfe = to_vfe(line); in vfe_queue_buffer() local
710 spin_lock_irqsave(&vfe->output_lock, flags); in vfe_queue_buffer()
714 vfe_wm_update(vfe, output->wm_idx[0], buf->addr[0], line); in vfe_queue_buffer()
719 spin_unlock_irqrestore(&vfe->output_lock, flags); in vfe_queue_buffer()
738 static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) in vfe_subdev_init() argument
740 vfe->isr_ops = vfe_isr_ops_170; in vfe_subdev_init()
741 vfe->video_ops = vfe_video_ops_170; in vfe_subdev_init()
743 vfe->line_num = VFE_LINE_NUM_GEN2; in vfe_subdev_init()