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

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

Merge "scsi: ufs: update clock scaling sequence"

parents fb50b6d0 ced3a83b
Loading
Loading
Loading
Loading
+18 −20
Original line number Original line Diff line number Diff line
@@ -1789,31 +1789,27 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up)
		ufshcd_custom_cmd_log(hba, "Gear-scaled-down");
		ufshcd_custom_cmd_log(hba, "Gear-scaled-down");
	}
	}


	/*
	/* Enter hibern8 before scaling clocks */
	 * If auto hibern8 is enabled then put the link in
	 * hibern8 manually, this is to avoid auto hibern8
	 * racing during clock frequency scaling sequence.
	 */
	if (ufshcd_is_auto_hibern8_enabled(hba)) {
	ret = ufshcd_uic_hibern8_enter(hba);
	ret = ufshcd_uic_hibern8_enter(hba);
	if (ret)
	if (ret)
		/* link will be bad state so no need to scale_up_gear */
		/* link will be bad state so no need to scale_up_gear */
		goto clk_scaling_unprepare;
		goto clk_scaling_unprepare;
	ufshcd_custom_cmd_log(hba, "Hibern8-entered");
	ufshcd_custom_cmd_log(hba, "Hibern8-entered");
	}


	ret = ufshcd_scale_clks(hba, scale_up);
	ret = ufshcd_scale_clks(hba, scale_up);
	if (ret)
	if (ret) {
		dev_err(hba->dev, "%s: scaling %s clks failed %d\n", __func__,
			scale_up ? "up" : "down", ret);
		goto scale_up_gear;
		goto scale_up_gear;
	}
	ufshcd_custom_cmd_log(hba, "Clk-freq-switched");
	ufshcd_custom_cmd_log(hba, "Clk-freq-switched");


	if (ufshcd_is_auto_hibern8_enabled(hba)) {
	/* Exit hibern8 after scaling clocks */
	ret = ufshcd_uic_hibern8_exit(hba);
	ret = ufshcd_uic_hibern8_exit(hba);
	if (ret)
	if (ret)
		/* link will be bad state so no need to scale_up_gear */
		/* link will be bad state so no need to scale_up_gear */
		goto clk_scaling_unprepare;
		goto clk_scaling_unprepare;
	ufshcd_custom_cmd_log(hba, "Hibern8-Exited");
	ufshcd_custom_cmd_log(hba, "Hibern8-Exited");
	}


	/* scale up the gear after scaling up clocks */
	/* scale up the gear after scaling up clocks */
	if (scale_up) {
	if (scale_up) {
@@ -1838,6 +1834,8 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up)
	goto clk_scaling_unprepare;
	goto clk_scaling_unprepare;


scale_up_gear:
scale_up_gear:
	if (ufshcd_uic_hibern8_exit(hba))
		goto clk_scaling_unprepare;
	if (!scale_up)
	if (!scale_up)
		ufshcd_scale_gear(hba, true);
		ufshcd_scale_gear(hba, true);
clk_scaling_unprepare:
clk_scaling_unprepare: