Merge branch 'twl4030-mfd' into for-2.6.33
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 10 Nov 2009 12:08:12 +0000 (12:08 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 10 Nov 2009 12:08:12 +0000 (12:08 +0000)
arch/arm/mach-omap2/board-3430sdp.c
arch/arm/mach-omap2/board-omap3beagle.c
arch/arm/mach-omap2/board-omap3evm.c
arch/arm/mach-omap2/board-omap3pandora.c
arch/arm/mach-omap2/board-overo.c
arch/arm/mach-omap2/board-zoom2.c
drivers/mfd/twl4030-codec.c
include/linux/i2c/twl4030.h
include/linux/mfd/twl4030-codec.h

index 87e69658be6fb9fa01218c556c9dad2a2c8a261a..08e535d92c0671657e1292c08f8204ceb21426d8 100644 (file)
@@ -415,6 +415,7 @@ static struct twl4030_codec_audio_data sdp3430_audio = {
 };
 
 static struct twl4030_codec_data sdp3430_codec = {
+       .audio_mclk = 26000000,
        .audio = &sdp3430_audio,
 };
 
index 2161d855fc9f0e6b9e0730604aac14b77280bd4c..8f0c106a449d09f2330c6867fbc8f5aca0b9594b 100644 (file)
@@ -259,6 +259,7 @@ static struct twl4030_codec_audio_data beagle_audio_data = {
 };
 
 static struct twl4030_codec_data beagle_codec_data = {
+       .audio_mclk = 26000000,
        .audio = &beagle_audio_data,
 };
 
index c0d97364dbd47d1eed7529480e765190d391aefe..25ca5f6a0d3d6ef33c0637d4806bcd006191606a 100644 (file)
@@ -199,6 +199,7 @@ static struct twl4030_codec_audio_data omap3evm_audio_data = {
 };
 
 static struct twl4030_codec_data omap3evm_codec_data = {
+       .audio_mclk = 26000000,
        .audio = &omap3evm_audio_data,
 };
 
index 74f7574086397225e8b834871549be7fa287fdb3..ed97b54e1fa5266482bd2ae6818edb9492fafddd 100644 (file)
@@ -286,6 +286,7 @@ static struct twl4030_codec_audio_data omap3pandora_audio_data = {
 };
 
 static struct twl4030_codec_data omap3pandora_codec_data = {
+       .audio_mclk = 26000000,
        .audio = &omap3pandora_audio_data,
 };
 
index dc550089755fdf455407cfbf1e9908579dcb9b22..e1fb50451e192269262c1d87593420919f558ce0 100644 (file)
@@ -334,6 +334,7 @@ static struct twl4030_codec_audio_data overo_audio_data = {
 };
 
 static struct twl4030_codec_data overo_codec_data = {
+       .audio_mclk = 26000000,
        .audio = &overo_audio_data,
 };
 
index e04a4f06ed9ac32b44255671ee8eb7ecdb0ed8b4..5fcb20f41a687350b8f631dd56fd8069cd775645 100644 (file)
@@ -236,6 +236,7 @@ static struct twl4030_codec_audio_data zoom2_audio_data = {
 };
 
 static struct twl4030_codec_data zoom2_codec_data = {
+       .audio_mclk = 26000000,
        .audio = &zoom2_audio_data,
 };
 
index 97103078dc2aafbc2dab66770d5199e413a24011..77b914907d7c20a96c9d1db4c2c18a9c8b49edda 100644 (file)
@@ -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,45 @@ 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;
+       }
+
+       /* Configure APLL_INFREQ and disable APLL if enabled */
+       val = 0;
+       switch (pdata->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;
+       default:
+               dev_err(&pdev->dev, "Invalid audio_mclk\n");
+               return -EINVAL;
+       }
+       twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
+                                       val, TWL4030_REG_APLL_CTL);
 
        codec = kzalloc(sizeof(struct twl4030_codec), GFP_KERNEL);
        if (!codec)
@@ -160,6 +194,7 @@ static int __devinit twl4030_codec_probe(struct platform_device *pdev)
 
        twl4030_codec_dev = pdev;
        mutex_init(&codec->mutex);
+       codec->audio_mclk = pdata->audio_mclk;
 
        /* Codec power */
        codec->resource[TWL4030_CODEC_RES_POWER].reg = TWL4030_REG_CODEC_MODE;
index ba61add3e05a38411eb94dd30fc40636bc866f72..5306a759cbdede6e70245440a5140f2df7821e03 100644 (file)
@@ -414,6 +414,7 @@ struct twl4030_codec_vibra_data {
 };
 
 struct twl4030_codec_data {
+       unsigned int    audio_mclk;
        struct twl4030_codec_audio_data         *audio;
        struct twl4030_codec_vibra_data         *vibra;
 };
index ef0a3041d7599b44267f571346253a9fa041550f..2ec317c68e59acf6769775ae9c24b1bfddefd59f 100644 (file)
@@ -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__ */