From: Oder Chiou <oder_chiou@realtek.com>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: Oder Chiou <oder_chiou@realtek.com>,
jack.yu@realtek.com, alsa-devel@alsa-project.org,
Chinyue Chen <chinyue@chromium.org>,
shumingf@realtek.com, bardliao@realtek.com, flove@realtek.com,
cychiang@chromium.org
Subject: [PATCH 1/2] ASoC: rt5514: Voice wakeup support.
Date: Wed, 8 Nov 2017 15:04:21 +0800 [thread overview]
Message-ID: <1510124662-5065-1-git-send-email-oder_chiou@realtek.com> (raw)
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>
---
sound/soc/codecs/rt5514-spi.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c
index b90d6d5..0c0e209 100644
--- a/sound/soc/codecs/rt5514-spi.c
+++ b/sound/soc/codecs/rt5514-spi.c
@@ -448,9 +448,35 @@ static int rt5514_spi_probe(struct spi_device *spi)
return ret;
}
+ device_init_wakeup(&spi->dev, true);
+
+ 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[] = {
{ .compatible = "realtek,rt5514", },
{},
@@ -460,6 +486,7 @@ MODULE_DEVICE_TABLE(of, rt5514_of_match);
static struct spi_driver rt5514_spi_driver = {
.driver = {
.name = "rt5514",
+ .pm = &rt5514_pm_ops,
.of_match_table = of_match_ptr(rt5514_of_match),
},
.probe = rt5514_spi_probe,
--
2.7.4
next reply other threads:[~2017-11-08 7:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-08 7:04 Oder Chiou [this message]
2017-11-08 7:04 ` [PATCH 2/2] ASoC: rt5514-spi: check irq status to schedule data copy in resume function Oder Chiou
2017-11-08 21:30 ` Applied "ASoC: rt5514-spi: check irq status to schedule data copy in resume function" to the asoc tree Mark Brown
2017-11-08 21:30 ` Applied "ASoC: rt5514: Voice wakeup support." " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1510124662-5065-1-git-send-email-oder_chiou@realtek.com \
--to=oder_chiou@realtek.com \
--cc=alsa-devel@alsa-project.org \
--cc=bardliao@realtek.com \
--cc=broonie@kernel.org \
--cc=chinyue@chromium.org \
--cc=cychiang@chromium.org \
--cc=flove@realtek.com \
--cc=jack.yu@realtek.com \
--cc=lgirdwood@gmail.com \
--cc=shumingf@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).