hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/thermal/qcom/tsens-v1.c
....@@ -78,11 +78,6 @@
7878
7979 #define MSM8976_CAL_SEL_MASK 0x3
8080
81
-#define MSM8976_CAL_DEGC_PT1 30
82
-#define MSM8976_CAL_DEGC_PT2 120
83
-#define MSM8976_SLOPE_FACTOR 1000
84
-#define MSM8976_SLOPE_DEFAULT 3200
85
-
8681 /* eeprom layout data for qcs404/405 (v1) */
8782 #define BASE0_MASK 0x000007f8
8883 #define BASE1_MASK 0x0007f800
....@@ -141,30 +136,6 @@
141136
142137 #define CAL_SEL_MASK 7
143138 #define CAL_SEL_SHIFT 0
144
-
145
-static void compute_intercept_slope_8976(struct tsens_priv *priv,
146
- u32 *p1, u32 *p2, u32 mode)
147
-{
148
- int i;
149
-
150
- priv->sensor[0].slope = 3313;
151
- priv->sensor[1].slope = 3275;
152
- priv->sensor[2].slope = 3320;
153
- priv->sensor[3].slope = 3246;
154
- priv->sensor[4].slope = 3279;
155
- priv->sensor[5].slope = 3257;
156
- priv->sensor[6].slope = 3234;
157
- priv->sensor[7].slope = 3269;
158
- priv->sensor[8].slope = 3255;
159
- priv->sensor[9].slope = 3239;
160
- priv->sensor[10].slope = 3286;
161
-
162
- for (i = 0; i < priv->num_sensors; i++) {
163
- priv->sensor[i].offset = (p1[i] * MSM8976_SLOPE_FACTOR) -
164
- (MSM8976_CAL_DEGC_PT1 *
165
- priv->sensor[i].slope);
166
- }
167
-}
168139
169140 static int calibrate_v1(struct tsens_priv *priv)
170141 {
....@@ -291,7 +262,7 @@
291262 break;
292263 }
293264
294
- compute_intercept_slope_8976(priv, p1, p2, mode);
265
+ compute_intercept_slope(priv, p1, p2, mode);
295266 kfree(qfprom_cdata);
296267
297268 return 0;
....@@ -362,6 +333,22 @@
362333 [TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0),
363334 };
364335
336
+static int __init init_8956(struct tsens_priv *priv) {
337
+ priv->sensor[0].slope = 3313;
338
+ priv->sensor[1].slope = 3275;
339
+ priv->sensor[2].slope = 3320;
340
+ priv->sensor[3].slope = 3246;
341
+ priv->sensor[4].slope = 3279;
342
+ priv->sensor[5].slope = 3257;
343
+ priv->sensor[6].slope = 3234;
344
+ priv->sensor[7].slope = 3269;
345
+ priv->sensor[8].slope = 3255;
346
+ priv->sensor[9].slope = 3239;
347
+ priv->sensor[10].slope = 3286;
348
+
349
+ return init_common(priv);
350
+}
351
+
365352 static const struct tsens_ops ops_generic_v1 = {
366353 .init = init_common,
367354 .calibrate = calibrate_v1,
....@@ -374,17 +361,29 @@
374361 .fields = tsens_v1_regfields,
375362 };
376363
364
+static const struct tsens_ops ops_8956 = {
365
+ .init = init_8956,
366
+ .calibrate = calibrate_8976,
367
+ .get_temp = get_temp_tsens_valid,
368
+};
369
+
370
+struct tsens_plat_data data_8956 = {
371
+ .num_sensors = 11,
372
+ .ops = &ops_8956,
373
+ .feat = &tsens_v1_feat,
374
+ .fields = tsens_v1_regfields,
375
+};
376
+
377377 static const struct tsens_ops ops_8976 = {
378378 .init = init_common,
379379 .calibrate = calibrate_8976,
380380 .get_temp = get_temp_tsens_valid,
381381 };
382382
383
-/* Valid for both MSM8956 and MSM8976. Sensor ID 3 is unused. */
384383 struct tsens_plat_data data_8976 = {
385384 .num_sensors = 11,
386385 .ops = &ops_8976,
387
- .hw_ids = (unsigned int[]){0, 1, 2, 4, 5, 6, 7, 8, 9, 10},
386
+ .hw_ids = (unsigned int[]){0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
388387 .feat = &tsens_v1_feat,
389388 .fields = tsens_v1_regfields,
390389 };