media: ov08x40: Move ov08x40_identify_module() function up
[ Upstream commit 7a39639e448f070cbe37317ac922886b6080ff43 ] Move the ov08x40_identify_module() function to above ov08x40_set_stream() this is a preparation patch for adding a missing ov08x40_identify_module() call to ov08x40_set_stream(). No functional changes, just moving code around. Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Stable-dep-of: ebf185efadb7 ("media: ov08x40: Add missing ov08x40_identify_module() call on stream-start") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fc96a720d8
commit
9c00d54454
@@ -1869,6 +1869,32 @@ static int ov08x40_stop_streaming(struct ov08x40 *ov08x)
|
||||
OV08X40_REG_VALUE_08BIT, OV08X40_MODE_STANDBY);
|
||||
}
|
||||
|
||||
/* Verify chip ID */
|
||||
static int ov08x40_identify_module(struct ov08x40 *ov08x)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(&ov08x->sd);
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
if (ov08x->identified)
|
||||
return 0;
|
||||
|
||||
ret = ov08x40_read_reg(ov08x, OV08X40_REG_CHIP_ID,
|
||||
OV08X40_REG_VALUE_24BIT, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (val != OV08X40_CHIP_ID) {
|
||||
dev_err(&client->dev, "chip id mismatch: %x!=%x\n",
|
||||
OV08X40_CHIP_ID, val);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
ov08x->identified = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ov08x40_set_stream(struct v4l2_subdev *sd, int enable)
|
||||
{
|
||||
struct ov08x40 *ov08x = to_ov08x40(sd);
|
||||
@@ -1906,32 +1932,6 @@ err_unlock:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Verify chip ID */
|
||||
static int ov08x40_identify_module(struct ov08x40 *ov08x)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(&ov08x->sd);
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
if (ov08x->identified)
|
||||
return 0;
|
||||
|
||||
ret = ov08x40_read_reg(ov08x, OV08X40_REG_CHIP_ID,
|
||||
OV08X40_REG_VALUE_24BIT, &val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (val != OV08X40_CHIP_ID) {
|
||||
dev_err(&client->dev, "chip id mismatch: %x!=%x\n",
|
||||
OV08X40_CHIP_ID, val);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
ov08x->identified = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct v4l2_subdev_video_ops ov08x40_video_ops = {
|
||||
.s_stream = ov08x40_set_stream,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user