static cam_err_t
run_flash_sequence (int fd, struct v4l2_buffer *buffer)
{
- // non flash
- led_flash_off (fd);
- mfldadvci->process_flash(advci_flash_stage_none);
- if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
- cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 0);
- return CAM_ERR_SYS;
- }
- // main flash
- mfldadvci->process_flash (advci_flash_stage_main);
- cam_driver_request_flash(fd, 1);
- if (-1 == ioctl (fd, VIDIOC_QBUF, buffer)) {
- cam_driver_dbg ("%s: Error qbuf %d\n", __func__, 1);
- return CAM_ERR_SYS;
- }
- if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
- cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 1);
- return CAM_ERR_SYS;
- }
+ // non flash
+ led_flash_off (fd);
- if (-1 == ioctl (fd, VIDIOC_QBUF, buffer)) {
- cam_driver_dbg ("%s: Error qbuf %d\n", __func__, 2);
- return CAM_ERR_SYS;
- }
- if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
- cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 2);
- return CAM_ERR_SYS;
- }
- /* In case of small images we need to do extra flash to get
- * auto exposure and auto white balance tuned for flash
- */
- if(mfld_driver.width < 2048 || mfld_driver.height < 1536) {
- cam_driver_request_flash(fd, 1);
- if (-1 == ioctl (fd, VIDIOC_QBUF, buffer)) {
- cam_driver_dbg ("%s: Error qbuf %d\n", __func__, 1);
- return CAM_ERR_SYS;
- }
- if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
- cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 1);
- return CAM_ERR_SYS;
- }
+ if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
+ cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 1);
+ return CAM_ERR_SYS;
+ }
+ mfldadvci->process_flash(advci_flash_stage_none);
- if (-1 == ioctl (fd, VIDIOC_QBUF, buffer)) {
- cam_driver_dbg ("%s: Error qbuf %d\n", __func__, 2);
- return CAM_ERR_SYS;
- }
- if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
- cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 2);
- return CAM_ERR_SYS;
- }
- }
+ if (-1 == ioctl (fd, VIDIOC_QBUF, buffer)) {
+ cam_driver_dbg ("%s: Error qbuf %d\n", __func__, 1);
+ return CAM_ERR_SYS;
+ }
+ if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
+ cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 1);
+ return CAM_ERR_SYS;
+ }
+ mfldadvci->process_flash (advci_flash_stage_pre);
- mfld_driver.flash_used = TRUE;
- return CAM_ERR_NONE;
+ cam_driver_request_flash(fd, 1);
+ if (-1 == ioctl (fd, VIDIOC_QBUF, buffer)) {
+ cam_driver_dbg ("%s: Error qbuf %d\n", __func__, 1);
+ return CAM_ERR_SYS;
+ }
+ if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
+ cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 1);
+ return CAM_ERR_SYS;
+ }
+ mfldadvci->process_flash (advci_flash_stage_main);
+ mfld_driver.flash_used = TRUE;
+ return CAM_ERR_NONE;
}
/* Discard the first two frames because of the first frame