drivers:media: Fix imx390 & imx185 probe issue.

Due to "mingain - 1" & "minexp - 1" during probe time observing
out of range whenever gain or exp is set "0" as min in DT.
Instead doing "maxgain + 1" & "maxexp + 1" to fix the probe.

Bug 4142996
Bug 4189361
Bug 4386912

Change-Id: I103e87b293079dadcd16b91f8e329ec9f938208c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020349
Tested-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Narendra Kondapalli <nkondapalli@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
Reviewed-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Praveen AC
2023-11-22 05:46:15 +00:00
committed by Amulya Yarlagadda
parent 4ad0e0c6c8
commit 4e63d195c6

View File

@@ -326,7 +326,7 @@ static int tegracam_set_ctrls(struct tegracam_ctrl_handler *handler,
/* For controls that require sensor to be on */
switch (ctrl->id) {
case TEGRA_CAMERA_CID_GAIN:
if (*ctrl->p_new.p_s64 == ctrlprops->min_gain_val - 1)
if (*ctrl->p_new.p_s64 == ctrlprops->max_gain_val + 1)
return 0;
err = ops->set_gain(tc_dev, *ctrl->p_new.p_s64);
break;
@@ -334,7 +334,7 @@ static int tegracam_set_ctrls(struct tegracam_ctrl_handler *handler,
err = ops->set_frame_rate(tc_dev, *ctrl->p_new.p_s64);
break;
case TEGRA_CAMERA_CID_EXPOSURE:
if (*ctrl->p_new.p_s64 == ctrlprops->min_exp_time.val - 1)
if (*ctrl->p_new.p_s64 == ctrlprops->max_exp_time.val + 1)
return 0;
err = ops->set_exposure(tc_dev, *ctrl->p_new.p_s64);
break;
@@ -607,8 +607,8 @@ int tegracam_init_ctrl_ranges_by_mode(
switch (ctrl->id) {
case TEGRA_CAMERA_CID_GAIN:
err = v4l2_ctrl_modify_range(ctrl,
ctrlprops->min_gain_val - 1,
ctrlprops->max_gain_val,
ctrlprops->min_gain_val,
ctrlprops->max_gain_val + 1,
ctrlprops->step_gain_val,
ctrlprops->default_gain);
break;
@@ -621,8 +621,8 @@ int tegracam_init_ctrl_ranges_by_mode(
break;
case TEGRA_CAMERA_CID_EXPOSURE:
err = v4l2_ctrl_modify_range(ctrl,
ctrlprops->min_exp_time.val - 1,
ctrlprops->max_exp_time.val,
ctrlprops->min_exp_time.val,
ctrlprops->max_exp_time.val + 1,
ctrlprops->step_exp_time.val,
ctrlprops->default_exp_time.val);
break;