summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/ov5640.c
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2022-05-13 17:13:59 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-07-08 17:22:54 +0300
commit2de6bb97f0904b4e3f221b326c0cf2623204316d (patch)
tree409f11c62daf0f50b987750f93fe66e012106f8c /drivers/media/i2c/ov5640.c
parent5113d5b33113710b9fd98bbc1cb9b14b99219395 (diff)
downloadlinux-2de6bb97f0904b4e3f221b326c0cf2623204316d.tar.xz
media: ov5640: Provide timings accessor
Provide a function to shortcut access to the correct timings definition to avoid repeating the same pattern when accessing the sensor timings. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/i2c/ov5640.c')
-rw-r--r--drivers/media/i2c/ov5640.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index ba4ef431594b..21ddbff19f95 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -1123,6 +1123,16 @@ static const struct ov5640_mode_info ov5640_mode_data[OV5640_NUM_MODES] = {
},
};
+static const struct ov5640_timings *
+ov5640_timings(const struct ov5640_dev *sensor,
+ const struct ov5640_mode_info *mode)
+{
+ if (ov5640_is_csi2(sensor))
+ return &mode->csi2_timings;
+
+ return &mode->dvp_timings;
+}
+
static int ov5640_init_slave_id(struct ov5640_dev *sensor)
{
struct i2c_client *client = sensor->i2c_client;
@@ -1635,11 +1645,7 @@ static int ov5640_set_timings(struct ov5640_dev *sensor,
return ret;
}
- if (ov5640_is_csi2(sensor))
- timings = &mode->csi2_timings;
- else
- timings = &mode->dvp_timings;
-
+ timings = ov5640_timings(sensor, mode);
analog_crop = &timings->analog_crop;
crop = &timings->crop;