Skip to contentSkip to conversation

OMAP3:PM: reject disabled OPP

PATCH In review Nishanth Menon 2 participants 2 messages Sep 25, 2009 – Sep 30, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP3:PM: reject disabled OPP

when the omap_opp structures are disabled by setting the frequency as 0 as below (as an example)
{0, VDD2_OPP1, 0x1E},
program_opp attempts to set voltage even after frequency setting fails. we can instead return if we see invalid values for either frequency or voltage

---
 arch/arm/mach-omap2/resource34xx.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/resource34xx.c +5 -0
index 1693e9b..491e1dc 100644
@@ -282,6 +282,11 @@ static int program_opp(int res, struct omap_opp *opp, int target_level,
 	t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level].opp_id);
 	c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level].opp_id);
 #endif
+
+	/* Sanity check of the OPP params before attempting to set */
+	if (!opp[target_level].rate || !opp[target_level].vsel)
+		return -EINVAL;
+
 	if (target_level > current_level)
 		raise = 1;
 	else
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 8 lines · Nishanth Menon

when the omap_opp structures are disabled by setting the frequency as 0 as below (as an example)
{0, VDD2_OPP1, 0x1E},
program_opp attempts to set voltage even after frequency setting fails. we can instead return if we see invalid values for either frequency or voltage

Looks good, pushing to PM branch.

Kevin

Quoted 22 lines
---
 arch/arm/mach-omap2/resource34xx.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/resource34xx.c +5 -0
index 1693e9b..491e1dc 100644
@@ -282,6 +282,11 @@ static int program_opp(int res, struct omap_opp *opp, int target_level,
 	t_opp = ID_VDD(res) | ID_OPP_NO(opp[target_level].opp_id);
 	c_opp = ID_VDD(res) | ID_OPP_NO(opp[current_level].opp_id);
 #endif
+
+	/* Sanity check of the OPP params before attempting to set */
+	if (!opp[target_level].rate || !opp[target_level].vsel)
+		return -EINVAL;
+
 	if (target_level > current_level)
 		raise = 1;
 	else
Signature · 1 line
1.6.0.4