Lines Matching full:stat
25 #define ISP_STAT_USES_DMAENGINE(stat) ((stat)->dma_ch != NULL) argument
59 #define IS_H3A_AF(stat) ((stat) == &(stat)->isp->isp_af) argument
60 #define IS_H3A_AEWB(stat) ((stat) == &(stat)->isp->isp_aewb) argument
61 #define IS_H3A(stat) (IS_H3A_AF(stat) || IS_H3A_AEWB(stat)) argument
63 static void __isp_stat_buf_sync_magic(struct ispstat *stat, in __isp_stat_buf_sync_magic() argument
71 dma_sync(stat->isp->dev, buf->dma_addr, 0, MAGIC_SIZE, dir); in __isp_stat_buf_sync_magic()
72 dma_sync(stat->isp->dev, buf->dma_addr + (buf_size & PAGE_MASK), in __isp_stat_buf_sync_magic()
76 static void isp_stat_buf_sync_magic_for_device(struct ispstat *stat, in isp_stat_buf_sync_magic_for_device() argument
81 if (ISP_STAT_USES_DMAENGINE(stat)) in isp_stat_buf_sync_magic_for_device()
84 __isp_stat_buf_sync_magic(stat, buf, buf_size, dir, in isp_stat_buf_sync_magic_for_device()
88 static void isp_stat_buf_sync_magic_for_cpu(struct ispstat *stat, in isp_stat_buf_sync_magic_for_cpu() argument
93 if (ISP_STAT_USES_DMAENGINE(stat)) in isp_stat_buf_sync_magic_for_cpu()
96 __isp_stat_buf_sync_magic(stat, buf, buf_size, dir, in isp_stat_buf_sync_magic_for_cpu()
100 static int isp_stat_buf_check_magic(struct ispstat *stat, in isp_stat_buf_check_magic() argument
103 const u32 buf_size = IS_H3A_AF(stat) ? in isp_stat_buf_check_magic()
109 isp_stat_buf_sync_magic_for_cpu(stat, buf, buf_size, DMA_FROM_DEVICE); in isp_stat_buf_check_magic()
117 dev_dbg(stat->isp->dev, in isp_stat_buf_check_magic()
119 stat->subdev.name); in isp_stat_buf_check_magic()
127 dev_dbg(stat->isp->dev, in isp_stat_buf_check_magic()
129 stat->subdev.name); in isp_stat_buf_check_magic()
134 isp_stat_buf_sync_magic_for_device(stat, buf, buf_size, in isp_stat_buf_check_magic()
140 static void isp_stat_buf_insert_magic(struct ispstat *stat, in isp_stat_buf_insert_magic() argument
143 const u32 buf_size = IS_H3A_AF(stat) ? in isp_stat_buf_insert_magic()
144 stat->buf_size + AF_EXTRA_DATA : stat->buf_size; in isp_stat_buf_insert_magic()
146 isp_stat_buf_sync_magic_for_cpu(stat, buf, buf_size, DMA_FROM_DEVICE); in isp_stat_buf_insert_magic()
152 * stat->buf_size. in isp_stat_buf_insert_magic()
157 isp_stat_buf_sync_magic_for_device(stat, buf, buf_size, in isp_stat_buf_insert_magic()
161 static void isp_stat_buf_sync_for_device(struct ispstat *stat, in isp_stat_buf_sync_for_device() argument
164 if (ISP_STAT_USES_DMAENGINE(stat)) in isp_stat_buf_sync_for_device()
167 dma_sync_sg_for_device(stat->isp->dev, buf->sgt.sgl, in isp_stat_buf_sync_for_device()
171 static void isp_stat_buf_sync_for_cpu(struct ispstat *stat, in isp_stat_buf_sync_for_cpu() argument
174 if (ISP_STAT_USES_DMAENGINE(stat)) in isp_stat_buf_sync_for_cpu()
177 dma_sync_sg_for_cpu(stat->isp->dev, buf->sgt.sgl, in isp_stat_buf_sync_for_cpu()
181 static void isp_stat_buf_clear(struct ispstat *stat) in isp_stat_buf_clear() argument
186 stat->buf[i].empty = 1; in isp_stat_buf_clear()
190 __isp_stat_buf_find(struct ispstat *stat, int look_empty) in __isp_stat_buf_find() argument
196 struct ispstat_buffer *curr = &stat->buf[i]; in __isp_stat_buf_find()
202 if (curr == stat->locked_buf || curr == stat->active_buf) in __isp_stat_buf_find()
225 isp_stat_buf_find_oldest(struct ispstat *stat) in isp_stat_buf_find_oldest() argument
227 return __isp_stat_buf_find(stat, 0); in isp_stat_buf_find_oldest()
231 isp_stat_buf_find_oldest_or_empty(struct ispstat *stat) in isp_stat_buf_find_oldest_or_empty() argument
233 return __isp_stat_buf_find(stat, 1); in isp_stat_buf_find_oldest_or_empty()
236 static int isp_stat_buf_queue(struct ispstat *stat) in isp_stat_buf_queue() argument
238 if (!stat->active_buf) in isp_stat_buf_queue()
241 ktime_get_ts64(&stat->active_buf->ts); in isp_stat_buf_queue()
243 stat->active_buf->buf_size = stat->buf_size; in isp_stat_buf_queue()
244 if (isp_stat_buf_check_magic(stat, stat->active_buf)) { in isp_stat_buf_queue()
245 dev_dbg(stat->isp->dev, "%s: data wasn't properly written.\n", in isp_stat_buf_queue()
246 stat->subdev.name); in isp_stat_buf_queue()
249 stat->active_buf->config_counter = stat->config_counter; in isp_stat_buf_queue()
250 stat->active_buf->frame_number = stat->frame_number; in isp_stat_buf_queue()
251 stat->active_buf->empty = 0; in isp_stat_buf_queue()
252 stat->active_buf = NULL; in isp_stat_buf_queue()
258 static void isp_stat_buf_next(struct ispstat *stat) in isp_stat_buf_next() argument
260 if (unlikely(stat->active_buf)) in isp_stat_buf_next()
262 dev_dbg(stat->isp->dev, in isp_stat_buf_next()
264 stat->subdev.name); in isp_stat_buf_next()
266 stat->active_buf = isp_stat_buf_find_oldest_or_empty(stat); in isp_stat_buf_next()
269 static void isp_stat_buf_release(struct ispstat *stat) in isp_stat_buf_release() argument
273 isp_stat_buf_sync_for_device(stat, stat->locked_buf); in isp_stat_buf_release()
274 spin_lock_irqsave(&stat->isp->stat_lock, flags); in isp_stat_buf_release()
275 stat->locked_buf = NULL; in isp_stat_buf_release()
276 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_buf_release()
280 static struct ispstat_buffer *isp_stat_buf_get(struct ispstat *stat, in isp_stat_buf_get() argument
287 spin_lock_irqsave(&stat->isp->stat_lock, flags); in isp_stat_buf_get()
290 buf = isp_stat_buf_find_oldest(stat); in isp_stat_buf_get()
292 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_buf_get()
293 dev_dbg(stat->isp->dev, "%s: cannot find a buffer.\n", in isp_stat_buf_get()
294 stat->subdev.name); in isp_stat_buf_get()
297 if (isp_stat_buf_check_magic(stat, buf)) { in isp_stat_buf_get()
298 dev_dbg(stat->isp->dev, in isp_stat_buf_get()
300 stat->subdev.name); in isp_stat_buf_get()
309 stat->locked_buf = buf; in isp_stat_buf_get()
311 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_buf_get()
314 dev_warn(stat->isp->dev, in isp_stat_buf_get()
316 stat->subdev.name); in isp_stat_buf_get()
317 isp_stat_buf_release(stat); in isp_stat_buf_get()
321 isp_stat_buf_sync_for_cpu(stat, buf); in isp_stat_buf_get()
328 dev_info(stat->isp->dev, in isp_stat_buf_get()
329 "%s: failed copying %d bytes of stat data\n", in isp_stat_buf_get()
330 stat->subdev.name, rval); in isp_stat_buf_get()
332 isp_stat_buf_release(stat); in isp_stat_buf_get()
338 static void isp_stat_bufs_free(struct ispstat *stat) in isp_stat_bufs_free() argument
340 struct device *dev = ISP_STAT_USES_DMAENGINE(stat) in isp_stat_bufs_free()
341 ? NULL : stat->isp->dev; in isp_stat_bufs_free()
345 struct ispstat_buffer *buf = &stat->buf[i]; in isp_stat_bufs_free()
352 dma_free_coherent(dev, stat->buf_alloc_size, buf->virt_addr, in isp_stat_bufs_free()
360 dev_dbg(stat->isp->dev, "%s: all buffers were freed.\n", in isp_stat_bufs_free()
361 stat->subdev.name); in isp_stat_bufs_free()
363 stat->buf_alloc_size = 0; in isp_stat_bufs_free()
364 stat->active_buf = NULL; in isp_stat_bufs_free()
406 static int isp_stat_bufs_alloc(struct ispstat *stat, u32 size) in isp_stat_bufs_alloc() argument
408 struct device *dev = ISP_STAT_USES_DMAENGINE(stat) in isp_stat_bufs_alloc()
409 ? NULL : stat->isp->dev; in isp_stat_bufs_alloc()
413 spin_lock_irqsave(&stat->isp->stat_lock, flags); in isp_stat_bufs_alloc()
415 BUG_ON(stat->locked_buf != NULL); in isp_stat_bufs_alloc()
418 if (stat->buf_alloc_size >= size) { in isp_stat_bufs_alloc()
419 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_bufs_alloc()
423 if (stat->state != ISPSTAT_DISABLED || stat->buf_processing) { in isp_stat_bufs_alloc()
424 dev_info(stat->isp->dev, in isp_stat_bufs_alloc()
426 stat->subdev.name); in isp_stat_bufs_alloc()
427 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_bufs_alloc()
431 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in isp_stat_bufs_alloc()
433 isp_stat_bufs_free(stat); in isp_stat_bufs_alloc()
435 stat->buf_alloc_size = size; in isp_stat_bufs_alloc()
438 struct ispstat_buffer *buf = &stat->buf[i]; in isp_stat_bufs_alloc()
443 dev_err(stat->isp->dev, in isp_stat_bufs_alloc()
445 stat->subdev.name, i); in isp_stat_bufs_alloc()
446 isp_stat_bufs_free(stat); in isp_stat_bufs_alloc()
452 dev_dbg(stat->isp->dev, in isp_stat_bufs_alloc()
454 stat->subdev.name, i, &buf->dma_addr, buf->virt_addr); in isp_stat_bufs_alloc()
460 static void isp_stat_queue_event(struct ispstat *stat, int err) in isp_stat_queue_event() argument
462 struct video_device *vdev = stat->subdev.devnode; in isp_stat_queue_event()
468 status->frame_number = stat->frame_number; in isp_stat_queue_event()
469 status->config_counter = stat->config_counter; in isp_stat_queue_event()
473 event.type = stat->event_type; in isp_stat_queue_event()
484 int omap3isp_stat_request_statistics(struct ispstat *stat, in omap3isp_stat_request_statistics() argument
489 if (stat->state != ISPSTAT_ENABLED) { in omap3isp_stat_request_statistics()
490 dev_dbg(stat->isp->dev, "%s: engine not enabled.\n", in omap3isp_stat_request_statistics()
491 stat->subdev.name); in omap3isp_stat_request_statistics()
495 mutex_lock(&stat->ioctl_lock); in omap3isp_stat_request_statistics()
496 buf = isp_stat_buf_get(stat, data); in omap3isp_stat_request_statistics()
498 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_request_statistics()
509 isp_stat_buf_release(stat); in omap3isp_stat_request_statistics()
510 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_request_statistics()
515 int omap3isp_stat_request_statistics_time32(struct ispstat *stat, in omap3isp_stat_request_statistics_time32() argument
521 ret = omap3isp_stat_request_statistics(stat, &data64); in omap3isp_stat_request_statistics_time32()
540 int omap3isp_stat_config(struct ispstat *stat, void *new_conf) in omap3isp_stat_config() argument
547 mutex_lock(&stat->ioctl_lock); in omap3isp_stat_config()
549 dev_dbg(stat->isp->dev, in omap3isp_stat_config()
551 stat->subdev.name, (unsigned long)buf_size); in omap3isp_stat_config()
553 ret = stat->ops->validate_params(stat, new_conf); in omap3isp_stat_config()
555 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_config()
556 dev_dbg(stat->isp->dev, "%s: configuration values are invalid.\n", in omap3isp_stat_config()
557 stat->subdev.name); in omap3isp_stat_config()
562 dev_dbg(stat->isp->dev, in omap3isp_stat_config()
564 stat->subdev.name, in omap3isp_stat_config()
578 if (IS_H3A(stat)) { in omap3isp_stat_config()
580 if (IS_H3A_AF(stat)) in omap3isp_stat_config()
586 if (stat->recover_priv) { in omap3isp_stat_config()
588 stat->recover_priv; in omap3isp_stat_config()
597 ret = isp_stat_bufs_alloc(stat, buf_size); in omap3isp_stat_config()
599 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_config()
603 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in omap3isp_stat_config()
604 stat->ops->set_params(stat, new_conf); in omap3isp_stat_config()
605 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_config()
611 user_cfg->config_counter = stat->config_counter + stat->inc_config; in omap3isp_stat_config()
614 stat->configured = 1; in omap3isp_stat_config()
615 dev_dbg(stat->isp->dev, in omap3isp_stat_config()
617 stat->subdev.name); in omap3isp_stat_config()
619 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_config()
630 static int isp_stat_buf_process(struct ispstat *stat, int buf_state) in isp_stat_buf_process() argument
634 if (!atomic_add_unless(&stat->buf_err, -1, 0) && in isp_stat_buf_process()
635 buf_state == STAT_BUF_DONE && stat->state == ISPSTAT_ENABLED) { in isp_stat_buf_process()
636 ret = isp_stat_buf_queue(stat); in isp_stat_buf_process()
637 isp_stat_buf_next(stat); in isp_stat_buf_process()
643 int omap3isp_stat_pcr_busy(struct ispstat *stat) in omap3isp_stat_pcr_busy() argument
645 return stat->ops->busy(stat); in omap3isp_stat_pcr_busy()
648 int omap3isp_stat_busy(struct ispstat *stat) in omap3isp_stat_busy() argument
650 return omap3isp_stat_pcr_busy(stat) | stat->buf_processing | in omap3isp_stat_busy()
651 (stat->state != ISPSTAT_DISABLED); in omap3isp_stat_busy()
661 static void isp_stat_pcr_enable(struct ispstat *stat, u8 pcr_enable) in isp_stat_pcr_enable() argument
663 if ((stat->state != ISPSTAT_ENABLING && in isp_stat_pcr_enable()
664 stat->state != ISPSTAT_ENABLED) && pcr_enable) in isp_stat_pcr_enable()
668 stat->ops->enable(stat, pcr_enable); in isp_stat_pcr_enable()
669 if (stat->state == ISPSTAT_DISABLING && !pcr_enable) in isp_stat_pcr_enable()
670 stat->state = ISPSTAT_DISABLED; in isp_stat_pcr_enable()
671 else if (stat->state == ISPSTAT_ENABLING && pcr_enable) in isp_stat_pcr_enable()
672 stat->state = ISPSTAT_ENABLED; in isp_stat_pcr_enable()
675 void omap3isp_stat_suspend(struct ispstat *stat) in omap3isp_stat_suspend() argument
679 spin_lock_irqsave(&stat->isp->stat_lock, flags); in omap3isp_stat_suspend()
681 if (stat->state != ISPSTAT_DISABLED) in omap3isp_stat_suspend()
682 stat->ops->enable(stat, 0); in omap3isp_stat_suspend()
683 if (stat->state == ISPSTAT_ENABLED) in omap3isp_stat_suspend()
684 stat->state = ISPSTAT_SUSPENDED; in omap3isp_stat_suspend()
686 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in omap3isp_stat_suspend()
689 void omap3isp_stat_resume(struct ispstat *stat) in omap3isp_stat_resume() argument
692 if (stat->state == ISPSTAT_SUSPENDED) in omap3isp_stat_resume()
693 stat->state = ISPSTAT_ENABLING; in omap3isp_stat_resume()
696 static void isp_stat_try_enable(struct ispstat *stat) in isp_stat_try_enable() argument
700 if (stat->priv == NULL) in isp_stat_try_enable()
704 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in isp_stat_try_enable()
705 if (stat->state == ISPSTAT_ENABLING && !stat->buf_processing && in isp_stat_try_enable()
706 stat->buf_alloc_size) { in isp_stat_try_enable()
711 stat->update = 1; in isp_stat_try_enable()
712 isp_stat_buf_next(stat); in isp_stat_try_enable()
713 stat->ops->setup_regs(stat, stat->priv); in isp_stat_try_enable()
714 isp_stat_buf_insert_magic(stat, stat->active_buf); in isp_stat_try_enable()
722 if (!IS_H3A(stat)) in isp_stat_try_enable()
723 atomic_set(&stat->buf_err, 0); in isp_stat_try_enable()
725 isp_stat_pcr_enable(stat, 1); in isp_stat_try_enable()
726 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in isp_stat_try_enable()
727 dev_dbg(stat->isp->dev, "%s: module is enabled.\n", in isp_stat_try_enable()
728 stat->subdev.name); in isp_stat_try_enable()
730 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in isp_stat_try_enable()
734 void omap3isp_stat_isr_frame_sync(struct ispstat *stat) in omap3isp_stat_isr_frame_sync() argument
736 isp_stat_try_enable(stat); in omap3isp_stat_isr_frame_sync()
739 void omap3isp_stat_sbl_overflow(struct ispstat *stat) in omap3isp_stat_sbl_overflow() argument
743 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in omap3isp_stat_sbl_overflow()
748 atomic_set(&stat->buf_err, 2); in omap3isp_stat_sbl_overflow()
753 * stat->sbl_ovl_recover is set to tell to the driver to temporarily use in omap3isp_stat_sbl_overflow()
756 if (stat->recover_priv) in omap3isp_stat_sbl_overflow()
757 stat->sbl_ovl_recover = 1; in omap3isp_stat_sbl_overflow()
758 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_sbl_overflow()
768 int omap3isp_stat_enable(struct ispstat *stat, u8 enable) in omap3isp_stat_enable() argument
772 dev_dbg(stat->isp->dev, "%s: user wants to %s module.\n", in omap3isp_stat_enable()
773 stat->subdev.name, enable ? "enable" : "disable"); in omap3isp_stat_enable()
776 mutex_lock(&stat->ioctl_lock); in omap3isp_stat_enable()
778 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in omap3isp_stat_enable()
780 if (!stat->configured && enable) { in omap3isp_stat_enable()
781 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_enable()
782 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_enable()
783 dev_dbg(stat->isp->dev, in omap3isp_stat_enable()
785 stat->subdev.name); in omap3isp_stat_enable()
790 if (stat->state == ISPSTAT_DISABLING) in omap3isp_stat_enable()
792 stat->state = ISPSTAT_ENABLED; in omap3isp_stat_enable()
793 else if (stat->state == ISPSTAT_DISABLED) in omap3isp_stat_enable()
795 stat->state = ISPSTAT_ENABLING; in omap3isp_stat_enable()
797 if (stat->state == ISPSTAT_ENABLING) { in omap3isp_stat_enable()
799 stat->state = ISPSTAT_DISABLED; in omap3isp_stat_enable()
800 } else if (stat->state == ISPSTAT_ENABLED) { in omap3isp_stat_enable()
802 stat->state = ISPSTAT_DISABLING; in omap3isp_stat_enable()
803 isp_stat_buf_clear(stat); in omap3isp_stat_enable()
807 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_enable()
808 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_enable()
815 struct ispstat *stat = v4l2_get_subdevdata(subdev); in omap3isp_stat_s_stream() local
822 isp_stat_try_enable(stat); in omap3isp_stat_s_stream()
826 omap3isp_stat_enable(stat, 0); in omap3isp_stat_s_stream()
827 spin_lock_irqsave(&stat->isp->stat_lock, flags); in omap3isp_stat_s_stream()
828 stat->ops->enable(stat, 0); in omap3isp_stat_s_stream()
829 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in omap3isp_stat_s_stream()
842 if (!omap3isp_stat_pcr_busy(stat)) in omap3isp_stat_s_stream()
843 omap3isp_stat_isr(stat); in omap3isp_stat_s_stream()
845 dev_dbg(stat->isp->dev, "%s: module is being disabled\n", in omap3isp_stat_s_stream()
846 stat->subdev.name); in omap3isp_stat_s_stream()
855 static void __stat_isr(struct ispstat *stat, int from_dma) in __stat_isr() argument
863 * stat->buf_processing must be set before disable module. It's in __stat_isr()
867 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in __stat_isr()
868 if (stat->state == ISPSTAT_DISABLED) { in __stat_isr()
869 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
872 buf_processing = stat->buf_processing; in __stat_isr()
873 stat->buf_processing = 1; in __stat_isr()
874 stat->ops->enable(stat, 0); in __stat_isr()
877 if (stat->state == ISPSTAT_ENABLED) { in __stat_isr()
878 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
879 dev_err(stat->isp->dev, in __stat_isr()
881 stat->subdev.name); in __stat_isr()
892 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
896 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
899 if (!omap3isp_stat_pcr_busy(stat)) { in __stat_isr()
900 if (!from_dma && stat->ops->buf_process) in __stat_isr()
902 ret = stat->ops->buf_process(stat); in __stat_isr()
907 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in __stat_isr()
912 * can return only after call stat's buf_process() operator. in __stat_isr()
914 if (stat->state == ISPSTAT_DISABLING) { in __stat_isr()
915 stat->state = ISPSTAT_DISABLED; in __stat_isr()
916 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
917 stat->buf_processing = 0; in __stat_isr()
920 pipe = to_isp_pipeline(&stat->subdev.entity); in __stat_isr()
921 stat->frame_number = atomic_read(&pipe->frame_number); in __stat_isr()
928 ret = isp_stat_buf_process(stat, ret); in __stat_isr()
930 if (likely(!stat->sbl_ovl_recover)) { in __stat_isr()
931 stat->ops->setup_regs(stat, stat->priv); in __stat_isr()
938 stat->update = 1; in __stat_isr()
939 stat->ops->setup_regs(stat, stat->recover_priv); in __stat_isr()
940 stat->sbl_ovl_recover = 0; in __stat_isr()
946 stat->update = 1; in __stat_isr()
949 isp_stat_buf_insert_magic(stat, stat->active_buf); in __stat_isr()
962 isp_stat_pcr_enable(stat, 1); in __stat_isr()
963 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
967 * to process the buffer, stat->buf_err is set and won't be in __stat_isr()
972 * Do not "stat->buf_err = 0" here. in __stat_isr()
975 if (stat->ops->buf_process) in __stat_isr()
982 atomic_set(&stat->buf_err, 1); in __stat_isr()
985 dev_dbg(stat->isp->dev, in __stat_isr()
987 stat->subdev.name); in __stat_isr()
991 stat->buf_processing = 0; in __stat_isr()
992 isp_stat_queue_event(stat, ret != STAT_BUF_DONE); in __stat_isr()
995 void omap3isp_stat_isr(struct ispstat *stat) in omap3isp_stat_isr() argument
997 __stat_isr(stat, 0); in omap3isp_stat_isr()
1000 void omap3isp_stat_dma_isr(struct ispstat *stat) in omap3isp_stat_dma_isr() argument
1002 __stat_isr(stat, 1); in omap3isp_stat_dma_isr()
1009 struct ispstat *stat = v4l2_get_subdevdata(subdev); in omap3isp_stat_subscribe_event() local
1011 if (sub->type != stat->event_type) in omap3isp_stat_subscribe_event()
1024 void omap3isp_stat_unregister_entities(struct ispstat *stat) in omap3isp_stat_unregister_entities() argument
1026 v4l2_device_unregister_subdev(&stat->subdev); in omap3isp_stat_unregister_entities()
1029 int omap3isp_stat_register_entities(struct ispstat *stat, in omap3isp_stat_register_entities() argument
1032 stat->subdev.dev = vdev->mdev->dev; in omap3isp_stat_register_entities()
1034 return v4l2_device_register_subdev(vdev, &stat->subdev); in omap3isp_stat_register_entities()
1037 static int isp_stat_init_entities(struct ispstat *stat, const char *name, in isp_stat_init_entities() argument
1040 struct v4l2_subdev *subdev = &stat->subdev; in isp_stat_init_entities()
1047 v4l2_set_subdevdata(subdev, stat); in isp_stat_init_entities()
1049 stat->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; in isp_stat_init_entities()
1052 return media_entity_pads_init(me, 1, &stat->pad); in isp_stat_init_entities()
1055 int omap3isp_stat_init(struct ispstat *stat, const char *name, in omap3isp_stat_init() argument
1060 stat->buf = kcalloc(STAT_MAX_BUFS, sizeof(*stat->buf), GFP_KERNEL); in omap3isp_stat_init()
1061 if (!stat->buf) in omap3isp_stat_init()
1064 isp_stat_buf_clear(stat); in omap3isp_stat_init()
1065 mutex_init(&stat->ioctl_lock); in omap3isp_stat_init()
1066 atomic_set(&stat->buf_err, 0); in omap3isp_stat_init()
1068 ret = isp_stat_init_entities(stat, name, sd_ops); in omap3isp_stat_init()
1070 mutex_destroy(&stat->ioctl_lock); in omap3isp_stat_init()
1071 kfree(stat->buf); in omap3isp_stat_init()
1077 void omap3isp_stat_cleanup(struct ispstat *stat) in omap3isp_stat_cleanup() argument
1079 media_entity_cleanup(&stat->subdev.entity); in omap3isp_stat_cleanup()
1080 mutex_destroy(&stat->ioctl_lock); in omap3isp_stat_cleanup()
1081 isp_stat_bufs_free(stat); in omap3isp_stat_cleanup()
1082 kfree(stat->buf); in omap3isp_stat_cleanup()