diff options
author | Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> | 2012-04-26 10:55:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-20 11:46:43 -0400 |
commit | 3de886e0e4e1a981442e26edca5a32777299b079 (patch) | |
tree | a4a7bd27f6d70a2c4073bfc1cc7de60579dc58ac /drivers | |
parent | 0458294751f8f9a883d518e55a13ea002df1d829 (diff) |
[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')
-rw-r--r-- | drivers/media/video/smiapp/smiapp-core.c | 31 |
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) | |||
653 | 653 | ||
654 | static int smiapp_get_limits_binning(struct smiapp_sensor *sensor) | 654 | static int smiapp_get_limits_binning(struct smiapp_sensor *sensor) |
655 | { | 655 | { |
656 | struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); | ||
656 | static u32 const limits[] = { | 657 | static u32 const limits[] = { |
657 | SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN, | 658 | SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN, |
658 | SMIAPP_LIMIT_MAX_FRAME_LENGTH_LINES_BIN, | 659 | SMIAPP_LIMIT_MAX_FRAME_LENGTH_LINES_BIN, |
@@ -671,11 +672,11 @@ static int smiapp_get_limits_binning(struct smiapp_sensor *sensor) | |||
671 | SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MIN, | 672 | SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MIN, |
672 | SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MAX_MARGIN, | 673 | SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MAX_MARGIN, |
673 | }; | 674 | }; |
675 | unsigned int i; | ||
676 | int rval; | ||
674 | 677 | ||
675 | if (sensor->limits[SMIAPP_LIMIT_BINNING_CAPABILITY] == | 678 | if (sensor->limits[SMIAPP_LIMIT_BINNING_CAPABILITY] == |
676 | SMIAPP_BINNING_CAPABILITY_NO) { | 679 | SMIAPP_BINNING_CAPABILITY_NO) { |
677 | unsigned int i; | ||
678 | |||
679 | for (i = 0; i < ARRAY_SIZE(limits); i++) | 680 | for (i = 0; i < ARRAY_SIZE(limits); i++) |
680 | sensor->limits[limits[i]] = | 681 | sensor->limits[limits[i]] = |
681 | sensor->limits[limits_replace[i]]; | 682 | sensor->limits[limits_replace[i]]; |
@@ -683,7 +684,31 @@ static int smiapp_get_limits_binning(struct smiapp_sensor *sensor) | |||
683 | return 0; | 684 | return 0; |
684 | } | 685 | } |
685 | 686 | ||
686 | return smiapp_get_limits(sensor, limits, ARRAY_SIZE(limits)); | 687 | rval = smiapp_get_limits(sensor, limits, ARRAY_SIZE(limits)); |
688 | if (rval < 0) | ||
689 | return rval; | ||
690 | |||
691 | /* | ||
692 | * Sanity check whether the binning limits are valid. If not, | ||
693 | * use the non-binning ones. | ||
694 | */ | ||
695 | if (sensor->limits[SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN] | ||
696 | && sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK_BIN] | ||
697 | && sensor->limits[SMIAPP_LIMIT_MIN_LINE_BLANKING_PCK_BIN]) | ||
698 | return 0; | ||
699 | |||
700 | for (i = 0; i < ARRAY_SIZE(limits); i++) { | ||
701 | dev_dbg(&client->dev, | ||
702 | "replace limit 0x%8.8x \"%s\" = %d, 0x%x\n", | ||
703 | smiapp_reg_limits[limits[i]].addr, | ||
704 | smiapp_reg_limits[limits[i]].what, | ||
705 | sensor->limits[limits_replace[i]], | ||
706 | sensor->limits[limits_replace[i]]); | ||
707 | sensor->limits[limits[i]] = | ||
708 | sensor->limits[limits_replace[i]]; | ||
709 | } | ||
710 | |||
711 | return 0; | ||
687 | } | 712 | } |
688 | 713 | ||
689 | static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) | 714 | static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) |