mfd: db8500-prcmu: Support the higher DB8520 ARMSS

The DB8520 used in a lot of Samsung phones has a slightly higher
maximum ARMSS frequency than the DB8500. In order to not confuse
the OPP framework and cpufreq, make sure the PRCMU driver
returns the correct frequency.

Cc: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
Linus Walleij 2019-08-29 13:25:01 +02:00 committed by Lee Jones
parent 569fac7462
commit fea3ac55e1

View file

@ -1695,21 +1695,41 @@ static long round_clock_rate(u8 clock, unsigned long rate)
return rounded_rate; return rounded_rate;
} }
static const unsigned long armss_freqs[] = { static const unsigned long db8500_armss_freqs[] = {
200000000, 200000000,
400000000, 400000000,
800000000, 800000000,
998400000 998400000
}; };
/* The DB8520 has slightly higher ARMSS max frequency */
static const unsigned long db8520_armss_freqs[] = {
200000000,
400000000,
800000000,
1152000000
};
static long round_armss_rate(unsigned long rate) static long round_armss_rate(unsigned long rate)
{ {
unsigned long freq = 0; unsigned long freq = 0;
const unsigned long *freqs;
int nfreqs;
int i; int i;
if (fw_info.version.project == PRCMU_FW_PROJECT_U8520) {
freqs = db8520_armss_freqs;
nfreqs = ARRAY_SIZE(db8520_armss_freqs);
} else {
freqs = db8500_armss_freqs;
nfreqs = ARRAY_SIZE(db8500_armss_freqs);
}
/* Find the corresponding arm opp from the cpufreq table. */ /* Find the corresponding arm opp from the cpufreq table. */
for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) { for (i = 0; i < nfreqs; i++) {
freq = armss_freqs[i]; freq = freqs[i];
if (rate <= freq) if (rate <= freq)
break; break;
} }
@ -1854,11 +1874,21 @@ static int set_armss_rate(unsigned long rate)
{ {
unsigned long freq; unsigned long freq;
u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP }; u8 opps[] = { ARM_EXTCLK, ARM_50_OPP, ARM_100_OPP, ARM_MAX_OPP };
const unsigned long *freqs;
int nfreqs;
int i; int i;
if (fw_info.version.project == PRCMU_FW_PROJECT_U8520) {
freqs = db8520_armss_freqs;
nfreqs = ARRAY_SIZE(db8520_armss_freqs);
} else {
freqs = db8500_armss_freqs;
nfreqs = ARRAY_SIZE(db8500_armss_freqs);
}
/* Find the corresponding arm opp from the cpufreq table. */ /* Find the corresponding arm opp from the cpufreq table. */
for (i = 0; i < ARRAY_SIZE(armss_freqs); i++) { for (i = 0; i < nfreqs; i++) {
freq = armss_freqs[i]; freq = freqs[i];
if (rate == freq) if (rate == freq)
break; break;
} }