Commit e3c57087ced40ed6a510dc771aa952fa1ebded01

Authored by Rajendra Nayak
Committed by Afzal Mohammed
1 parent f92e7d1144
Exists in master

OMAP2+: OPP: Do not skip scanning OPP table if one of them is invalid

Let omap_init_opp_table run through all the OPP's instead of
returning on seeing the first invalid one. Skip the invalid ones
and give a fair chance to the rest to get registered,
if they are found to be valid.
For every invalid entry in the OPP table, instead of a pr_warn,
do a WARN so it gets the attention it needs.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
[vaibhav.bedia@ti.com: Pull in for AM33xx]
Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>

Showing 1 changed file with 6 additions and 5 deletions Inline Diff

arch/arm/mach-omap2/opp.c
1 /* 1 /*
2 * OMAP SoC specific OPP wrapper function 2 * OMAP SoC specific OPP wrapper function
3 * 3 *
4 * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/ 4 * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/
5 * Nishanth Menon 5 * Nishanth Menon
6 * Kevin Hilman 6 * Kevin Hilman
7 * Copyright (C) 2010 Nokia Corporation. 7 * Copyright (C) 2010 Nokia Corporation.
8 * Eduardo Valentin 8 * Eduardo Valentin
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 * 13 *
14 * This program is distributed "as is" WITHOUT ANY WARRANTY of any 14 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
15 * kind, whether express or implied; without even the implied warranty 15 * kind, whether express or implied; without even the implied warranty
16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details. 17 * GNU General Public License for more details.
18 */ 18 */
19 #include <linux/module.h> 19 #include <linux/module.h>
20 #include <linux/opp.h> 20 #include <linux/opp.h>
21 21
22 #include <plat/omap_device.h> 22 #include <plat/omap_device.h>
23 #include <plat/dvfs.h> 23 #include <plat/dvfs.h>
24 24
25 #include "omap_opp_data.h" 25 #include "omap_opp_data.h"
26 26
27 /* Temp variable to allow multiple calls */ 27 /* Temp variable to allow multiple calls */
28 static u8 __initdata omap_table_init; 28 static u8 __initdata omap_table_init;
29 29
30 /** 30 /**
31 * omap_init_opp_table() - Initialize opp table as per the CPU type 31 * omap_init_opp_table() - Initialize opp table as per the CPU type
32 * @opp_def: opp default list for this silicon 32 * @opp_def: opp default list for this silicon
33 * @opp_def_size: number of opp entries for this silicon 33 * @opp_def_size: number of opp entries for this silicon
34 * 34 *
35 * Register the initial OPP table with the OPP library based on the CPU 35 * Register the initial OPP table with the OPP library based on the CPU
36 * type. This is meant to be used only by SoC specific registration. 36 * type. This is meant to be used only by SoC specific registration.
37 */ 37 */
38 int __init omap_init_opp_table(struct omap_opp_def *opp_def, 38 int __init omap_init_opp_table(struct omap_opp_def *opp_def,
39 u32 opp_def_size) 39 u32 opp_def_size)
40 { 40 {
41 int i, r; 41 int i, r;
42 42
43 if (!opp_def || !opp_def_size) { 43 if (!opp_def || !opp_def_size) {
44 pr_err("%s: invalid params!\n", __func__); 44 pr_err("%s: invalid params!\n", __func__);
45 return -EINVAL; 45 return -EINVAL;
46 } 46 }
47 47
48 /* 48 /*
49 * Initialize only if not already initialized even if the previous 49 * Initialize only if not already initialized even if the previous
50 * call failed, because, no reason we'd succeed again. 50 * call failed, because, no reason we'd succeed again.
51 */ 51 */
52 if (omap_table_init) 52 if (omap_table_init)
53 return -EEXIST; 53 return -EEXIST;
54 omap_table_init = 1; 54 omap_table_init = 1;
55 55
56 /* Lets now register with OPP library */ 56 /* Lets now register with OPP library */
57 for (i = 0; i < opp_def_size; i++) { 57 for (i = 0; i < opp_def_size; i++) {
58 struct omap_hwmod *oh; 58 struct omap_hwmod *oh;
59 struct device *dev; 59 struct device *dev;
60 60
61 if (!opp_def->hwmod_name) { 61 if (!opp_def->hwmod_name) {
62 pr_err("%s: NULL name of omap_hwmod, failing [%d].\n", 62 WARN(1, "%s: NULL name of omap_hwmod, failing"
63 __func__, i); 63 " [%d].\n", __func__, i);
64 return -EINVAL; 64 goto next;
65 } 65 }
66 oh = omap_hwmod_lookup(opp_def->hwmod_name); 66 oh = omap_hwmod_lookup(opp_def->hwmod_name);
67 if (!oh || !oh->od) { 67 if (!oh || !oh->od) {
68 pr_warn("%s: no hwmod or odev for %s, [%d] " 68 WARN(1, "%s: no hwmod or odev for %s, [%d] "
69 "cannot add OPPs.\n", __func__, 69 "cannot add OPPs.\n", __func__,
70 opp_def->hwmod_name, i); 70 opp_def->hwmod_name, i);
71 return -EINVAL; 71 goto next;
72 } 72 }
73 dev = &oh->od->pdev->dev; 73 dev = &oh->od->pdev->dev;
74 74
75 r = opp_add(dev, opp_def->freq, opp_def->u_volt); 75 r = opp_add(dev, opp_def->freq, opp_def->u_volt);
76 if (r) { 76 if (r) {
77 dev_err(dev, "%s: add OPP %ld failed for %s [%d] " 77 dev_err(dev, "%s: add OPP %ld failed for %s [%d] "
78 "result=%d\n", 78 "result=%d\n",
79 __func__, opp_def->freq, 79 __func__, opp_def->freq,
80 opp_def->hwmod_name, i, r); 80 opp_def->hwmod_name, i, r);
81 } else { 81 } else {
82 if (!opp_def->default_available) 82 if (!opp_def->default_available)
83 r = opp_disable(dev, opp_def->freq); 83 r = opp_disable(dev, opp_def->freq);
84 if (r) 84 if (r)
85 dev_err(dev, "%s: disable %ld failed for %s " 85 dev_err(dev, "%s: disable %ld failed for %s "
86 "[%d] result=%d\n", 86 "[%d] result=%d\n",
87 __func__, opp_def->freq, 87 __func__, opp_def->freq,
88 opp_def->hwmod_name, i, r); 88 opp_def->hwmod_name, i, r);
89 89
90 r = omap_dvfs_register_device(dev, 90 r = omap_dvfs_register_device(dev,
91 opp_def->voltdm_name, opp_def->clk_name); 91 opp_def->voltdm_name, opp_def->clk_name);
92 if (r) 92 if (r)
93 dev_err(dev, "%s:%s:err dvfs register %d %d\n", 93 dev_err(dev, "%s:%s:err dvfs register %d %d\n",
94 __func__, opp_def->hwmod_name, r, i); 94 __func__, opp_def->hwmod_name, r, i);
95 } 95 }
96 next:
96 opp_def++; 97 opp_def++;
97 } 98 }
98 99
99 return 0; 100 return 0;
100 } 101 }
101 102