mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
Merge "thermal: qcom-spmi-temp-alarm: align temp readings with over-temp stage"
This commit is contained in:
commit
1059cd9eac
1 changed files with 18 additions and 1 deletions
|
|
@ -190,7 +190,7 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_chip *chip)
|
|||
static int qpnp_tm_get_temp(void *data, int *temp)
|
||||
{
|
||||
struct qpnp_tm_chip *chip = data;
|
||||
int ret, mili_celsius;
|
||||
int ret, mili_celsius, stage, stage_temp_min;
|
||||
|
||||
if (!temp)
|
||||
return -EINVAL;
|
||||
|
|
@ -207,10 +207,27 @@ static int qpnp_tm_get_temp(void *data, int *temp)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
mutex_lock(&chip->lock);
|
||||
stage = qpnp_tm_get_temp_stage(chip);
|
||||
if (stage < 0) {
|
||||
mutex_unlock(&chip->lock);
|
||||
return stage;
|
||||
}
|
||||
if (chip->subtype != QPNP_TM_SUBTYPE_GEN1)
|
||||
stage = alarm_state_map[stage];
|
||||
stage_temp_min = qpnp_tm_decode_temp(chip, stage);
|
||||
mutex_unlock(&chip->lock);
|
||||
|
||||
ret = iio_read_channel_processed(chip->adc, &mili_celsius);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (stage_temp_min > mili_celsius && stage_temp_min > 0) {
|
||||
dev_dbg(chip->dev, "replacing ADC temp=%d with min stage[%d] temp=%d\n",
|
||||
mili_celsius, stage, stage_temp_min);
|
||||
mili_celsius = stage_temp_min;
|
||||
}
|
||||
|
||||
chip->temp = mili_celsius;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue