• Home
  • Raw
  • Download

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 v4l2_get_timestamp(&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()
505 isp_stat_buf_release(stat); in omap3isp_stat_request_statistics()
506 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_request_statistics()
519 int omap3isp_stat_config(struct ispstat *stat, void *new_conf) in omap3isp_stat_config() argument
527 dev_dbg(stat->isp->dev, "%s: configuration is NULL\n", in omap3isp_stat_config()
528 stat->subdev.name); in omap3isp_stat_config()
532 mutex_lock(&stat->ioctl_lock); in omap3isp_stat_config()
534 dev_dbg(stat->isp->dev, "%s: configuring module with buffer " in omap3isp_stat_config()
535 "size=0x%08lx\n", stat->subdev.name, (unsigned long)buf_size); in omap3isp_stat_config()
537 ret = stat->ops->validate_params(stat, new_conf); in omap3isp_stat_config()
539 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_config()
540 dev_dbg(stat->isp->dev, "%s: configuration values are " in omap3isp_stat_config()
541 "invalid.\n", stat->subdev.name); in omap3isp_stat_config()
546 dev_dbg(stat->isp->dev, "%s: driver has corrected buffer size " in omap3isp_stat_config()
547 "request to 0x%08lx\n", stat->subdev.name, in omap3isp_stat_config()
561 if (IS_H3A(stat)) { in omap3isp_stat_config()
563 if (IS_H3A_AF(stat)) in omap3isp_stat_config()
569 if (stat->recover_priv) { in omap3isp_stat_config()
571 stat->recover_priv; in omap3isp_stat_config()
580 ret = isp_stat_bufs_alloc(stat, buf_size); in omap3isp_stat_config()
582 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_config()
586 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in omap3isp_stat_config()
587 stat->ops->set_params(stat, new_conf); in omap3isp_stat_config()
588 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_config()
594 user_cfg->config_counter = stat->config_counter + stat->inc_config; in omap3isp_stat_config()
597 stat->configured = 1; in omap3isp_stat_config()
598 dev_dbg(stat->isp->dev, "%s: module has been successfully " in omap3isp_stat_config()
599 "configured.\n", stat->subdev.name); in omap3isp_stat_config()
601 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_config()
612 static int isp_stat_buf_process(struct ispstat *stat, int buf_state) in isp_stat_buf_process() argument
616 if (!atomic_add_unless(&stat->buf_err, -1, 0) && in isp_stat_buf_process()
617 buf_state == STAT_BUF_DONE && stat->state == ISPSTAT_ENABLED) { in isp_stat_buf_process()
618 ret = isp_stat_buf_queue(stat); in isp_stat_buf_process()
619 isp_stat_buf_next(stat); in isp_stat_buf_process()
625 int omap3isp_stat_pcr_busy(struct ispstat *stat) in omap3isp_stat_pcr_busy() argument
627 return stat->ops->busy(stat); in omap3isp_stat_pcr_busy()
630 int omap3isp_stat_busy(struct ispstat *stat) in omap3isp_stat_busy() argument
632 return omap3isp_stat_pcr_busy(stat) | stat->buf_processing | in omap3isp_stat_busy()
633 (stat->state != ISPSTAT_DISABLED); in omap3isp_stat_busy()
643 static void isp_stat_pcr_enable(struct ispstat *stat, u8 pcr_enable) in isp_stat_pcr_enable() argument
645 if ((stat->state != ISPSTAT_ENABLING && in isp_stat_pcr_enable()
646 stat->state != ISPSTAT_ENABLED) && pcr_enable) in isp_stat_pcr_enable()
650 stat->ops->enable(stat, pcr_enable); in isp_stat_pcr_enable()
651 if (stat->state == ISPSTAT_DISABLING && !pcr_enable) in isp_stat_pcr_enable()
652 stat->state = ISPSTAT_DISABLED; in isp_stat_pcr_enable()
653 else if (stat->state == ISPSTAT_ENABLING && pcr_enable) in isp_stat_pcr_enable()
654 stat->state = ISPSTAT_ENABLED; in isp_stat_pcr_enable()
657 void omap3isp_stat_suspend(struct ispstat *stat) in omap3isp_stat_suspend() argument
661 spin_lock_irqsave(&stat->isp->stat_lock, flags); in omap3isp_stat_suspend()
663 if (stat->state != ISPSTAT_DISABLED) in omap3isp_stat_suspend()
664 stat->ops->enable(stat, 0); in omap3isp_stat_suspend()
665 if (stat->state == ISPSTAT_ENABLED) in omap3isp_stat_suspend()
666 stat->state = ISPSTAT_SUSPENDED; in omap3isp_stat_suspend()
668 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in omap3isp_stat_suspend()
671 void omap3isp_stat_resume(struct ispstat *stat) in omap3isp_stat_resume() argument
674 if (stat->state == ISPSTAT_SUSPENDED) in omap3isp_stat_resume()
675 stat->state = ISPSTAT_ENABLING; in omap3isp_stat_resume()
678 static void isp_stat_try_enable(struct ispstat *stat) in isp_stat_try_enable() argument
682 if (stat->priv == NULL) in isp_stat_try_enable()
686 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in isp_stat_try_enable()
687 if (stat->state == ISPSTAT_ENABLING && !stat->buf_processing && in isp_stat_try_enable()
688 stat->buf_alloc_size) { in isp_stat_try_enable()
693 stat->update = 1; in isp_stat_try_enable()
694 isp_stat_buf_next(stat); in isp_stat_try_enable()
695 stat->ops->setup_regs(stat, stat->priv); in isp_stat_try_enable()
696 isp_stat_buf_insert_magic(stat, stat->active_buf); in isp_stat_try_enable()
704 if (!IS_H3A(stat)) in isp_stat_try_enable()
705 atomic_set(&stat->buf_err, 0); in isp_stat_try_enable()
707 isp_stat_pcr_enable(stat, 1); in isp_stat_try_enable()
708 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in isp_stat_try_enable()
709 dev_dbg(stat->isp->dev, "%s: module is enabled.\n", in isp_stat_try_enable()
710 stat->subdev.name); in isp_stat_try_enable()
712 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in isp_stat_try_enable()
716 void omap3isp_stat_isr_frame_sync(struct ispstat *stat) in omap3isp_stat_isr_frame_sync() argument
718 isp_stat_try_enable(stat); in omap3isp_stat_isr_frame_sync()
721 void omap3isp_stat_sbl_overflow(struct ispstat *stat) in omap3isp_stat_sbl_overflow() argument
725 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in omap3isp_stat_sbl_overflow()
730 atomic_set(&stat->buf_err, 2); in omap3isp_stat_sbl_overflow()
738 if (stat->recover_priv) in omap3isp_stat_sbl_overflow()
739 stat->sbl_ovl_recover = 1; in omap3isp_stat_sbl_overflow()
740 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_sbl_overflow()
750 int omap3isp_stat_enable(struct ispstat *stat, u8 enable) in omap3isp_stat_enable() argument
754 dev_dbg(stat->isp->dev, "%s: user wants to %s module.\n", in omap3isp_stat_enable()
755 stat->subdev.name, enable ? "enable" : "disable"); in omap3isp_stat_enable()
758 mutex_lock(&stat->ioctl_lock); in omap3isp_stat_enable()
760 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in omap3isp_stat_enable()
762 if (!stat->configured && enable) { in omap3isp_stat_enable()
763 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_enable()
764 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_enable()
765 dev_dbg(stat->isp->dev, "%s: cannot enable module as it's " in omap3isp_stat_enable()
767 stat->subdev.name); in omap3isp_stat_enable()
772 if (stat->state == ISPSTAT_DISABLING) in omap3isp_stat_enable()
774 stat->state = ISPSTAT_ENABLED; in omap3isp_stat_enable()
775 else if (stat->state == ISPSTAT_DISABLED) in omap3isp_stat_enable()
777 stat->state = ISPSTAT_ENABLING; in omap3isp_stat_enable()
779 if (stat->state == ISPSTAT_ENABLING) { in omap3isp_stat_enable()
781 stat->state = ISPSTAT_DISABLED; in omap3isp_stat_enable()
782 } else if (stat->state == ISPSTAT_ENABLED) { in omap3isp_stat_enable()
784 stat->state = ISPSTAT_DISABLING; in omap3isp_stat_enable()
785 isp_stat_buf_clear(stat); in omap3isp_stat_enable()
789 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in omap3isp_stat_enable()
790 mutex_unlock(&stat->ioctl_lock); in omap3isp_stat_enable()
797 struct ispstat *stat = v4l2_get_subdevdata(subdev); in omap3isp_stat_s_stream() local
804 isp_stat_try_enable(stat); in omap3isp_stat_s_stream()
808 omap3isp_stat_enable(stat, 0); in omap3isp_stat_s_stream()
809 spin_lock_irqsave(&stat->isp->stat_lock, flags); in omap3isp_stat_s_stream()
810 stat->ops->enable(stat, 0); in omap3isp_stat_s_stream()
811 spin_unlock_irqrestore(&stat->isp->stat_lock, flags); in omap3isp_stat_s_stream()
824 if (!omap3isp_stat_pcr_busy(stat)) in omap3isp_stat_s_stream()
825 omap3isp_stat_isr(stat); in omap3isp_stat_s_stream()
827 dev_dbg(stat->isp->dev, "%s: module is being disabled\n", in omap3isp_stat_s_stream()
828 stat->subdev.name); in omap3isp_stat_s_stream()
837 static void __stat_isr(struct ispstat *stat, int from_dma) in __stat_isr() argument
849 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in __stat_isr()
850 if (stat->state == ISPSTAT_DISABLED) { in __stat_isr()
851 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
854 buf_processing = stat->buf_processing; in __stat_isr()
855 stat->buf_processing = 1; in __stat_isr()
856 stat->ops->enable(stat, 0); in __stat_isr()
859 if (stat->state == ISPSTAT_ENABLED) { in __stat_isr()
860 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
861 dev_err(stat->isp->dev, in __stat_isr()
863 "processing a buffer.\n", stat->subdev.name); in __stat_isr()
874 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
878 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
881 if (!omap3isp_stat_pcr_busy(stat)) { in __stat_isr()
882 if (!from_dma && stat->ops->buf_process) in __stat_isr()
884 ret = stat->ops->buf_process(stat); in __stat_isr()
889 spin_lock_irqsave(&stat->isp->stat_lock, irqflags); in __stat_isr()
896 if (stat->state == ISPSTAT_DISABLING) { in __stat_isr()
897 stat->state = ISPSTAT_DISABLED; in __stat_isr()
898 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
899 stat->buf_processing = 0; in __stat_isr()
902 pipe = to_isp_pipeline(&stat->subdev.entity); in __stat_isr()
903 stat->frame_number = atomic_read(&pipe->frame_number); in __stat_isr()
910 ret = isp_stat_buf_process(stat, ret); in __stat_isr()
912 if (likely(!stat->sbl_ovl_recover)) { in __stat_isr()
913 stat->ops->setup_regs(stat, stat->priv); in __stat_isr()
920 stat->update = 1; in __stat_isr()
921 stat->ops->setup_regs(stat, stat->recover_priv); in __stat_isr()
922 stat->sbl_ovl_recover = 0; in __stat_isr()
928 stat->update = 1; in __stat_isr()
931 isp_stat_buf_insert_magic(stat, stat->active_buf); in __stat_isr()
944 isp_stat_pcr_enable(stat, 1); in __stat_isr()
945 spin_unlock_irqrestore(&stat->isp->stat_lock, irqflags); in __stat_isr()
957 if (stat->ops->buf_process) in __stat_isr()
964 atomic_set(&stat->buf_err, 1); in __stat_isr()
967 dev_dbg(stat->isp->dev, "%s: cannot process buffer, " in __stat_isr()
968 "device is busy.\n", stat->subdev.name); in __stat_isr()
972 stat->buf_processing = 0; in __stat_isr()
973 isp_stat_queue_event(stat, ret != STAT_BUF_DONE); in __stat_isr()
976 void omap3isp_stat_isr(struct ispstat *stat) in omap3isp_stat_isr() argument
978 __stat_isr(stat, 0); in omap3isp_stat_isr()
981 void omap3isp_stat_dma_isr(struct ispstat *stat) in omap3isp_stat_dma_isr() argument
983 __stat_isr(stat, 1); in omap3isp_stat_dma_isr()
990 struct ispstat *stat = v4l2_get_subdevdata(subdev); in omap3isp_stat_subscribe_event() local
992 if (sub->type != stat->event_type) in omap3isp_stat_subscribe_event()
1005 void omap3isp_stat_unregister_entities(struct ispstat *stat) in omap3isp_stat_unregister_entities() argument
1007 v4l2_device_unregister_subdev(&stat->subdev); in omap3isp_stat_unregister_entities()
1010 int omap3isp_stat_register_entities(struct ispstat *stat, in omap3isp_stat_register_entities() argument
1013 stat->subdev.dev = vdev->mdev->dev; in omap3isp_stat_register_entities()
1015 return v4l2_device_register_subdev(vdev, &stat->subdev); in omap3isp_stat_register_entities()
1018 static int isp_stat_init_entities(struct ispstat *stat, const char *name, in isp_stat_init_entities() argument
1021 struct v4l2_subdev *subdev = &stat->subdev; in isp_stat_init_entities()
1028 v4l2_set_subdevdata(subdev, stat); in isp_stat_init_entities()
1030 stat->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT; in isp_stat_init_entities()
1033 return media_entity_init(me, 1, &stat->pad, 0); in isp_stat_init_entities()
1036 int omap3isp_stat_init(struct ispstat *stat, const char *name, in omap3isp_stat_init() argument
1041 stat->buf = kcalloc(STAT_MAX_BUFS, sizeof(*stat->buf), GFP_KERNEL); in omap3isp_stat_init()
1042 if (!stat->buf) in omap3isp_stat_init()
1045 isp_stat_buf_clear(stat); in omap3isp_stat_init()
1046 mutex_init(&stat->ioctl_lock); in omap3isp_stat_init()
1047 atomic_set(&stat->buf_err, 0); in omap3isp_stat_init()
1049 ret = isp_stat_init_entities(stat, name, sd_ops); in omap3isp_stat_init()
1051 mutex_destroy(&stat->ioctl_lock); in omap3isp_stat_init()
1052 kfree(stat->buf); in omap3isp_stat_init()
1058 void omap3isp_stat_cleanup(struct ispstat *stat) in omap3isp_stat_cleanup() argument
1060 media_entity_cleanup(&stat->subdev.entity); in omap3isp_stat_cleanup()
1061 mutex_destroy(&stat->ioctl_lock); in omap3isp_stat_cleanup()
1062 isp_stat_bufs_free(stat); in omap3isp_stat_cleanup()
1063 kfree(stat->buf); in omap3isp_stat_cleanup()