From: Mark Brown Date: Fri, 26 Jan 2018 15:27:28 +0000 (+0000) Subject: Merge remote-tracking branches 'asoc/topic/rl6231' and 'asoc/topic/rt5514' into asoc... X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=a451d4e0c23b096bcfe5ec494fce7e5125bc4dd3;p=openwrt%2Fstaging%2Fblogic.git Merge remote-tracking branches 'asoc/topic/rl6231' and 'asoc/topic/rt5514' into asoc-next --- a451d4e0c23b096bcfe5ec494fce7e5125bc4dd3 diff --cc sound/soc/codecs/rt5514-spi.c index 64bf26cec20d,2df91db765ac,b90d6d5d7ff8..2144edca97b0 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c @@@@ -461,43 -459,42 -451,6 +462,43 @@@@ static int rt5514_spi_probe(struct spi_ return 0; } +static int __maybe_unused rt5514_suspend(struct device *dev) +{ + int irq = to_spi_device(dev)->irq; + + if (device_may_wakeup(dev)) + enable_irq_wake(irq); + + return 0; +} + +static int __maybe_unused 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); ++ if (rt5514_dsp) { ++ 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; +} + +static const struct dev_pm_ops rt5514_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(rt5514_suspend, rt5514_resume) +}; + static const struct of_device_id rt5514_of_match[] = { { .compatible = "realtek,rt5514", }, {},