Using the requested level can pick a secondary corner lower than the one
required to support the chosen primary corner, under-voting the
dependent rail. To fix this, match against the selected primary voltage
instead.

Fixes: 4b565ca5a2cb ("drm/msm: Add A6XX device support")
Reviewed-by: Konrad Dybcio <[email protected]>
Signed-off-by: Akhil P Oommen <[email protected]>
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index baf77a620572..d072646093a1 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -1765,10 +1765,14 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device 
*dev, u32 *votes,
                /*
                 * Look for a level in in the secondary list that matches. If
                 * nothing fits, use the maximum non zero vote
+                *
+                * The secondary rail depends on the primary rail, so match it
+                * against the quantized primary voltage (which is >= the
+                * requested level), not the requested level itself.
                 */
 
                for (j = 0; j < sec_count; j++) {
-                       if (sec[j] >= level) {
+                       if (sec[j] >= pri[pindex]) {
                                sindex = j;
                                break;
                        } else if (sec[j]) {

-- 
2.55.0

Reply via email to