OSDN Git Service

media: ov5640: Put max framerate into table and simplify check
authorAdam Ford <aford173@gmail.com>
Fri, 25 Oct 2019 19:07:23 +0000 (21:07 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 4 Jan 2020 07:07:35 +0000 (08:07 +0100)
commit5554c80e18780db8457e222e998ef56030f687bf
tree6b330cf5afd0f5f47a849d25bbfc47a4210ee6db
parent22ad4e05585cb50c486b05bdaa4b4a4686074ff7
media: ov5640: Put max framerate into table and simplify check

Currently the various modes are placed into a table, but when
ov5640_find_mode is called, it has to double check whether
or not the requested framerate is tolerated by the mode.
The determination is based on checking hact, vact, and frame rate.

Only 640x480 is allowed at 60fps and QSXGA is limited to 15fps, but
as the number of permitted frame rates change, this will begin to
add more and more complexity to the check.

This patch simplifies the check by adding the max framerate
allowed for each mode into the table of modes.  It then compares
the requested framerate to the max permitted in the mode's table.
This reduces the number of comparisions to one down from three
at run-time.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/i2c/ov5640.c