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;
}
}
presence = 1;
mutex_lock(&dev->mutex);
if (!dev->ready)
- goto done;
+ goto not_ready;
clk_enable(dev->clk);
w1_imask(dev, OI_PRESENCE_DONE);
w1_imask(dev, 0);
dev->transfer_completion = NULL;
clk_disable(dev->clk);
+not_ready:
mutex_unlock(&dev->mutex);
return presence;
}
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;
}
/* TODO: Is this necessary? I would assume yes. */
w1_setup(dev);
+ mutex_lock(&dev->mutex);
+ dev->ready = true;
+ mutex_unlock(&dev->mutex);
return 0;
}