EDP: tegra: export VSYS_MIN debugfs attr
Sivaram Nair [Tue, 10 Sep 2013 10:23:48 +0000 (13:23 +0300)]
Adding a new debugfs attr for vsys_min psy depletion platform data for
tuning.

Bug 1306298

Change-Id: Id9b7a6affae2216e7bafde55eea2f8eacbe24572
Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
Reviewed-on: http://git-master/r/272489
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Vandana Bansal <vandanab@nvidia.com>
Reviewed-by: Timo Alho <talho@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

drivers/edp/psy_depletion.c

index cdd22a9..9eb5a2c 100644 (file)
@@ -289,7 +289,25 @@ static int capacity_get(void *data, u64 *val)
        return 0;
 }
 
+static int vsysmin_set(void *data, u64 val)
+{
+       struct depl_driver *drv = data;
+
+       drv->pdata->vsys_min = val;
+       flush_delayed_work_sync(&drv->work);
+
+       return 0;
+}
+
+static int vsysmin_get(void *data, u64 *val)
+{
+       struct depl_driver *drv = data;
+       *val = drv->pdata->vsys_min;
+       return 0;
+}
+
 DEFINE_SIMPLE_ATTRIBUTE(capacity_fops, capacity_get, capacity_set, "%lld\n");
+DEFINE_SIMPLE_ATTRIBUTE(vsysmin_fops, vsysmin_get, vsysmin_set, "%lld\n");
 
 static void init_debug(struct depl_driver *drv)
 {
@@ -300,6 +318,13 @@ static void init_debug(struct depl_driver *drv)
                return;
        }
 
+       d = debugfs_create_file("vsys_min", S_IRUGO | S_IWUSR,
+                       drv->client.dentry, drv, &vsysmin_fops);
+       WARN_ON(IS_ERR_OR_NULL(d));
+
+       if (!drv->emulator_mode)
+               return;
+
        d = debugfs_create_file("capacity", S_IRUGO | S_IWUSR,
                        drv->client.dentry, drv, &capacity_fops);
        WARN_ON(IS_ERR_OR_NULL(d));
@@ -362,8 +387,7 @@ static __devinit int depl_probe(struct platform_device *pdev)
        INIT_DELAYED_WORK_DEFERRABLE(&drv->work, depl_update);
        schedule_delayed_work(&drv->work, 0);
 
-       if (drv->emulator_mode)
-               init_debug(drv);
+       init_debug(drv);
 
        return 0;