From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
To: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
sameo@linux.intel.com
Cc: linux-kernel@vger.kernel.org, tony@atomide.com,
broonie@opensource.wolfsonmicro.com
Subject: [PATCH 3/5] MFD: twl4030-codec: APLL_INFREQ handling in the MFD driver
Date: Mon, 2 Nov 2009 14:34:53 +0200 [thread overview]
Message-ID: <1257165295-9352-4-git-send-email-peter.ujfalusi@nokia.com> (raw)
In-Reply-To: <1257165295-9352-3-git-send-email-peter.ujfalusi@nokia.com>
Move the APLL_CTL register configuration to the twl4030-codec
MFD driver.
Provide also a function for childs to query the audio_mclk
frequency.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
drivers/mfd/twl4030-codec.c | 40 +++++++++++++++++++++++++++++++++++++
include/linux/mfd/twl4030-codec.h | 1 +
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/twl4030-codec.c b/drivers/mfd/twl4030-codec.c
index 9710307..6e77f57 100644
--- a/drivers/mfd/twl4030-codec.c
+++ b/drivers/mfd/twl4030-codec.c
@@ -41,6 +41,7 @@ struct twl4030_codec_resource {
};
struct twl4030_codec {
+ unsigned int audio_mclk;
struct mutex mutex;
struct twl4030_codec_resource resource[TWL4030_CODEC_RES_MAX];
struct mfd_cell cells[TWL4030_CODEC_CELLS];
@@ -145,12 +146,32 @@ int twl4030_codec_disable_resource(unsigned id)
}
EXPORT_SYMBOL_GPL(twl4030_codec_disable_resource);
+unsigned int twl4030_codec_get_mclk(void)
+{
+ struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev);
+
+ return codec->audio_mclk;
+}
+EXPORT_SYMBOL_GPL(twl4030_codec_get_mclk);
+
static int __devinit twl4030_codec_probe(struct platform_device *pdev)
{
struct twl4030_codec *codec;
struct twl4030_codec_data *pdata = pdev->dev.platform_data;
struct mfd_cell *cell = NULL;
int ret, childs = 0;
+ u8 val;
+
+ if (!pdata) {
+ dev_err(&pdev->dev, "Platform data is missing\n");
+ return -EINVAL;
+ }
+ if (!(pdata->audio_mclk == 19200000 ||
+ pdata->audio_mclk == 26000000 ||
+ pdata->audio_mclk == 38400000)) {
+ dev_err(&pdev->dev, "Invalid audio_mclk\n");
+ return -EINVAL;
+ }
codec = kzalloc(sizeof(struct twl4030_codec), GFP_KERNEL);
if (!codec)
@@ -160,6 +181,25 @@ static int __devinit twl4030_codec_probe(struct platform_device *pdev)
twl4030_codec_dev = pdev;
mutex_init(&codec->mutex);
+ codec->audio_mclk = pdata->audio_mclk;
+
+ /* Configure APLL_INFREQ */
+ twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &val,
+ TWL4030_REG_APLL_CTL);
+ val &= ~TWL4030_APLL_INFREQ;
+ switch (codec->audio_mclk) {
+ case 19200000:
+ val |= TWL4030_APLL_INFREQ_19200KHZ;
+ break;
+ case 26000000:
+ val |= TWL4030_APLL_INFREQ_26000KHZ;
+ break;
+ case 38400000:
+ val |= TWL4030_APLL_INFREQ_38400KHZ;
+ break;
+ }
+ twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
+ val, TWL4030_REG_APLL_CTL);
/* Codec power */
codec->resource[TWL4030_CODEC_RES_POWER].reg = TWL4030_REG_CODEC_MODE;
diff --git a/include/linux/mfd/twl4030-codec.h b/include/linux/mfd/twl4030-codec.h
index ef0a304..2ec317c 100644
--- a/include/linux/mfd/twl4030-codec.h
+++ b/include/linux/mfd/twl4030-codec.h
@@ -267,5 +267,6 @@ enum twl4030_codec_res {
int twl4030_codec_disable_resource(enum twl4030_codec_res id);
int twl4030_codec_enable_resource(enum twl4030_codec_res id);
+unsigned int twl4030_codec_get_mclk(void);
#endif /* End of __TWL4030_CODEC_H__ */
--
1.6.5.2
next prev parent reply other threads:[~2009-11-02 12:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-02 12:34 [PATCH 0/5] ASoC/MFD/OMAP: TWL4030: APLL_CTL handling change Peter Ujfalusi
2009-11-02 12:34 ` [PATCH 1/5] MFD: TWL4030: Add audio_mclk to the codec platform data Peter Ujfalusi
2009-11-02 12:34 ` [PATCH 2/5] OMAP: Configure audio_mclk for twl4030-codec MFD Peter Ujfalusi
2009-11-02 12:34 ` Peter Ujfalusi [this message]
2009-11-02 12:34 ` [PATCH 4/5] ASoC: TWL4030: Make sure, that the codec is powered on startup Peter Ujfalusi
2009-11-02 12:34 ` [PATCH 5/5] ASoC: TWL4030: Do not modify the APLL_CTL register Peter Ujfalusi
2009-11-02 17:27 ` Mark Brown
2009-11-03 14:05 ` Peter Ujfalusi
2009-11-02 17:28 ` [PATCH 4/5] ASoC: TWL4030: Make sure, that the codec is powered on startup Mark Brown
2009-11-02 17:30 ` [PATCH 3/5] MFD: twl4030-codec: APLL_INFREQ handling in the MFD driver Mark Brown
2009-11-03 13:37 ` Peter Ujfalusi
2009-11-03 13:44 ` Mark Brown
2009-11-03 14:02 ` Peter Ujfalusi
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=1257165295-9352-4-git-send-email-peter.ujfalusi@nokia.com \
--to=peter.ujfalusi@nokia.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=tony@atomide.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
all inboxes | Powered by JetHome®