From: Fabio Estevam <festevam@gmail.com>
To: broonie@kernel.org
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
alsa-devel@alsa-project.org, b50113@freescale.com
Subject: [RFC] ASoC: wm8962: Allow codec to work when CONFIG_PM=n
Date: Tue, 30 Dec 2014 13:58:16 -0200 [thread overview]
Message-ID: <1419955096-18810-1-git-send-email-festevam@gmail.com> (raw)
From: Fabio Estevam <fabio.estevam@freescale.com>
Currently the codec does not work in the CONFIG_PM=n case because the regulators
and clock are kept disabled.
Allow the codec to be functional by calling wm8962_runtime_resume() when
CONFIG_PM=n.
Tested on a imx6sl-evk in the CONFIG_PM=y and CONFIG_PM=n cases.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Probably there is a better solution, hence I am sending it as RFC.
Thanks
sound/soc/codecs/wm8962.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index d32d554..0b041c9 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3546,6 +3546,9 @@ static int wm8962_set_pdata_from_of(struct i2c_client *i2c,
return 0;
}
+static int wm8962_runtime_resume(struct device *dev);
+static int wm8962_runtime_suspend(struct device *dev);
+
static int wm8962_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
@@ -3771,6 +3774,9 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
/* The drivers should power up as needed */
regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
+ if (!IS_ENABLED(CONFIG_PM))
+ wm8962_runtime_resume(&i2c->dev);
+
return 0;
err_enable:
@@ -3781,11 +3787,12 @@ err:
static int wm8962_i2c_remove(struct i2c_client *client)
{
+ if (!IS_ENABLED(CONFIG_PM))
+ wm8962_runtime_suspend(&client->dev);
snd_soc_unregister_codec(&client->dev);
return 0;
}
-#ifdef CONFIG_PM
static int wm8962_runtime_resume(struct device *dev)
{
struct wm8962_priv *wm8962 = dev_get_drvdata(dev);
@@ -3860,7 +3867,6 @@ static int wm8962_runtime_suspend(struct device *dev)
return 0;
}
-#endif
static struct dev_pm_ops wm8962_pm = {
SET_RUNTIME_PM_OPS(wm8962_runtime_suspend, wm8962_runtime_resume, NULL)
--
1.9.1
next reply other threads:[~2014-12-30 15:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-30 15:58 Fabio Estevam [this message]
2014-12-30 16:22 ` [RFC] ASoC: wm8962: Allow codec to work when CONFIG_PM=n 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=1419955096-18810-1-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=b50113@freescale.com \
--cc=broonie@kernel.org \
--cc=fabio.estevam@freescale.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.