diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-08-01 16:09:24 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-17 19:33:41 +0200 |
commit | 5bd1d91d673df395aafe0c984de6195e9e662ec3 (patch) | |
tree | 8275bab0a5ed285b483a8bf70efbe80f5582465b /drivers/media/i2c/tvp5150.c | |
parent | media: tvp5150: add querystd (diff) | |
download | linux-5bd1d91d673df395aafe0c984de6195e9e662ec3.tar.xz linux-5bd1d91d673df395aafe0c984de6195e9e662ec3.zip |
media: tvp5150: implement decoder lock when irq is not used
When irq is used, the lock is set via IRQ code. When it isn't,
the driver just assumes it is always locked. Instead, read the
lock status from the status register.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/i2c/tvp5150.c')
-rw-r--r-- | drivers/media/i2c/tvp5150.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index cbb19001c9e4..f4cd73d90f7f 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -810,11 +810,25 @@ static v4l2_std_id tvp5150_read_std(struct v4l2_subdev *sd) } } +static int query_lock(struct v4l2_subdev *sd) +{ + struct tvp5150 *decoder = to_tvp5150(sd); + int status; + + if (decoder->irq) + return decoder->lock; + + regmap_read(decoder->regmap, TVP5150_STATUS_REG_1, &status); + + /* For standard detection, we need the 3 locks */ + return (status & 0x0e) == 0x0e; +} + static int tvp5150_querystd(struct v4l2_subdev *sd, v4l2_std_id *std_id) { struct tvp5150 *decoder = to_tvp5150(sd); - *std_id = decoder->lock ? tvp5150_read_std(sd) : V4L2_STD_UNKNOWN; + *std_id = query_lock(sd) ? tvp5150_read_std(sd) : V4L2_STD_UNKNOWN; return 0; } @@ -1208,7 +1222,10 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable) tvp5150_enable(sd); /* Enable outputs if decoder is locked */ - val = decoder->lock ? decoder->oe : 0; + if (decoder->irq) + val = decoder->lock ? decoder->oe : 0; + else + val = decoder->oe; int_val = TVP5150_INT_A_LOCK; v4l2_subdev_notify_event(&decoder->sd, &tvp5150_ev_fmt); } @@ -1777,8 +1794,6 @@ static int tvp5150_probe(struct i2c_client *c, IRQF_ONESHOT, "tvp5150", core); if (res) return res; - } else { - core->lock = true; } res = v4l2_async_register_subdev(sd); |