media: ov2659: make S_FMT succeed even if requested format doesn't match
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 30 Mar 2019 14:01:31 +0000 (10:01 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:48:20 +0000 (06:48 -0700)
commit32696debee684d0c569ffc13a4c8ef5dee93f281
treedb28779d57bbed36d1540de9e30e75db7f44ae3e
parentf84c1010c0cdd991f60c1b13530420829bb9bdaa
media: ov2659: make S_FMT succeed even if requested format doesn't match

[ Upstream commit bccb89cf9cd07a0690d519696a00c00a973b3fe4 ]

This driver returns an error if unsupported media bus pixel code is
requested by VIDIOC_SUBDEV_S_FMT.

But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst,

Drivers must not return an error solely because the requested format
doesn't match the device capabilities. They must instead modify the
format to match what the hardware can provide.

So select default format code and return success in that case.

This is detected by v4l2-compliance.

Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/i2c/ov2659.c