misc: nct1008: set edp zone on driver initialization
Alex Frid [Wed, 25 May 2011 02:07:22 +0000 (19:07 -0700)]
Original-Change-Id: I2f578aee6dea911ebbe63cdcb5c9a7ddfcdf2264
Reviewed-on: http://git-master/r/32862
Tested-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>

Rebase-Id: Rd50d38c5de1e7bbca21184751a47700ed3a14e6c

drivers/misc/nct1008.c

index 53b1766..034fa59 100644 (file)
@@ -681,6 +681,7 @@ static int __devinit nct1008_probe(struct i2c_client *client,
 {
        struct nct1008_data *data;
        int err;
+       u8 temperature;
 
        data = kzalloc(sizeof(struct nct1008_data), GFP_KERNEL);
 
@@ -710,6 +711,13 @@ static int __devinit nct1008_probe(struct i2c_client *client,
 
        nct1008_enable(client);         /* sensor is running */
 
+       err = nct1008_get_temp(&data->client->dev, &temperature);
+       if (err) {
+               pr_err("%s: get temp fail(%d)", __func__, err);
+               return 0;       /*do not fail init on the 1st read */
+       }
+
+       tegra_edp_update_thermal_zone(temperature);
        return 0;
 
 error: