@@ -1263,6 +1263,19 @@ int32_t qpnp_adc_batt_therm_qrd(struct qpnp_vadc_chip *chip,
1263
1263
qpnp_adc_map_voltage_temp (adcmap_batt_therm_qrd ,
1264
1264
ARRAY_SIZE (adcmap_batt_therm_qrd ),
1265
1265
batt_thm_voltage , & adc_chan_result -> physical );
1266
+ } else {
1267
+
1268
+ qpnp_adc_scale_with_calib_param (adc_code ,
1269
+ adc_properties , chan_properties , & batt_thm_voltage );
1270
+
1271
+ adc_chan_result -> measurement = batt_thm_voltage ;
1272
+
1273
+ return qpnp_adc_map_voltage_temp (
1274
+ adcmap_batt_therm_qrd ,
1275
+ ARRAY_SIZE (adcmap_batt_therm_qrd ),
1276
+ batt_thm_voltage ,
1277
+ & adc_chan_result -> physical );
1278
+
1266
1279
}
1267
1280
return 0 ;
1268
1281
}
@@ -2152,6 +2165,64 @@ int32_t qpnp_adc_qrd_skut1_btm_scaler(struct qpnp_vadc_chip *chip,
2152
2165
}
2153
2166
EXPORT_SYMBOL (qpnp_adc_qrd_skut1_btm_scaler );
2154
2167
2168
+ int32_t qpnp_adc_qrd_215_btm_scaler (struct qpnp_vadc_chip * chip ,
2169
+ struct qpnp_adc_tm_btm_param * param ,
2170
+ uint32_t * low_threshold , uint32_t * high_threshold )
2171
+ {
2172
+ struct qpnp_vadc_linear_graph btm_param ;
2173
+ int64_t low_output = 0 , high_output = 0 ;
2174
+ int rc = 0 ;
2175
+
2176
+ if (param -> adc_tm_hc ) {
2177
+ pr_debug ("Update scaling for VADC_TM_HC\n" );
2178
+ return - EINVAL ;
2179
+ }
2180
+
2181
+ qpnp_get_vadc_gain_and_offset (chip , & btm_param , CALIB_RATIOMETRIC );
2182
+
2183
+ pr_debug ("warm_temp:%d and cool_temp:%d\n" , param -> high_temp ,
2184
+ param -> low_temp );
2185
+ rc = qpnp_adc_map_voltage_temp (
2186
+ adcmap_batt_therm_qrd ,
2187
+ ARRAY_SIZE (adcmap_batt_therm_qrd ),
2188
+ (param -> low_temp ),
2189
+ & low_output );
2190
+ if (rc ) {
2191
+ pr_debug ("low_temp mapping failed with %d\n" , rc );
2192
+ return rc ;
2193
+ }
2194
+
2195
+ pr_debug ("low_output:%lld\n" , low_output );
2196
+ low_output *= btm_param .dy ;
2197
+ low_output = div64_s64 (low_output , btm_param .adc_vref );
2198
+ low_output += btm_param .adc_gnd ;
2199
+
2200
+ rc = qpnp_adc_map_voltage_temp (
2201
+ adcmap_batt_therm_qrd ,
2202
+ ARRAY_SIZE (adcmap_batt_therm_qrd ),
2203
+ (param -> high_temp ),
2204
+ & high_output );
2205
+ if (rc ) {
2206
+ pr_debug ("high temp mapping failed with %d\n" , rc );
2207
+ return rc ;
2208
+ }
2209
+
2210
+ pr_debug ("high_output:%lld\n" , high_output );
2211
+ high_output *= btm_param .dy ;
2212
+ high_output = div64_s64 (high_output , btm_param .adc_vref );
2213
+ high_output += btm_param .adc_gnd ;
2214
+
2215
+ /* btm low temperature correspondes to high voltage threshold */
2216
+ * low_threshold = high_output ;
2217
+ /* btm high temperature correspondes to low voltage threshold */
2218
+ * high_threshold = low_output ;
2219
+
2220
+ pr_debug ("high_volt:%d, low_volt:%d\n" , * high_threshold ,
2221
+ * low_threshold );
2222
+ return 0 ;
2223
+ }
2224
+ EXPORT_SYMBOL (qpnp_adc_qrd_215_btm_scaler );
2225
+
2155
2226
int32_t qpnp_adc_smb_btm_rscaler (struct qpnp_vadc_chip * chip ,
2156
2227
struct qpnp_adc_tm_btm_param * param ,
2157
2228
uint32_t * low_threshold , uint32_t * high_threshold )
0 commit comments