From: Rocky Hao Date: Fri, 31 Mar 2017 09:02:39 +0000 (+0800) Subject: thermal: rockchip: rk3368: fix efuse value of temp ajust code issue X-Git-Tag: firefly_0821_release~164 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=firefly-linux-kernel-4.4.55.git;a=commitdiff_plain;h=f19cbe449b99077576826f38ac0dbfc6f491d8c5 thermal: rockchip: rk3368: fix efuse value of temp ajust code issue bit 7 of efuse value of temp ajust code indecates positive or negtive. if bit 7 is set, it indecats a negtive ajust code. Change-Id: I2b604b6b5e566df08b871c817cf25541292575bc Signed-off-by: Rocky Hao --- diff --git a/drivers/thermal/rk3368_thermal.c b/drivers/thermal/rk3368_thermal.c index ec7161dc8cab..290bd4d5aad8 100644 --- a/drivers/thermal/rk3368_thermal.c +++ b/drivers/thermal/rk3368_thermal.c @@ -260,7 +260,7 @@ static const struct chip_tsadc_table tsadc_table_3368 = { .mode = ADC_INCREMENT, }; -static int rk3368_get_ajust_code(struct device_node *np, u8 *ajust_code) +static int rk3368_get_ajust_code(struct device_node *np, int *ajust_code) { struct nvmem_cell *cell; unsigned char *buf; @@ -282,7 +282,11 @@ static int rk3368_get_ajust_code(struct device_node *np, u8 *ajust_code) if (buf[0] == INVALID_EFUSE_VALUE) return -EINVAL; - *ajust_code = buf[0]; + if (buf[0] & 0x80) + *ajust_code = -(buf[0] & 0x7f); + else + *ajust_code = buf[0]; + kfree(buf); return 0; @@ -847,7 +851,7 @@ static int rk3368_thermal_probe(struct platform_device *pdev) int i, j; int error; int uv; - u8 ajust_code = 0; + int ajust_code = 0; match = of_match_node(of_rk3368_thermal_match, np); if (!match)