aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/i2c/ov5647.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/i2c/ov5647.c')
-rw-r--r--drivers/media/i2c/ov5647.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
index 95ce90fdb876..5720940d99b1 100644
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -28,6 +28,7 @@
#include <linux/of_graph.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
+#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-image-sizes.h>
@@ -77,6 +78,8 @@ struct ov5647 {
unsigned int height;
int power_count;
struct clk *xclk;
+ struct v4l2_ctrl_handler ctrls;
+ struct v4l2_ctrl *pixel_clock;
};
static inline struct ov5647 *to_state(struct v4l2_subdev *sd)
@@ -253,6 +256,7 @@ static int ov5647_stream_on(struct v4l2_subdev *sd)
{
int ret;
+ pr_info("Enabling OV5647 stream");
ret = ov5647_write(sd, 0x4202, 0x00);
if (ret < 0)
return ret;
@@ -526,6 +530,15 @@ static int ov5647_parse_dt(struct device_node *np)
return ret;
}
+static int ov5647_s_ctrl(struct v4l2_ctrl *ctrl)
+{
+ return 0;
+}
+
+static struct v4l2_ctrl_ops ov5647_ctrl_ops = {
+ .s_ctrl = ov5647_s_ctrl,
+};
+
static int ov5647_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -563,6 +576,12 @@ static int ov5647_probe(struct i2c_client *client,
mutex_init(&sensor->lock);
+ v4l2_ctrl_handler_init(&sensor->ctrls, 1);
+ sensor->pixel_clock = v4l2_ctrl_new_std(&sensor->ctrls,
+ &ov5647_ctrl_ops,
+ V4L2_CID_PIXEL_RATE,
+ 1, INT_MAX, 1, 46500000);
+ sensor->sd.ctrl_handler = &sensor->ctrls;
sd = &sensor->sd;
v4l2_i2c_subdev_init(sd, client, &ov5647_subdev_ops);
sensor->sd.internal_ops = &ov5647_subdev_internal_ops;