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

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

Merge "leds: leds-qpnp-flash: move duration property to flash LED node"

parents e0e26b4e 82b82753
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -54,12 +54,6 @@ Optional properties:
				  when battery voltage is low
- qcom,otst2-moduled-enabled	: Boolean type. This enables driver to enable MASK to support
				OTST2 connection.
- qcom,duration			: Duration for flash LED. When duration time expires, hardware
				will turn off flash LED. Values should be from 10 ms to 1280 ms
				with 10 ms incremental step. Not applicable to torch.
- qcom,follow-otst2-rb-disabled	: Boolean type. This allows driver to reset/deset module.
				By default, driver resets module. This entry allows driver to
				bypass reset module sequence.

Required properties inside child node. Chile node contains settings for each individual LED.
Each LED hardware needs a node for itself and a switch node to control brightness.
@@ -81,7 +75,11 @@ Optional properties inside child node:
			  integer from 0 t 1000 inclusive, indicating 0 to 1000 mA.
- boost-supply		: flash LED boost power source for flash LED
- boost-voltage-max	: maximum voltage for flash LED boost regulator in uV. This attribute is
			: required if boost-supply is defined.
			required if boost-supply is defined.
- qcom,duration	: Duration for flash LED. When duration time expires, hardware will turn off
		flash LED. Values should be from 10 ms to 1280 ms with 10 ms incremental
		step. Not applicable to torch. It is required for LED:SWITCH node to handle
		LED used as flash.

Example:
	qcom,leds@d300 {
@@ -105,7 +103,6 @@ Example:
		qcom,vph-pwr-droop-debounce-time = <10>;
		qcom,headroom-sense-ch0-enabled;
		qcom,headroom-sense-ch1-enabled;
		qcom,duration = <1280>;

		pm8226_flash0: qcom,flash_0 {
			label = "flash";
@@ -114,6 +111,7 @@ Example:
					"flash0_trigger";
			qcom,max-current = <1000>;
			qcom,id = <0>;
			qcom,duration = <1280>;
			qcom,current = <625>;
		};

@@ -136,6 +134,7 @@ Example:
					"switch_trigger";
			qcom,id = <2>;
			qcom,current = <625>;
			qcom,duration = <1280>;
			qcom,max-current = <1000>;
			boost-supply = <pm8226_chg_boost>;
			boost-voltage-max = <3600000>;
+13 −11
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ struct flash_node_data {
	u32				boost_voltage_max;
	u16				max_current;
	u16				prgm_current;
	u16				duration;
	u8				id;
	u8				type;
	u8				trigger;
@@ -190,7 +191,6 @@ struct flash_led_platform_data {
	u16				vph_pwr_droop_threshold;
	u16				headroom;
	u16				clamp_current;
	u16				duration;
	u8				thermal_derate_threshold;
	u8				vph_pwr_droop_debounce_time;
	u8				startup_dly;
@@ -1297,7 +1297,7 @@ static void qpnp_flash_led_work(struct work_struct *work)
			}
		}

		val = (u8)((led->pdata->duration - FLASH_DURATION_DIVIDER)
		val = (u8)((flash_node->duration - FLASH_DURATION_DIVIDER)
						/ FLASH_DURATION_DIVIDER);
		rc = qpnp_led_masked_write(led->spmi_dev,
			FLASH_SAFETY_TIMER(led->base),
@@ -1748,6 +1748,17 @@ static int qpnp_flash_led_parse_each_led_dt(struct qpnp_flash_led *led,
		return rc;
	}

	if (flash_node->type == SWITCH || flash_node->type == FLASH) {
		rc = of_property_read_u32(node, "qcom,duration", &val);
		if (!rc)
			flash_node->duration = (u16)val;
		else if (rc != -EINVAL) {
			dev_err(&led->spmi_dev->dev,
					"Unable to read duration\n");
			return rc;
		}
	}

	switch (led->peripheral_type) {
	case FLASH_SUBTYPE_SINGLE:
		flash_node->trigger = FLASH_LED0_TRIGGER;
@@ -1829,15 +1840,6 @@ static int qpnp_flash_led_parse_common_dt(
		return rc;
	}

	rc = of_property_read_u32(node, "qcom,duration", &val);
	if (!rc) {
		led->pdata->duration = val;
	} else if (rc != -EINVAL) {
		dev_err(&led->spmi_dev->dev,
					"unable to read duration\n");
		return rc;
	}

	led->pdata->pmic_charger_support =
			of_property_read_bool(node,
						"qcom,pmic-charger-support");