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

Commit 0b033960 authored by Suman Mukherjee's avatar Suman Mukherjee Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Added flash_led_release function



For LED flash, led_release function was missing.
Due to that, msm close was getting stuck and device can't restart.
Added null check for function pointers.

Change-Id: I1c28a92add51f5544f0b16d25c74a544c8380b19
Signed-off-by: default avatarSuman <Mukherjee&lt;sumam@codeaurora.org>
parent 2f0371e7
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -37,13 +37,25 @@ static long msm_led_flash_subdev_ioctl(struct v4l2_subdev *sd,
	}
	switch (cmd) {
	case VIDIOC_MSM_SENSOR_GET_SUBDEV_ID:
                if (fctrl->func_tbl->flash_get_subdev_id)
			return fctrl->func_tbl->flash_get_subdev_id(fctrl, argp);
		else
			pr_err("NULL flash_get_subdev function\n");
			return -EINVAL;
	case VIDIOC_MSM_FLASH_LED_DATA_CFG:
                if (fctrl->func_tbl->flash_led_config)
			return fctrl->func_tbl->flash_led_config(fctrl, argp);
		else
			pr_err("NULL flash_led_config function\n");
			return -EINVAL;
	case MSM_SD_NOTIFY_FREEZE:
		return 0;
	case MSM_SD_SHUTDOWN:
                if (fctrl->func_tbl->flash_led_release)
			return fctrl->func_tbl->flash_led_release(fctrl);
		else
			pr_err("NULL flash_led_release function\n");
			return -EINVAL;
	default:
		pr_err_ratelimited("invalid cmd %d\n", cmd);
		return -ENOIOCTLCMD;
+22 −0
Original line number Diff line number Diff line
@@ -38,6 +38,27 @@ static int32_t msm_led_trigger_get_subdev_id(struct msm_led_flash_ctrl_t *fctrl,
	return 0;
}

static int32_t msm_led_trigger_release(struct msm_led_flash_ctrl_t *fctrl)
{
	int rc = 0;
	uint32_t i;

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

	/* Flash off */
	for (i = 0; i < fctrl->flash_num_sources; i++)
		if (fctrl->flash_trigger[i])
			led_trigger_event(fctrl->flash_trigger[i], 0);
	/* Torch off */
	for (i = 0; i < fctrl->torch_num_sources; i++)
		if (fctrl->torch_trigger[i])
			led_trigger_event(fctrl->torch_trigger[i], 0);
	return rc;
}

static int32_t msm_led_trigger_config(struct msm_led_flash_ctrl_t *fctrl,
	void *data)
{
@@ -318,6 +339,7 @@ static int __init msm_led_trigger_add_driver(void)
static struct msm_flash_fn_t msm_led_trigger_func_tbl = {
	.flash_get_subdev_id = msm_led_trigger_get_subdev_id,
	.flash_led_config = msm_led_trigger_config,
	.flash_led_release = msm_led_trigger_release,
};

static struct msm_led_flash_ctrl_t fctrl = {