Skip to content

Commit

Permalink
ti-soc-thermal: implement eocz bit to make driver useful on omap3
Browse files Browse the repository at this point in the history
For omap3, proper implementation of eocz bit is needed. It was
actually a TODO in the driver.

Signed-off-by: Pavel Machek <[email protected]>
Signed-off-by: Eduardo Valentin <[email protected]>
  • Loading branch information
pavelmachek authored and Eduardo Valentin committed May 5, 2015
1 parent e34238b commit a4296d1
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions drivers/thermal/ti-soc-thermal/ti-bandgap.c
Original file line number Diff line number Diff line change
Expand Up @@ -894,24 +894,36 @@ 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))
RMW_BITS(bgp, id, bgap_mode_ctrl, mode_ctrl_mask, 0);

/* 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;
}

Expand Down

0 comments on commit a4296d1

Please sign in to comment.