]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0133-OMAP3-VP-create-VP-helper-function-for-updating-erro.patch
6dcb4a2728cf774f02f1f92907bc24ab5d9660c9
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / voltdm / 0133-OMAP3-VP-create-VP-helper-function-for-updating-erro.patch
1 From 55240989f6c71ec461adae95cbc125f213d8a451 Mon Sep 17 00:00:00 2001
2 From: Kevin Hilman <khilman@ti.com>
3 Date: Tue, 5 Apr 2011 15:15:31 -0700
4 Subject: [PATCH 133/149] OMAP3+: VP: create VP helper function for updating error gain
6 Create new helper function in VP layer for updating VP error gain.
7 Currently used during pre-scale for VP force update and VC bypass.
9 TODO: determine if this can be removed from the pre-scale path and
10 moved to VP enable path.
12 Signed-off-by: Kevin Hilman <khilman@ti.com>
13 ---
14  arch/arm/mach-omap2/vc.c |   19 ++-----------------
15  arch/arm/mach-omap2/vp.c |   19 +++++++++++++++++++
16  arch/arm/mach-omap2/vp.h |    2 ++
17  3 files changed, 23 insertions(+), 17 deletions(-)
19 diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
20 index f64c826..e855559 100644
21 --- a/arch/arm/mach-omap2/vc.c
22 +++ b/arch/arm/mach-omap2/vc.c
23 @@ -96,9 +96,7 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
24                       u8 *target_vsel, u8 *current_vsel)
25  {
26         struct omap_vc_channel *vc = voltdm->vc;
27 -       struct omap_vdd_info *vdd = voltdm->vdd;
28 -       struct omap_volt_data *volt_data;
29 -       u32 vc_cmdval, vp_errgain_val;
30 +       u32 vc_cmdval;
31  
32         /* Check if sufficient pmic info is available for this vdd */
33         if (!voltdm->pmic) {
34 @@ -120,11 +118,6 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
35                 return -EINVAL;
36         }
37  
38 -       /* Get volt_data corresponding to target_volt */
39 -       volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
40 -       if (IS_ERR(volt_data))
41 -               volt_data = NULL;
42 -
43         *target_vsel = voltdm->pmic->uv_to_vsel(target_volt);
44         *current_vsel = voltdm->pmic->uv_to_vsel(vdd->curr_volt);
45  
46 @@ -134,15 +127,7 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
47         vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift);
48         voltdm->write(vc_cmdval, vc->cmdval_reg);
49  
50 -       /* Setting vp errorgain based on the voltage */
51 -       if (volt_data) {
52 -               vp_errgain_val = voltdm->read(voltdm->vp->vpconfig);
53 -               vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain;
54 -               vp_errgain_val &= voltdm->vp->common->vpconfig_errorgain_mask;
55 -               vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain <<
56 -                       __ffs(voltdm->vp->common->vpconfig_errorgain_mask);
57 -               voltdm->write(vp_errgain_val, voltdm->vp->vpconfig);
58 -       }
59 +       omap_vp_update_errorgain(voltdm, target_volt);
60  
61         return 0;
62  }
63 diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
64 index ea61a47..f68a6db 100644
65 --- a/arch/arm/mach-omap2/vp.c
66 +++ b/arch/arm/mach-omap2/vp.c
67 @@ -106,6 +106,25 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
68         voltdm->write(vp_val, vp->vlimitto);
69  }
70  
71 +int omap_vp_update_errorgain(struct voltagedomain *voltdm,
72 +                            unsigned long target_volt)
73 +{
74 +       struct omap_volt_data *volt_data;
75 +
76 +       /* Get volt_data corresponding to target_volt */
77 +       volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
78 +       if (IS_ERR(volt_data))
79 +               return -EINVAL;
80 +
81 +       /* Setting vp errorgain based on the voltage */
82 +       voltdm->rmw(voltdm->vp->common->vpconfig_errorgain_mask,
83 +                   volt_data->vp_errgain <<
84 +                   __ffs(voltdm->vp->common->vpconfig_errorgain_mask),
85 +                   voltdm->vp->vpconfig);
86 +
87 +       return 0;
88 +}
89 +
90  /* VP force update method of voltage scaling */
91  int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
92                               unsigned long target_volt)
93 diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
94 index 2afe11d..71ac738 100644
95 --- a/arch/arm/mach-omap2/vp.h
96 +++ b/arch/arm/mach-omap2/vp.h
97 @@ -148,5 +148,7 @@ void omap_vp_disable(struct voltagedomain *voltdm);
98  unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
99  int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
100                               unsigned long target_volt);
101 +int omap_vp_update_errorgain(struct voltagedomain *voltdm,
102 +                            unsigned long target_volt);
103  
104  #endif
105 -- 
106 1.6.6.1