summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhalchandra Gajare <gajare@codeaurora.org>2016-12-06 17:34:35 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-12-06 19:04:08 -0800
commit5f30ee1cc59c837f11081e71a4bd2a3910a86d13 (patch)
tree32ccc3cb2f0e94ecc4f3f802bcdb11759df62e1a
parent5142c18bae30439decd1c139999b54197e2aae91 (diff)
ASoC: wcd-spi: fix clock disable request during shutdown
It is possible that there could be pending delayed request to disable the clock while the manager driver has already raised shutdown event. In such cases, the delayed clock disable request will be made after shutdown, resulting in unclocked access on the SPI bus. Fix this by intercepting the shutdown event to flush the clock votes and disable the clock. CRs-Fixed: 1091032 Change-Id: I53a3a9aa540c10932eed7fa29ce7c6050504a9a0 Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
-rw-r--r--sound/soc/codecs/wcd-spi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/soc/codecs/wcd-spi.c b/sound/soc/codecs/wcd-spi.c
index 70be9c98b481..614410c26a91 100644
--- a/sound/soc/codecs/wcd-spi.c
+++ b/sound/soc/codecs/wcd-spi.c
@@ -855,12 +855,22 @@ static int wdsp_spi_event_handler(struct device *dev, void *priv_data,
void *data)
{
struct spi_device *spi = to_spi_device(dev);
+ struct wcd_spi_priv *wcd_spi = spi_get_drvdata(spi);
int ret = 0;
dev_dbg(&spi->dev, "%s: event type %d\n",
__func__, event);
switch (event) {
+ case WDSP_EVENT_POST_SHUTDOWN:
+ cancel_delayed_work_sync(&wcd_spi->clk_dwork);
+ WCD_SPI_MUTEX_LOCK(spi, wcd_spi->clk_mutex);
+ if (test_bit(WCD_SPI_CLK_STATE_ENABLED, &wcd_spi->status_mask))
+ wcd_spi_clk_disable(spi);
+ wcd_spi->clk_users = 0;
+ WCD_SPI_MUTEX_UNLOCK(spi, wcd_spi->clk_mutex);
+ break;
+
case WDSP_EVENT_PRE_DLOAD_CODE:
case WDSP_EVENT_PRE_DLOAD_DATA:
ret = wcd_spi_clk_ctrl(spi, WCD_SPI_CLK_ENABLE,