diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-08-16 02:57:30 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-09-21 19:11:30 -0400 |
commit | 18cb65033832df8d33aa3a9c9c3e32016fc09cf5 (patch) | |
tree | e819d0dac37b00e76dcb6ce00f1812ab6da7d70f /drivers/media/i2c/tvp7002.c | |
parent | a0ffe4c0908b27b35ce56d35ba6f3c10be3fd371 (diff) |
[media] tvp7002: Don't update device->streaming if write to register fails
This ensures device->streaming has correct status.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c/tvp7002.c')
-rw-r--r-- | drivers/media/i2c/tvp7002.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c index 11f2387e1dab..51bac762638b 100644 --- a/drivers/media/i2c/tvp7002.c +++ b/drivers/media/i2c/tvp7002.c | |||
@@ -775,25 +775,20 @@ static int tvp7002_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, | |||
775 | static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable) | 775 | static int tvp7002_s_stream(struct v4l2_subdev *sd, int enable) |
776 | { | 776 | { |
777 | struct tvp7002 *device = to_tvp7002(sd); | 777 | struct tvp7002 *device = to_tvp7002(sd); |
778 | int error = 0; | 778 | int error; |
779 | 779 | ||
780 | if (device->streaming == enable) | 780 | if (device->streaming == enable) |
781 | return 0; | 781 | return 0; |
782 | 782 | ||
783 | if (enable) { | 783 | /* low impedance: on, high impedance: off */ |
784 | /* Set output state on (low impedance means stream on) */ | 784 | error = tvp7002_write(sd, TVP7002_MISC_CTL_2, enable ? 0x00 : 0x03); |
785 | error = tvp7002_write(sd, TVP7002_MISC_CTL_2, 0x00); | 785 | if (error) { |
786 | device->streaming = enable; | 786 | v4l2_dbg(1, debug, sd, "Fail to set streaming\n"); |
787 | } else { | 787 | return error; |
788 | /* Set output state off (high impedance means stream off) */ | ||
789 | error = tvp7002_write(sd, TVP7002_MISC_CTL_2, 0x03); | ||
790 | if (error) | ||
791 | v4l2_dbg(1, debug, sd, "Unable to stop streaming\n"); | ||
792 | |||
793 | device->streaming = enable; | ||
794 | } | 788 | } |
795 | 789 | ||
796 | return error; | 790 | device->streaming = enable; |
791 | return 0; | ||
797 | } | 792 | } |
798 | 793 | ||
799 | /* | 794 | /* |