Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132895
b: refs/heads/master
c: ee7d476
h: refs/heads/master
i:
  132893: f597172
  132891: f9cd774
  132887: 4de1404
  132879: d1011ee
  132863: 6c90851
v: v3
  • Loading branch information
Mark Brown committed Mar 6, 2009
1 parent b964f68 commit abe4305
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 118 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: 26bd7b496cabc232fcff9ae0249828420c52b5af
refs/heads/master: ee7d476714464206317d4420d67e3bfa0308448d
44 changes: 18 additions & 26 deletions trunk/sound/soc/s3c24xx/neo1973_wm8753.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
#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 @@ -72,7 +64,7 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream,
int ret = 0;
unsigned long iis_clkrate;

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

iis_clkrate = s3c24xx_i2s_get_clockrate();

Expand Down Expand Up @@ -158,7 +150,7 @@ static int neo1973_hifi_hw_free(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;

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

/* disable the PLL */
return snd_soc_dai_set_pll(codec_dai, WM8753_PLL1, 0, 0);
Expand All @@ -181,7 +173,7 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream,
int ret = 0;
unsigned long iis_clkrate;

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

iis_clkrate = s3c24xx_i2s_get_clockrate();

Expand Down Expand Up @@ -224,7 +216,7 @@ static int neo1973_voice_hw_free(struct snd_pcm_substream *substream)
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;

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

/* disable the PLL */
return snd_soc_dai_set_pll(codec_dai, WM8753_PLL2, 0, 0);
Expand All @@ -246,7 +238,7 @@ 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__);
pr_debug("Entered %s\n", __func__);

