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

Commit 279b215e authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie
Browse files

drm/radeon/kms: make sure ss id matches



entries in the ss table aren't always ordered
by id.

Signed-off-by: default avatarAlex Deucher <alexdeucher@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 390d0bbe
Loading
Loading
Loading
Loading
+12 −6
Original line number Original line Diff line number Diff line
@@ -1006,6 +1006,7 @@ static struct radeon_atom_ss *radeon_atombios_get_ss_info(struct
	struct _ATOM_SPREAD_SPECTRUM_INFO *ss_info;
	struct _ATOM_SPREAD_SPECTRUM_INFO *ss_info;
	uint8_t frev, crev;
	uint8_t frev, crev;
	struct radeon_atom_ss *ss = NULL;
	struct radeon_atom_ss *ss = NULL;
	int i;


	if (id > ATOM_MAX_SS_ENTRY)
	if (id > ATOM_MAX_SS_ENTRY)
		return NULL;
		return NULL;
@@ -1023,12 +1024,17 @@ static struct radeon_atom_ss *radeon_atombios_get_ss_info(struct
		if (!ss)
		if (!ss)
			return NULL;
			return NULL;


		ss->percentage = le16_to_cpu(ss_info->asSS_Info[id].usSpreadSpectrumPercentage);
		for (i = 0; i < ATOM_MAX_SS_ENTRY; i++) {
		ss->type = ss_info->asSS_Info[id].ucSpreadSpectrumType;
			if (ss_info->asSS_Info[i].ucSS_Id == id) {
		ss->step = ss_info->asSS_Info[id].ucSS_Step;
				ss->percentage =
		ss->delay = ss_info->asSS_Info[id].ucSS_Delay;
					le16_to_cpu(ss_info->asSS_Info[i].usSpreadSpectrumPercentage);
		ss->range = ss_info->asSS_Info[id].ucSS_Range;
				ss->type = ss_info->asSS_Info[i].ucSpreadSpectrumType;
		ss->refdiv = ss_info->asSS_Info[id].ucRecommendedRef_Div;
				ss->step = ss_info->asSS_Info[i].ucSS_Step;
				ss->delay = ss_info->asSS_Info[i].ucSS_Delay;
				ss->range = ss_info->asSS_Info[i].ucSS_Range;
				ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div;
			}
		}
	}
	}
	return ss;
	return ss;
}
}