Skip to content

Commit

Permalink
Merge pull request #29 from tosibox/tb-4.9-2.0.x-imx
Browse files Browse the repository at this point in the history
Fix reading of thermal grade OTP value on i.MX7D
  • Loading branch information
otavio authored Jul 2, 2018
2 parents 94e918f + f4d0951 commit 92a2550
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/thermal/imx_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,18 +625,21 @@ static int imx_get_sensor_data(struct platform_device *pdev)
imx6_calibrate_data(data, val);

/* use OTP for thermal grade */
if (data->socdata->version == TEMPMON_IMX7)
if (data->socdata->version == TEMPMON_IMX7) {
ret = regmap_read(map, IMX7_OCOTP_TESTER3, &val);
else
val = (val >> 8) & 0x03;
} else {
ret = regmap_read(map, OCOTP_MEM0, &val);
val = (val >> 6) & 0x03;
}

if (ret) {
dev_err(&pdev->dev, "failed to read temp grade: %d\n", ret);
return ret;
}

/* The maximum die temp is specified by the Temperature Grade */
switch ((val >> 6) & 0x3) {
switch (val) {
case 0: /* Commercial (0 to 95C) */
data->temp_grade = "Commercial";
data->temp_max = 95000;
Expand Down

0 comments on commit 92a2550

Please sign in to comment.