media: hi556: correct the test pattern configuration
commit 020f602b068c9ce18d5056d02c8302199377d98d upstream.
Hynix hi556 support 8 test pattern modes:
hi556_test_pattern_menu[] = {
{
"Disabled",
"Solid Colour",
"100% Colour Bars",
"Fade To Grey Colour Bars",
"PN9",
"Gradient Horizontal",
"Gradient Vertical",
"Check Board",
"Slant Pattern",
}
The test pattern is set by a 8-bit register according to the
specification.
+--------+-------------------------------+
| BIT[0] | Solid color |
+--------+-------------------------------+
| BIT[1] | Color bar |
+--------+-------------------------------+
| BIT[2] | Fade to grey color bar |
+--------+-------------------------------+
| BIT[3] | PN9 |
+--------+-------------------------------+
| BIT[4] | Gradient horizontal |
+--------+-------------------------------+
| BIT[5] | Gradient vertical |
+--------+-------------------------------+
| BIT[6] | Check board |
+--------+-------------------------------+
| BIT[7] | Slant pattern |
+--------+-------------------------------+
Based on function above, current test pattern programming is wrong.
This patch fixes it by 'BIT(pattern - 1)'. If pattern is 0, driver
will disable the test pattern generation and set the pattern to 0.
Fixes: e62138403a ("media: hi556: Add support for Hi-556 sensor")
Cc: stable@vger.kernel.org
Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8f11e57ec5
commit
a452610472
@@ -602,21 +602,23 @@ static int hi556_test_pattern(struct hi556 *hi556, u32 pattern)
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
if (pattern) {
|
||||
ret = hi556_read_reg(hi556, HI556_REG_ISP,
|
||||
HI556_REG_VALUE_08BIT, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = hi556_read_reg(hi556, HI556_REG_ISP,
|
||||
HI556_REG_VALUE_08BIT, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = hi556_write_reg(hi556, HI556_REG_ISP,
|
||||
HI556_REG_VALUE_08BIT,
|
||||
val | HI556_REG_ISP_TPG_EN);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
val = pattern ? (val | HI556_REG_ISP_TPG_EN) :
|
||||
(val & ~HI556_REG_ISP_TPG_EN);
|
||||
|
||||
ret = hi556_write_reg(hi556, HI556_REG_ISP,
|
||||
HI556_REG_VALUE_08BIT, val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
val = pattern ? BIT(pattern - 1) : 0;
|
||||
|
||||
return hi556_write_reg(hi556, HI556_REG_TEST_PATTERN,
|
||||
HI556_REG_VALUE_08BIT, pattern);
|
||||
HI556_REG_VALUE_08BIT, val);
|
||||
}
|
||||
|
||||
static int hi556_set_ctrl(struct v4l2_ctrl *ctrl)
|
||||
|
||||
Reference in New Issue
Block a user