ASoC: rt5514: Voice wakeup support.
If the rt5514 Wake on Voice device is opened while suspended, it will be able to wake up the system when a voice command is detected. This patch also supports user-space policy to override wakeup behavior by /sys/bus/spi/drivers/rt5514/spi2.0/power/wakeup. Signed-off-by: Chinyue Chen <chinyue@chromium.org> Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
c4a71ff78e
commit
58f1c07d23
|
@ -456,9 +456,35 @@ static int rt5514_spi_probe(struct spi_device *spi)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device_init_wakeup(&spi->dev, true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int 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 rt5514_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
int irq = to_spi_device(dev)->irq;
|
||||||
|
|
||||||
|
if (device_may_wakeup(dev))
|
||||||
|
disable_irq_wake(irq);
|
||||||
|
|
||||||
|
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[] = {
|
static const struct of_device_id rt5514_of_match[] = {
|
||||||
{ .compatible = "realtek,rt5514", },
|
{ .compatible = "realtek,rt5514", },
|
||||||
{},
|
{},
|
||||||
|
@ -468,6 +494,7 @@ MODULE_DEVICE_TABLE(of, rt5514_of_match);
|
||||||
static struct spi_driver rt5514_spi_driver = {
|
static struct spi_driver rt5514_spi_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "rt5514",
|
.name = "rt5514",
|
||||||
|
.pm = &rt5514_pm_ops,
|
||||||
.of_match_table = of_match_ptr(rt5514_of_match),
|
.of_match_table = of_match_ptr(rt5514_of_match),
|
||||||
},
|
},
|
||||||
.probe = rt5514_spi_probe,
|
.probe = rt5514_spi_probe,
|
||||||
|
|
Loading…
Reference in New Issue