From c696cd1a5693b021c8bb133eeedd0f12cd2df4e3 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sat, 4 Aug 2018 11:55:40 +0000 Subject: [PATCH] The operating-points-v2 binding allows opp-microvolt to be a single cell or three cells. Handle both cases, but ignore the minimum and maximum values if they are provided in the case where we have three cells. ok patrick@ --- sys/arch/arm64/arm64/cpu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/arch/arm64/arm64/cpu.c b/sys/arch/arm64/arm64/cpu.c index 74879ff8a48..c8f75912a72 100644 --- a/sys/arch/arm64/arm64/cpu.c +++ b/sys/arch/arm64/arm64/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.21 2018/08/03 18:36:01 kettenis Exp $ */ +/* $OpenBSD: cpu.c,v 1.22 2018/08/04 11:55:40 kettenis Exp $ */ /* * Copyright (c) 2016 Dale Rahn @@ -525,7 +525,8 @@ cpu_opp_init(struct cpu_info *ci, uint32_t phandle) { struct opp_table *ot; int count, node, child; - int i; + uint32_t values[3]; + int i, len; LIST_FOREACH(ot, &opp_tables, ot_list) { if (ot->ot_phandle == phandle) { @@ -562,8 +563,10 @@ cpu_opp_init(struct cpu_info *ci, uint32_t phandle) continue; ot->ot_opp[count].opp_hz = OF_getpropint64(child, "opp-hz", 0); - ot->ot_opp[count].opp_microvolt = - OF_getpropint(child, "opp-microvolt", 0); + len = OF_getpropintarray(child, "opp-microvolt", + values, sizeof(values)); + if (len == sizeof(uint32_t) || len == 3 * sizeof(uint32_t)) + ot->ot_opp[count].opp_microvolt = values[0]; count++; } -- 2.20.1