Commit 1ca96571 authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher
Browse files

drm/amd/display: Change dc_set_power_state() to bool instead of int



DC code is reused by other OSes and so Linux return codes don't
make sense.  Change dc_set_power_state() to boolean and add a wrapper
dm_set_power_state() to return a Linux error code for the memory
allocation failure.

Suggested-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b2e1cbe6
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -2638,6 +2638,11 @@ static void hpd_rx_irq_work_suspend(struct amdgpu_display_manager *dm)
	}
}

static int dm_set_power_state(struct dc *dc, enum dc_acpi_cm_power_state power_state)
{
	return dc_set_power_state(dc, power_state) ? 0 : -ENOMEM;
}

static int dm_suspend(void *handle)
{
	struct amdgpu_device *adev = handle;
@@ -2671,7 +2676,7 @@ static int dm_suspend(void *handle)

	hpd_rx_irq_work_suspend(dm);

	return dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
	return dm_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
}

struct amdgpu_dm_connector *
@@ -2865,7 +2870,7 @@ static int dm_resume(void *handle)
		if (r)
			DRM_ERROR("DMUB interface failed to initialize: status=%d\n", r);

		r = dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
		r = dm_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
		if (r)
			return r;

@@ -2917,7 +2922,7 @@ static int dm_resume(void *handle)
	}

	/* power on hardware */
	r = dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
	r = dm_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
	if (r)
		return r;

+4 −4
Original line number Diff line number Diff line
@@ -4723,7 +4723,7 @@ void dc_power_down_on_boot(struct dc *dc)
		dc->hwss.power_down_on_boot(dc);
}

int dc_set_power_state(
bool dc_set_power_state(
	struct dc *dc,
	enum dc_acpi_cm_power_state power_state)
{
@@ -4731,7 +4731,7 @@ int dc_set_power_state(
	struct display_mode_lib *dml;

	if (!dc->current_state)
		return 0;
		return true;

	switch (power_state) {
	case DC_ACPI_CM_POWER_STATE_D0:
@@ -4758,7 +4758,7 @@ int dc_set_power_state(

		ASSERT(dml);
		if (!dml)
			return -ENOMEM;
			return false;

		/* Preserve refcount */
		refcount = dc->current_state->refcount;
@@ -4777,7 +4777,7 @@ int dc_set_power_state(
		break;
	}

	return 0;
	return true;
}

void dc_resume(struct dc *dc)
+1 −1
Original line number Diff line number Diff line
@@ -2283,7 +2283,7 @@ void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bo

/* Power Interfaces */

int dc_set_power_state(
bool dc_set_power_state(
		struct dc *dc,
		enum dc_acpi_cm_power_state power_state);
void dc_resume(struct dc *dc);