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

Commit d46c3e85 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: sensor: Add flash support capability in sensor library."

parents 69c4f207 d69e4dfe
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -38,7 +38,8 @@ Optional properties:
    -pm8941_torch
- qcom,slave-id : should contain i2c slave address, device id address
    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.
Example:

qcom,led-flash@60 {
@@ -57,4 +58,6 @@ qcom,led-flash@60 {
		qcom,gpio-req-tbl-flags = <0 0>;
		qcom,gpio-req-tbl-label = "FLASH_EN",
			"FLASH_NOW";
		qcom,max-current = <750>;
		qcom,max-duration = <1600>;
	};
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ struct msm_led_flash_ctrl_t {
	struct led_trigger *flash_trigger[MAX_LED_TRIGGERS];
	uint32_t flash_op_current[MAX_LED_TRIGGERS];
	uint32_t flash_max_current[MAX_LED_TRIGGERS];
	uint32_t flash_max_duration[MAX_LED_TRIGGERS];
	const char *torch_trigger_name;
	struct led_trigger *torch_trigger;
	uint32_t torch_op_current;
+51 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ int32_t msm_led_i2c_trigger_config(struct msm_led_flash_ctrl_t *fctrl,
	void *data)
{
	int rc = 0;
	int i = 0;
	struct msm_camera_led_cfg_t *cfg = (struct msm_camera_led_cfg_t *)data;
	CDBG("called led_state %d\n", cfg->cfgtype);

@@ -56,6 +57,12 @@ int32_t msm_led_i2c_trigger_config(struct msm_led_flash_ctrl_t *fctrl,
	case MSM_CAMERA_LED_INIT:
		if (fctrl->func_tbl->flash_led_init)
			rc = fctrl->func_tbl->flash_led_init(fctrl);
		for (i = 0; i < MAX_LED_TRIGGERS; i++) {
			cfg->flash_current[i] =
				fctrl->flash_max_current[i];
			cfg->flash_duration[i] =
				fctrl->flash_max_duration[i];
		}
		break;

	case MSM_CAMERA_LED_RELEASE:
@@ -418,6 +425,50 @@ static int32_t msm_led_get_dt_data(struct device_node *of_node,
			}
		}

		/* Read the max current for an LED if present */
		if (of_get_property(of_node, "qcom,max-current", &count)) {
			count /= sizeof(uint32_t);

			if (count > MAX_LED_TRIGGERS) {
				pr_err("failed\n");
				rc = -EINVAL;
				goto ERROR8;
			}

			rc = of_property_read_u32_array(of_node,
				"qcom,max-current",
				fctrl->flash_max_current, count);
			if (rc < 0) {
				pr_err("%s failed %d\n", __func__, __LINE__);
				goto ERROR8;
			}

			for (; count < MAX_LED_TRIGGERS; count++)
				fctrl->flash_max_current[count] = 0;
		}

		/* Read the max duration for an LED if present */
		if (of_get_property(of_node, "qcom,max-duration", &count)) {
			count /= sizeof(uint32_t);

			if (count > MAX_LED_TRIGGERS) {
				pr_err("failed\n");
				rc = -EINVAL;
				goto ERROR8;
			}

			rc = of_property_read_u32_array(of_node,
				"qcom,max-duration",
				fctrl->flash_max_duration, count);
			if (rc < 0) {
				pr_err("%s failed %d\n", __func__, __LINE__);
				goto ERROR8;
			}

			for (; count < MAX_LED_TRIGGERS; count++)
				fctrl->flash_max_duration[count] = 0;
		}

		flashdata->slave_info =
			kzalloc(sizeof(struct msm_camera_slave_info),
				GFP_KERNEL);
+1 −0
Original line number Diff line number Diff line
@@ -737,6 +737,7 @@ struct msm_camera_led_cfg_t {
	enum msm_camera_led_config_t cfgtype;
	uint32_t torch_current;
	uint32_t flash_current[MAX_LED_TRIGGERS];
	uint32_t flash_duration[MAX_LED_TRIGGERS];
};

/* sensor init structures and enums */