[media] s5p-fimc: Keep local copy of sensors platform data
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Mon, 17 Sep 2012 09:00:48 +0000 (06:00 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 1 Oct 2012 23:27:52 +0000 (20:27 -0300)
Use a copy of sensor platform data structure, rather than referencing
external platform data from the driver. This allows to fill the local
copy with values parsed from device tree when needed.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/s5p-fimc/fimc-capture.c
drivers/media/platform/s5p-fimc/fimc-lite.c
drivers/media/platform/s5p-fimc/fimc-mdevice.c
drivers/media/platform/s5p-fimc/fimc-mdevice.h

index d7df8fb14889de9f1861755af1703c3e3aeecfde..dded988152206e779c3f49844d5ade4a09f14663 100644 (file)
@@ -50,9 +50,9 @@ static int fimc_capture_hw_init(struct fimc_dev *fimc)
        fimc_prepare_dma_offset(ctx, &ctx->d_frame);
        fimc_set_yuv_order(ctx);
 
-       fimc_hw_set_camera_polarity(fimc, sensor->pdata);
-       fimc_hw_set_camera_type(fimc, sensor->pdata);
-       fimc_hw_set_camera_source(fimc, sensor->pdata);
+       fimc_hw_set_camera_polarity(fimc, &sensor->pdata);
+       fimc_hw_set_camera_type(fimc, &sensor->pdata);
+       fimc_hw_set_camera_source(fimc, &sensor->pdata);
        fimc_hw_set_camera_offset(fimc, &ctx->s_frame);
 
        ret = fimc_set_scaler_info(ctx);
index bef8d3ef79cc7553e288bd8e78e7046d822a8dac..5e6c704f108528e508eea0cd5462dc6f3c2bd89a 100644 (file)
@@ -135,7 +135,7 @@ static int fimc_lite_hw_init(struct fimc_lite *fimc)
        sensor = v4l2_get_subdev_hostdata(pipeline->subdevs[IDX_SENSOR]);
        spin_lock_irqsave(&fimc->slock, flags);
 
-       flite_hw_set_camera_bus(fimc, sensor->pdata);
+       flite_hw_set_camera_bus(fimc, &sensor->pdata);
        flite_hw_set_source_format(fimc, &fimc->inp_frame);
        flite_hw_set_window_offset(fimc, &fimc->inp_frame);
        flite_hw_set_output_dma(fimc, &fimc->out_frame, true);
index 223fcfe2e1b3dc28b6960e495a4214a9c8919045..80ada5882f62c8156c74265a7279eca9e6fbc35c 100644 (file)
@@ -252,27 +252,27 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd,
        if (!s_info || !fmd)
                return NULL;
 
-       adapter = i2c_get_adapter(s_info->pdata->i2c_bus_num);
+       adapter = i2c_get_adapter(s_info->pdata.i2c_bus_num);
        if (!adapter) {
                v4l2_warn(&fmd->v4l2_dev,
                          "Failed to get I2C adapter %d, deferring probe\n",
-                         s_info->pdata->i2c_bus_num);
+                         s_info->pdata.i2c_bus_num);
                return ERR_PTR(-EPROBE_DEFER);
        }
        sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter,
-                                      s_info->pdata->board_info, NULL);
+                                      s_info->pdata.board_info, NULL);
        if (IS_ERR_OR_NULL(sd)) {
                i2c_put_adapter(adapter);
                v4l2_warn(&fmd->v4l2_dev,
                          "Failed to acquire subdev %s, deferring probe\n",
-                         s_info->pdata->board_info->type);
+                         s_info->pdata.board_info->type);
                return ERR_PTR(-EPROBE_DEFER);
        }
        v4l2_set_subdev_hostdata(sd, s_info);
        sd->grp_id = SENSOR_GROUP_ID;
 
        v4l2_info(&fmd->v4l2_dev, "Registered sensor subdevice %s\n",
-                 s_info->pdata->board_info->type);
+                 s_info->pdata.board_info->type);
        return sd;
 }
 
@@ -316,7 +316,7 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
        for (i = 0; i < num_clients; i++) {
                struct v4l2_subdev *sd;
 
-               fmd->sensor[i].pdata = &pdata->isp_info[i];
+               fmd->sensor[i].pdata = pdata->isp_info[i];
                ret = __fimc_md_set_camclk(fmd, &fmd->sensor[i], true);
                if (ret)
                        break;
@@ -641,11 +641,11 @@ static int fimc_md_create_links(struct fimc_md *fmd)
 
                sensor = fmd->sensor[i].subdev;
                s_info = v4l2_get_subdev_hostdata(sensor);
-               if (!s_info || !s_info->pdata)
+               if (!s_info)
                        continue;
 
                source = NULL;
-               pdata = s_info->pdata;
+               pdata = &s_info->pdata;
 
                switch (pdata->bus_type) {
                case FIMC_MIPI_CSI2:
@@ -757,7 +757,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
                                struct fimc_sensor_info *s_info,
                                bool on)
 {
-       struct s5p_fimc_isp_info *pdata = s_info->pdata;
+       struct s5p_fimc_isp_info *pdata = &s_info->pdata;
        struct fimc_camclk_info *camclk;
        int ret = 0;
 
index 0135386457ee985fe3c37ccbd8af8c5c0edc67c8..2d8d41d8262042c156d834d24b8649cff0f268b1 100644 (file)
@@ -51,7 +51,7 @@ struct fimc_camclk_info {
  * This data structure applies to image sensor and the writeback subdevs.
  */
 struct fimc_sensor_info {
-       struct s5p_fimc_isp_info *pdata;
+       struct s5p_fimc_isp_info pdata;
        struct v4l2_subdev *subdev;
        struct fimc_dev *host;
 };