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

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

Merge "scsi: ufs-qti: Enable block layer runtime PM for well-known logical units"

parents c4e3acfb bb45ad80
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#include <linux/of.h>
#include <linux/bitfield.h>
#include <linux/blkdev.h>
#include <linux/blk-pm.h>
#include <linux/suspend.h>
#include <linux/devfreq.h>
#include <linux/pinctrl/consumer.h>
@@ -7686,6 +7687,16 @@ static int ufshcd_set_low_vcc_level(struct ufs_hba *hba,
	return ret;
}

static inline void ufshcd_blk_pm_runtime_init(struct scsi_device *sdev)
{
	scsi_autopm_get_device(sdev);
	blk_pm_runtime_init(sdev->request_queue, &sdev->sdev_gendev);
	if (sdev->rpm_autosuspend)
		pm_runtime_set_autosuspend_delay(&sdev->sdev_gendev,
						 UFSHCD_AUTO_SUSPEND_DELAY_MS);
	scsi_autopm_put_device(sdev);
}

/**
 * ufshcd_scsi_add_wlus - Adds required W-LUs
 * @hba: per-adapter instance
@@ -7725,6 +7736,7 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba)
		hba->sdev_ufs_device = NULL;
		goto out;
	}
	ufshcd_blk_pm_runtime_init(hba->sdev_ufs_device);
	scsi_device_put(hba->sdev_ufs_device);

	sdev_rpmb = __scsi_add_device(hba->host, 0, 0,
@@ -7733,14 +7745,17 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba)
		ret = PTR_ERR(sdev_rpmb);
		goto remove_sdev_ufs_device;
	}
	ufshcd_blk_pm_runtime_init(sdev_rpmb);
	scsi_device_put(sdev_rpmb);

	sdev_boot = __scsi_add_device(hba->host, 0, 0,
		ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL);
	if (IS_ERR(sdev_boot))
	if (IS_ERR(sdev_boot)) {
		dev_err(hba->dev, "%s: BOOT WLUN not found\n", __func__);
	else
	} else {
		ufshcd_blk_pm_runtime_init(sdev_boot);
		scsi_device_put(sdev_boot);
	}
	goto out;

remove_sdev_ufs_device: