diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-10-03 14:24:46 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-10-03 14:24:46 -0400 |
| commit | 447a8b858e4bda41c394b1bc7fdbc9dc0bdf44f6 (patch) | |
| tree | 676e741f2552c9cb301e1e49c557b92bf8940f55 /drivers/media/platform/vsp1/vsp1_entity.c | |
| parent | 3049683eafdbbbd7350b0e5ca02a2d8c026a3362 (diff) | |
| parent | 042e1c79166b9250edd8262bea84e1703f27ad2e (diff) | |
Merge branch 'next' into for-linus
Prepare first round of input updates for 3.18.
Diffstat (limited to 'drivers/media/platform/vsp1/vsp1_entity.c')
| -rw-r--r-- | drivers/media/platform/vsp1/vsp1_entity.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c index 44167834285d..79af71d5e270 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.c +++ b/drivers/media/platform/vsp1/vsp1_entity.c | |||
| @@ -20,6 +20,42 @@ | |||
| 20 | 20 | ||
| 21 | #include "vsp1.h" | 21 | #include "vsp1.h" |
| 22 | #include "vsp1_entity.h" | 22 | #include "vsp1_entity.h" |
| 23 | #include "vsp1_video.h" | ||
| 24 | |||
| 25 | bool vsp1_entity_is_streaming(struct vsp1_entity *entity) | ||
| 26 | { | ||
| 27 | bool streaming; | ||
| 28 | |||
| 29 | mutex_lock(&entity->lock); | ||
| 30 | streaming = entity->streaming; | ||
| 31 | mutex_unlock(&entity->lock); | ||
| 32 | |||
| 33 | return streaming; | ||
| 34 | } | ||
| 35 | |||
| 36 | int vsp1_entity_set_streaming(struct vsp1_entity *entity, bool streaming) | ||
| 37 | { | ||
| 38 | int ret; | ||
| 39 | |||
| 40 | mutex_lock(&entity->lock); | ||
| 41 | entity->streaming = streaming; | ||
| 42 | mutex_unlock(&entity->lock); | ||
| 43 | |||
| 44 | if (!streaming) | ||
| 45 | return 0; | ||
| 46 | |||
| 47 | if (!entity->subdev.ctrl_handler) | ||
| 48 | return 0; | ||
| 49 | |||
| 50 | ret = v4l2_ctrl_handler_setup(entity->subdev.ctrl_handler); | ||
| 51 | if (ret < 0) { | ||
| 52 | mutex_lock(&entity->lock); | ||
| 53 | entity->streaming = false; | ||
| 54 | mutex_unlock(&entity->lock); | ||
| 55 | } | ||
| 56 | |||
| 57 | return ret; | ||
| 58 | } | ||
| 23 | 59 | ||
| 24 | /* ----------------------------------------------------------------------------- | 60 | /* ----------------------------------------------------------------------------- |
| 25 | * V4L2 Subdevice Operations | 61 | * V4L2 Subdevice Operations |
| @@ -157,6 +193,8 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, | |||
| 157 | if (i == ARRAY_SIZE(vsp1_routes)) | 193 | if (i == ARRAY_SIZE(vsp1_routes)) |
| 158 | return -EINVAL; | 194 | return -EINVAL; |
| 159 | 195 | ||
| 196 | mutex_init(&entity->lock); | ||
| 197 | |||
| 160 | entity->vsp1 = vsp1; | 198 | entity->vsp1 = vsp1; |
| 161 | entity->source_pad = num_pads - 1; | 199 | entity->source_pad = num_pads - 1; |
| 162 | 200 | ||
| @@ -185,7 +223,11 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, | |||
| 185 | 223 | ||
| 186 | void vsp1_entity_destroy(struct vsp1_entity *entity) | 224 | void vsp1_entity_destroy(struct vsp1_entity *entity) |
| 187 | { | 225 | { |
| 226 | if (entity->video) | ||
| 227 | vsp1_video_cleanup(entity->video); | ||
| 188 | if (entity->subdev.ctrl_handler) | 228 | if (entity->subdev.ctrl_handler) |
| 189 | v4l2_ctrl_handler_free(entity->subdev.ctrl_handler); | 229 | v4l2_ctrl_handler_free(entity->subdev.ctrl_handler); |
| 190 | media_entity_cleanup(&entity->subdev.entity); | 230 | media_entity_cleanup(&entity->subdev.entity); |
| 231 | |||
| 232 | mutex_destroy(&entity->lock); | ||
| 191 | } | 233 | } |
