Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63828977 authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi
Browse files

msm: thermal: Use thermal-core framework to get temp on post boot



KTM configures tsens id map at boot and assumes thermal zone id for
tsens is starting with zero. It gets tsens id based on this assumption
from tsens id map and reads temperature using tsens API directly.
But thermal zone id allocation is happening at runtime based on
registration with thermal-core. Use thermal-core framework to get
temperature once after interrupt mode is enabled to avoid mismatch
between tsens id and zone id in a case where other sensor driver
registers with thermal core before tsens driver.

CRs-fixed: 656713
Change-Id: I4a7339f54d1981bc87b3784a20afbca2b2b9d707
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent d411be83
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -1027,24 +1027,26 @@ static int therm_get_temp(uint32_t id, enum sensor_id_type type, long *temp)

	switch (type) {
	case THERM_ZONE_ID:
		tsens_dev.sensor_num = tsens_id_map[id];
		ret = sensor_get_temp(id, temp);
		if (ret) {
			pr_err("Unable to read thermal zone sensor:%d\n", id);
			goto get_temp_exit;
		}
		break;
	case THERM_TSENS_ID:
		tsens_dev.sensor_num = id;
		break;
	default:
		pr_err("Invalid type\n");
		ret = -EINVAL;
		goto get_temp_exit;
		break;
	}

		ret = tsens_get_temp(&tsens_dev, temp);
		if (ret) {
			pr_err("Unable to read TSENS sensor:%d\n",
				tsens_dev.sensor_num);
			goto get_temp_exit;
		}
		break;
	default:
		pr_err("Invalid type\n");
		ret = -EINVAL;
		goto get_temp_exit;
	}

get_temp_exit:
	return ret;
@@ -1056,7 +1058,7 @@ static int set_threshold(uint32_t zone_id,
	int i = 0, ret = 0;
	long temp;

	if ((!threshold) || (zone_id >= max_tsens_num)) {
	if (!threshold) {
		pr_err("Invalid input\n");
		ret = -EINVAL;
		goto set_threshold_exit;