Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172777
b: refs/heads/master
c: cfaf6d2
h: refs/heads/master
i:
  172775: 79f84e4
v: v3
  • Loading branch information
Peter Ujfalusi authored and Tony Lindgren committed Nov 22, 2009
1 parent 6e2b113 commit efbea38
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6df74efbb8c38c4a057223be564323ff26d44fd3
refs/heads/master: cfaf6d2c1cb231f77e24109cb1460db429608bd4
35 changes: 35 additions & 0 deletions trunk/drivers/mfd/twl4030-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mfd/twl4030-codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */

0 comments on commit efbea38

Please sign in to comment.