aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-11-10 07:08:12 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-11-10 07:08:12 -0500
commit0969afcc449d5d655784c04e938cf4cfc6e89c0e (patch)
treea763ddfc2969cb820da13dcec6065801bfe79f65
parent5f63ef9909c187581c7f2c28fbc93866a0d59f7f (diff)
parentf9b4639e045c750e2bad37462476403995508350 (diff)
Merge branch 'twl4030-mfd' into for-2.6.33
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c1
-rw-r--r--arch/arm/mach-omap2/board-overo.c1
-rw-r--r--arch/arm/mach-omap2/board-zoom2.c1
-rw-r--r--drivers/mfd/twl4030-codec.c35
-rw-r--r--include/linux/i2c/twl4030.h1
-rw-r--r--include/linux/mfd/twl4030-codec.h1
9 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 87e69658be6..08e535d92c0 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -415,6 +415,7 @@ static struct twl4030_codec_audio_data sdp3430_audio = {
415}; 415};
416 416
417static struct twl4030_codec_data sdp3430_codec = { 417static struct twl4030_codec_data sdp3430_codec = {
418 .audio_mclk = 26000000,
418 .audio = &sdp3430_audio, 419 .audio = &sdp3430_audio,
419}; 420};
420 421
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 2161d855fc9..8f0c106a449 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -259,6 +259,7 @@ static struct twl4030_codec_audio_data beagle_audio_data = {
259}; 259};
260 260
261static struct twl4030_codec_data beagle_codec_data = { 261static struct twl4030_codec_data beagle_codec_data = {
262 .audio_mclk = 26000000,
262 .audio = &beagle_audio_data, 263 .audio = &beagle_audio_data,
263}; 264};
264 265
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index c0d97364dbd..25ca5f6a0d3 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -199,6 +199,7 @@ static struct twl4030_codec_audio_data omap3evm_audio_data = {
199}; 199};
200 200
201static struct twl4030_codec_data omap3evm_codec_data = { 201static struct twl4030_codec_data omap3evm_codec_data = {
202 .audio_mclk = 26000000,
202 .audio = &omap3evm_audio_data, 203 .audio = &omap3evm_audio_data,
203}; 204};
204 205
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 74f75740863..ed97b54e1fa 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -286,6 +286,7 @@ static struct twl4030_codec_audio_data omap3pandora_audio_data = {
286}; 286};
287 287
288static struct twl4030_codec_data omap3pandora_codec_data = { 288static struct twl4030_codec_data omap3pandora_codec_data = {
289 .audio_mclk = 26000000,
289 .audio = &omap3pandora_audio_data, 290 .audio = &omap3pandora_audio_data,
290}; 291};
291 292
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index dc550089755..e1fb50451e1 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -334,6 +334,7 @@ static struct twl4030_codec_audio_data overo_audio_data = {
334}; 334};
335 335
336static struct twl4030_codec_data overo_codec_data = { 336static struct twl4030_codec_data overo_codec_data = {
337 .audio_mclk = 26000000,
337 .audio = &overo_audio_data, 338 .audio = &overo_audio_data,
338}; 339};
339 340
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index e04a4f06ed9..5fcb20f41a6 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -236,6 +236,7 @@ static struct twl4030_codec_audio_data zoom2_audio_data = {
236}; 236};
237 237
238static struct twl4030_codec_data zoom2_codec_data = { 238static struct twl4030_codec_data zoom2_codec_data = {
239 .audio_mclk = 26000000,
239 .audio = &zoom2_audio_data, 240 .audio = &zoom2_audio_data,
240}; 241};
241 242
diff --git a/drivers/mfd/twl4030-codec.c b/drivers/mfd/twl4030-codec.c
index 97103078dc2..77b914907d7 100644
--- a/drivers/mfd/twl4030-codec.c
+++ b/drivers/mfd/twl4030-codec.c
@@ -41,6 +41,7 @@ struct twl4030_codec_resource {
41}; 41};
42 42
43struct twl4030_codec { 43struct twl4030_codec {
44 unsigned int audio_mclk;
44 struct mutex mutex; 45 struct mutex mutex;
45 struct twl4030_codec_resource resource[TWL4030_CODEC_RES_MAX]; 46 struct twl4030_codec_resource resource[TWL4030_CODEC_RES_MAX];
46 struct mfd_cell cells[TWL4030_CODEC_CELLS]; 47 struct mfd_cell cells[TWL4030_CODEC_CELLS];
@@ -145,12 +146,45 @@ int twl4030_codec_disable_resource(unsigned id)
145} 146}
146EXPORT_SYMBOL_GPL(twl4030_codec_disable_resource); 147EXPORT_SYMBOL_GPL(twl4030_codec_disable_resource);
147 148
149unsigned int twl4030_codec_get_mclk(void)
150{
151 struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev);
152
153 return codec->audio_mclk;
154}
155EXPORT_SYMBOL_GPL(twl4030_codec_get_mclk);
156
148static int __devinit twl4030_codec_probe(struct platform_device *pdev) 157static int __devinit twl4030_codec_probe(struct platform_device *pdev)
149{ 158{
150 struct twl4030_codec *codec; 159 struct twl4030_codec *codec;
151 struct twl4030_codec_data *pdata = pdev->dev.platform_data; 160 struct twl4030_codec_data *pdata = pdev->dev.platform_data;
152 struct mfd_cell *cell = NULL; 161 struct mfd_cell *cell = NULL;
153 int ret, childs = 0; 162 int ret, childs = 0;
163 u8 val;
164
165 if (!pdata) {
166 dev_err(&pdev->dev, "Platform data is missing\n");
167 return -EINVAL;
168 }
169
170 /* Configure APLL_INFREQ and disable APLL if enabled */
171 val = 0;
172 switch (pdata->audio_mclk) {
173 case 19200000:
174 val |= TWL4030_APLL_INFREQ_19200KHZ;
175 break;
176 case 26000000:
177 val |= TWL4030_APLL_INFREQ_26000KHZ;
178 break;
179 case 38400000:
180 val |= TWL4030_APLL_INFREQ_38400KHZ;
181 break;
182 default:
183 dev_err(&pdev->dev, "Invalid audio_mclk\n");
184 return -EINVAL;
185 }
186 twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
187 val, TWL4030_REG_APLL_CTL);
154 188
155 codec = kzalloc(sizeof(struct twl4030_codec), GFP_KERNEL); 189 codec = kzalloc(sizeof(struct twl4030_codec), GFP_KERNEL);
156 if (!codec) 190 if (!codec)
@@ -160,6 +194,7 @@ static int __devinit twl4030_codec_probe(struct platform_device *pdev)
160 194
161 twl4030_codec_dev = pdev; 195 twl4030_codec_dev = pdev;
162 mutex_init(&codec->mutex); 196 mutex_init(&codec->mutex);
197 codec->audio_mclk = pdata->audio_mclk;
163 198
164 /* Codec power */ 199 /* Codec power */
165 codec->resource[TWL4030_CODEC_RES_POWER].reg = TWL4030_REG_CODEC_MODE; 200 codec->resource[TWL4030_CODEC_RES_POWER].reg = TWL4030_REG_CODEC_MODE;
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index ba61add3e05..5306a759cbd 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -414,6 +414,7 @@ struct twl4030_codec_vibra_data {
414}; 414};
415 415
416struct twl4030_codec_data { 416struct twl4030_codec_data {
417 unsigned int audio_mclk;
417 struct twl4030_codec_audio_data *audio; 418 struct twl4030_codec_audio_data *audio;
418 struct twl4030_codec_vibra_data *vibra; 419 struct twl4030_codec_vibra_data *vibra;
419}; 420};
diff --git a/include/linux/mfd/twl4030-codec.h b/include/linux/mfd/twl4030-codec.h
index ef0a3041d75..2ec317c68e5 100644
--- a/include/linux/mfd/twl4030-codec.h
+++ b/include/linux/mfd/twl4030-codec.h
@@ -267,5 +267,6 @@ enum twl4030_codec_res {
267 267
268int twl4030_codec_disable_resource(enum twl4030_codec_res id); 268int twl4030_codec_disable_resource(enum twl4030_codec_res id);
269int twl4030_codec_enable_resource(enum twl4030_codec_res id); 269int twl4030_codec_enable_resource(enum twl4030_codec_res id);
270unsigned int twl4030_codec_get_mclk(void);
270 271
271#endif /* End of __TWL4030_CODEC_H__ */ 272#endif /* End of __TWL4030_CODEC_H__ */