OMAP3+: voltage: remove unneeded debugfs interface
[pandora-kernel.git] / arch / arm / mach-omap2 / vp.c
index a3afcbe..c9a315f 100644 (file)
@@ -1,6 +1,5 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/debugfs.h>
 
 #include <plat/common.h>
 
@@ -10,11 +9,9 @@
 #include "prm-regbits-44xx.h"
 #include "prm44xx.h"
 
-static void __init vp_debugfs_init(struct voltagedomain *voltdm);
-
 static void vp_latch_vsel(struct voltagedomain *voltdm)
 {
-       struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
+       struct omap_vp_instance *vp = voltdm->vp;
        u32 vpconfig;
        unsigned long uvdc;
        char vsel;
@@ -35,14 +32,14 @@ static void vp_latch_vsel(struct voltagedomain *voltdm)
        vsel = voltdm->pmic->uv_to_vsel(uvdc);
 
        vpconfig = voltdm->read(vp->vpconfig);
-       vpconfig &= ~(vp->vp_common->vpconfig_initvoltage_mask |
-                       vp->vp_common->vpconfig_initvdd);
-       vpconfig |= vsel << vp->vp_common->vpconfig_initvoltage_shift;
+       vpconfig &= ~(vp->common->vpconfig_initvoltage_mask |
+                       vp->common->vpconfig_initvdd);
+       vpconfig |= vsel << vp->common->vpconfig_initvoltage_shift;
 
        voltdm->write(vpconfig, vp->vpconfig);
 
        /* Trigger initVDD value copy to voltage processor */
-       voltdm->write((vpconfig | vp->vp_common->vpconfig_initvdd),
+       voltdm->write((vpconfig | vp->common->vpconfig_initvdd),
                       vp->vpconfig);
 
        /* Clear initVDD copy trigger bit */
@@ -52,7 +49,7 @@ static void vp_latch_vsel(struct voltagedomain *voltdm)
 /* Generic voltage init functions */
 void __init omap_vp_init(struct voltagedomain *voltdm)
 {
-       struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
+       struct omap_vp_instance *vp = voltdm->vp;
        struct omap_vdd_info *vdd = voltdm->vdd;
        u32 vp_val;
 
@@ -64,38 +61,36 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
 
        vp_val = vdd->vp_rt_data.vpconfig_erroroffset |
                (vdd->vp_rt_data.vpconfig_errorgain <<
-               vp->vp_common->vpconfig_errorgain_shift) |
-               vp->vp_common->vpconfig_timeouten;
+               vp->common->vpconfig_errorgain_shift) |
+               vp->common->vpconfig_timeouten;
        voltdm->write(vp_val, vp->vpconfig);
 
        vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin <<
-               vp->vp_common->vstepmin_smpswaittimemin_shift) |
+               vp->common->vstepmin_smpswaittimemin_shift) |
                (vdd->vp_rt_data.vstepmin_stepmin <<
-               vp->vp_common->vstepmin_stepmin_shift));
+               vp->common->vstepmin_stepmin_shift));
        voltdm->write(vp_val, vp->vstepmin);
 
        vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax <<
-               vp->vp_common->vstepmax_smpswaittimemax_shift) |
+               vp->common->vstepmax_smpswaittimemax_shift) |
                (vdd->vp_rt_data.vstepmax_stepmax <<
-               vp->vp_common->vstepmax_stepmax_shift));
+               vp->common->vstepmax_stepmax_shift));
        voltdm->write(vp_val, vp->vstepmax);
 
        vp_val = ((vdd->vp_rt_data.vlimitto_vddmax <<
-               vp->vp_common->vlimitto_vddmax_shift) |
+               vp->common->vlimitto_vddmax_shift) |
                (vdd->vp_rt_data.vlimitto_vddmin <<
-               vp->vp_common->vlimitto_vddmin_shift) |
+               vp->common->vlimitto_vddmin_shift) |
                (vdd->vp_rt_data.vlimitto_timeout <<
-               vp->vp_common->vlimitto_timeout_shift));
+               vp->common->vlimitto_timeout_shift));
        voltdm->write(vp_val, vp->vlimitto);
