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

static int mxc_v4l2out_probe ( struct platform_device *  pdev  )  [static]

Probe routine for the framebuffer driver. It is called during the driver binding process. The following functions are performed in this routine: Framebuffer initialization, Memory allocation and mapping, Framebuffer registration, IPU initialization.

Returns:
Appropriate error code to the kernel common code

Definition at line 2497 of file mxc_v4l2_output.c.

{
      int i;
      vout_data *vout;

      /*
       * Allocate sufficient memory for the fb structure
       */
      g_vout = vout = kmalloc(sizeof(vout_data), GFP_KERNEL);

      if (!vout)
            return 0;

      memset(vout, 0, sizeof(vout_data));

      vout->video_dev = video_device_alloc();
      if (vout->video_dev == NULL)
            return -1;
      vout->video_dev->minor = -1;

      *(vout->video_dev) = mxc_v4l2out_template;

      /* register v4l device */
      if (video_register_device(vout->video_dev,
                          VFL_TYPE_GRABBER, video_nr) == -1) {
            dev_dbg(&pdev->dev, "video_register_device failed\n");
            return 0;
      }
      dev_info(&pdev->dev, "Registered device video%d\n",
             vout->video_dev->minor & 0x1f);
      /*vout->video_dev->dev = &pdev->dev;*/

      video_set_drvdata(vout->video_dev, vout);

      init_MUTEX(&vout->param_lock);
      init_MUTEX(&vout->busy_lock);

      /* setup outputs and cropping */
      vout->cur_disp_output = -1;
      for (i = 0; i < num_registered_fb; i++) {
            char *idstr = registered_fb[i]->fix.id;
            if (strncmp(idstr, "DISP", 4) == 0) {
                  int disp_num = idstr[4] - '0';
                  if (disp_num == 3) {
                        if (strcmp(idstr, "DISP3 BG - DI1") == 0)
                              disp_num = 5;
                        else if (strncmp(idstr, "DISP3 BG", 8) == 0)
                              disp_num = 4;
                  }
                  vout->crop_bounds[disp_num].left = 0;
                  vout->crop_bounds[disp_num].top = 0;
                  vout->crop_bounds[disp_num].width =
                      registered_fb[i]->var.xres;
                  vout->crop_bounds[disp_num].height =
                      registered_fb[i]->var.yres;
                  vout->output_enabled[disp_num] = true;
                  vout->output_fb_num[disp_num] = i;
                  if (vout->cur_disp_output == -1) {
                        vout->cur_disp_output = disp_num;
                  }
            }

      }
      vout->crop_current = vout->crop_bounds[vout->cur_disp_output];

      platform_set_drvdata(pdev, vout);

      return 0;
}


Generated by  Doxygen 1.6.0   Back to index