ASoC: rt5514-spi: check irq status to schedule data copy in resume function
[sfrench/cifs-2.6.git] / sound / soc / codecs / rt5514-spi.c
index d03756913dd9c72fc5d32ee61ea76cd54d87605b..36e0a58ffc8762912ec1a0c61f56c3d7f6e28619 100644 (file)
@@ -473,11 +473,21 @@ static int rt5514_suspend(struct device *dev)
 
 static int rt5514_resume(struct device *dev)
 {
+       struct snd_soc_platform *platform = snd_soc_lookup_platform(dev);
+       struct rt5514_dsp *rt5514_dsp =
+               snd_soc_platform_get_drvdata(platform);
        int irq = to_spi_device(dev)->irq;
+       u8 buf[8];
 
        if (device_may_wakeup(dev))
                disable_irq_wake(irq);
 
+       if (rt5514_dsp->substream) {
+               rt5514_spi_burst_read(RT5514_IRQ_CTRL, (u8 *)&buf, sizeof(buf));
+               if (buf[0] & RT5514_IRQ_STATUS_BIT)
+                       rt5514_schedule_copy(rt5514_dsp);
+       }
+
        return 0;
 }