diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2011-06-10 14:36:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-09-06 16:49:40 -0400 |
commit | e1d72f4d521733bbf16cb5ba63683fe4147fa349 (patch) | |
tree | be8e5825baef40898b4058f2f519e359dea781f9 /drivers/media/video/s5p-fimc/fimc-capture.c | |
parent | ee7160e57c98ffb03253abb2cb4ad5b1376a2257 (diff) |
[media] s5p-fimc: Add v4l2_device notification support for single frame capture
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s5p-fimc/fimc-capture.c')
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-capture.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index adbbb63fd526..7fafd1228fbc 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -1076,6 +1076,53 @@ static const struct media_entity_operations fimc_sd_media_ops = { | |||
1076 | .link_setup = fimc_link_setup, | 1076 | .link_setup = fimc_link_setup, |
1077 | }; | 1077 | }; |
1078 | 1078 | ||
1079 | /** | ||
1080 | * fimc_sensor_notify - v4l2_device notification from a sensor subdev | ||
1081 | * @sd: pointer to a subdev generating the notification | ||
1082 | * @notification: the notification type, must be S5P_FIMC_TX_END_NOTIFY | ||
1083 | * @arg: pointer to an u32 type integer that stores the frame payload value | ||
1084 | * | ||
1085 | * The End Of Frame notification sent by sensor subdev in its still capture | ||
1086 | * mode. If there is only a single VSYNC generated by the sensor at the | ||
1087 | * beginning of a frame transmission, FIMC does not issue the LastIrq | ||
1088 | * (end of frame) interrupt. And this notification is used to complete the | ||
1089 | * frame capture and returning a buffer to user-space. Subdev drivers should | ||
1090 | * call this notification from their last 'End of frame capture' interrupt. | ||
1091 | */ | ||
1092 | void fimc_sensor_notify(struct v4l2_subdev *sd, unsigned int notification, | ||
1093 | void *arg) | ||
1094 | { | ||
1095 | struct fimc_sensor_info *sensor; | ||
1096 | struct fimc_vid_buffer *buf; | ||
1097 | struct fimc_md *fmd; | ||
1098 | struct fimc_dev *fimc; | ||
1099 | unsigned long flags; | ||
1100 | |||
1101 | if (sd == NULL) | ||
1102 | return; | ||
1103 | |||
1104 | sensor = v4l2_get_subdev_hostdata(sd); | ||
1105 | fmd = entity_to_fimc_mdev(&sd->entity); | ||
1106 | |||
1107 | spin_lock_irqsave(&fmd->slock, flags); | ||
1108 | fimc = sensor ? sensor->host : NULL; | ||
1109 | |||
1110 | if (fimc && arg && notification == S5P_FIMC_TX_END_NOTIFY && | ||
1111 | test_bit(ST_CAPT_PEND, &fimc->state)) { | ||
1112 | unsigned long irq_flags; | ||
1113 | spin_lock_irqsave(&fimc->slock, irq_flags); | ||
1114 | if (!list_empty(&fimc->vid_cap.active_buf_q)) { | ||
1115 | buf = list_entry(fimc->vid_cap.active_buf_q.next, | ||
1116 | struct fimc_vid_buffer, list); | ||
1117 | vb2_set_plane_payload(&buf->vb, 0, *((u32 *)arg)); | ||
1118 | } | ||
1119 | fimc_capture_irq_handler(fimc, true); | ||
1120 | fimc_deactivate_capture(fimc); | ||
1121 | spin_unlock_irqrestore(&fimc->slock, irq_flags); | ||
1122 | } | ||
1123 | spin_unlock_irqrestore(&fmd->slock, flags); | ||
1124 | } | ||
1125 | |||
1079 | static int fimc_subdev_enum_mbus_code(struct v4l2_subdev *sd, | 1126 | static int fimc_subdev_enum_mbus_code(struct v4l2_subdev *sd, |
1080 | struct v4l2_subdev_fh *fh, | 1127 | struct v4l2_subdev_fh *fh, |
1081 | struct v4l2_subdev_mbus_code_enum *code) | 1128 | struct v4l2_subdev_mbus_code_enum *code) |