OMAP1 PM Core, PM Core Implementation 2/2
RFC 1/1 OMAP1 PM Core, PM Core Implementation 2/2
OMAP1 PM Core reference implementation
arch/arm/Kconfig +15 -0
@@ -745,6 +745,21 @@ config CPU_FREQ_INTEGRATOR endmenu +if (ARCH_OMAP) + +menu "PM Core" + +config OMAP1_PM_CORE + tristate "OMAP1 PM Core" + depends POWEROP + help + This enables OMAP1 PM Core to control platform clocks/power via + PowerOP interface + +endmenu + +endif + endif menu "Floating point emulation"
arch/arm/mach-omap1/Makefile +3 -0
@@ -38,3 +38,6 @@ led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o obj-$(CONFIG_LEDS) += $(led-y) +#PM Core +obj-$(CONFIG_OMAP1_PM_CORE) +=pm_core.o +
arch/arm/mach-omap1/pm_core.c new file +530 -0
530 lines not on this page · raw message
include/asm-arm/arch-omap/pm_core.h new file +48 -0
48 lines not on this page · raw message
Some nitpicking about the patch follows..
arch/arm/mach-omap1/pm_core.c line 148
Quoted 4 lines · Eugeny S. Mints
arch/arm/mach-omap1/pm_core.c new file +4
-0+static long +get_vtg (const char *vdomain) +{ +long ret =0 ;
Unnecessary initialisation.
arch/arm/mach-omap1/pm_core.c line 167
Quoted 4 lines
arch/arm/mach-omap1/pm_core.c new file +4
-0+static long +set_vtg (const char *vdomain,int val) +{ +long ret =0 ;
here too. This and 'int i = 0;' happens in many functions.
arch/arm/mach-omap1/pm_core.c line 268
Quoted 9 lines
arch/arm/mach-omap1/pm_core.c new file +9
-0+ err =omap_pm_core_verify_opt (opt); +if (err !=0 ) + goto out; + +return (void *)opt; +out: +kfree (opt); +return NULL ; +}
Maybe use if (err != 0) { kfree(opt); return NULL; } because goto out is only used once?
Quoted 4 lines
arch/arm/mach-omap1/pm_core.c new file +4
-0+static int cpu_vltg_show (void *md_opt,int *value) +{ +int rc =0 ; +if (md_opt ==NULL ) {
arch/arm/mach-omap1/pm_core.c line 401
Quoted 10 lines
arch/arm/mach-omap1/pm_core.c new file +10
-0+if ((*value =get_vtg ("v1" )) <=0 ) +return -EIO ; + } +else { +struct pm_core_point *opt = (struct pm_core_point *)md_opt; + *value = opt->cpu_vltg; + } + +return rc; +}
int rc is unnecessary because the function always returns 0. This happens in many places.
include/asm-arm/arch-omap/pm_core.h line 33
Quoted 8 lines
include/asm-arm/arch-omap/pm_core.h new file +8
-0+int dpll;/* in KHz */ +int cpu;/* CPU frequency in KHz */ +int tc;/* in KHz */ +int per;/* in KHz */ +int dsp;/* in KHz */ +int dspmmu;/* in KHz */ +int lcd;/* in KHz */ +};
The SI multiplier is 'k', not 'K'.
- Heikki
Quoted 9 lines · Heikki Orsila
Some nitpicking about the patch follows..
arch/arm/mach-omap1/pm_core.c line 148
Quoted 4 lines · Eugeny S. Mints
arch/arm/mach-omap1/pm_core.c new file +4
-0+static long +get_vtg (const char *vdomain) +{ +long ret =0 ;Unnecessary initialisation.
No, sorry.
Quoted 6 lines
arch/arm/mach-omap1/pm_core.c line 167
Quoted 4 lines
arch/arm/mach-omap1/pm_core.c new file +4
-0+static long +set_vtg (const char *vdomain,int val) +{ +long ret =0 ;here too. This and 'int i = 0;' happens in many functions.
Wrong again. automatic variables are not zero initialized.
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-omap1/pm_core.c new file +4
-0+ err =omap_pm_core_verify_opt (opt); +if (err !=0 ) + goto out; +
Quoted 8 lines
arch/arm/mach-omap1/pm_core.c line 268
Quoted 5 lines
arch/arm/mach-omap1/pm_core.c new file +5
-0+return (void *)opt; +out: +kfree (opt); +return NULL ; +}Maybe use if (err != 0) { kfree(opt); return NULL; } because goto out is only used once?
This is actually common kernel idiom, so it is okay to leave like this. Your other points are ok.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 4 lines · Pavel Machek
Quoted 3 lines · Heikki Orsila
Some nitpicking about the patch follows..
On Sat, Sep 30, 2006 at 02:24:35AM +0400, Eugeny S. Mints wrote:
Quoted 8 lines
Quoted 6 lines
arch/arm/mach-omap1/pm_core.c line 148
Quoted 4 lines
arch/arm/mach-omap1/pm_core.c new file +4
-0+static long +get_vtg (const char *vdomain) +{ +long ret =0 ;Unnecessary initialisation.
No, sorry.
In get_vtg(), if VOLTAGE_FRAMEWORK is defined then
ret = vtg_get_voltage(v);
is the first user. If VOLTAGE_FRAMEWORK is not defined, the first user is:
ret = vtg_get_voltage(&vhandle);
Then "return ret;" follows. I cannot see a path where pre-initialisation of ret does anything useful. If someone removed the #else part, the compiler would bark.
Quoted 9 lines
Quoted 7 lines
arch/arm/mach-omap1/pm_core.c line 167
Quoted 5 lines
arch/arm/mach-omap1/pm_core.c new file +4
-0+static long +set_vtg (const char *vdomain,int val) +{ +long ret =0 ;here too.
Wrong again. automatic variables are not zero initialized.
My bad, this was a mistake. If VOLTAGE_FRAMEWORK is not defined, ret must be initialised. (the compiler would have noticed this one :-)
Quoted 1 line
Quoted 1 line
'int i = 0;' happens in many functions.
for example, omap_pm_create_point() does this.
- Heikki
Hi!
Quoted 16 lines
Quoted 11 lines
Quoted 9 lines
Some nitpicking about the patch follows..
arch/arm/mach-omap1/pm_core.c line 148
Quoted 4 lines · Eugeny S. Mints
arch/arm/mach-omap1/pm_core.c new file +4
-0+static long +get_vtg (const char *vdomain) +{ +long ret =0 ;Unnecessary initialisation.
No, sorry.
In
get_vtg(), ifVOLTAGE_FRAMEWORKis defined thenret = vtg_get_voltage(v);
Quoted 7 lines
is the first user. If
VOLTAGE_FRAMEWORKis not defined, the first user is:ret = vtg_get_voltage(&vhandle);Then "return ret;" follows. I cannot see a path where pre-initialisation of ret does anything useful. If someone removed the #else part, the compiler would bark.
Ahha, sorry, I did not look at this kind of context.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html