Lines Matching refs:gsc

30 	struct gsc_dev *gsc = ctx->gsc_dev;  in gsc_m2m_ctx_stop_req()  local
33 curr_ctx = v4l2_m2m_get_curr_priv(gsc->m2m.m2m_dev); in gsc_m2m_ctx_stop_req()
34 if (!gsc_m2m_pending(gsc) || (curr_ctx != ctx)) in gsc_m2m_ctx_stop_req()
38 ret = wait_event_timeout(gsc->irq_queue, in gsc_m2m_ctx_stop_req()
149 struct gsc_dev *gsc; in gsc_m2m_device_run() local
157 gsc = ctx->gsc_dev; in gsc_m2m_device_run()
158 spin_lock_irqsave(&gsc->slock, flags); in gsc_m2m_device_run()
160 set_bit(ST_M2M_PEND, &gsc->state); in gsc_m2m_device_run()
163 if (gsc->m2m.ctx != ctx) { in gsc_m2m_device_run()
165 gsc->m2m.ctx, ctx); in gsc_m2m_device_run()
167 gsc->m2m.ctx = ctx; in gsc_m2m_device_run()
174 wake_up(&gsc->irq_queue); in gsc_m2m_device_run()
184 gsc_set_prefbuf(gsc, &ctx->s_frame); in gsc_m2m_device_run()
185 gsc_hw_set_input_addr(gsc, &ctx->s_frame.addr, GSC_M2M_BUF_NUM); in gsc_m2m_device_run()
186 gsc_hw_set_output_addr(gsc, &ctx->d_frame.addr, GSC_M2M_BUF_NUM); in gsc_m2m_device_run()
189 gsc_hw_set_input_buf_masking(gsc, GSC_M2M_BUF_NUM, false); in gsc_m2m_device_run()
190 gsc_hw_set_output_buf_masking(gsc, GSC_M2M_BUF_NUM, false); in gsc_m2m_device_run()
191 gsc_hw_set_frm_done_irq_mask(gsc, false); in gsc_m2m_device_run()
192 gsc_hw_set_gsc_irq_enable(gsc, true); in gsc_m2m_device_run()
217 gsc_hw_enable_control(gsc, true); in gsc_m2m_device_run()
219 spin_unlock_irqrestore(&gsc->slock, flags); in gsc_m2m_device_run()
224 spin_unlock_irqrestore(&gsc->slock, flags); in gsc_m2m_device_run()
291 struct gsc_dev *gsc = ctx->gsc_dev; in gsc_m2m_querycap() local
296 dev_name(&gsc->pdev->dev)); in gsc_m2m_querycap()
372 struct gsc_dev *gsc = ctx->gsc_dev; in gsc_m2m_reqbufs() local
376 gsc->variant->in_buf_cnt : gsc->variant->out_buf_cnt; in gsc_m2m_reqbufs()
615 struct gsc_dev *gsc = video_drvdata(file); in gsc_m2m_open() local
619 pr_debug("pid: %d, state: 0x%lx", task_pid_nr(current), gsc->state); in gsc_m2m_open()
621 if (mutex_lock_interruptible(&gsc->lock)) in gsc_m2m_open()
630 v4l2_fh_init(&ctx->fh, gsc->m2m.vfd); in gsc_m2m_open()
640 ctx->gsc_dev = gsc; in gsc_m2m_open()
650 ctx->m2m_ctx = v4l2_m2m_ctx_init(gsc->m2m.m2m_dev, ctx, queue_init); in gsc_m2m_open()
657 if (gsc->m2m.refcnt++ == 0) in gsc_m2m_open()
658 set_bit(ST_M2M_OPEN, &gsc->state); in gsc_m2m_open()
662 mutex_unlock(&gsc->lock); in gsc_m2m_open()
672 mutex_unlock(&gsc->lock); in gsc_m2m_open()
679 struct gsc_dev *gsc = ctx->gsc_dev; in gsc_m2m_release() local
682 task_pid_nr(current), gsc->state, gsc->m2m.refcnt); in gsc_m2m_release()
684 mutex_lock(&gsc->lock); in gsc_m2m_release()
691 if (--gsc->m2m.refcnt <= 0) in gsc_m2m_release()
692 clear_bit(ST_M2M_OPEN, &gsc->state); in gsc_m2m_release()
695 mutex_unlock(&gsc->lock); in gsc_m2m_release()
703 struct gsc_dev *gsc = ctx->gsc_dev; in gsc_m2m_poll() local
706 if (mutex_lock_interruptible(&gsc->lock)) in gsc_m2m_poll()
710 mutex_unlock(&gsc->lock); in gsc_m2m_poll()
718 struct gsc_dev *gsc = ctx->gsc_dev; in gsc_m2m_mmap() local
721 if (mutex_lock_interruptible(&gsc->lock)) in gsc_m2m_mmap()
725 mutex_unlock(&gsc->lock); in gsc_m2m_mmap()
744 int gsc_register_m2m_device(struct gsc_dev *gsc) in gsc_register_m2m_device() argument
749 if (!gsc) in gsc_register_m2m_device()
752 pdev = gsc->pdev; in gsc_register_m2m_device()
754 gsc->vdev.fops = &gsc_m2m_fops; in gsc_register_m2m_device()
755 gsc->vdev.ioctl_ops = &gsc_m2m_ioctl_ops; in gsc_register_m2m_device()
756 gsc->vdev.release = video_device_release_empty; in gsc_register_m2m_device()
757 gsc->vdev.lock = &gsc->lock; in gsc_register_m2m_device()
758 gsc->vdev.vfl_dir = VFL_DIR_M2M; in gsc_register_m2m_device()
759 gsc->vdev.v4l2_dev = &gsc->v4l2_dev; in gsc_register_m2m_device()
760 gsc->vdev.device_caps = V4L2_CAP_STREAMING | in gsc_register_m2m_device()
762 snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m", in gsc_register_m2m_device()
763 GSC_MODULE_NAME, gsc->id); in gsc_register_m2m_device()
765 video_set_drvdata(&gsc->vdev, gsc); in gsc_register_m2m_device()
767 gsc->m2m.vfd = &gsc->vdev; in gsc_register_m2m_device()
768 gsc->m2m.m2m_dev = v4l2_m2m_init(&gsc_m2m_ops); in gsc_register_m2m_device()
769 if (IS_ERR(gsc->m2m.m2m_dev)) { in gsc_register_m2m_device()
771 return PTR_ERR(gsc->m2m.m2m_dev); in gsc_register_m2m_device()
774 ret = video_register_device(&gsc->vdev, VFL_TYPE_GRABBER, -1); in gsc_register_m2m_device()
781 pr_debug("gsc m2m driver registered as /dev/video%d", gsc->vdev.num); in gsc_register_m2m_device()
785 v4l2_m2m_release(gsc->m2m.m2m_dev); in gsc_register_m2m_device()
790 void gsc_unregister_m2m_device(struct gsc_dev *gsc) in gsc_unregister_m2m_device() argument
792 if (gsc) { in gsc_unregister_m2m_device()
793 v4l2_m2m_release(gsc->m2m.m2m_dev); in gsc_unregister_m2m_device()
794 video_unregister_device(&gsc->vdev); in gsc_unregister_m2m_device()