*
*/
+#include <linux/clk.h>
#include <linux/cpu_cooling.h>
#include <linux/cpufreq.h>
#include <linux/delay.h>
struct regmap *tempmon;
unsigned long trip_temp[IMX_TRIP_NUM];
u32 c1, c2; /* See formula in imx_get_sensor_data() */
+ struct clk *thermal_clk;
};
static int imx_get_temp(struct thermal_zone_device *tz, unsigned long *temp)
unsigned int n_meas;
u32 val;
+ clk_prepare_enable(data->thermal_clk);
/*
* Every time we measure the temperature, we will power on the
* temperature sensor, enable measurements, take a reading,
last_temp = *temp;
}
+ clk_disable_unprepare(data->thermal_clk);
+
return 0;
}
return ret;
}
+ data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
+ ret = IS_ERR(data->thermal_clk);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to get thermal clk!\n");
+ return ret;
+ }
+
/* Make sure sensor is in known good state for measurements */
regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN);
regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_MEASURE_TEMP);