[PATCH/RFC v1 9/9] media: i2c: ar0144: Add support for companding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx>
---
 drivers/media/i2c/ar0144.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ar0144.c b/drivers/media/i2c/ar0144.c
index 782a09a66ba6..021e19861f8f 100644
--- a/drivers/media/i2c/ar0144.c
+++ b/drivers/media/i2c/ar0144.c
@@ -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);
-- 
Regards,

Laurent Pinchart





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux