Commit ec3e0685 authored by Martin Kepplinger's avatar Martin Kepplinger
Browse files

hi846: implement open() callback for internal ops

parent ce502efe
......@@ -1387,6 +1387,22 @@ static int hi846_s_power(struct v4l2_subdev *sd, int on)
static int hi846_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
struct hi846 *hi846 = to_hi846(sd);
struct v4l2_mbus_framefmt *mf;
struct i2c_client *client = v4l2_get_subdevdata(sd);
dev_dbg(&client->dev, "%s: starting\n", __func__);
mf = v4l2_subdev_get_try_format(sd, fh->pad, 0);
mutex_lock(&hi846->mutex);
mf->code = HI846_MEDIA_BUS_FORMAT;
mf->colorspace = V4L2_COLORSPACE_RAW;
mf->field = V4L2_FIELD_NONE;
mf->width = hi846->cur_mode->width;
mf->height = hi846->cur_mode->height;
mutex_unlock(&hi846->mutex);
return 0;
}
......@@ -1415,6 +1431,10 @@ static const struct media_entity_operations hi846_subdev_entity_ops = {
.link_validate = v4l2_subdev_link_validate,
};
static const struct v4l2_subdev_internal_ops hi846_internal_ops = {
.open = hi846_open,
};
static void hi846_gpio_assert(struct hi846 *hi846, int id, bool on)
{
struct hi846_gpio *gpio = &hi846->gpios[id];
......@@ -1650,6 +1670,7 @@ static int hi846_probe(struct i2c_client *client)
goto probe_error_v4l2_ctrl_handler_free;
}
hi846->sd.internal_ops = &hi846_internal_ops;
hi846->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
hi846->sd.entity.ops = &hi846_subdev_entity_ops;
hi846->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment