1 From f4d559078cab81209b721a83ffd87a40a6fb52c4 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Fri, 23 Jun 2017 17:58:55 +0100
4 Subject: [PATCH 324/454] ov5647: Add support for non-continuous clock mode
6 The driver was only supporting continuous clock mode
7 although this was not stated anywhere.
8 Non-continuous clock saves a small amount of power and
9 on some SoCs is easier to interface with.
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
13 drivers/media/i2c/ov5647.c | 13 ++++++++++---
14 1 file changed, 10 insertions(+), 3 deletions(-)
16 --- a/drivers/media/i2c/ov5647.c
17 +++ b/drivers/media/i2c/ov5647.c
18 @@ -86,6 +86,7 @@ struct ov5647 {
21 struct gpio_desc *pwdn;
25 static inline struct ov5647 *to_state(struct v4l2_subdev *sd)
26 @@ -302,6 +303,7 @@ static int __sensor_init(struct v4l2_sub
29 struct i2c_client *client = v4l2_get_subdevdata(sd);
30 + struct ov5647 *ov5647 = to_state(sd);
32 ret = ov5647_read(sd, 0x0100, &rdval);
34 @@ -329,7 +331,9 @@ static int __sensor_init(struct v4l2_sub
38 - return ov5647_write(sd, 0x4800, 0x04);
39 + return ov5647_write(sd, 0x4800,
40 + (ov5647->flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK) ?
44 static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)
45 @@ -547,7 +551,7 @@ static const struct v4l2_subdev_internal
49 -static int ov5647_parse_dt(struct device_node *np)
50 +static int ov5647_parse_dt(struct device_node *np, struct ov5647 *sensor)
52 struct v4l2_fwnode_endpoint bus_cfg;
53 struct device_node *ep;
54 @@ -560,6 +564,9 @@ static int ov5647_parse_dt(struct device
56 ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg);
59 + sensor->flags = bus_cfg.bus.mipi_csi2.flags;
64 @@ -579,7 +586,7 @@ static int ov5647_probe(struct i2c_clien
67 if (IS_ENABLED(CONFIG_OF) && np) {
68 - ret = ov5647_parse_dt(np);
69 + ret = ov5647_parse_dt(np, sensor);
71 dev_err(dev, "DT parsing error: %d\n", ret);