]> git.baikalelectronics.ru Git - kernel.git/commit
media: imx258: Limit the max analogue gain to 480
authorUmang Jain <umang.jain@ideasonboard.com>
Fri, 23 Jul 2021 11:22:33 +0000 (13:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:31 +0000 (12:26 +0200)
commit7615b2016246ebb17ce76d421d43df3d264e73b7
tree3216d53554f6d82a2c83a2f4bc6763bed69b6cd6
parent66f1ee168722f862240ed595cc75660aa1079421
media: imx258: Limit the max analogue gain to 480

[ Upstream commit f809665ee75fff3f4ea8907f406a66d380aeb184 ]

The range for analog gain mentioned in the datasheet is [0, 480].
The real gain formula mentioned in the datasheet is:

Gain = 512 / (512 – X)

Hence, values larger than 511 clearly makes no sense. The gain
register field is also documented to be of 9-bits in the datasheet.

Certainly, it is enough to infer that, the kernel driver currently
advertises an arbitrary analog gain max. Fix it by rectifying the
value as per the data sheet i.e. 480.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/i2c/imx258.c