Lines Matching refs:stat
24 #define ISP_STAT_USES_DMAENGINE(stat) ((stat)->dma_ch != NULL) argument
58 #define IS_H3A_AF(stat) ((stat) == &(stat)->isp->isp_af) argument
59 #define IS_H3A_AEWB(stat) ((stat) == &(stat)->isp->isp_aewb) argument
60 #define IS_H3A(stat) (IS_H3A_AF(stat) || IS_H3A_AEWB(stat)) argument
62 static void __isp_stat_buf_sync_magic(struct ispstat *stat, in __isp_stat_buf_sync_magic() argument
70 dma_sync(stat->isp->dev, buf->dma_addr, 0, MAGIC_SIZE, dir); in __isp_stat_buf_sync_magic()
71 dma_sync(stat->isp->dev, buf->dma_addr + (buf_size & PAGE_MASK), in __isp_stat_buf_sync_magic()
75 static void isp_stat_buf_sync_magic_for_device(struct ispstat *stat, in isp_stat_buf_sync_magic_for_device() argument
80 if (ISP_STAT_USES_DMAENGINE(stat)) in isp_stat_buf_sync_magic_for_device()
83 __isp_stat_buf_sync_magic(stat, buf, buf_size, dir, in isp_stat_buf_sync_magic_for_device()
87 static void isp_stat_buf_sync_magic_for_cpu(struct ispstat *stat, in isp_stat_buf_sync_magic_for_cpu() argument
92 if (ISP_STAT_USES_DMAENGINE(stat)) in isp_stat_buf_sync_magic_for_cpu()
95 __isp_stat_buf_sync_magic(stat, buf, buf_size, dir, in isp_stat_buf_sync_magic_for_cpu()
99 static int isp_stat_buf_check_magic(struct ispstat *stat, in isp_stat_buf_check_magic() argument
102 const u32 buf_size = IS_H3A_AF(stat) ? in isp_stat_buf_check_magic()
108 isp_stat_buf_sync_magic_for_cpu(stat, buf, buf_size, DMA_FROM_DEVICE); in isp_stat_buf_check_magic()
116 dev_dbg(stat->isp->dev, "%s: beginning magic check does not " in isp_stat_buf_check_magic()
117 "match.\n", stat->subdev.name); in isp_stat_buf_check_magic()
125 dev_dbg(stat->isp->dev, "%s: ending magic check does " in isp_stat_buf_check_magic()
126 "not match.\n", stat->subdev.name); in isp_stat_buf_check_magic()
131 isp_stat_buf_sync_magic_for_device(stat, buf, buf_size, in isp_stat_buf_check_magic()
137 static void isp_stat_buf_insert_magic(struct ispstat *stat, in isp_stat_buf_insert_magic() argument
140 const u32 buf_size = IS_H3A_AF(stat) ? in isp_stat_buf_insert_magic()
141 stat->buf_size + AF_EXTRA_DATA : stat->buf_size; in isp_stat_buf_insert_magic()
143 isp_stat_buf_sync_magic_for_cpu(stat, buf, buf_size, DMA_FROM_DEVICE); in isp_stat_buf_insert_magic()
154 isp_stat_buf_sync_magic_for_device(stat, buf, buf_size, in isp_stat_buf_insert_magic()
158 static void isp_stat_buf_sync_for_device(struct ispstat *stat, in isp_stat_buf_sync_for_device() argument
161 if (ISP_STAT_USES_DMAENGINE(stat)) in isp_stat_buf_sync_for_device()
164 dma_sync_sg_for_device(stat->isp->dev, buf->sgt.sgl, in isp_stat_buf_sync_for_device()
168 static void isp_stat_buf_sync_for_cpu(struct ispstat *stat, in isp_stat_buf_sync_for_cpu() argument
171 if (ISP_STAT_USES_DMAENGINE(stat)) in isp_stat_buf_sync_for_cpu()
174 dma_sync_sg_for_cpu(stat->isp->dev, buf->sgt.sgl, in isp_stat_buf_sync_for_cpu()
178 static void isp_stat_buf_clear(struct ispstat *stat) in isp_stat_buf_clear() argument
183 stat->buf[i].empty = 1; in isp_stat_buf_clear()
187 __isp_stat_buf_find(struct ispstat *stat, int look_empty) in __isp_stat_buf_find() argument
193 struct ispstat_buffer *curr = &stat->buf[i]; in __isp_stat_buf_find()
199 if (curr == stat->locked_buf || curr == stat->active_buf) in __isp_stat_buf_find()
222 isp_stat_buf_find_oldest(struct ispstat *stat) in isp_stat_buf_find_oldest() argument
224 return __isp_stat_buf_find(stat, 0); in isp_stat_buf_find_oldest()
228 isp_stat_buf_find_oldest_or_empty(struct ispstat *stat) in isp_stat_buf_find_oldest_or_empty() argument
230 return __isp_stat_buf_find(stat, 1); in isp_stat_buf_find_oldest_or_empty()
233 static int isp_stat_buf_queue(struct ispstat *stat) in isp_stat_buf_queue() argument
235 if (!stat->active_buf) in isp_stat_buf_queue()
238 ktime_get_ts(&stat->active_buf->ts); in isp_stat_buf_queue()
240 stat->active_buf->buf_size = stat->buf_size; in isp_stat_buf_queue()
241 if (isp_stat_buf_check_magic(stat, stat->active_buf)) { in isp_stat_buf_queue()
242 dev_dbg(stat->isp->dev, "%s: data wasn't properly written.\n", in isp_stat_buf_queue()
243 stat->subdev.name); in isp_stat_buf_queue()
246 stat->active_buf->config_counter = stat->config_counter; in isp_stat_buf_queue()
247 stat->active_buf->frame_number = stat->frame_number; in isp_stat_buf_queue()
248 stat->active_buf->empty = 0; in isp_stat_buf_queue()
249 stat->active_buf = NULL; in isp_stat_buf_queue()
255 static void isp_stat_buf_next(struct ispstat *stat) in isp_stat_buf_next() argument
257 if (unlikely(stat->active_buf)) in isp_stat_buf_next()
259 dev_dbg(stat->isp->dev, "%s: new buffer requested without " in isp_stat_buf_next()
261 stat->subdev.name); in isp_stat_buf_next()
263 stat->active_buf = isp_stat_buf_find_oldest_or_empty(stat); in isp_stat_buf_next()
266 static void isp_stat_buf_release(struct ispstat *stat) in isp_stat_buf_release() argument
270 isp_stat_buf_sync_for_device(stat, stat->locked_buf); in isp_stat_buf_release()
271 spin_lock_irqsave(&stat->isp->stat_lock, flags); in isp_stat_buf_release()
272 stat->locked_buf = NULL; in isp_stat_buf_release()
273 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_buf_release()
277 static struct ispstat_buffer *isp_stat_buf_get(struct ispstat *stat, in isp_stat_buf_get() argument
284 spin_lock_irqsave(&stat->isp->stat_lock, flags); in isp_stat_buf_get()
287 buf = isp_stat_buf_find_oldest(stat); in isp_stat_buf_get()
289 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_buf_get()
290 dev_dbg(stat->isp->dev, "%s: cannot find a buffer.\n", in isp_stat_buf_get()
291 stat->subdev.name); in isp_stat_buf_get()
294 if (isp_stat_buf_check_magic(stat, buf)) { in isp_stat_buf_get()
295 dev_dbg(stat->isp->dev, "%s: current buffer has " in isp_stat_buf_get()
296 "corrupted data\n.", stat->subdev.name); in isp_stat_buf_get()
305 stat->locked_buf = buf; in isp_stat_buf_get()
307 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_buf_get()
310 dev_warn(stat->isp->dev, "%s: userspace's buffer size is " in isp_stat_buf_get()
311 "not enough.\n", stat->subdev.name); in isp_stat_buf_get()
312 isp_stat_buf_release(stat); in isp_stat_buf_get()
316 isp_stat_buf_sync_for_cpu(stat, buf); in isp_stat_buf_get()
323 dev_info(stat->isp->dev, in isp_stat_buf_get()
325 stat->subdev.name, rval); in isp_stat_buf_get()
327 isp_stat_buf_release(stat); in isp_stat_buf_get()
333 static void isp_stat_bufs_free(struct ispstat *stat) in isp_stat_bufs_free() argument
335 struct device *dev = ISP_STAT_USES_DMAENGINE(stat) in isp_stat_bufs_free()
336 ? NULL : stat->isp->dev; in isp_stat_bufs_free()
340 struct ispstat_buffer *buf = &stat->buf[i]; in isp_stat_bufs_free()
347 dma_free_coherent(dev, stat->buf_alloc_size, buf->virt_addr, in isp_stat_bufs_free()
355 dev_dbg(stat->isp->dev, "%s: all buffers were freed.\n", in isp_stat_bufs_free()
356 stat->subdev.name); in isp_stat_bufs_free()
358 stat->buf_alloc_size = 0; in isp_stat_bufs_free()
359 stat->active_buf = NULL; in isp_stat_bufs_free()
401 static int isp_stat_bufs_alloc(struct ispstat *stat, u32 size) in isp_stat_bufs_alloc() argument
403 struct device *dev = ISP_STAT_USES_DMAENGINE(stat) in isp_stat_bufs_alloc()
404 ? NULL : stat->isp->dev; in isp_stat_bufs_alloc()
408 spin_lock_irqsave(&stat->isp->stat_lock, flags); in isp_stat_bufs_alloc()
410 BUG_ON(stat->locked_buf != NULL); in isp_stat_bufs_alloc()
413 if (stat->buf_alloc_size >= size) { in isp_stat_bufs_alloc()
414 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_bufs_alloc()
418 if (stat->state != ISPSTAT_DISABLED || stat->buf_processing) { in isp_stat_bufs_alloc()
419 dev_info(stat->isp->dev, in isp_stat_bufs_alloc()
421 stat->subdev.name); in isp_stat_bufs_alloc()
422 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_bufs_alloc()
426 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_bufs_alloc()
428 isp_stat_bufs_free(stat); in isp_stat_bufs_alloc()
430 stat->buf_alloc_size = size; in isp_stat_bufs_alloc()
433 struct ispstat_buffer *buf = &stat->buf[i]; in isp_stat_bufs_alloc()
438 dev_err(stat->isp->dev, in isp_stat_bufs_alloc()
440 stat->subdev.name, i); in isp_stat_bufs_alloc()
441 isp_stat_bufs_free(stat); in isp_stat_bufs_alloc()
447 dev_dbg(stat->isp->dev, in isp_stat_bufs_alloc()
449 stat->subdev.name, i, in isp_stat_bufs_alloc()
457 static void isp_stat_queue_event(struct ispstat *stat, int err) in isp_stat_queue_event() argument
459 struct video_device *vdev = stat->subdev.devnode; in isp_stat_queue_event()
465 status->frame_number = stat->frame_number; in isp_stat_queue_event()
466 status->config_counter = stat->config_counter; in isp_stat_queue_event()
470 event.type = stat->event_type; in isp_stat_queue_event()
481 int omap3isp_stat_request_statistics(struct ispstat *stat, in omap3isp_stat_request_statistics() argument
486 if (stat->state != ISPSTAT_ENABLED) { in omap3isp_stat_request_statistics()
487 dev_dbg(stat->isp->dev, "%s: engine not enabled.\n", in omap3isp_stat_request_statistics()
488 stat->subdev.name); in omap3isp_stat_request_statistics()
492 mutex_lock(&stat->ioctl_lock); in omap3isp_stat_request_statistics()
493 buf = isp_stat_buf_get(stat, data); in omap3isp_stat_request_statistics()
495 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_request_statistics()
506 isp_stat_buf_release(stat); in omap3isp_stat_request_statistics()
507 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_request_statistics()
520 int omap3isp_stat_config(struct ispstat *stat, void *new_conf) in omap3isp_stat_config() argument
528 dev_dbg(stat->isp->dev, "%s: configuration is NULL\n", in omap3isp_stat_config()
529 stat->subdev.name); in omap3isp_stat_config()
533 mutex_lock(&stat->ioctl_lock); in omap3isp_stat_config()
535 dev_dbg(stat->isp->dev, "%s: configuring module with buffer " in omap3isp_stat_config()
536 "size=0x%08lx\n", stat->subdev.name, (unsigned long)buf_size); in omap3isp_stat_config()
538 ret = stat->ops->validate_params(stat, new_conf); in omap3isp_stat_config()
540 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_config()
541 dev_dbg(stat->isp->dev, "%s: configuration values are " in omap3isp_stat_config()
542 "invalid.\n", stat->subdev.name); in omap3isp_stat_config()
547 dev_dbg(stat->isp->dev, "%s: driver has corrected buffer size " in omap3isp_stat_config()
548 "request to 0x%08lx\n", stat->subdev.name, in omap3isp_stat_config()
562 if (IS_H3A(stat)) { in omap3isp_stat_config()
564 if (IS_H3A_AF(stat)) in omap3isp_stat_config()
570 if (stat->recover_priv) { in omap3isp_stat_config()
572 stat->recover_priv; in omap3isp_stat_config()
581 ret = isp_stat_bufs_alloc(stat, buf_size); in omap3isp_stat_config()
583 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_config()
587 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in omap3isp_stat_config()
588 stat->ops->set_params(stat, new_conf); in omap3isp_stat_config()
589 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_config()
595 user_cfg->config_counter = stat->config_counter + stat->inc_config; in omap3isp_stat_config()
598 stat->configured = 1; in omap3isp_stat_config()
599 dev_dbg(stat->isp->dev, "%s: module has been successfully " in omap3isp_stat_config()
600 "configured.\n", stat->subdev.name); in omap3isp_stat_config()
602 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_config()
613 static int isp_stat_buf_process(struct ispstat *stat, int buf_state) in isp_stat_buf_process() argument
617 if (!atomic_add_unless(&stat->buf_err, -1, 0) && in isp_stat_buf_process()
618 buf_state == STAT_BUF_DONE && stat->state == ISPSTAT_ENABLED) { in isp_stat_buf_process()
619 ret = isp_stat_buf_queue(stat); in isp_stat_buf_process()
620 isp_stat_buf_next(stat); in isp_stat_buf_process()
626 int omap3isp_stat_pcr_busy(struct ispstat *stat) in omap3isp_stat_pcr_busy() argument
628 return stat->ops->busy(stat); in omap3isp_stat_pcr_busy()
631 int omap3isp_stat_busy(struct ispstat *stat) in omap3isp_stat_busy() argument
633 return omap3isp_stat_pcr_busy(stat) | stat->buf_processing | in omap3isp_stat_busy()
634 (stat->state != ISPSTAT_DISABLED); in omap3isp_stat_busy()
644 static void isp_stat_pcr_enable(struct ispstat *stat, u8 pcr_enable) in isp_stat_pcr_enable() argument
646 if ((stat->state != ISPSTAT_ENABLING && in isp_stat_pcr_enable()
647 stat->state != ISPSTAT_ENABLED) && pcr_enable) in isp_stat_pcr_enable()
651 stat->ops->enable(stat, pcr_enable); in isp_stat_pcr_enable()
652 if (stat->state == ISPSTAT_DISABLING && !pcr_enable) in isp_stat_pcr_enable()
653 stat->state = ISPSTAT_DISABLED; in isp_stat_pcr_enable()
654 else if (stat->state == ISPSTAT_ENABLING && pcr_enable) in isp_stat_pcr_enable()
655 stat->state = ISPSTAT_ENABLED; in isp_stat_pcr_enable()
658 void omap3isp_stat_suspend(struct ispstat *stat) in omap3isp_stat_suspend() argument
662 spin_lock_irqsave(&stat->isp->stat_lock, flags); in omap3isp_stat_suspend()
664 if (stat->state != ISPSTAT_DISABLED) in omap3isp_stat_suspend()
665 stat->ops->enable(stat, 0); in omap3isp_stat_suspend()
666 if (stat->state == ISPSTAT_ENABLED) in omap3isp_stat_suspend()
667 stat->state = ISPSTAT_SUSPENDED; in omap3isp_stat_suspend()
669 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in omap3isp_stat_suspend()
672 void omap3isp_stat_resume(struct ispstat *stat) in omap3isp_stat_resume() argument
675 if (stat->state == ISPSTAT_SUSPENDED) in omap3isp_stat_resume()
676 stat->state = ISPSTAT_ENABLING; in omap3isp_stat_resume()
679 static void isp_stat_try_enable(struct ispstat *stat) in isp_stat_try_enable() argument
683 if (stat->priv == NULL) in isp_stat_try_enable()
687 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in isp_stat_try_enable()
688 if (stat->state == ISPSTAT_ENABLING && !stat->buf_processing && in isp_stat_try_enable()
689 stat->buf_alloc_size) { in isp_stat_try_enable()
694 stat->update = 1; in isp_stat_try_enable()
695 isp_stat_buf_next(stat); in isp_stat_try_enable()
696 stat->ops->setup_regs(stat, stat->priv); in isp_stat_try_enable()
697 isp_stat_buf_insert_magic(stat, stat->active_buf); in isp_stat_try_enable()
705 if (!IS_H3A(stat)) in isp_stat_try_enable()
706 atomic_set(&stat->buf_err, 0); in isp_stat_try_enable()
708 isp_stat_pcr_enable(stat, 1); in isp_stat_try_enable()
709 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in isp_stat_try_enable()
710 dev_dbg(stat->isp->dev, "%s: module is enabled.\n", in isp_stat_try_enable()
711 stat->subdev.name); in isp_stat_try_enable()
713 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in isp_stat_try_enable()
717 void omap3isp_stat_isr_frame_sync(struct ispstat *stat) in omap3isp_stat_isr_frame_sync() argument
719 isp_stat_try_enable(stat); in omap3isp_stat_isr_frame_sync()
722 void omap3isp_stat_sbl_overflow(struct ispstat *stat) in omap3isp_stat_sbl_overflow() argument
726 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in omap3isp_stat_sbl_overflow()
731 atomic_set(&stat->buf_err, 2); in omap3isp_stat_sbl_overflow()
739 if (stat->recover_priv) in omap3isp_stat_sbl_overflow()
740 stat->sbl_ovl_recover = 1; in omap3isp_stat_sbl_overflow()
741 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_sbl_overflow()
751 int omap3isp_stat_enable(struct ispstat *stat, u8 enable) in omap3isp_stat_enable() argument
755 dev_dbg(stat->isp->dev, "%s: user wants to %s module.\n", in omap3isp_stat_enable()
756 stat->subdev.name, enable ? "enable" : "disable"); in omap3isp_stat_enable()
759 mutex_lock(&stat->ioctl_lock); in omap3isp_stat_enable()
761 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in omap3isp_stat_enable()
763 if (!stat->configured && enable) { in omap3isp_stat_enable()
764 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_enable()
765 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_enable()
766 dev_dbg(stat->isp->dev, "%s: cannot enable module as it's " in omap3isp_stat_enable()
768 stat->subdev.name); in omap3isp_stat_enable()
773 if (stat->state == ISPSTAT_DISABLING) in omap3isp_stat_enable()
775 stat->state = ISPSTAT_ENABLED; in omap3isp_stat_enable()
776 else if (stat->state == ISPSTAT_DISABLED) in omap3isp_stat_enable()
778 stat->state = ISPSTAT_ENABLING; in omap3isp_stat_enable()
780 if (stat->state == ISPSTAT_ENABLING) { in omap3isp_stat_enable()
782 stat->state = ISPSTAT_DISABLED; in omap3isp_stat_enable()
783 } else if (stat->state == ISPSTAT_ENABLED) { in omap3isp_stat_enable()
785 stat->state = ISPSTAT_DISABLING; in omap3isp_stat_enable()
786 isp_stat_buf_clear(stat); in omap3isp_stat_enable()
790 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_enable()
791 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_enable()
798 struct ispstat *stat = v4l2_get_subdevdata(subdev); in omap3isp_stat_s_stream() local
805 isp_stat_try_enable(stat); in omap3isp_stat_s_stream()
809 omap3isp_stat_enable(stat, 0); in omap3isp_stat_s_stream()
810 spin_lock_irqsave(&stat->isp->stat_lock, flags); in omap3isp_stat_s_stream()
811 stat->ops->enable(stat, 0); in omap3isp_stat_s_stream()
812 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in omap3isp_stat_s_stream()
825 if (!omap3isp_stat_pcr_busy(stat)) in omap3isp_stat_s_stream()
826 omap3isp_stat_isr(stat); in omap3isp_stat_s_stream()
828 dev_dbg(stat->isp->dev, "%s: module is being disabled\n", in omap3isp_stat_s_stream()
829 stat->subdev.name); in omap3isp_stat_s_stream()
838 static void __stat_isr(struct ispstat *stat, int from_dma) in __stat_isr() argument
850 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in __stat_isr()
851 if (stat->state == ISPSTAT_DISABLED) { in __stat_isr()
852 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
855 buf_processing = stat->buf_processing; in __stat_isr()
856 stat->buf_processing = 1; in __stat_isr()
857 stat->ops->enable(stat, 0); in __stat_isr()
860 if (stat->state == ISPSTAT_ENABLED) { in __stat_isr()
861 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
862 dev_err(stat->isp->dev, in __stat_isr()
864 "processing a buffer.\n", stat->subdev.name); in __stat_isr()
875 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
879 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
882 if (!omap3isp_stat_pcr_busy(stat)) { in __stat_isr()
883 if (!from_dma && stat->ops->buf_process) in __stat_isr()
885 ret = stat->ops->buf_process(stat); in __stat_isr()
890 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in __stat_isr()
897 if (stat->state == ISPSTAT_DISABLING) { in __stat_isr()
898 stat->state = ISPSTAT_DISABLED; in __stat_isr()
899 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
900 stat->buf_processing = 0; in __stat_isr()
903 pipe = to_isp_pipeline(&stat->subdev.entity); in __stat_isr()
904 stat->frame_number = atomic_read(&pipe->frame_number); in __stat_isr()
911 ret = isp_stat_buf_process(stat, ret); in __stat_isr()
913 if (likely(!stat->sbl_ovl_recover)) { in __stat_isr()
914 stat->ops->setup_regs(stat, stat->priv); in __stat_isr()
921 stat->update = 1; in __stat_isr()
922 stat->ops->setup_regs(stat, stat->recover_priv); in __stat_isr()
923 stat->sbl_ovl_recover = 0; in __stat_isr()
929 stat->update = 1; in __stat_isr()
932 isp_stat_buf_insert_magic(stat, stat->active_buf); in __stat_isr()
945 isp_stat_pcr_enable(stat, 1); in __stat_isr()
946 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
958 if (stat->ops->buf_process) in __stat_isr()
965 atomic_set(&stat->buf_err, 1); in __stat_isr()
968 dev_dbg(stat->isp->dev, "%s: cannot process buffer, " in __stat_isr()
969 "device is busy.\n", stat->subdev.name); in __stat_isr()
973 stat->buf_processing = 0; in __stat_isr()
974 isp_stat_queue_event(stat, ret != STAT_BUF_DONE); in __stat_isr()
977 void omap3isp_stat_isr(struct ispstat *stat) in omap3isp_stat_isr() argument
979 __stat_isr(stat, 0); in omap3isp_stat_isr()
982 void omap3isp_stat_dma_isr(struct ispstat *stat) in omap3isp_stat_dma_isr() argument
984 __stat_isr(stat, 1); in omap3isp_stat_dma_isr()
991 struct ispstat *stat = v4l2_get_subdevdata(subdev); in omap3isp_stat_subscribe_event() local
993 if (sub->type != stat->event_type) in omap3isp_stat_subscribe_event()
1006 void omap3isp_stat_unregister_entities(struct ispstat *stat) in omap3isp_stat_unregister_entities() argument
1008 v4l2_device_unregister_subdev(&stat->subdev); in omap3isp_stat_unregister_entities()
1011 int omap3isp_stat_register_entities(struct ispstat *stat, in omap3isp_stat_register_entities() argument
1014 return v4l2_device_register_subdev(vdev, &stat->subdev); in omap3isp_stat_register_entities()
1017 static int isp_stat_init_entities(struct ispstat *stat, const char *name, in isp_stat_init_entities() argument
1020 struct v4l2_subdev *subdev = &stat->subdev; in isp_stat_init_entities()
1027 v4l2_set_subdevdata(subdev, stat); in isp_stat_init_entities()
1029 stat->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; in isp_stat_init_entities()
1032 return media_entity_init(me, 1, &stat->pad, 0); in isp_stat_init_entities()
1035 int omap3isp_stat_init(struct ispstat *stat, const char *name, in omap3isp_stat_init() argument
1040 stat->buf = kcalloc(STAT_MAX_BUFS, sizeof(*stat->buf), GFP_KERNEL); in omap3isp_stat_init()
1041 if (!stat->buf) in omap3isp_stat_init()
1044 isp_stat_buf_clear(stat); in omap3isp_stat_init()
1045 mutex_init(&stat->ioctl_lock); in omap3isp_stat_init()
1046 atomic_set(&stat->buf_err, 0); in omap3isp_stat_init()
1048 ret = isp_stat_init_entities(stat, name, sd_ops); in omap3isp_stat_init()
1050 mutex_destroy(&stat->ioctl_lock); in omap3isp_stat_init()
1051 kfree(stat->buf); in omap3isp_stat_init()
1057 void omap3isp_stat_cleanup(struct ispstat *stat) in omap3isp_stat_cleanup() argument
1059 media_entity_cleanup(&stat->subdev.entity); in omap3isp_stat_cleanup()
1060 mutex_destroy(&stat->ioctl_lock); in omap3isp_stat_cleanup()
1061 isp_stat_bufs_free(stat); in omap3isp_stat_cleanup()
1062 kfree(stat->buf); in omap3isp_stat_cleanup()