aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2012-10-20 09:17:02 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-29 07:49:54 -0400
commit1e9240b35264fa0280abc4487b47b28eecf10b52 (patch)
tree337c568b66d24f6542b071d0e95eb0bdab801796 /drivers/media/i2c
parent6de1b143a45d3c4b8ad277b484e0d14df0d30d63 (diff)
[media] smiapp: Input for PLL configuration is mostly static
The input values for PLL configuration are mostly static. So set them when the sensor is registered. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/smiapp/smiapp-core.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index e08e588ad24b..868ad0ba59b6 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -276,11 +276,6 @@ static int smiapp_pll_update(struct smiapp_sensor *sensor)
276 struct smiapp_pll *pll = &sensor->pll; 276 struct smiapp_pll *pll = &sensor->pll;
277 int rval; 277 int rval;
278 278
279 memset(&sensor->pll, 0, sizeof(sensor->pll));
280
281 pll->lanes = sensor->platform_data->lanes;
282 pll->ext_clk_freq_hz = sensor->platform_data->ext_clk;
283
284 if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0) { 279 if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0) {
285 /* 280 /*
286 * Fill in operational clock divisors limits from the 281 * Fill in operational clock divisors limits from the
@@ -296,20 +291,13 @@ static int smiapp_pll_update(struct smiapp_sensor *sensor)
296 lim.max_op_sys_clk_freq_hz = lim.max_vt_sys_clk_freq_hz; 291 lim.max_op_sys_clk_freq_hz = lim.max_vt_sys_clk_freq_hz;
297 lim.min_op_pix_clk_freq_hz = lim.min_vt_pix_clk_freq_hz; 292 lim.min_op_pix_clk_freq_hz = lim.min_vt_pix_clk_freq_hz;
298 lim.max_op_pix_clk_freq_hz = lim.max_vt_pix_clk_freq_hz; 293 lim.max_op_pix_clk_freq_hz = lim.max_vt_pix_clk_freq_hz;
299 /* Profile 0 sensors have no separate OP clock branch. */
300 pll->flags |= SMIAPP_PLL_FLAG_NO_OP_CLOCKS;
301 } 294 }
302 295
303 if (smiapp_needs_quirk(sensor,
304 SMIAPP_QUIRK_FLAG_OP_PIX_CLOCK_PER_LANE))
305 pll->flags |= SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE;
306
307 pll->binning_horizontal = sensor->binning_horizontal; 296 pll->binning_horizontal = sensor->binning_horizontal;
308 pll->binning_vertical = sensor->binning_vertical; 297 pll->binning_vertical = sensor->binning_vertical;
309 pll->link_freq = 298 pll->link_freq =
310 sensor->link_freq->qmenu_int[sensor->link_freq->val]; 299 sensor->link_freq->qmenu_int[sensor->link_freq->val];
311 pll->scale_m = sensor->scale_m; 300 pll->scale_m = sensor->scale_m;
312 pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN];
313 pll->bits_per_pixel = sensor->csi_format->compressed; 301 pll->bits_per_pixel = sensor->csi_format->compressed;
314 302
315 rval = smiapp_pll_calculate(&client->dev, &lim, pll); 303 rval = smiapp_pll_calculate(&client->dev, &lim, pll);
@@ -2369,6 +2357,7 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
2369{ 2357{
2370 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 2358 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
2371 struct i2c_client *client = v4l2_get_subdevdata(subdev); 2359 struct i2c_client *client = v4l2_get_subdevdata(subdev);
2360 struct smiapp_pll *pll = &sensor->pll;
2372 struct smiapp_subdev *last = NULL; 2361 struct smiapp_subdev *last = NULL;
2373 u32 tmp; 2362 u32 tmp;
2374 unsigned int i; 2363 unsigned int i;
@@ -2635,6 +2624,17 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
2635 if (rval < 0) 2624 if (rval < 0)
2636 goto out_nvm_release; 2625 goto out_nvm_release;
2637 2626
2627 /* prepare PLL configuration input values */
2628 pll->lanes = sensor->platform_data->lanes;
2629 pll->ext_clk_freq_hz = sensor->platform_data->ext_clk;
2630 /* Profile 0 sensors have no separate OP clock branch. */
2631 if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0)
2632 pll->flags |= SMIAPP_PLL_FLAG_NO_OP_CLOCKS;
2633 if (smiapp_needs_quirk(sensor,
2634 SMIAPP_QUIRK_FLAG_OP_PIX_CLOCK_PER_LANE))
2635 pll->flags |= SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE;
2636 pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN];
2637
2638 rval = smiapp_update_mode(sensor); 2638 rval = smiapp_update_mode(sensor);
2639 if (rval) { 2639 if (rval) {
2640 dev_err(&client->dev, "update mode failed\n"); 2640 dev_err(&client->dev, "update mode failed\n");