Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

static int mxc_v4l2out_streamoff ( vout_data *  vout  )  [static]

Shut down the voutera

Parameters:
vout structure vout_data *
Returns:
status 0 Success

Definition at line 1477 of file mxc_v4l2_output.c.

References mxc_free_buffers().

{
      struct fb_info *fbi =
          registered_fb[vout->output_fb_num[vout->cur_disp_output]];
      int i, retval = 0, disp_irq = 0;
      unsigned long lockflag = 0;

      if (!vout)
            return -EINVAL;

      if (vout->state == STATE_STREAM_OFF) {
            return 0;
      }

      ipu_release_disp_sem(vout->display_ch);

      if (INTERLACED_CONTENT(vout))
            ipu_free_irq(IPU_IRQ_PRP_VF_OUT_EOF, vout);
      else
            ipu_free_irq(IPU_IRQ_PP_IN_EOF, vout);

      spin_lock_irqsave(&g_lock, lockflag);

      del_timer(&vout->output_timer);

      if (vout->state == STATE_STREAM_ON) {
            vout->state = STATE_STREAM_STOPPING;
      }

      if (!vout->ic_bypass) {
            if (INTERLACED_CONTENT(vout))
                  ipu_disable_irq(IPU_IRQ_PRP_VF_OUT_EOF);
            else
                  ipu_disable_irq(IPU_IRQ_PP_IN_EOF);
      }

      spin_unlock_irqrestore(&g_lock, lockflag);

      pending_buffer = 0;
      disp_irq = get_display_irq(vout);
      ipu_free_irq(disp_irq, vout);

      if (vout->display_ch == MEM_FG_SYNC) {
            struct mxcfb_pos fb_pos;
            mm_segment_t old_fs;

            fb_pos.x = 0;
            fb_pos.y = 0;
            if (fbi->fbops->fb_ioctl) {
                  old_fs = get_fs();
                  set_fs(KERNEL_DS);
                  fbi->fbops->fb_ioctl(fbi, MXCFB_SET_OVERLAY_POS,
                              (unsigned long)&fb_pos);
                  set_fs(old_fs);
            }
      }

      if (vout->post_proc_ch == MEM_PP_MEM ||
          vout->post_proc_ch == MEM_PRP_VF_MEM) {
            /* SDC or ADC with Rotation */
            if (!ipu_can_rotate_in_place(vout->rotate)) {
                  ipu_unlink_channels(MEM_PP_MEM, MEM_ROT_PP_MEM);
                  ipu_unlink_channels(MEM_ROT_PP_MEM,
                                  vout->display_ch);
                  ipu_disable_channel(MEM_ROT_PP_MEM, true);

                  if (vout->rot_pp_bufs[0]) {
                        mxc_free_buffers(vout->rot_pp_bufs,
                                     vout->rot_pp_bufs_vaddr, 2,
                                     vout->display_buf_size);
                  }
            } else {
                  ipu_unlink_channels(MEM_PP_MEM, vout->display_ch);
            }
            ipu_disable_channel(MEM_PP_MEM, true);

            if (vout->display_ch == ADC_SYS2 ||
                  vout->display_ch == MEM_FG_SYNC) {
                  ipu_disable_channel(vout->display_ch, true);
                  ipu_uninit_channel(vout->display_ch);
            } else {
                  fbi->var.activate |= FB_ACTIVATE_FORCE;
                  fb_set_var(fbi, &fbi->var);

                  if (vout->display_ch == MEM_FG_SYNC) {
                        acquire_console_sem();
                        fb_blank(fbi, FB_BLANK_POWERDOWN);
                        release_console_sem();
                  }

                  vout->display_bufs[0] = 0;
                  vout->display_bufs[1] = 0;
            }

            ipu_uninit_channel(MEM_PP_MEM);
            if (!ipu_can_rotate_in_place(vout->rotate))
                  ipu_uninit_channel(MEM_ROT_PP_MEM);
      } else if (INTERLACED_CONTENT(vout) && (vout->post_proc_ch == MEM_VDI_PRP_VF_MEM)) {
            if (!ipu_can_rotate_in_place(vout->rotate)) {
                  ipu_unlink_channels(MEM_VDI_PRP_VF_MEM,
                                  MEM_ROT_VF_MEM);
                  ipu_unlink_channels(MEM_ROT_VF_MEM,
                                  vout->display_ch);
                  ipu_disable_channel(MEM_ROT_VF_MEM, true);

                  if (vout->rot_pp_bufs[0]) {
                        mxc_free_buffers(vout->rot_pp_bufs,
                                     vout->rot_pp_bufs_vaddr, 2,
                                     vout->display_buf_size);
                  }
            } else {
                  ipu_unlink_channels(MEM_VDI_PRP_VF_MEM,
                                  vout->display_ch);
            }

            ipu_disable_channel(MEM_VDI_PRP_VF_MEM, true);

            if (vout->display_ch == ADC_SYS2 ||
                  vout->display_ch == MEM_FG_SYNC) {
                  ipu_disable_channel(vout->display_ch, true);
                  ipu_uninit_channel(vout->display_ch);
            } else {
                  fbi->var.activate |= FB_ACTIVATE_FORCE;
                  fb_set_var(fbi, &fbi->var);

                  if (vout->display_ch == MEM_FG_SYNC) {
                        acquire_console_sem();
                        fb_blank(fbi, FB_BLANK_POWERDOWN);
                        release_console_sem();
                  }

                  vout->display_bufs[0] = 0;
                  vout->display_bufs[1] = 0;
            }

            ipu_uninit_channel(MEM_VDI_PRP_VF_MEM);
            if (!ipu_can_rotate_in_place(vout->rotate))
                  ipu_uninit_channel(MEM_ROT_VF_MEM);
      } else {          /* ADC Direct */
            ipu_disable_channel(MEM_PP_ADC, true);
            ipu_uninit_channel(MEM_PP_ADC);
      }
      vout->ready_q.head = vout->ready_q.tail = 0;
      vout->done_q.head = vout->done_q.tail = 0;
      for (i = 0; i < vout->buffer_cnt; i++) {
            vout->v4l2_bufs[i].flags = 0;
            vout->v4l2_bufs[i].timestamp.tv_sec = 0;
            vout->v4l2_bufs[i].timestamp.tv_usec = 0;
      }

      vout->state = STATE_STREAM_OFF;

#ifdef CONFIG_FB_MXC_ASYNC_PANEL
      if (vout->cur_disp_output < DISP3) {
            if (vout->display_bufs[0] != 0) {
                  mxc_free_buffers(vout->display_bufs,
                               vout->display_bufs_vaddr, 2,
                               vout->display_buf_size);
            }

            mxcfb_set_refresh_mode(registered_fb
                               [vout->
                              output_fb_num[vout->cur_disp_output]],
                               MXCFB_REFRESH_PARTIAL, 0);
      }
#endif

      return retval;
}


Generated by  Doxygen 1.6.0   Back to index