]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
media: tegra: camera: Refine TPG controls
authorBhanu Murthy V <bmurthyv@nvidia.com>
Wed, 18 May 2016 22:32:16 +0000 (15:32 -0700)
committerWenjia Zhou <wenjiaz@nvidia.com>
Wed, 27 Jul 2016 22:25:12 +0000 (15:25 -0700)
Remove warning message as part of set control function
as the control while initialization always use zero
value, which is default state. This also will affect
compliance testing as control full range is not provided
to application for usage.
Fix TPG control to be available only for TPG driver.
Fix TPG control setup when multiple channels are used.

Bug 1736471
Bug 1758954

Change-Id: I589f787264608fac747f997ebee9f8e36a707831
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Reviewed-on: http://git-master/r/1150059
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
drivers/media/platform/tegra/camera/channel.c
drivers/media/platform/tegra/camera/mc_common.c
drivers/media/platform/tegra/camera/mc_common.h

index cadb24a48c97f005564fcdcb2c626f12549b1c8b..b1cf44ab6958c22e1074b448cec7bd3ccd259e6b 100644 (file)
@@ -1008,6 +1008,15 @@ static int tegra_channel_setup_controls(struct tegra_channel *chan)
                return chan->ctrl_handler.error;
        }
 
+       if (chan->vi->pg_mode) {
+               /* Add VI control handler for TPG control */
+               v4l2_ctrl_add_handler(&chan->ctrl_handler,
+                                       &chan->vi->ctrl_handler, NULL);
+               if (chan->ctrl_handler.error)
+                       dev_err(chan->vi->dev,
+                               "Failed to add VI controls\n");
+       }
+
        /* setup the controls */
        return v4l2_ctrl_handler_setup(&chan->ctrl_handler);
 }
index f852561f765dff3765d3362c6e4093b25e5e3352..f984299ea92c6ba371a203318091e0d1ef47b853 100644 (file)
@@ -128,9 +128,7 @@ static int vi_s_ctrl(struct v4l2_ctrl *ctrl)
                                 ctrl->val);
                        vi->pg_mode = ctrl->val;
                        vi->csi->pg_mode = vi->pg_mode;
-               } else
-                       dev_warn(&vi->ndev->dev,
-                                "TPG mode can't be disabled for TPG driver\n");
+               }
                break;
        default:
                dev_err(vi->dev, "%s:Not valid ctrl\n", __func__);
@@ -212,26 +210,29 @@ int tegra_vi_v4l2_init(struct tegra_mc_vi *vi)
                goto register_error;
        }
 
-       v4l2_ctrl_handler_init(&vi->ctrl_handler, 1);
-       vi->pattern = v4l2_ctrl_new_std_menu_items(&vi->ctrl_handler,
+       if (vi->pg_mode) {
+               /* only for TPG driver initialize VI ctrl handler */
+               v4l2_ctrl_handler_init(&vi->ctrl_handler, 1);
+               vi->pattern = v4l2_ctrl_new_std_menu_items(&vi->ctrl_handler,
                                &vi_ctrl_ops, V4L2_CID_TEST_PATTERN,
                                ARRAY_SIZE(vi_pattern_strings) - 1,
                                0, vi->pg_mode, vi_pattern_strings);
 
-       if (vi->ctrl_handler.error) {
-               dev_err(vi->dev, "failed to add controls\n");
-               ret = vi->ctrl_handler.error;
-               goto ctrl_error;
-       }
-       vi->v4l2_dev.ctrl_handler = &vi->ctrl_handler;
+               if (vi->ctrl_handler.error) {
+                       dev_err(vi->dev, "failed to add controls\n");
+                       ret = vi->ctrl_handler.error;
+                       goto ctrl_error;
+               }
+               vi->v4l2_dev.ctrl_handler = &vi->ctrl_handler;
 
-       ret = v4l2_ctrl_handler_setup(&vi->ctrl_handler);
-       if (ret < 0) {
-               dev_err(vi->dev, "failed to set controls\n");
-               goto ctrl_error;
+               ret = v4l2_ctrl_handler_setup(&vi->ctrl_handler);
+               if (ret < 0) {
+                       dev_err(vi->dev, "failed to set controls\n");
+                       goto ctrl_error;
+               }
        }
-       return 0;
 
+       return 0;
 
 ctrl_error:
        v4l2_ctrl_handler_free(&vi->ctrl_handler);
index 3573326a2f2704690bfad94c6658f82726c40294..4f2005d81d71a9e9d6ad767997d95413774b5ce5 100644 (file)
@@ -206,7 +206,6 @@ struct tegra_mc_vi {
 
        struct v4l2_ctrl_handler ctrl_handler;
        struct v4l2_ctrl *pattern;
-       struct v4l2_ctrl *bypass;
        enum tegra_vi_pg_mode pg_mode;
        DECLARE_BITMAP(tpg_fmts_bitmap, MAX_FORMAT_NUM);