media: renesas-ceu: Set mbus_fmt on subdev operations

The renesas-ceu driver intializes the desired mbus_format at 'complete'
time, inspecting the supported subdevice ones, and tuning some
parameters to produce the requested memory format from what the sensor
can produce. Although, the initially selected mbus_format was not
provided to the subdevice during set_fmt and try_fmt operations,
providing instead a '0' mbus format code.

As long as the sensor defaults to a compatible mbus_format when an
invalid code as '0' is provided, capture operations work correctly. If
the subdevice defaults to an unsupported format (eg. some RGB
permutations) capture does not work properly due to a mismatch on the
expected and received image format on the wire.

Fix that by re-using the initially selected mbus_format code during
set_fmt and try_fmt subdevice operation calls.

Tested by printing out the format selection procedure with ov7670
sensor.

Before this patch:
[    0.866001] ov7670_try_fmt_internal -- Looking for mbus_code 0x0000
[    0.870882] ov7670_try_fmt_internal -- Try mbus_code 0x2008
[    0.876336] ov7670_try_fmt_internal -- Try mbus_code 0x1002
[    0.881387] ov7670_try_fmt_internal -- Try mbus_code 0x1008
[    0.886537] ov7670_try_fmt_internal -- Try mbus_code 0x3001
[    0.891584] ov7670_try_fmt_internal -- mbus_code defaulted to 0x2008

With this patch applied:
[    0.867015] ov7670_try_fmt_internal -- Looking for mbus_code 0x2008
[    0.873205] ov7670_try_fmt_internal -- Try mbus_code 0x2008: match

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
(cherry picked from commit d3a67f27471d4792caf84132228def2b18617932)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
1 file changed