int rt55033_gpio_flash_lock(bool lock)
{
	int ret = 0;

	mutex_lock(&flash_m_lock);
	if (lock) {
		/* Strobe Lock */
		if (strobe_lock) {
			pr_warn("%s: strobe already locked!\n", __func__);
			goto unlock;
		} else
			pr_info("%s: lock\n", __func__);

		if (rt5033_fled_strobe_critial_section_lock(&g_fled_info->base) < 0)
			pr_err("%s: error, failed to critial_section_lock\n", __func__);

		strobe_lock = true;
	} else {
		/* Strobe Unlock */
		if (!strobe_lock) {
			pr_warn("%s: strobe already is in unlock state!\n", __func__);
			goto unlock;
		} else
			pr_info("%s: unlock\n", __func__);

		if (rt5033_fled_strobe_critial_section_unlock(&g_fled_info->base) < 0)
			pr_err("%s: error, failed to critial_section_unlock\n", __func__);

		strobe_lock = false;
	}

unlock:
	mutex_unlock(&flash_m_lock);

	return ret;
}
static int32_t msm_led_trigger_config(struct msm_led_flash_ctrl_t *fctrl,
	void *data)
{
	int rc = 0;
	struct msm_camera_led_cfg_t *cfg = (struct msm_camera_led_cfg_t *)data;
	uint32_t i;
#ifdef CONFIG_FLED_RT5033_EXT_GPIO
	rt_fled_info_t *fled_info = rt_fled_get_info_by_name(NULL);
#endif
#if 0
	uint32_t curr_l, max_curr_l;
#endif
	CDBG("called led_state %d\n", cfg->cfgtype);

	if (!fctrl) {
		pr_err("failed\n");
		return -EINVAL;
	}

	switch (cfg->cfgtype) {
	case MSM_CAMERA_LED_OFF:
		CDBG("MSM_CAMERA_LED_OFF\n");
#ifdef CONFIG_FLED_RT5033_EXT_GPIO
		if (assistive_light == true) {
			CDBG("When assistive light, Not control flash\n");
			return 0;
		}
#endif
		gpio_request(fctrl->led_irq_gpio1, NULL);
		gpio_request(fctrl->led_irq_gpio2, NULL);
		gpio_direction_output(fctrl->led_irq_gpio1, 0);
		gpio_direction_output(fctrl->led_irq_gpio2, 0);
		gpio_free(fctrl->led_irq_gpio1);
		gpio_free(fctrl->led_irq_gpio2);
#ifdef CONFIG_FLED_RT5033_EXT_GPIO
		if (lock_state) {
			if (fled_info) {
				rt5033_fled_strobe_critial_section_unlock(fled_info);
				lock_state = false;
			}
		}
#endif
		break;
#if 0
		for (i = 0; i < fctrl->num_sources; i++)
			if (fctrl->flash_trigger[i])
				led_trigger_event(fctrl->flash_trigger[i], 0);
		if (fctrl->torch_trigger)
			led_trigger_event(fctrl->torch_trigger, 0);
		break;
#endif

	case MSM_CAMERA_LED_LOW:
		CDBG("MSM_CAMERA_LED_LOW\n");
#ifdef CONFIG_FLED_RT5033_EXT_GPIO
		if (assistive_light == true) {
			CDBG("When assistive light, Not control flash\n");
			return 0;
		}
#endif
		gpio_request(fctrl->led_irq_gpio1, NULL);
		gpio_direction_output(fctrl->led_irq_gpio1, 1);
		gpio_free(fctrl->led_irq_gpio1);
		break;
#if 0
		if (fctrl->torch_trigger) {
			max_curr_l = fctrl->torch_max_current;
			if (cfg->torch_current > 0 &&
				cfg->torch_current < max_curr_l) {
				curr_l = cfg->torch_current;
			} else {
				curr_l = fctrl->torch_op_current;
				pr_debug("LED current clamped to %d\n",
					curr_l);
			}
			led_trigger_event(fctrl->torch_trigger,
				curr_l);
		}
		break;
#endif

	case MSM_CAMERA_LED_HIGH:
		CDBG("MSM_CAMERA_LED_HIGH\n");
#ifdef CONFIG_FLED_RT5033_EXT_GPIO
		if (assistive_light == true) {
			CDBG("When assistive light, Not control flash\n");
			return 0;
		}
		if (fled_info) {
			rt5033_fled_strobe_critial_section_lock(fled_info);
			lock_state = true;
		}
#endif
		gpio_request(fctrl->led_irq_gpio2, NULL);
		gpio_direction_output(fctrl->led_irq_gpio2, 1);
		gpio_free(fctrl->led_irq_gpio2);
		break;
#if 0
		if (fctrl->torch_trigger)
			led_trigger_event(fctrl->torch_trigger, 0);
		for (i = 0; i < fctrl->num_sources; i++)
			if (fctrl->flash_trigger[i]) {
				max_curr_l = fctrl->flash_max_current[i];
				if (cfg->flash_current[i] > 0 &&
					cfg->flash_current[i] < max_curr_l) {
					curr_l = cfg->flash_current[i];
				} else {
					curr_l = fctrl->flash_op_current[i];
					pr_debug("LED current clamped to %d\n",
						curr_l);
				}
				led_trigger_event(fctrl->flash_trigger[i],
					curr_l);
			}
		break;
#endif
	case MSM_CAMERA_LED_INIT:
	case MSM_CAMERA_LED_RELEASE:
		CDBG("MSM_CAMERA_LED_INIT\n");
#ifdef CONFIG_FLED_RT5033_EXT_GPIO
		if (assistive_light == true) {
			CDBG("When assistive light, Not control flash\n");
		} else {
			gpio_request(fctrl->led_irq_gpio1, NULL);
			gpio_request(fctrl->led_irq_gpio2, NULL);
			gpio_direction_output(fctrl->led_irq_gpio1, 0);
			gpio_direction_output(fctrl->led_irq_gpio2, 0);
			gpio_free(fctrl->led_irq_gpio1);
			gpio_free(fctrl->led_irq_gpio2);
			if (lock_state) {
				if (fled_info) {
					rt5033_fled_strobe_critial_section_unlock(fled_info);
					lock_state = false;
				}
			}
		}
#endif
		for (i = 0; i < fctrl->num_sources; i++)
			if (fctrl->flash_trigger[i])
				led_trigger_event(fctrl->flash_trigger[i], 0);
		if (fctrl->torch_trigger)
			led_trigger_event(fctrl->torch_trigger, 0);
		break;

	default:
		pr_err("LED state error!\n");
		rc = -EFAULT;
		break;
	}

	CDBG("flash_set_led_state: return %d\n", rc);
	return rc;
}