[COMMON] fimc-is2: add condition for flash S2MU106 initilize
authorWooyeon Kim <wooy88.kim@samsung.com>
Thu, 24 Jan 2019 09:59:25 +0000 (18:59 +0900)
committerlingsen1 <lingsen1@lenovo.com>
Sun, 7 Feb 2021 09:36:55 +0000 (17:36 +0800)
 - when flash init, if flash is turned on, do off

 PR JIRA ID: CPR-618

Change-Id: I58aa9d8e39dc526a172b9f4f0ae658b992c4d9f6
Signed-off-by: Wooyeon Kim <wooy88.kim@samsung.com>
drivers/media/platform/exynos/fimc-is2/sensor/module_framework/flash/fimc-is-flash-s2mu106.c

index 3e7743b6658bdf93de8430081e266c8ad054bb00..7b0800255387a33aa9ed478ac2b385ddb618034a 100644 (file)
@@ -41,6 +41,11 @@ static int flash_s2mu106_init(struct v4l2_subdev *subdev, u32 val)
 
        FIMC_BUG(!flash);
 
+       for (i = 0; i < FLASH_LED_CH_MAX; i++) {
+               if (flash->led_ch[i] >= 0 && flash->flash_data.flash_fired)
+                       s2mu106_fled_set_mode_ctrl(flash->led_ch[i], CAM_FLASH_MODE_OFF);
+       }
+
        /* TODO: init flash driver */
        flash->flash_data.mode = CAM2_FLASH_MODE_OFF;
        flash->flash_data.intensity = 100; /* TODO: Need to figure out min/max range */
@@ -48,11 +53,6 @@ static int flash_s2mu106_init(struct v4l2_subdev *subdev, u32 val)
        flash->flash_data.flash_fired = false;
        flash->flash_data.cal_en = false;
 
-       for (i = 0; i < FLASH_LED_CH_MAX; i++) {
-               if (flash->led_ch[i] >= 0)
-                       s2mu106_fled_set_mode_ctrl(flash->led_ch[i], CAM_FLASH_MODE_OFF);
-       }
-
        return ret;
 }