]>
Commit | Line | Data |
---|---|---|
2f47b8fc SL |
1 | From 9448837cbe97f249ec327849b4f7df78e4e322a7 Mon Sep 17 00:00:00 2001 |
2 | From: Akinobu Mita <akinobu.mita@gmail.com> | |
3 | Date: Sat, 30 Mar 2019 10:01:31 -0400 | |
4 | Subject: media: ov2659: make S_FMT succeed even if requested format doesn't | |
5 | match | |
6 | ||
7 | [ Upstream commit bccb89cf9cd07a0690d519696a00c00a973b3fe4 ] | |
8 | ||
9 | This driver returns an error if unsupported media bus pixel code is | |
10 | requested by VIDIOC_SUBDEV_S_FMT. | |
11 | ||
12 | But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst, | |
13 | ||
14 | Drivers must not return an error solely because the requested format | |
15 | doesn't match the device capabilities. They must instead modify the | |
16 | format to match what the hardware can provide. | |
17 | ||
18 | So select default format code and return success in that case. | |
19 | ||
20 | This is detected by v4l2-compliance. | |
21 | ||
22 | Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com> | |
23 | Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> | |
24 | Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> | |
25 | Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> | |
26 | Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | |
27 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
28 | --- | |
29 | drivers/media/i2c/ov2659.c | 6 ++++-- | |
30 | 1 file changed, 4 insertions(+), 2 deletions(-) | |
31 | ||
32 | diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c | |
33 | index 1f999e9c0118e..3554eea77e04c 100644 | |
34 | --- a/drivers/media/i2c/ov2659.c | |
35 | +++ b/drivers/media/i2c/ov2659.c | |
36 | @@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, | |
37 | if (ov2659_formats[index].code == mf->code) | |
38 | break; | |
39 | ||
40 | - if (index < 0) | |
41 | - return -EINVAL; | |
42 | + if (index < 0) { | |
43 | + index = 0; | |
44 | + mf->code = ov2659_formats[index].code; | |
45 | + } | |
46 | ||
47 | mf->colorspace = V4L2_COLORSPACE_SRGB; | |
48 | mf->code = ov2659_formats[index].code; | |
49 | -- | |
50 | 2.20.1 | |
51 |