-
-       vp_debugfs_init(voltdm);
 }
 
 /* VP force update method of voltage scaling */
 int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
                              unsigned long target_volt)
 {
-       struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
+       struct omap_vp_instance *vp = voltdm->vp;
        u32 vpconfig;
        u8 target_vsel, current_vsel;
        int ret, timeout = 0;
@@ -109,8 +104,8 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
         * is <3us
         */
        while (timeout++ < VP_TRANXDONE_TIMEOUT) {
-               vp->vp_common->ops->clear_txdone(vp->id);
-               if (!vp->vp_common->ops->check_txdone(vp->id))
+               vp->common->ops->clear_txdone(vp->id);
+               if (!vp->common->ops->check_txdone(vp->id))
                        break;
                udelay(1);
        }
@@ -122,19 +117,19 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 
        /* Configure for VP-Force Update */
        vpconfig = voltdm->read(vp->vpconfig);
-       vpconfig &= ~(vp->vp_common->vpconfig_initvdd |
-                       vp->vp_common->vpconfig_forceupdate |
-                       vp->vp_common->vpconfig_initvoltage_mask);
+       vpconfig &= ~(vp->common->vpconfig_initvdd |
+                       vp->common->vpconfig_forceupdate |
+                       vp->common->vpconfig_initvoltage_mask);
        vpconfig |= ((target_vsel <<
-                       vp->vp_common->vpconfig_initvoltage_shift));
+                       vp->common->vpconfig_initvoltage_shift));
        voltdm->write(vpconfig, vp->vpconfig);
 
        /* Trigger initVDD value copy to voltage processor */
-       vpconfig |= vp->vp_common->vpconfig_initvdd;
+       vpconfig |= vp->common->vpconfig_initvdd;
        voltdm->write(vpconfig, vp->vpconfig);
 
        /* Force update of voltage */
-       vpconfig |= vp->vp_common->vpconfig_forceupdate;
+       vpconfig |= vp->common->vpconfig_forceupdate;
        voltdm->write(vpconfig, vp->vpconfig);
 
        /*
@@ -142,7 +137,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
         * Depends on SMPSWAITTIMEMIN/MAX and voltage change
         */
        timeout = 0;
