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

Commit 1d77e5d4 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: use new PWM API to replace the old one"

parents f136459e 8a581775
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -150,6 +150,9 @@ Required properties:
			    binding above.

Optional properties:
- pwms:
    Value type: <prop-encoded-array>
    Definition: The PWM device (phandle) used for controlling backlight.
- qcom,platform-spi-dc-gpio: Pull down this gpio indicate current package is command,
        Pull up this gpio indicate current package is parameter or pixels.
- qcom,platform-reset-gpio:             Specifies the panel reset gpio.
@@ -164,7 +167,6 @@ Optional properties:
	-- qcom,supply-post-on-sleep: time to sleep (ms) after turning on
	-- qcom,supply-pre-off-sleep: time to sleep (ms) before turning off
	-- qcom,supply-post-off-sleep: time to sleep (ms) after turning off

Example:
	mdss_spi_panel: qcom,mdss_spi_panel {
		compatible = "qcom,mdss-spi-panel";
@@ -175,6 +177,7 @@ Example:
		qcom,platform-te-gpio = <&tlmm 57 0>;
		qcom,platform-reset-gpio = <&tlmm 42 0>;
		qcom,platform-spi-dc-gpio = <&tlmm 39 0>;
		pwms = <&pms405_l1 0 1000000>;

		qcom,panel-supply-entries {
			#address-cells = <1>;
+17 −32
Original line number Diff line number Diff line
@@ -882,19 +882,6 @@ static int mdss_spi_panel_parse_dt(struct device_node *np,
	return 0;
}

static void mdss_spi_panel_pwm_cfg(struct spi_panel_data *ctrl)
{
	if (ctrl->pwm_pmi)
		return;

	ctrl->pwm_bl = pwm_request(ctrl->pwm_lpg_chan, "lcd-bklt");
	if (IS_ERR_OR_NULL(ctrl->pwm_bl)) {
		pr_err("%s: Error: lpg_chan=%d pwm request failed",
				__func__, ctrl->pwm_lpg_chan);
	}
	ctrl->pwm_enabled = 0;
}

static void mdss_spi_panel_bklt_pwm(struct spi_panel_data *ctrl, int level)
{
	int ret;
@@ -924,24 +911,13 @@ static void mdss_spi_panel_bklt_pwm(struct spi_panel_data *ctrl, int level)
			__func__, ctrl->bklt_ctrl, ctrl->pwm_period,
				ctrl->pwm_pmic_gpio, ctrl->pwm_lpg_chan);

	if (ctrl->pwm_period >= USEC_PER_SEC) {
		ret = pwm_config(ctrl->pwm_bl, duty, ctrl->pwm_period);
		if (ret) {
			pr_err("%s: pwm_config() failed err=%d\n",
					__func__, ret);
			return;
		}
	} else {
	period_ns = ctrl->pwm_period * NSEC_PER_USEC;
	ret = pwm_config(ctrl->pwm_bl,
				level * period_ns / ctrl->bklt_max,
				period_ns);
			level * period_ns / ctrl->bklt_max, period_ns);
	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;
	}
	}

	if (!ctrl->pwm_enabled) {
		ret = pwm_enable(ctrl->pwm_bl);
@@ -1189,8 +1165,17 @@ static int spi_panel_device_register(struct device_node *pan_node,
		pr_err("%s:%d, reset gpio not specified\n",
						__func__, __LINE__);

	if (ctrl_pdata->bklt_ctrl == SPI_BL_PWM)
		mdss_spi_panel_pwm_cfg(ctrl_pdata);
	if (ctrl_pdata->bklt_ctrl == SPI_BL_PWM) {
		if (ctrl_pdata->pwm_pmi)
			return -EINVAL;

		ctrl_pdata->pwm_bl = devm_of_pwm_get(&ctrl_pdev->dev,
					ctrl_pdev->dev.of_node, NULL);
		if (IS_ERR_OR_NULL(ctrl_pdata->pwm_bl))
			pr_err("%s: Error: devm_of_pwm_get failed",
				__func__);
		ctrl_pdata->pwm_enabled = 0;
	}

	ctrl_pdata->ctrl_state = CTRL_STATE_UNKNOWN;
	ctrl_pdata->panel_data.get_fb_node = mdss_spi_get_fb_node_cb;