@@ -292,6 +292,8 @@ struct mtk_thermal {
292
292
293
293
const struct mtk_thermal_data * conf ;
294
294
struct mtk_thermal_bank banks [MAX_NUM_ZONES ];
295
+
296
+ int (* raw_to_mcelsius )(struct mtk_thermal * mt , int sensno , s32 raw );
295
297
};
296
298
297
299
/* MT8183 thermal sensor data */
@@ -656,13 +658,9 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
656
658
for (i = 0 ; i < conf -> bank_data [bank -> id ].num_sensors ; i ++ ) {
657
659
raw = readl (mt -> thermal_base + conf -> msr [i ]);
658
660
659
- if (mt -> conf -> version == MTK_THERMAL_V1 ) {
660
- temp = raw_to_mcelsius_v1 (
661
- mt , conf -> bank_data [bank -> id ].sensors [i ], raw );
662
- } else {
663
- temp = raw_to_mcelsius_v2 (
664
- mt , conf -> bank_data [bank -> id ].sensors [i ], raw );
665
- }
661
+ temp = mt -> raw_to_mcelsius (
662
+ mt , conf -> bank_data [bank -> id ].sensors [i ], raw );
663
+
666
664
667
665
/*
668
666
* The first read of a sensor often contains very high bogus
@@ -1073,6 +1071,11 @@ static int mtk_thermal_probe(struct platform_device *pdev)
1073
1071
mtk_thermal_release_periodic_ts (mt , auxadc_base );
1074
1072
}
1075
1073
1074
+ if (mt -> conf -> version == MTK_THERMAL_V1 )
1075
+ mt -> raw_to_mcelsius = raw_to_mcelsius_v1 ;
1076
+ else
1077
+ mt -> raw_to_mcelsius = raw_to_mcelsius_v2 ;
1078
+
1076
1079
for (ctrl_id = 0 ; ctrl_id < mt -> conf -> num_controller ; ctrl_id ++ )
1077
1080
for (i = 0 ; i < mt -> conf -> num_banks ; i ++ )
1078
1081
mtk_thermal_init_bank (mt , i , apmixed_phys_base ,
0 commit comments