-       omap_test_timeout(vp->vp_common->ops->check_txdone(vp->id),
+       omap_test_timeout(vp->common->ops->check_txdone(vp->id),
                          VP_TRANXDONE_TIMEOUT, timeout);
        if (timeout >= VP_TRANXDONE_TIMEOUT)
                pr_err("%s: vdd_%s TRANXDONE timeout exceeded."
@@ -157,8 +152,8 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
         */
        timeout = 0;
        while (timeout++ < VP_TRANXDONE_TIMEOUT) {
-               vp->vp_common->ops->clear_txdone(vp->id);
-               if (!vp->vp_common->ops->check_txdone(vp->id))
+               vp->common->ops->clear_txdone(vp->id);
+               if (!vp->common->ops->check_txdone(vp->id))
                        break;
                udelay(1);
        }
@@ -170,10 +165,10 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
 
        vpconfig = voltdm->read(vp->vpconfig);
        /* Clear initVDD copy trigger bit */
-       vpconfig &= ~vp->vp_common->vpconfig_initvdd;
+       vpconfig &= ~vp->common->vpconfig_initvdd;
        voltdm->write(vpconfig, vp->vpconfig);
        /* Clear force bit */
-       vpconfig &= ~vp->vp_common->vpconfig_forceupdate;
+       vpconfig &= ~vp->common->vpconfig_forceupdate;
        voltdm->write(vpconfig, vp->vpconfig);
 
        return 0;
@@ -187,8 +182,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
  */
 unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
 {
-       struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
-       struct omap_vdd_info *vdd;
+       struct omap_vp_instance *vp = voltdm->vp;
        u8 curr_vsel;
 
        if (!voltdm || IS_ERR(voltdm)) {
@@ -196,7 +190,6 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
                return 0;
        }
 
-       vdd = voltdm->vdd;
        if (!voltdm->read) {
                pr_err("%s: No read API for reading vdd_%s regs\n",
                        __func__, voltdm->name);
@@ -223,8 +216,7 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
  */
 void omap_vp_enable(struct voltagedomain *voltdm)
 {
-       struct omap_vp_instance_data *vp;
-       struct omap_vdd_info *vdd;
+       struct omap_vp_instance *vp;
        u32 vpconfig;
 
        if (!voltdm || IS_ERR(voltdm)) {
@@ -232,8 +224,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
                return;
        }
 
-       vdd = voltdm->vdd;
-       vp = voltdm->vdd->vp_data;
+       vp = voltdm->vp;
        if (!voltdm->read || !voltdm->write) {
                pr_err("%s: No read/write API for accessing vdd_%s regs\n",
                        __func__, voltdm->name);
@@ -241,16 +232,16 @@ void omap_vp_enable(struct voltagedomain *voltdm)
        }
 
        /* If VP is already enabled, do nothing. Return */
-       if (vdd->vp_enabled)
+       if (vp->enabled)
                return;
 
        vp_latch_vsel(voltdm);
 
        /* Enable VP */
        vpconfig = voltdm->read(vp->vpconfig);
-       vpconfig |= vp->vp_common->vpconfig_vpenable;
+       vpconfig |= vp->common->vpconfig_vpenable;
        voltdm->write(vpconfig, vp->vpconfig);
-       vdd->vp_enabled = true;
+       vp->enabled = true;
 }
 
 /**
@@ -262,8 +253,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
  */
 void omap_vp_disable(struct voltagedomain *voltdm)
 {
-       struct omap_vp_instance_data *vp;
-       struct omap_vdd_info *vdd;
+       struct omap_vp_instance *vp;
        u32 vpconfig;
        int timeout;
 
@@ -272,8 +262,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
                return;
        }
 
-       vdd = voltdm->vdd;
-       vp = voltdm->vdd->vp_data;
+       vp = voltdm->vp;
        if (!voltdm->read || !voltdm->write) {
                pr_err("%s: No read/write API for accessing vdd_%s regs\n",
                        __func__, voltdm->name);
@@ -281,7 +270,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
        }
 
        /* If VP is already disabled, do nothing. Return */
-       if (!vdd->vp_enabled) {
+       if (!vp->enabled) {
                pr_warning("%s: Trying to disable VP for vdd_%s when"
                        "it is already disabled\n", __func__, voltdm->name);
                return;
@@ -289,7 +278,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
 
        /* Disable VP */
        vpconfig = voltdm->read(vp->vpconfig);
-       vpconfig &= ~vp->vp_common->vpconfig_vpenable;
+       vpconfig &= ~vp->common->vpconfig_vpenable;
        voltdm->write(vpconfig, vp->vpconfig);
 
        /*
@@ -302,65 +291,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
                pr_warning("%s: vdd_%s idle timedout\n",
                        __func__, voltdm->name);
 
-       vdd->vp_enabled = false;
+       vp->enabled = false;
 
        return;
 }
-
-/* Voltage debugfs support */
-static int vp_volt_debug_get(void *data, u64 *val)
-{
-       struct voltagedomain *voltdm = (struct voltagedomain *)data;
-       struct omap_vp_instance_data *vp = voltdm->vdd->vp_data;
-       struct omap_vdd_info *vdd = voltdm->vdd;
-       u8 vsel;
-
-       if (!vdd) {
-               pr_warning("Wrong paramater passed\n");
-               return -EINVAL;
-       }
-
-       vsel = voltdm->read(vp->voltage);
-
-       if (!voltdm->pmic->vsel_to_uv) {
-               pr_warning("PMIC function to convert vsel to voltage"
-                       "in uV not registerd\n");
-               return -EINVAL;
-       }
-
-       *val = voltdm->pmic->vsel_to_uv(vsel);
-       return 0;
-}
-
-DEFINE_SIMPLE_ATTRIBUTE(vp_volt_debug_fops, vp_volt_debug_get, NULL, "%llu\n");
-
-static void __init vp_debugfs_init(struct voltagedomain *voltdm)
-{
-       struct omap_vdd_info *vdd = voltdm->vdd;
-       struct dentry *debug_dir;
-
-       debug_dir = debugfs_create_dir("vp", vdd->debug_dir);
-       if (IS_ERR(debug_dir))
-               pr_err("%s: Unable to create VP debugfs dir dir\n", __func__);
-
-       (void) debugfs_create_x16("errorgain", S_IRUGO, debug_dir,
-                               &(vdd->vp_rt_data.vpconfig_errorgain));
-       (void) debugfs_create_x16("smpswaittimemin", S_IRUGO,
-                               debug_dir,
-                               &(vdd->vp_rt_data.vstepmin_smpswaittimemin));
-       (void) debugfs_create_x8("stepmin", S_IRUGO, debug_dir,
-                               &(vdd->vp_rt_data.vstepmin_stepmin));
-       (void) debugfs_create_x16("smpswaittimemax", S_IRUGO,
-                               debug_dir,
-                               &(vdd->vp_rt_data.vstepmax_smpswaittimemax));
-       (void) debugfs_create_x8("stepmax", S_IRUGO, debug_dir,
-                               &(vdd->vp_rt_data.vstepmax_stepmax));
-       (void) debugfs_create_x8("vddmax", S_IRUGO, debug_dir,
-                               &(vdd->vp_rt_data.vlimitto_vddmax));
-       (void) debugfs_create_x8("vddmin", S_IRUGO, debug_dir,
-                               &(vdd->vp_rt_data.vlimitto_vddmin));
-       (void) debugfs_create_x16("timeout", S_IRUGO, debug_dir,
-                               &(vdd->vp_rt_data.vlimitto_timeout));
-       (void) debugfs_create_file("curr_volt", S_IRUGO, debug_dir,
-                               (void *) voltdm, &vp_volt_debug_fops);
-}