brcm2708: add kernel 4.14 support
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.14 / 950-0321-ov5647-Add-set_fmt-and-get_fmt-calls.patch
1 From 76ba71d15be13d6c48a63d53c33134dc17736d71 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Mon, 20 Mar 2017 16:33:44 +0000
4 Subject: [PATCH 321/454] ov5647: Add set_fmt and get_fmt calls.
5
6 There's no way to query the subdevice for the supported
7 resolutions.
8 Add set_fmt and get_fmt implementations.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
11 ---
12 drivers/media/i2c/ov5647.c | 22 ++++++++++++++++++++++
13 1 file changed, 22 insertions(+)
14
15 --- a/drivers/media/i2c/ov5647.c
16 +++ b/drivers/media/i2c/ov5647.c
17 @@ -442,8 +442,30 @@ static int ov5647_enum_mbus_code(struct
18 return 0;
19 }
20
21 +static int ov5647_set_get_fmt(struct v4l2_subdev *sd,
22 + struct v4l2_subdev_pad_config *cfg,
23 + struct v4l2_subdev_format *format)
24 +{
25 + struct v4l2_mbus_framefmt *fmt = &format->format;
26 +
27 + if (format->pad != 0)
28 + return -EINVAL;
29 +
30 + /* Only one format is supported, so return that */
31 + memset(fmt, 0, sizeof(*fmt));
32 + fmt->code = MEDIA_BUS_FMT_SBGGR8_1X8;
33 + fmt->colorspace = V4L2_COLORSPACE_SRGB;
34 + fmt->field = V4L2_FIELD_NONE;
35 + fmt->width = 640;
36 + fmt->height = 480;
37 +
38 + return 0;
39 +}
40 +
41 static const struct v4l2_subdev_pad_ops ov5647_subdev_pad_ops = {
42 .enum_mbus_code = ov5647_enum_mbus_code,
43 + .set_fmt = ov5647_set_get_fmt,
44 + .get_fmt = ov5647_set_get_fmt,
45 };
46
47 static const struct v4l2_subdev_ops ov5647_subdev_ops = {