Thara Gopinath <[email protected]> writes:

> This patch adds voltage driver support for OMAP3. The driver
> allows  configuring the voltage controller and voltage
> processors during init and exports APIs to enable/disable
> voltage processors, scale voltage and reset voltage.
> The driver also maintains the global voltage table on a per
> VDD basis which contains the various voltages supported by the
> VDD along with per voltage dependent data like smartreflex
> n-target value, errminlimit and voltage processor errorgain.
> The driver allows scaling of VDD voltages either through
> "vc bypass method" or through "vp forceupdate method" the
> choice being configurable through the board file.
>
> This patch contains code originally in linux omap pm branch
> smartreflex driver.  Major contributors to this driver are
> Lesly A M, Rajendra Nayak, Kalle Jokiniemi, Paul Walmsley,
> Nishant Menon, Kevin Hilman.
>
> Signed-off-by: Thara Gopinath <[email protected]>

[...]

> +static void __init vdd_data_configure(struct omap_vdd_info *vdd)
> +{
> +     if (cpu_is_omap34xx())
> +             omap3_vdd_data_configure(vdd);
> +}
> +
> +static void __init init_voltagecontroller(void)
> +{
> +     if (cpu_is_omap34xx())
> +             omap3_init_voltagecontroller();
> +}

Drop these two functions...

[...]

> +/**
> + * omap_voltage_init : Volatage init API which does VP and VC init.
> + */
> +static int __init omap_voltage_init(void)
> +{
> +     int i;

...and setup function pointers in these cpu_is checks.  Something like
the below (not even compile tested.)

       void (*vdd_data_configure)(void);
       void (*init_voltageprocessor)(void);

> +
> +     if (cpu_is_omap34xx()) {
> +             volt_mod = OMAP3430_GR_MOD;
> +             vdd_info = omap3_vdd_info;
> +             nr_scalable_vdd = OMAP3_NR_SCALABLE_VDD;

                vdd_data_configure = omap3_vdd_data_configure;
                init_voltageprocessor = omap3_init_voltageprocessor;

> +     } else {
> +             pr_warning("%s: voltage driver support not added\n", __func__);
> +             return 0;
> +     }
> +     init_voltagecontroller();
> +     for (i = 0; i < nr_scalable_vdd; i++) {
> +             vdd_data_configure(&vdd_info[i]);
> +             init_voltageprocessor(&vdd_info[i]);
> +     }
> +     return 0;
> +}
> +core_initcall(omap_voltage_init);

We really want to minimize the cpu_is_* checks, and ideally they should
only be present in the first __init function.

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to