Skip to content

Commit

Permalink
hwmon: (sfctemp) Assert reset between conversions
Browse files Browse the repository at this point in the history
Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
  • Loading branch information
esmil committed Jun 4, 2021
1 parent cff88cf commit f45c43f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions drivers/hwmon/sfctemp.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,36 +76,34 @@ static irqreturn_t sfctemp_isr(int irq, void *data)
struct sfctemp *sfctemp = data;

sfctemp->dout = readl(sfctemp->regs);
writel(SFCTEMP_RSTN, sfctemp->regs);
writel(0, sfctemp->regs);
complete(&sfctemp->conversion_done);
return IRQ_HANDLED;
}

static void sfctemp_power_up(struct sfctemp *sfctemp)
{
/* make sure we're powered down first */
writel(SFCTEMP_PD, sfctemp->regs);
udelay(1);

writel(0, sfctemp->regs);
/* wait t_pu(50us) + t_rst(100ns) */
usleep_range(60, 200);

writel(SFCTEMP_RSTN, sfctemp->regs);
/* wait t_su(500ps) */
udelay(1);
}

static void sfctemp_power_down(struct sfctemp *sfctemp)
{
writel(SFCTEMP_RSTN, sfctemp->regs);
udelay(1);

writel(SFCTEMP_PD, sfctemp->regs);
udelay(1);
}

static void sfctemp_run(struct sfctemp *sfctemp)
{
/* de-assert reset */
writel(SFCTEMP_RSTN, sfctemp->regs);
udelay(1); /* wait t_su(500ps) */

/* start conversion */
writel(SFCTEMP_RSTN | SFCTEMP_RUN, sfctemp->regs);
}

Expand Down

0 comments on commit f45c43f

Please sign in to comment.