]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
driver: tmon: tegra: update rtemp functionality
authorsreenivasulu velpula <svelpula@nvidia.com>
Thu, 21 Feb 2013 19:11:05 +0000 (00:41 +0530)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 20:02:34 +0000 (13:02 -0700)
Bug 1182410

Reviewed-on: http://git-master/r/203014
(cherry picked from commit 57e260678b3c59b22c0999e267387661aa4feca0)

Change-Id: I530c6e07e8a18c6b972ad531c45bb8b6c2817042
Signed-off-by: sreenivasulu velpula <svelpula@nvidia.com>
Reviewed-on: http://git-master/r/206273
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
drivers/hwmon/tmon-tmp411.c
include/linux/platform_data/tmon_tmp411.h

index 4bbec982ed88617edc62ffc0baa1080b973276c5..6c68a5e082fbcb6ae9c09c54b79db2ec4f03ce88 100644 (file)
@@ -175,33 +175,17 @@ static int tmon_check_local_temp(struct i2c_client *client,
        return TMON_NOCHANGE;
 }
 
-static int tmon_rtemp_boundary_check(struct i2c_client *client,
-                               int rtemp_low_boundary,
-                               int rtemp_high_boundary, int *low_to_high)
+static int tmon_check_remote_temp(struct i2c_client *client,
+                                                u32 delta_temp)
 {
        static int last_temp;
        int err;
        int curr_temp = 0;
-
-       *low_to_high = -1;
-
        err = tmon_read_remote_temp(client, &curr_temp);
        if (err)
                return TMON_ERR;
 
-       /* If remote temp is changing from < rtemp_high_boundary
-               to >= rtemp_high_boundary. */
-       if (last_temp < rtemp_high_boundary &&
-               curr_temp >= rtemp_high_boundary)
-               *low_to_high = 1;
-
-       /* If remote temp is changing from >= rtemp_low_boundary
-               to < rtemp_low_boundary */
-       else if (last_temp >= rtemp_low_boundary &&
-               curr_temp < rtemp_low_boundary)
-               *low_to_high = 0;
-
-       if (*low_to_high == 0 || *low_to_high == 1) {
+       if (abs(curr_temp - last_temp) >= delta_temp) {
                last_temp = curr_temp;
                return curr_temp;
        }
@@ -235,7 +219,6 @@ device_attr(local_temp);
 static void tmon_update(struct work_struct *work)
 {
        int ret;
-       int low_to_high;
        struct tmon_info *tmon_data =
            container_of(to_delayed_work(work),
                         struct tmon_info,
@@ -256,15 +239,12 @@ static void tmon_update(struct work_struct *work)
                pdata->ltemp_dependent_reg_update)
                pdata->ltemp_dependent_reg_update(ret);
 
-       ret =
-           tmon_rtemp_boundary_check(tmon_data->client,
-                                       pdata->rtemp_low_boundary,
-                                       pdata->rtemp_high_boundary,
-                                       &low_to_high);
+       ret = tmon_check_remote_temp(tmon_data->client,
+                                               pdata->delta_temp);
 
        if (ret != TMON_ERR && ret != TMON_NOCHANGE &&
-               pdata->rtemp_dependent_reg_update)
-               pdata->rtemp_dependent_reg_update(ret, low_to_high);
+               pdata->utmip_temp_dep_update)
+               pdata->utmip_temp_dep_update(ret, pdata->utmip_temp_bound);
 
        schedule_delayed_work(&tmon_data->tmon_work,
                              msecs_to_jiffies(pdata->delta_time));
index 25180fc4d376afe4e4449ad8215cb8edd06dae28..94a3a104407433020ea81680e2c8c32760821e63 100644 (file)
@@ -26,10 +26,9 @@ struct tmon_plat_data {
        signed int delta_temp;
        signed int delta_time;
        signed int remote_offset;
-       int rtemp_low_boundary;
-       int rtemp_high_boundary;
+       int utmip_temp_bound;
        void (*ltemp_dependent_reg_update)(int ltemp);
-       void (*rtemp_dependent_reg_update)(int rtemp, int low_to_high);
+       void (*utmip_temp_dep_update)(int rtemp, int utmip_temp_bound);
 };