diff options
author | Marco Felsch <m.felsch@pengutronix.de> | 2020-03-12 11:31:52 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-03-12 16:40:51 +0100 |
commit | 9c8e509863287383363e01d7eaae1086b2b411d8 (patch) | |
tree | 56bb9f9c666bc42583f1c7eb5f3703e5d73b07cb /drivers/media/i2c/tvp5150.c | |
parent | media: tvp5150: add v4l2-event support (diff) | |
download | linux-9c8e509863287383363e01d7eaae1086b2b411d8.tar.xz linux-9c8e509863287383363e01d7eaae1086b2b411d8.zip |
media: tvp5150: add subdev open/close callbacks
Bring the device into a working state upon a open/close call. Currently
this involves only the interrupt enable/disable process but can be
extended in the future.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/i2c/tvp5150.c')
-rw-r--r-- | drivers/media/i2c/tvp5150.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index d59b52775334..f28739d5830c 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -1618,6 +1618,26 @@ err: return 0; } +static int tvp5150_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) +{ + int ret; + + ret = pm_runtime_get_sync(sd->dev); + if (ret < 0) { + pm_runtime_put_noidle(sd->dev); + return ret; + } + + return 0; +} + +static int tvp5150_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) +{ + pm_runtime_put(sd->dev); + + return 0; +} + /* ----------------------------------------------------------------------- */ static const struct v4l2_ctrl_ops tvp5150_ctrl_ops = { @@ -1675,6 +1695,8 @@ static const struct v4l2_subdev_ops tvp5150_ops = { static const struct v4l2_subdev_internal_ops tvp5150_internal_ops = { .registered = tvp5150_registered, + .open = tvp5150_open, + .close = tvp5150_close, }; /**************************************************************************** |