Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e1b466d authored by Nishant Pandit's avatar Nishant Pandit Committed by Matt Wagantall
Browse files

msm: camera: Optimize the dual led flash scenarios



  The dual led flash usecases have considerable latency than single
led  because each request is queued into the worker thread of led
framework which has inherent latency. This also causes sync issues
with each led firing at different time.

  The solution is to configure the current values for each led and use
a trigger node to fire both the leds at the same time.

Change-Id: I0a853b154a6175c3f88681711e413753afd84890
Signed-off-by: default avatarNishant Pandit <npandit@codeaurora.org>
parent bbf2b5fa
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ Optional properties:
    and expected id read value.
- qcom,max-current: Max current in mA supported by flash
- qcom,max-duration: Max duration in milliseconds the flash can glow.
-qcom,switch-source : Should contain phandle to switch source node.
      This is used to trigger dual led at same time to avoid sync issues.
Example:

qcom,led-flash@60 {
+32 −1
Original line number Diff line number Diff line
@@ -378,6 +378,8 @@ static int32_t msm_flash_off(struct msm_flash_ctrl_t *flash_ctrl,
	for (i = 0; i < flash_ctrl->torch_num_sources; i++)
		if (flash_ctrl->torch_trigger[i])
			led_trigger_event(flash_ctrl->torch_trigger[i], 0);
	if (flash_ctrl->switch_trigger)
		led_trigger_event(flash_ctrl->switch_trigger, 0);

	CDBG("Exit\n");
	return 0;
@@ -518,7 +520,8 @@ static int32_t msm_flash_low(
				curr);
		}
	}

	if (flash_ctrl->switch_trigger)
		led_trigger_event(flash_ctrl->switch_trigger, 1);
	CDBG("Exit\n");
	return 0;
}
@@ -554,6 +557,8 @@ static int32_t msm_flash_high(
				curr);
		}
	}
	if (flash_ctrl->switch_trigger)
		led_trigger_event(flash_ctrl->switch_trigger, 1);
	return 0;
}

@@ -759,6 +764,32 @@ static int32_t msm_flash_get_pmic_source_info(
	uint32_t count = 0, i = 0;
	struct device_node *flash_src_node = NULL;
	struct device_node *torch_src_node = NULL;
	struct device_node *switch_src_node = NULL;

	switch_src_node = of_parse_phandle(of_node, "qcom,switch-source", 0);
	if (!switch_src_node) {
		CDBG("%s:%d switch_src_node NULL\n", __func__, __LINE__);
	} else {
		rc = of_property_read_string(switch_src_node,
			"qcom,default-led-trigger",
			&fctrl->switch_trigger_name);
		if (rc < 0) {
			rc = of_property_read_string(switch_src_node,
				"linux,default-trigger",
				&fctrl->switch_trigger_name);
			if (rc < 0)
				pr_err("default-trigger read failed\n");
		}
		of_node_put(switch_src_node);
		switch_src_node = NULL;
		if (!rc) {
			CDBG("switch trigger %s\n",
				fctrl->switch_trigger_name);
			led_trigger_register_simple(
				fctrl->switch_trigger_name,
				&fctrl->switch_trigger);
		}
	}

	if (of_get_property(of_node, "qcom,flash-source", &count)) {
		count /= sizeof(uint32_t);
+5 −1
Original line number Diff line number Diff line
/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2009-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -64,6 +64,10 @@ struct msm_flash_ctrl_t {
	struct msm_flash_func_t *func_tbl;
	struct msm_camera_power_ctrl_t power_info;

	/* Switch node to trigger led */
	const char *switch_trigger_name;
	struct led_trigger *switch_trigger;

	/* Flash */
	uint32_t flash_num_sources;
	const char *flash_trigger_name[MAX_LED_TRIGGERS];