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

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

Merge "scsi: ufs: Add load vote for VCCQ parent regulator"

parents ca956ae0 33b3b462
Loading
Loading
Loading
Loading
+36 −9
Original line number Diff line number Diff line
@@ -771,15 +771,16 @@ static int ufs_qcom_config_vreg(struct device *dev,
		ret = regulator_set_load(vreg->reg, uA_load);
		if (ret)
			goto out;

		if (vreg->min_uV && vreg->max_uV) {
			min_uV = on ? vreg->min_uV : 0;
			ret = regulator_set_voltage(reg, min_uV, vreg->max_uV);
			if (ret) {
			dev_err(dev, "%s: %s set voltage failed, err=%d\n",
				dev_err(dev, "%s: %s failed, err=%d\n",
					__func__, vreg->name, ret);
				goto out;
			}
		}
	}
out:
	return ret;
}
@@ -844,6 +845,10 @@ static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		if (host->vddp_ref_clk && ufs_qcom_is_link_off(hba))
			ret = ufs_qcom_disable_vreg(hba->dev,
					host->vddp_ref_clk);
		if (host->vccq_parent && !hba->auto_bkops_enabled)
			ufs_qcom_config_vreg(hba->dev,
					host->vccq_parent, false);

		ufs_qcom_ice_suspend(host);
		if (ufs_qcom_is_link_off(hba)) {
			/* Assert PHY soft reset */
@@ -877,6 +882,8 @@ static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
				   hba->spm_lvl > UFS_PM_LVL_3))
		ufs_qcom_enable_vreg(hba->dev,
				      host->vddp_ref_clk);
	if (host->vccq_parent)
		ufs_qcom_config_vreg(hba->dev, host->vccq_parent, true);

	err = ufs_qcom_enable_lane_clks(host);
	if (err)
@@ -2132,7 +2139,10 @@ static int ufs_qcom_parse_reg_info(struct ufs_qcom_host *host, char *name,
	if (ret) {
		dev_dbg(dev, "%s: unable to find %s err %d, using default\n",
			__func__, prop_name, ret);
		if (!strcmp(name, "qcom,vddp-ref-clk"))
			vreg->min_uV = VDDP_REF_CLK_MIN_UV;
		else if (!strcmp(name, "qcom,vccq-parent"))
			vreg->min_uV = 0;
		ret = 0;
	}

@@ -2141,7 +2151,10 @@ static int ufs_qcom_parse_reg_info(struct ufs_qcom_host *host, char *name,
	if (ret) {
		dev_dbg(dev, "%s: unable to find %s err %d, using default\n",
			__func__, prop_name, ret);
		if (!strcmp(name, "qcom,vddp-ref-clk"))
			vreg->max_uV = VDDP_REF_CLK_MAX_UV;
		else if (!strcmp(name, "qcom,vccq-parent"))
			vreg->max_uV = 0;
		ret = 0;
	}

@@ -2298,9 +2311,20 @@ static int ufs_qcom_init(struct ufs_hba *hba)
		}
	}

	err = ufs_qcom_parse_reg_info(host, "qcom,vccq-parent",
				      &host->vccq_parent);
	if (host->vccq_parent) {
		err = ufs_qcom_config_vreg(hba->dev, host->vccq_parent, true);
		if (err) {
			dev_err(dev, "%s: failed vccq-parent set load: %d\n",
				__func__, err);
			goto out_disable_vddp;
		}
	}

	err = ufs_qcom_init_lane_clks(host);
	if (err)
		goto out_disable_vddp;
		goto out_set_load_vccq_parent;

	ufs_qcom_parse_lpm(host);
	if (host->disable_lpm)
@@ -2324,6 +2348,9 @@ static int ufs_qcom_init(struct ufs_hba *hba)

	goto out;

out_set_load_vccq_parent:
	if (host->vccq_parent)
		ufs_qcom_config_vreg(hba->dev, host->vccq_parent, false);
out_disable_vddp:
	if (host->vddp_ref_clk)
		ufs_qcom_disable_vreg(dev, host->vddp_ref_clk);
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -382,6 +382,7 @@ struct ufs_qcom_host {
	struct work_struct ice_cfg_work;
	struct request *req_pending;
	struct ufs_vreg *vddp_ref_clk;
	struct ufs_vreg *vccq_parent;
	bool work_pending;
	bool is_phy_pwr_on;
};
+2 −2
Original line number Diff line number Diff line
@@ -10251,8 +10251,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
		hba->hibern8_on_idle.state = HIBERN8_ENTERED;

set_vreg_lpm:
	if (!hba->auto_bkops_enabled)
		ufshcd_vreg_set_lpm(hba);

disable_clks:
	/*
	 * Call vendor specific suspend callback. As these callbacks may access