w1: masters: tegra_w1: Clear device ready flag when suspended

This will prevent any device from trying to read/write via w1
before the w1 master has resumed.

Change-Id: Ic3a27f07db6fcefb76937adf471d2fd44033b178
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
This commit is contained in:
Rebecca Schultz Zavin
2010-09-01 16:14:24 -07:00
committed by Colin Cross
parent e02c752012
commit 8f3a4f8447

View File

@@ -282,7 +282,7 @@ static u8 tegra_w1_touch_bit(void *data, u8 bit)
w1_writel(dev, control | OC_WR0_BIT, OWR_CONTROL);
rc = w1_wait(dev, OI_BIT_XFER_DONE);
if (rc) {
W1_ERR("write-0 failed\n");
W1_ERR("write-0 failed %d\n", rc);
goto done;
}
}
@@ -308,7 +308,7 @@ static u8 tegra_w1_reset_bus(void *data)
presence = 1;
mutex_lock(&dev->mutex);
if (!dev->ready)
goto done;
goto not_ready;
clk_enable(dev->clk);
w1_imask(dev, OI_PRESENCE_DONE);
@@ -336,6 +336,7 @@ done:
w1_imask(dev, 0);
dev->transfer_completion = NULL;
clk_disable(dev->clk);
not_ready:
mutex_unlock(&dev->mutex);
return presence;
}
@@ -450,6 +451,10 @@ static int tegra_w1_remove(struct platform_device *pdev)
static int tegra_w1_suspend(struct platform_device *pdev, pm_message_t state)
{
struct tegra_device *dev = platform_get_drvdata(pdev);
mutex_lock(&dev->mutex);
dev->ready = false;
mutex_unlock(&dev->mutex);
return 0;
}
@@ -459,6 +464,9 @@ static int tegra_w1_resume(struct platform_device *pdev)
/* TODO: Is this necessary? I would assume yes. */
w1_setup(dev);
mutex_lock(&dev->mutex);
dev->ready = true;
mutex_unlock(&dev->mutex);
return 0;
}