Add the V4L2_CID_COMPANDING control to enable control of companding. The
sensor supports A-law only, enable the linear (no companding) and A-law
menu entries.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/i2c/ar0144.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
@@ -996,6 +996,12 @@ static int ar0144_s_ctrl(struct v4l2_ctrl *ctrl)
AR0144_AUTO_AG_EN | AR0144_AE_ENABLE : 0, &ret);
break;
+ case V4L2_CID_COMPANDING:
+ cci_write(sensor->regmap, AR0144_COMPANDING,
+ ctrl->val == V4L2_COMPANDING_ALAW ?
+ AR0144_COMPAND_EN : 0, &ret);
+ break;
+
case V4L2_CID_LINK_FREQ:
break;
@@ -1030,7 +1036,7 @@ static int ar0144_init_ctrls(struct ar0144 *sensor)
if (ret < 0)
return ret;
- v4l2_ctrl_handler_init(&sensor->ctrls, 17);
+ v4l2_ctrl_handler_init(&sensor->ctrls, 18);
v4l2_ctrl_new_fwnode_properties(&sensor->ctrls, &ar0144_ctrl_ops,
&props);
@@ -1094,6 +1100,10 @@ static int ar0144_init_ctrls(struct ar0144 *sensor)
sensor->vflip = v4l2_ctrl_new_std(&sensor->ctrls, &ar0144_ctrl_ops,
V4L2_CID_VFLIP, 0, 1, 1, 0);
+ v4l2_ctrl_new_std_menu(&sensor->ctrls, &ar0144_ctrl_ops,
+ V4L2_CID_COMPANDING, V4L2_COMPANDING_ALAW, 0,
+ V4L2_COMPANDING_LINEAR);
+
if (sensor->ctrls.error) {
ret = sensor->ctrls.error;
v4l2_ctrl_handler_free(&sensor->ctrls);