diff options
author | Pavel Machek <pavel@ucw.cz> | 2015-01-18 21:20:51 +0100 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2015-05-04 21:27:53 -0700 |
commit | a4296d19b5e19a5c9a3979e9595fa26c40af67b5 (patch) | |
tree | 184099b64c4d4911464d203954dff8ac898d9a47 /drivers/thermal/ti-soc-thermal | |
parent | e34238bf98a2ad9deda9444d69903889eced0519 (diff) | |
download | linux-a4296d19b5e19a5c9a3979e9595fa26c40af67b5.tar.bz2 |
ti-soc-thermal: implement eocz bit to make driver useful on omap3
For omap3, proper implementation of eocz bit is needed. It was
actually a TODO in the driver.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal/ti-soc-thermal')
-rw-r--r-- | drivers/thermal/ti-soc-thermal/ti-bandgap.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index 4d8c8b6efbe0..12f3ee5337bb 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c @@ -894,7 +894,8 @@ void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id) static int ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id) { - u32 temp = 0, counter = 1000; + u32 counter = 1000; + struct temp_sensor_registers *tsr; /* Select single conversion mode */ if (TI_BANDGAP_HAS(bgp, MODE_CONFIG)) @@ -902,16 +903,27 @@ ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id) /* Start of Conversion = 1 */ RMW_BITS(bgp, id, temp_sensor_ctrl, bgap_soc_mask, 1); - /* Wait until DTEMP is updated */ - temp = ti_bandgap_read_temp(bgp, id); - while ((temp == 0) && --counter) - temp = ti_bandgap_read_temp(bgp, id); - /* REVISIT: Check correct condition for end of conversion */ + /* Wait for EOCZ going up */ + tsr = bgp->conf->sensors[id].registers; + + while (--counter) { + if (ti_bandgap_readl(bgp, tsr->temp_sensor_ctrl) & + tsr->bgap_eocz_mask) + break; + } /* Start of Conversion = 0 */ RMW_BITS(bgp, id, temp_sensor_ctrl, bgap_soc_mask, 0); + /* Wait for EOCZ going down */ + counter = 1000; + while (--counter) { + if (!(ti_bandgap_readl(bgp, tsr->temp_sensor_ctrl) & + tsr->bgap_eocz_mask)) + break; + } + return 0; } |