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

Commit a639259d authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss
Browse files

thermal: tsens: Add optional property to check valid bit



Add support to check if the valid bit is available before reading
the ADC data. If the valid bit is available the driver reads
this bit to ensure the ADC data is correct if not it proceeds
to read the data register again.

Change-Id: Ibe872b3ef2a82a99fcd5c50776dd5b915f19569c
Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
parent e7c95927
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@ Optional properties:
		each controller is done using the qcom,sensor-id property. If the
		property is not present the SW ID mapping with default from 0 to
		total number of supported sensors with each controller instance.
- qcom,valid-status-check: If property is present, check the VALID bit is set
		before reporting the temperature data.

Example:

tsens@fc4a8000 {
+6 −4
Original line number Diff line number Diff line
@@ -5262,14 +5262,16 @@ static int get_device_tree_data(struct platform_device *pdev,
	else
		tmdev->tsens_type = TSENS_TYPE0;

	tmdev->tsens_valid_status_check = of_property_read_bool(of_node,
				"qcom,valid-status-check");
	if (!tmdev->tsens_valid_status_check) {
		if (!strcmp(id->compatible, "qcom,msm8994-tsens") ||
		(!strcmp(id->compatible, "qcom,msmzirc-tsens")) ||
		(!strcmp(id->compatible, "qcom,msm8992-tsens")) ||
		(!strcmp(id->compatible, "qcom,msm8996-tsens")) ||
		(!strcmp(id->compatible, "qcom,msmtitanium-tsens")))
			tmdev->tsens_valid_status_check = true;
	else
		tmdev->tsens_valid_status_check = false;
	}

	tmdev->tsens_irq = platform_get_irq_byname(pdev,
					"tsens-upper-lower");