Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99020
b: refs/heads/master
c: 1894c59
h: refs/heads/master
v: v3
  • Loading branch information
Tim Niemeyer authored and Jaroslav Kysela committed May 19, 2008
1 parent 84c2d8f commit 39c92a2
Show file tree
Hide file tree
Showing 2 changed files with 47 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: 650f6b13318bce6a8d59bfa48fe15b5832623cbc
refs/heads/master: 1894c59fdb63692f5ba2576875cc558b856935ca
46 changes: 46 additions & 0 deletions trunk/sound/soc/s3c24xx/neo1973_wm8753.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
#include "s3c24xx-pcm.h"
#include "s3c24xx-i2s.h"

/* Debugging stuff */
#define S3C24XX_SOC_NEO1973_WM8753_DEBUG 0
#if S3C24XX_SOC_NEO1973_WM8753_DEBUG
#define DBG(x...) printk(KERN_DEBUG "s3c24xx-soc-neo1973-wm8753: " x)
#else
#define DBG(x...)
#endif

/* define the scenarios */
#define NEO_AUDIO_OFF 0
#define NEO_GSM_CALL_AUDIO_HANDSET 1
Expand All @@ -67,6 +75,8 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream,
int ret = 0;
unsigned long iis_clkrate;

DBG("Entered %s\n", __func__);

iis_clkrate = s3c24xx_i2s_get_clockrate();

switch (params_rate(params)) {
Expand Down Expand Up @@ -151,6 +161,8 @@ static int neo1973_hifi_hw_free(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;

DBG("Entered %s\n", __func__);

/* disable the PLL */
return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL1, 0, 0);
}
Expand All @@ -172,6 +184,8 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream,
int ret = 0;
unsigned long iis_clkrate;

DBG("Entered %s\n", __func__);

iis_clkrate = s3c24xx_i2s_get_clockrate();

if (params_rate(params) != 8000)
Expand Down Expand Up @@ -213,6 +227,8 @@ static int neo1973_voice_hw_free(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;

DBG("Entered %s\n", __func__);

/* disable the PLL */
return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL2, 0, 0);
}
Expand All @@ -233,6 +249,8 @@ static int neo1973_get_scenario(struct snd_kcontrol *kcontrol,

static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario)
{
DBG("Entered %s\n", __func__);

switch (neo1973_scenario) {
case NEO_AUDIO_OFF:
snd_soc_dapm_set_endpoint(codec, "Audio Out", 0);
Expand Down Expand Up @@ -315,6 +333,8 @@ static int neo1973_set_scenario(struct snd_kcontrol *kcontrol,
{
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);

DBG("Entered %s\n", __func__);

if (neo1973_scenario == ucontrol->value.integer.value[0])
return 0;

Expand All @@ -327,6 +347,8 @@ static u8 lm4857_regs[4] = {0x00, 0x40, 0x80, 0xC0};

static void lm4857_write_regs(void)
{
DBG("Entered %s\n", __func__);

if (i2c_master_send(i2c, lm4857_regs, 4) != 4)
printk(KERN_ERR "lm4857: i2c write failed\n");
}
Expand All @@ -338,6 +360,8 @@ static int lm4857_get_reg(struct snd_kcontrol *kcontrol,
int shift = (kcontrol->private_value >> 8) & 0x0F;
int mask = (kcontrol->private_value >> 16) & 0xFF;

DBG("Entered %s\n", __func__);

ucontrol->value.integer.value[0] = (lm4857_regs[reg] >> shift) & mask;
return 0;
}
Expand All @@ -364,6 +388,8 @@ static int lm4857_get_mode(struct snd_kcontrol *kcontrol,
{
u8 value = lm4857_regs[LM4857_CTRL] & 0x0F;

DBG("Entered %s\n", __func__);

if (value)
value -= 5;

Expand All @@ -376,6 +402,8 @@ static int lm4857_set_mode(struct snd_kcontrol *kcontrol,
{
u8 value = ucontrol->value.integer.value[0];

DBG("Entered %s\n", __func__);

if (value)
value += 5;

Expand Down Expand Up @@ -483,6 +511,8 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec)
{
int i, err;

DBG("Entered %s\n", __func__);

/* set up NC codec pins */
snd_soc_dapm_set_endpoint(codec, "LOUT2", 0);
snd_soc_dapm_set_endpoint(codec, "ROUT2", 0);
Expand Down Expand Up @@ -583,6 +613,8 @@ static int lm4857_amp_probe(struct i2c_adapter *adap, int addr, int kind)
{
int ret;

DBG("Entered %s\n", __func__);

client_template.adapter = adap;
client_template.addr = addr;

Expand All @@ -606,20 +638,26 @@ static int lm4857_amp_probe(struct i2c_adapter *adap, int addr, int kind)

static int lm4857_i2c_detach(struct i2c_client *client)
{
DBG("Entered %s\n", __func__);

i2c_detach_client(client);
kfree(client);
return 0;
}

static int lm4857_i2c_attach(struct i2c_adapter *adap)
{
DBG("Entered %s\n", __func__);

return i2c_probe(adap, &addr_data, lm4857_amp_probe);
}

static u8 lm4857_state;

static int lm4857_suspend(struct i2c_client *dev, pm_message_t state)
{
DBG("Entered %s\n", __func__);

dev_dbg(&dev->dev, "lm4857_suspend\n");
lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf;
if (lm4857_state) {
Expand All @@ -631,6 +669,8 @@ static int lm4857_suspend(struct i2c_client *dev, pm_message_t state)

static int lm4857_resume(struct i2c_client *dev)
{
DBG("Entered %s\n", __func__);

if (lm4857_state) {
lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f);
lm4857_write_regs();
Expand All @@ -640,6 +680,8 @@ static int lm4857_resume(struct i2c_client *dev)

static void lm4857_shutdown(struct i2c_client *dev)
{
DBG("Entered %s\n", __func__);

dev_dbg(&dev->dev, "lm4857_shutdown\n");
lm4857_regs[LM4857_CTRL] &= 0xf0;
lm4857_write_regs();
Expand Down Expand Up @@ -671,6 +713,8 @@ static int __init neo1973_init(void)
{
int ret;

DBG("Entered %s\n", __func__);

neo1973_snd_device = platform_device_alloc("soc-audio", -1);
if (!neo1973_snd_device)
return -ENOMEM;
Expand All @@ -691,6 +735,8 @@ static int __init neo1973_init(void)

static void __exit neo1973_exit(void)
{
DBG("Entered %s\n", __func__);

i2c_del_driver(&lm4857_i2c_driver);
platform_device_unregister(neo1973_snd_device);
}
Expand Down

0 comments on commit 39c92a2

Please sign in to comment.