Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308001
b: refs/heads/master
c: 356bccb
h: refs/heads/master
i:
  307999: 2bb68a6
v: v3
  • Loading branch information
Peter Ujfalusi authored and Liam Girdwood committed May 22, 2012
1 parent 01dbff0 commit b49ea13
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7d09f9e98956b29755f20d830252dec9300e7044
refs/heads/master: 356bccbea17988bd32a016ada867dd6a53ba2796
25 changes: 21 additions & 4 deletions trunk/sound/soc/omap/omap-abe-twl6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,25 @@
#include "omap-pcm.h"
#include "../codecs/twl6040.h"

struct abe_twl6040 {
int jack_detection; /* board can detect jack events */
int mclk_freq; /* MCLK frequency speed for twl6040 */
};

static int omap_abe_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_card *card = codec->card;
struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev);
struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card);
int clk_id, freq;
int ret;

clk_id = twl6040_get_clk_id(rtd->codec);
if (clk_id == TWL6040_SYSCLK_SEL_HPPLL)
freq = pdata->mclk_freq;
freq = priv->mclk_freq;
else if (clk_id == TWL6040_SYSCLK_SEL_LPPLL)
freq = 32768;
else
Expand Down Expand Up @@ -176,6 +181,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_card *card = codec->card;
struct snd_soc_dapm_context *dapm = &codec->dapm;
struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev);
struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card);
int hs_trim;
int ret = 0;

Expand All @@ -199,7 +205,7 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd)
TWL6040_HSF_TRIM_RIGHT(hs_trim));

/* Headset jack detection only if it is supported */
if (pdata->jack_detection) {
if (priv->jack_detection) {
ret = snd_soc_jack_new(codec, "Headset Jack",
SND_JACK_HEADSET, &hs_jack);
if (ret)
Expand Down Expand Up @@ -265,6 +271,7 @@ static __devinit int omap_abe_probe(struct platform_device *pdev)
{
struct omap_abe_twl6040_data *pdata = dev_get_platdata(&pdev->dev);
struct snd_soc_card *card = &omap_abe_card;
struct abe_twl6040 *priv;
int num_links = 0;
int ret;

Expand All @@ -275,14 +282,22 @@ static __devinit int omap_abe_probe(struct platform_device *pdev)
return -ENODEV;
}

priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL);
if (priv == NULL)
return -ENOMEM;

if (pdata->card_name) {
card->name = pdata->card_name;
} else {
dev_err(&pdev->dev, "Card name is not provided\n");
return -ENODEV;
}

if (!pdata->mclk_freq) {
priv->jack_detection = pdata->jack_detection;
priv->mclk_freq = pdata->mclk_freq;


if (!priv->mclk_freq) {
dev_err(&pdev->dev, "MCLK frequency missing\n");
return -ENODEV;
}
Expand All @@ -295,6 +310,8 @@ static __devinit int omap_abe_probe(struct platform_device *pdev)
card->dai_link = abe_twl6040_dai_links;
card->num_links = num_links;

snd_soc_card_set_drvdata(card, priv);

ret = snd_soc_register_card(card);
if (ret)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
Expand Down

0 comments on commit b49ea13

Please sign in to comment.