Commit 9c913f38 authored by Guchun Chen's avatar Guchun Chen Committed by Alex Deucher
Browse files

drm/amdgpu: drop runpm from amdgpu_device structure



It's redundant, as now switching to rpm_mode to indicate
runtime power management mode.

Suggested-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarGuchun Chen <guchun.chen@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 75a9ad8c
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1011,7 +1011,6 @@ struct amdgpu_device {
	uint64_t	df_perfmon_config_assign_mask[AMDGPU_MAX_DF_PERFMONS];

	/* enable runtime pm on the device */
	bool                            runpm;
	bool                            in_runpm;
	bool                            has_pr3;

+5 −5
Original line number Diff line number Diff line
@@ -2121,7 +2121,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
	if (ret)
		DRM_ERROR("Creating debugfs files failed (%d).\n", ret);

	if (adev->runpm) {
	if (adev->pm.rpm_mode != AMDGPU_RUNPM_NONE) {
		/* only need to skip on ATPX */
		if (amdgpu_device_supports_px(ddev))
			dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
@@ -2178,7 +2178,7 @@ amdgpu_pci_remove(struct pci_dev *pdev)

	drm_dev_unplug(dev);

	if (adev->runpm) {
	if (adev->pm.rpm_mode != AMDGPU_RUNPM_NONE) {
		pm_runtime_get_sync(dev->dev);
		pm_runtime_forbid(dev->dev);
	}
@@ -2461,7 +2461,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
	struct amdgpu_device *adev = drm_to_adev(drm_dev);
	int ret, i;

	if (!adev->runpm) {
	if (adev->pm.rpm_mode == AMDGPU_RUNPM_NONE) {
		pm_runtime_forbid(dev);
		return -EBUSY;
	}
@@ -2530,7 +2530,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
	struct amdgpu_device *adev = drm_to_adev(drm_dev);
	int ret;

	if (!adev->runpm)
	if (adev->pm.rpm_mode == AMDGPU_RUNPM_NONE)
		return -EINVAL;

	/* Avoids registers access if device is physically gone */
@@ -2574,7 +2574,7 @@ static int amdgpu_pmops_runtime_idle(struct device *dev)
	/* we don't want the main rpm_idle to call suspend - we want to autosuspend */
	int ret = 1;

	if (!adev->runpm) {
	if (adev->pm.rpm_mode == AMDGPU_RUNPM_NONE) {
		pm_runtime_forbid(dev);
		return -EBUSY;
	}
+10 −13
Original line number Diff line number Diff line
@@ -147,14 +147,13 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
		goto out;
	}

	adev->pm.rpm_mode = AMDGPU_RUNPM_NONE;
	if (amdgpu_device_supports_px(dev) &&
	    (amdgpu_runtime_pm != 0)) { /* enable runpm by default for atpx */
		adev->runpm = true;
	    (amdgpu_runtime_pm != 0)) { /* enable PX as runtime mode */
		adev->pm.rpm_mode = AMDGPU_RUNPM_PX;
		dev_info(adev->dev, "Using ATPX for runtime pm\n");
	} else if (amdgpu_device_supports_boco(dev) &&
		   (amdgpu_runtime_pm != 0)) { /* enable runpm by default for boco */
		adev->runpm = true;
		   (amdgpu_runtime_pm != 0)) { /* enable boco as runtime mode */
		adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO;
		dev_info(adev->dev, "Using BOCO for runtime pm\n");
	} else if (amdgpu_device_supports_baco(dev) &&
@@ -162,26 +161,24 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
		switch (adev->asic_type) {
		case CHIP_VEGA20:
		case CHIP_ARCTURUS:
			/* enable runpm if runpm=1 */
			/* enable BACO as runpm mode if runpm=1 */
			if (amdgpu_runtime_pm > 0)
				adev->runpm = true;
				adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
			break;
		case CHIP_VEGA10:
			/* turn runpm on if noretry=0 */
			/* enable BACO as runpm mode if noretry=0 */
			if (!adev->gmc.noretry)
				adev->runpm = true;
				adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
			break;
		default:
			/* enable runpm on CI+ */
			adev->runpm = true;
			/* enable BACO as runpm mode on CI+ */
			adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
			break;
		}

		if (adev->runpm) {
			adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
		if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO)
			dev_info(adev->dev, "Using BACO for runtime pm\n");
	}
	}

	/* Call ACPI methods: require modeset init
	 * but failure is not fatal