switch (neo1973_scenario) {
case NEO_AUDIO_OFF:
Expand Down Expand Up @@ -330,7 +322,7 @@ static int neo1973_set_scenario(struct snd_kcontrol *kcontrol,
{
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);

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

if (neo1973_scenario == ucontrol->value.integer.value[0])
return 0;
Expand All @@ -344,7 +336,7 @@ static u8 lm4857_regs[4] = {0x00, 0x40, 0x80, 0xC0};

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

if (i2c_master_send(i2c, lm4857_regs, 4) != 4)
printk(KERN_ERR "lm4857: i2c write failed\n");
Expand All @@ -357,7 +349,7 @@ 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__);
pr_debug("Entered %s\n", __func__);

ucontrol->value.integer.value[0] = (lm4857_regs[reg] >> shift) & mask;
return 0;
Expand Down Expand Up @@ -385,7 +377,7 @@ static int lm4857_get_mode(struct snd_kcontrol *kcontrol,
{
u8 value = lm4857_regs[LM4857_CTRL] & 0x0F;

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

if (value)
value -= 5;
Expand All @@ -399,7 +391,7 @@ static int lm4857_set_mode(struct snd_kcontrol *kcontrol,
{
u8 value = ucontrol->value.integer.value[0];

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

if (value)
value += 5;
Expand Down Expand Up @@ -508,7 +500,7 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec)
{
int i, err;

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

/* set up NC codec pins */
snd_soc_dapm_nc_pin(codec, "LOUT2");
Expand Down Expand Up @@ -593,7 +585,7 @@ static struct snd_soc_device neo1973_snd_devdata = {
static int lm4857_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
DBG("Entered %s\n", __func__);
pr_debug("Entered %s\n", __func__);

i2c = client;

Expand All @@ -603,7 +595,7 @@ static int lm4857_i2c_probe(struct i2c_client *client,

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

i2c = NULL;

Expand All @@ -614,7 +606,7 @@ static u8 lm4857_state;

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

dev_dbg(&dev->dev, "lm4857_suspend\n");
lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf;
Expand All @@ -627,7 +619,7 @@ 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__);
pr_debug("Entered %s\n", __func__);

if (lm4857_state) {
lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f);
Expand All @@ -638,7 +630,7 @@ static int lm4857_resume(struct i2c_client *dev)

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

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

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

if (!machine_is_neo1973_gta01()) {
printk(KERN_INFO
Expand Down Expand Up @@ -700,7 +692,7 @@ static int __init neo1973_init(void)

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

i2c_del_driver(&lm4857_i2c_driver);
platform_device_unregister(neo1973_snd_device);
Expand Down
49 changes: 21 additions & 28 deletions trunk/sound/soc/s3c24xx/s3c-i2s-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@
#include "s3c-i2s-v2.h"

#define S3C2412_I2S_DEBUG_CON 0
#define S3C2412_I2S_DEBUG 0

#if S3C2412_I2S_DEBUG
#define DBG(x...) printk(KERN_INFO x)
#else
#define DBG(x...) do { } while (0)
#endif

static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
{
Expand Down Expand Up @@ -87,13 +80,13 @@ void s3c2412_snd_txctrl(struct s3c_i2sv2_info *i2s, int on)
void __iomem *regs = i2s->regs;
u32 fic, con, mod;

DBG("%s(%d)\n", __func__, on);
pr_debug("%s(%d)\n", __func__, on);

fic = readl(regs + S3C2412_IISFIC);
con = readl(regs + S3C2412_IISCON);
mod = readl(regs + S3C2412_IISMOD);

DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
pr_debug("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);

if (on) {
con |= S3C2412_IISCON_TXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
Expand Down Expand Up @@ -148,7 +141,7 @@ void s3c2412_snd_txctrl(struct s3c_i2sv2_info *i2s, int on)

fic = readl(regs + S3C2412_IISFIC);
dbg_showcon(__func__, con);
DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
pr_debug("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
}
EXPORT_SYMBOL_GPL(s3c2412_snd_txctrl);

Expand All @@ -157,13 +150,13 @@ void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on)
void __iomem *regs = i2s->regs;
u32 fic, con, mod;

DBG("%s(%d)\n", __func__, on);
pr_debug("%s(%d)\n", __func__, on);

fic = readl(regs + S3C2412_IISFIC);
con = readl(regs + S3C2412_IISCON);
mod = readl(regs + S3C2412_IISMOD);

DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
pr_debug("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);

if (on) {
con |= S3C2412_IISCON_RXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
Expand Down Expand Up @@ -214,7 +207,7 @@ void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on)
}

fic = readl(regs + S3C2412_IISFIC);
DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
pr_debug("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
}
EXPORT_SYMBOL_GPL(s3c2412_snd_rxctrl);

Expand All @@ -227,7 +220,7 @@ static int s3c2412_snd_lrsync(struct s3c_i2sv2_info *i2s)
u32 iiscon;
unsigned long timeout = jiffies + msecs_to_jiffies(5);

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

while (1) {
iiscon = readl(i2s->regs + S3C2412_IISCON);
Expand All @@ -252,10 +245,10 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
u32 iismod;

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

iismod = readl(i2s->regs + S3C2412_IISMOD);
DBG("hw_params r: IISMOD: %x \n", iismod);
pr_debug("hw_params r: IISMOD: %x \n", iismod);

#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
#define IISMOD_MASTER_MASK S3C2412_IISMOD_MASTER_MASK
Expand Down Expand Up @@ -288,7 +281,7 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
iismod |= IISMOD_MASTER;
break;
default:
DBG("unknwon master/slave format\n");
pr_debug("unknwon master/slave format\n");
return -EINVAL;
}

Expand All @@ -305,12 +298,12 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
iismod |= S3C2412_IISMOD_SDF_IIS;
break;
default:
DBG("Unknown data format\n");
pr_debug("Unknown data format\n");
return -EINVAL;
}

writel(iismod, i2s->regs + S3C2412_IISMOD);
DBG("hw_params w: IISMOD: %x \n", iismod);
pr_debug("hw_params w: IISMOD: %x \n", iismod);
return 0;
}

Expand All @@ -323,7 +316,7 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
struct s3c_i2sv2_info *i2s = to_info(dai->cpu_dai);
u32 iismod;

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

if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
dai->cpu_dai->dma_data = i2s->dma_playback;
Expand All @@ -332,7 +325,7 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,

/* Working copies of register */
iismod = readl(i2s->regs + S3C2412_IISMOD);
DBG("%s: r: IISMOD: %x\n", __func__, iismod);
pr_debug("%s: r: IISMOD: %x\n", __func__, iismod);

switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
Expand All @@ -344,7 +337,7 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
}

writel(iismod, i2s->regs + S3C2412_IISMOD);
DBG("%s: w: IISMOD: %x\n", __func__, iismod);
pr_debug("%s: w: IISMOD: %x\n", __func__, iismod);
return 0;
}

Expand All @@ -357,7 +350,7 @@ static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
unsigned long irqs;
int ret = 0;

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

switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
Expand Down Expand Up @@ -417,15 +410,15 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
u32 reg;

DBG("%s(%p, %d, %d)\n", __func__, cpu_dai, div_id, div);
pr_debug("%s(%p, %d, %d)\n", __func__, cpu_dai, div_id, div);

switch (div_id) {
case S3C_I2SV2_DIV_BCLK:
reg = readl(i2s->regs + S3C2412_IISMOD);
reg &= ~S3C2412_IISMOD_BCLK_MASK;
writel(reg | div, i2s->regs + S3C2412_IISMOD);

DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
pr_debug("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
break;

case S3C_I2SV2_DIV_RCLK:
Expand Down Expand Up @@ -457,7 +450,7 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
reg = readl(i2s->regs + S3C2412_IISMOD);
reg &= ~S3C2412_IISMOD_RCLK_MASK;
writel(reg | div, i2s->regs + S3C2412_IISMOD);
DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
pr_debug("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
break;

case S3C_I2SV2_DIV_PRESCALER:
Expand All @@ -467,7 +460,7 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
} else {
writel(0x0, i2s->regs + S3C2412_IISPSR);
}
DBG("%s: PSR=%08x\n", __func__, readl(i2s->regs + S3C2412_IISPSR));
pr_debug("%s: PSR=%08x\n", __func__, readl(i2s->regs + S3C2412_IISPSR));
break;

default:
Expand Down Expand Up @@ -560,7 +553,7 @@ int s3c_i2sv2_probe(struct platform_device *pdev,

i2s->iis_pclk = clk_get(dev, "iis");
if (i2s->iis_pclk == NULL) {
DBG("failed to get iis_clock\n");
pr_debug("failed to get iis_clock\n");
iounmap(i2s->regs);
return -ENOENT;
}
Expand Down
Loading

0 comments on commit abe4305

Please sign in to comment.