| .. | .. |
|---|
| 78 | 78 | |
|---|
| 79 | 79 | #define MSM8976_CAL_SEL_MASK 0x3 |
|---|
| 80 | 80 | |
|---|
| 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 | | - |
|---|
| 86 | 81 | /* eeprom layout data for qcs404/405 (v1) */ |
|---|
| 87 | 82 | #define BASE0_MASK 0x000007f8 |
|---|
| 88 | 83 | #define BASE1_MASK 0x0007f800 |
|---|
| .. | .. |
|---|
| 141 | 136 | |
|---|
| 142 | 137 | #define CAL_SEL_MASK 7 |
|---|
| 143 | 138 | #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 | | -} |
|---|
| 168 | 139 | |
|---|
| 169 | 140 | static int calibrate_v1(struct tsens_priv *priv) |
|---|
| 170 | 141 | { |
|---|
| .. | .. |
|---|
| 291 | 262 | break; |
|---|
| 292 | 263 | } |
|---|
| 293 | 264 | |
|---|
| 294 | | - compute_intercept_slope_8976(priv, p1, p2, mode); |
|---|
| 265 | + compute_intercept_slope(priv, p1, p2, mode); |
|---|
| 295 | 266 | kfree(qfprom_cdata); |
|---|
| 296 | 267 | |
|---|
| 297 | 268 | return 0; |
|---|
| .. | .. |
|---|
| 362 | 333 | [TRDY] = REG_FIELD(TM_TRDY_OFF, 0, 0), |
|---|
| 363 | 334 | }; |
|---|
| 364 | 335 | |
|---|
| 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 | + |
|---|
| 365 | 352 | static const struct tsens_ops ops_generic_v1 = { |
|---|
| 366 | 353 | .init = init_common, |
|---|
| 367 | 354 | .calibrate = calibrate_v1, |
|---|
| .. | .. |
|---|
| 374 | 361 | .fields = tsens_v1_regfields, |
|---|
| 375 | 362 | }; |
|---|
| 376 | 363 | |
|---|
| 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 | + |
|---|
| 377 | 377 | static const struct tsens_ops ops_8976 = { |
|---|
| 378 | 378 | .init = init_common, |
|---|
| 379 | 379 | .calibrate = calibrate_8976, |
|---|
| 380 | 380 | .get_temp = get_temp_tsens_valid, |
|---|
| 381 | 381 | }; |
|---|
| 382 | 382 | |
|---|
| 383 | | -/* Valid for both MSM8956 and MSM8976. Sensor ID 3 is unused. */ |
|---|
| 384 | 383 | struct tsens_plat_data data_8976 = { |
|---|
| 385 | 384 | .num_sensors = 11, |
|---|
| 386 | 385 | .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}, |
|---|
| 388 | 387 | .feat = &tsens_v1_feat, |
|---|
| 389 | 388 | .fields = tsens_v1_regfields, |
|---|
| 390 | 389 | }; |
|---|