summaryrefslogtreecommitdiff
path: root/drivers/media/video/smiapp
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@maxwell.research.nokia.com>2012-04-26 18:55:13 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-20 19:46:43 +0400
commit3de886e0e4e1a981442e26edca5a32777299b079 (patch)
treea4a7bd27f6d70a2c4073bfc1cc7de60579dc58ac /drivers/media/video/smiapp
parent0458294751f8f9a883d518e55a13ea002df1d829 (diff)
downloadlinux-3de886e0e4e1a981442e26edca5a32777299b079.tar.xz
[media] smiapp: Use non-binning limits if the binning limit is zero
Some sensors do use binning but do not have valid limits in binning registers. Use non-binning limits in that case. Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/smiapp')
-rw-r--r--drivers/media/video/smiapp/smiapp-core.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/media/video/smiapp/smiapp-core.c b/drivers/media/video/smiapp/smiapp-core.c
index 6524091a9a4c..47d6901b4022 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -653,6 +653,7 @@ static int smiapp_get_all_limits(struct smiapp_sensor *sensor)
static int smiapp_get_limits_binning(struct smiapp_sensor *sensor)
{
+ struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
static u32 const limits[] = {
SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN,
SMIAPP_LIMIT_MAX_FRAME_LENGTH_LINES_BIN,
@@ -671,11 +672,11 @@ static int smiapp_get_limits_binning(struct smiapp_sensor *sensor)
SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MIN,
SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MAX_MARGIN,
};
+ unsigned int i;
+ int rval;
if (sensor->limits[SMIAPP_LIMIT_BINNING_CAPABILITY] ==
SMIAPP_BINNING_CAPABILITY_NO) {
- unsigned int i;
-
for (i = 0; i < ARRAY_SIZE(limits); i++)
sensor->limits[limits[i]] =
sensor->limits[limits_replace[i]];
@@ -683,7 +684,31 @@ static int smiapp_get_limits_binning(struct smiapp_sensor *sensor)
return 0;
}
- return smiapp_get_limits(sensor, limits, ARRAY_SIZE(limits));
+ rval = smiapp_get_limits(sensor, limits, ARRAY_SIZE(limits));
+ if (rval < 0)
+ return rval;
+
+ /*
+ * Sanity check whether the binning limits are valid. If not,
+ * use the non-binning ones.
+ */
+ if (sensor->limits[SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN]
+ && sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK_BIN]
+ && sensor->limits[SMIAPP_LIMIT_MIN_LINE_BLANKING_PCK_BIN])
+ return 0;
+
+ for (i = 0; i < ARRAY_SIZE(limits); i++) {
+ dev_dbg(&client->dev,
+ "replace limit 0x%8.8x \"%s\" = %d, 0x%x\n",
+ smiapp_reg_limits[limits[i]].addr,
+ smiapp_reg_limits[limits[i]].what,
+ sensor->limits[limits_replace[i]],
+ sensor->limits[limits_replace[i]]);
+ sensor->limits[limits[i]] =
+ sensor->limits[limits_replace[i]];
+ }
+
+ return 0;
}
static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor)