]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
thermal: nct72: report correct initial temperature
authorRajkumar Kasirajan <rkasirajan@nvidia.com>
Mon, 21 Dec 2015 07:03:20 +0000 (15:03 +0800)
committerWinnie Hsu <whsu@nvidia.com>
Thu, 7 Jan 2016 20:00:30 +0000 (12:00 -0800)
If NCT is in standby mode, need to initiate one-shot conversion
before reading temperature, otherwise while bootup NCT will report
wrong initial temperature and driver will set wrong temperature
alert limits based on that.

Bug 200161159

Change-Id: I158a73eb692a71c0262496369bcd3bd3d62a40e1
Signed-off-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
(cherry picked from commit 4164770df219bcd37ffa68950882564181a78e8f)
Reviewed-on: http://git-master/r/929885
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/misc/nct1008.c

index dc0caa533bc6bcd23e864fb1d5948e415d784441..f3998901116b00214fbcf044d312a608cff7bd62 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Driver for NCT1008, temperature monitoring device from ON Semiconductors
  *
- * Copyright (c) 2010-2015, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2010-2016, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1341,6 +1341,12 @@ static int nct1008_configure_sensor(struct nct1008_data *data)
        if (ret)
                goto error;
 
+       /* Initiate one-shot conversion  */
+       nct1008_write_reg(data->client, ONE_SHOT, 0x1);
+
+       /* Give hardware necessary time to finish conversion */
+       msleep(MAX_CONV_TIME_ONESHOT_MS);
+
        /* read initial temperature */
        ret = nct1008_read_reg(client, LOC_TEMP_RD);
        if (ret < 0)