void (*tsensor_update_irqs)(struct meson_tsensor_data *data);
};
+static struct meson_tsensor_data *g_tsensor_data_ptr;
+
static void meson_report_trigger(struct meson_tsensor_data *p)
{
char data[10], *envp[] = { data, NULL };
return 0;
}
+int meson_get_temperature(void)
+{
+ int temp;
+ int ret;
+
+ ret = meson_get_temp(g_tsensor_data_ptr, &temp);
+ if (ret) {
+ printk("meson_get_temp failed!\n");
+ return ret;
+ }
+
+ return temp / 1000;
+}
+EXPORT_SYMBOL(meson_get_temperature);
+
static void meson_tsensor_work(struct work_struct *work)
{
platform_set_drvdata(pdev, data);
mutex_init(&data->lock);
+ g_tsensor_data_ptr = data;
+
data->clk = devm_clk_get(&pdev->dev, "ts_comp");
if (IS_ERR(data->clk)) {
dev_err(&pdev->dev, "Failed to get tsclock\n");
}
extern int get_cpu_temp(void);
+extern int meson_get_temperature(void);
static void fan_work_func(struct work_struct *_work)
{
if (is_mcu_fan_control_available()) {
int temp = -EINVAL;
struct khadas_fan_data *fan_data = &g_mcu_data->fan_data;
- temp = get_cpu_temp();
+ if (KHADAS_BOARD_VIM2 == g_mcu_data->fan_data.board)
+ temp = get_cpu_temp();
+ else if (KHADAS_BOARD_VIM3 == g_mcu_data->fan_data.board)
+ temp = meson_get_temperature();
if(temp != -EINVAL){
if(temp < fan_data->trig_temp_level0 ) {
struct class_attribute *attr, char *buf)
{
int temp = -EINVAL;
- temp = get_cpu_temp();
+
+ if (KHADAS_BOARD_VIM2 == g_mcu_data->fan_data.board)
+ temp = get_cpu_temp();
+ else if (KHADAS_BOARD_VIM3 == g_mcu_data->fan_data.board)
+ temp = meson_get_temperature();
return sprintf(buf, "cpu_temp:%d\nFan trigger temperature: level0:%d level1:%d level2:%d\n", temp, g_mcu_data->fan_data.trig_temp_level0, g_mcu_data->fan_data.trig_temp_level1, g_mcu_data->fan_data.trig_temp_level2);
}