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

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

Merge "mdss: display: making lpg channel and pwm period as optional"

parents 101ddc30 5e25ef79
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -3,7 +3,8 @@ Qualcomm MDSS EDP
MDSS EDP is a edp driver which supports panels that are compatable with
VESA EDP display interface specification.

One should also configure the gpio that drives the pwm to the external backlight.
When configuring the optional properties for external backlight, one should also
configure the gpio that drives the pwm to it.

Required properties
- compatible :				Must be "qcom,mdss-edp".
@@ -14,8 +15,6 @@ Required properties
- vdda-supply :				Phandle for vdd regulator device node.
- gpio-panel-en	:			GPIO for supplying power to panel and backlight
							driver.
- qcom,panel-lpg-channel :		LPG channel for backlight.
- qcom,panel-pwm-period :		PWM period in microseconds.
- status :				A string that has to be set to "okay/ok" to enable
						the driver. By default this property will be set to
						"disable". Will be set to "ok/okay" status for
@@ -24,6 +23,10 @@ Required properties
					interface is mapped.
- gpio-panel-hpd :			gpio pin use for edp hpd

Optional properties
- qcom,panel-lpg-channel :		LPG channel for backlight.
- qcom,panel-pwm-period :		PWM period in microseconds.


Optional properties:
- qcom,cont-splash-enabled:             Boolean used to enable continuous splash mode.
+2 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@
	qcom,mdss_edp@fd923400 {
		status = "ok";
		qcom,cont-splash-enabled;
		qcom,panel-lpg-channel = <7>; /* LPG Channel 8 */
		qcom,panel-pwm-period = <53>;
	};

	i2c@f9967000 {
+0 −2
Original line number Diff line number Diff line
@@ -188,8 +188,6 @@
		reg-names = "edp_base", "mmss_cc_base";
		vdda-supply = <&pm8941_l12>;
		gpio-panel-en = <&msmgpio 58 0>;
		qcom,panel-lpg-channel = <7>; /* LPG Channel 8 */
		qcom,panel-pwm-period = <53>;
		qcom,mdss-fb-map = <&mdss_fb0>;
		gpio-panel-hpd = <&msmgpio 102 0>;
	};
+35 −29
Original line number Diff line number Diff line
@@ -164,25 +164,31 @@ static int mdss_edp_pwm_config(struct mdss_edp_drv_pdata *edp_drv)
	ret = of_property_read_u32(edp_drv->pdev->dev.of_node,
			"qcom,panel-pwm-period", &edp_drv->pwm_period);
	if (ret) {
		pr_err("%s: panel pwm period is not specified, %d", __func__,
		pr_warn("%s: panel pwm period is not specified, %d", __func__,
				edp_drv->pwm_period);
		return -EINVAL;
		edp_drv->pwm_period = -EINVAL;
	}

	ret = of_property_read_u32(edp_drv->pdev->dev.of_node,
			"qcom,panel-lpg-channel", &edp_drv->lpg_channel);
	if (ret) {
		pr_err("%s: panel lpg channel is not specified, %d", __func__,
		pr_warn("%s: panel lpg channel is not specified, %d", __func__,
				edp_drv->lpg_channel);
		return -EINVAL;
		edp_drv->lpg_channel = -EINVAL;
	}

	edp_drv->bl_pwm = pwm_request(edp_drv->lpg_channel, "lcd-backlight");
	if (edp_drv->pwm_period != -EINVAL &&
		edp_drv->lpg_channel != -EINVAL) {
		edp_drv->bl_pwm = pwm_request(edp_drv->lpg_channel,
				"lcd-backlight");
		if (edp_drv->bl_pwm == NULL || IS_ERR(edp_drv->bl_pwm)) {
			pr_err("%s: pwm request failed", __func__);
			edp_drv->bl_pwm = NULL;
			return -EIO;
		}
	} else {
		edp_drv->bl_pwm = NULL;
	}

	return 0;
}
@@ -199,20 +205,17 @@ void mdss_edp_set_backlight(struct mdss_panel_data *pdata, u32 bl_level)
		return;
	}

	if (edp_drv->bl_pwm != NULL) {
		bl_max = edp_drv->panel_data.panel_info.bl_max;
		if (bl_level > bl_max)
			bl_level = bl_max;

	if (edp_drv->bl_pwm == NULL) {
		pr_err("%s: edp_drv->bl_pwm=NULL.\n", __func__);
		return;
	}

		ret = pwm_config(edp_drv->bl_pwm,
				bl_level * edp_drv->pwm_period / bl_max,
				edp_drv->pwm_period);
		if (ret) {
		pr_err("%s: pwm_config() failed err=%d.\n", __func__, ret);
			pr_err("%s: pwm_config() failed err=%d.\n", __func__,
					ret);
			return;
		}

@@ -223,11 +226,13 @@ void mdss_edp_set_backlight(struct mdss_panel_data *pdata, u32 bl_level)

		ret = pwm_enable(edp_drv->bl_pwm);
		if (ret) {
		pr_err("%s: pwm_enable() failed err=%d\n", __func__, ret);
			pr_err("%s: pwm_enable() failed err=%d\n", __func__,
					ret);
			return;
		}
	edp_drv->is_pwm_enabled = 1;
	}
}

int mdss_edp_mainlink_ready(struct mdss_edp_drv_pdata *ep, u32 which)
{
@@ -593,6 +598,7 @@ int mdss_edp_off(struct mdss_panel_data *pdata)
	mdss_edp_irq_disable(edp_drv);

	gpio_set_value(edp_drv->gpio_panel_en, 0);
	if (edp_drv->bl_pwm != NULL)
		pwm_disable(edp_drv->bl_pwm);
	edp_drv->is_pwm_enabled = 0;