Commit 9f072b7b authored by Mark Brown's avatar Mark Brown

Merge branch 'for-2.6.32' into for-2.6.33

parents b1cd6b9e 0c31cf3e
...@@ -205,7 +205,6 @@ struct snd_soc_jack_gpio; ...@@ -205,7 +205,6 @@ struct snd_soc_jack_gpio;
#endif #endif
typedef int (*hw_write_t)(void *,const char* ,int); typedef int (*hw_write_t)(void *,const char* ,int);
typedef int (*hw_read_t)(void *,char* ,int);
extern struct snd_ac97_bus_ops soc_ac97_ops; extern struct snd_ac97_bus_ops soc_ac97_ops;
......
/* /*
* Au12x0/Au1550 PSC ALSA ASoC audio support. * Au12x0/Au1550 PSC ALSA ASoC audio support.
* *
* (c) 2007-2008 MSC Vertriebsges.m.b.H., * (c) 2007-2009 MSC Vertriebsges.m.b.H.,
* Manuel Lauss <mano@roarinelk.homelinux.net> * Manuel Lauss <manuel.lauss@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/pcm.h> #include <sound/pcm.h>
...@@ -29,6 +30,9 @@ ...@@ -29,6 +30,9 @@
#include "psc.h" #include "psc.h"
/* how often to retry failed codec register reads/writes */
#define AC97_RW_RETRIES 5
#define AC97_DIR \ #define AC97_DIR \
(SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE) (SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE)
...@@ -45,6 +49,9 @@ ...@@ -45,6 +49,9 @@
#define AC97PCR_CLRFIFO(stype) \ #define AC97PCR_CLRFIFO(stype) \
((stype) == PCM_TX ? PSC_AC97PCR_TC : PSC_AC97PCR_RC) ((stype) == PCM_TX ? PSC_AC97PCR_TC : PSC_AC97PCR_RC)
#define AC97STAT_BUSY(stype) \
((stype) == PCM_TX ? PSC_AC97STAT_TB : PSC_AC97STAT_RB)
/* instance data. There can be only one, MacLeod!!!! */ /* instance data. There can be only one, MacLeod!!!! */
static struct au1xpsc_audio_data *au1xpsc_ac97_workdata; static struct au1xpsc_audio_data *au1xpsc_ac97_workdata;
...@@ -54,24 +61,33 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97, ...@@ -54,24 +61,33 @@ static unsigned short au1xpsc_ac97_read(struct snd_ac97 *ac97,
{ {
/* FIXME */ /* FIXME */
struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata; struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata;
unsigned short data, tmo; unsigned short data, retry, tmo;
au_writel(PSC_AC97CDC_RD | PSC_AC97CDC_INDX(reg), AC97_CDC(pscdata)); au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata));
au_sync(); au_sync();
tmo = 1000; retry = AC97_RW_RETRIES;
while ((!(au_readl(AC97_EVNT(pscdata)) & PSC_AC97EVNT_CD)) && --tmo) do {
mutex_lock(&pscdata->lock);
au_writel(PSC_AC97CDC_RD | PSC_AC97CDC_INDX(reg),
AC97_CDC(pscdata));
au_sync();
tmo = 2000;
while ((!(au_readl(AC97_EVNT(pscdata)) & PSC_AC97EVNT_CD))
&& --tmo)
udelay(2); udelay(2);
if (!tmo)
data = 0xffff;
else
data = au_readl(AC97_CDC(pscdata)) & 0xffff; data = au_readl(AC97_CDC(pscdata)) & 0xffff;
au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata)); au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata));
au_sync(); au_sync();
return data; mutex_unlock(&pscdata->lock);
} while (--retry && !tmo);
return retry ? data : 0xffff;
} }
/* AC97 controller writes to codec register */ /* AC97 controller writes to codec register */
...@@ -80,16 +96,29 @@ static void au1xpsc_ac97_write(struct snd_ac97 *ac97, unsigned short reg, ...@@ -80,16 +96,29 @@ static void au1xpsc_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
{ {
/* FIXME */ /* FIXME */
struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata; struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata;
unsigned int tmo; unsigned int tmo, retry;
au_writel(PSC_AC97CDC_INDX(reg) | (val & 0xffff), AC97_CDC(pscdata)); au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata));
au_sync(); au_sync();
tmo = 1000;
while ((!(au_readl(AC97_EVNT(pscdata)) & PSC_AC97EVNT_CD)) && --tmo) retry = AC97_RW_RETRIES;
do {
mutex_lock(&pscdata->lock);
au_writel(PSC_AC97CDC_INDX(reg) | (val & 0xffff),
AC97_CDC(pscdata));
au_sync(); au_sync();
tmo = 2000;
while ((!(au_readl(AC97_EVNT(pscdata)) & PSC_AC97EVNT_CD))
&& --tmo)
udelay(2);
au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata)); au_writel(PSC_AC97EVNT_CD, AC97_EVNT(pscdata));
au_sync(); au_sync();
mutex_unlock(&pscdata->lock);
} while (--retry && !tmo);
} }
/* AC97 controller asserts a warm reset */ /* AC97 controller asserts a warm reset */
...@@ -129,9 +158,9 @@ static void au1xpsc_ac97_cold_reset(struct snd_ac97 *ac97) ...@@ -129,9 +158,9 @@ static void au1xpsc_ac97_cold_reset(struct snd_ac97 *ac97)
au_sync(); au_sync();
/* wait for PSC to indicate it's ready */ /* wait for PSC to indicate it's ready */
i = 100000; i = 1000;
while (!((au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_SR)) && (--i)) while (!((au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_SR)) && (--i))
au_sync(); msleep(1);
if (i == 0) { if (i == 0) {
printk(KERN_ERR "au1xpsc-ac97: PSC not ready!\n"); printk(KERN_ERR "au1xpsc-ac97: PSC not ready!\n");
...@@ -143,9 +172,9 @@ static void au1xpsc_ac97_cold_reset(struct snd_ac97 *ac97) ...@@ -143,9 +172,9 @@ static void au1xpsc_ac97_cold_reset(struct snd_ac97 *ac97)
au_sync(); au_sync();
/* wait for AC97 core to become ready */ /* wait for AC97 core to become ready */
i = 100000; i = 1000;
while (!((au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_DR)) && (--i)) while (!((au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_DR)) && (--i))
au_sync(); msleep(1);
if (i == 0) if (i == 0)
printk(KERN_ERR "au1xpsc-ac97: AC97 ctrl not ready\n"); printk(KERN_ERR "au1xpsc-ac97: AC97 ctrl not ready\n");
} }
...@@ -165,12 +194,12 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream, ...@@ -165,12 +194,12 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
{ {
/* FIXME */ /* FIXME */
struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata; struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata;
unsigned long r, stat; unsigned long r, ro, stat;
int chans, stype = SUBSTREAM_TYPE(substream); int chans, stype = SUBSTREAM_TYPE(substream);
chans = params_channels(params); chans = params_channels(params);
r = au_readl(AC97_CFG(pscdata)); r = ro = au_readl(AC97_CFG(pscdata));
stat = au_readl(AC97_STAT(pscdata)); stat = au_readl(AC97_STAT(pscdata));
/* already active? */ /* already active? */
...@@ -180,9 +209,6 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream, ...@@ -180,9 +209,6 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
(pscdata->rate != params_rate(params))) (pscdata->rate != params_rate(params)))
return -EINVAL; return -EINVAL;
} else { } else {
/* disable AC97 device controller first */
au_writel(r & ~PSC_AC97CFG_DE_ENABLE, AC97_CFG(pscdata));
au_sync();
/* set sample bitdepth: REG[24:21]=(BITS-2)/2 */ /* set sample bitdepth: REG[24:21]=(BITS-2)/2 */
r &= ~PSC_AC97CFG_LEN_MASK; r &= ~PSC_AC97CFG_LEN_MASK;
...@@ -199,14 +225,40 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream, ...@@ -199,14 +225,40 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
r |= PSC_AC97CFG_RXSLOT_ENA(4); r |= PSC_AC97CFG_RXSLOT_ENA(4);
} }
/* finally enable the AC97 controller again */ /* do we need to poke the hardware? */
if (!(r ^ ro))
goto out;
/* ac97 engine is about to be disabled */
mutex_lock(&pscdata->lock);
/* disable AC97 device controller first... */
au_writel(r & ~PSC_AC97CFG_DE_ENABLE, AC97_CFG(pscdata));
au_sync();
/* ...wait for it... */
while (au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_DR)
asm volatile ("nop");
/* ...write config... */
au_writel(r, AC97_CFG(pscdata));
au_sync();
/* ...enable the AC97 controller again... */
au_writel(r | PSC_AC97CFG_DE_ENABLE, AC97_CFG(pscdata)); au_writel(r | PSC_AC97CFG_DE_ENABLE, AC97_CFG(pscdata));
au_sync(); au_sync();
/* ...and wait for ready bit */
while (!(au_readl(AC97_STAT(pscdata)) & PSC_AC97STAT_DR))
asm volatile ("nop");
mutex_unlock(&pscdata->lock);
pscdata->cfg = r; pscdata->cfg = r;
pscdata->rate = params_rate(params); pscdata->rate = params_rate(params);
} }
out:
return 0; return 0;
} }
...@@ -222,6 +274,8 @@ static int au1xpsc_ac97_trigger(struct snd_pcm_substream *substream, ...@@ -222,6 +274,8 @@ static int au1xpsc_ac97_trigger(struct snd_pcm_substream *substream,
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
au_writel(AC97PCR_CLRFIFO(stype), AC97_PCR(pscdata));
au_sync();
au_writel(AC97PCR_START(stype), AC97_PCR(pscdata)); au_writel(AC97PCR_START(stype), AC97_PCR(pscdata));
au_sync(); au_sync();
break; break;
...@@ -229,6 +283,13 @@ static int au1xpsc_ac97_trigger(struct snd_pcm_substream *substream, ...@@ -229,6 +283,13 @@ static int au1xpsc_ac97_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
au_writel(AC97PCR_STOP(stype), AC97_PCR(pscdata)); au_writel(AC97PCR_STOP(stype), AC97_PCR(pscdata));
au_sync(); au_sync();
while (au_readl(AC97_STAT(pscdata)) & AC97STAT_BUSY(stype))
asm volatile ("nop");
au_writel(AC97PCR_CLRFIFO(stype), AC97_PCR(pscdata));
au_sync();
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
...@@ -251,6 +312,8 @@ static int au1xpsc_ac97_probe(struct platform_device *pdev, ...@@ -251,6 +312,8 @@ static int au1xpsc_ac97_probe(struct platform_device *pdev,
if (!au1xpsc_ac97_workdata) if (!au1xpsc_ac97_workdata)
return -ENOMEM; return -ENOMEM;
mutex_init(&au1xpsc_ac97_workdata->lock);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) { if (!r) {
ret = -ENODEV; ret = -ENODEV;
...@@ -386,4 +449,4 @@ module_exit(au1xpsc_ac97_exit); ...@@ -386,4 +449,4 @@ module_exit(au1xpsc_ac97_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Au12x0/Au1550 PSC AC97 ALSA ASoC audio driver"); MODULE_DESCRIPTION("Au12x0/Au1550 PSC AC97 ALSA ASoC audio driver");
MODULE_AUTHOR("Manuel Lauss <mano@roarinelk.homelinux.net>"); MODULE_AUTHOR("Manuel Lauss <manuel.lauss@gmail.com>");
...@@ -29,6 +29,7 @@ struct au1xpsc_audio_data { ...@@ -29,6 +29,7 @@ struct au1xpsc_audio_data {
unsigned long pm[2]; unsigned long pm[2];
struct resource *ioarea; struct resource *ioarea;
struct mutex lock;
}; };
#define PCM_TX 0 #define PCM_TX 0
......
...@@ -277,7 +277,11 @@ static int bf5xx_ac97_resume(struct snd_soc_dai *dai) ...@@ -277,7 +277,11 @@ static int bf5xx_ac97_resume(struct snd_soc_dai *dai)
if (!dai->active) if (!dai->active)
return 0; return 0;
#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT)
ret = sport_set_multichannel(sport, 16, 0x3FF, 1);
#else
ret = sport_set_multichannel(sport, 16, 0x1F, 1); ret = sport_set_multichannel(sport, 16, 0x1F, 1);
#endif
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
return -EBUSY; return -EBUSY;
...@@ -334,7 +338,11 @@ static int bf5xx_ac97_probe(struct platform_device *pdev, ...@@ -334,7 +338,11 @@ static int bf5xx_ac97_probe(struct platform_device *pdev,
goto sport_err; goto sport_err;
} }
/*SPORT works in TDM mode to simulate AC97 transfers*/ /*SPORT works in TDM mode to simulate AC97 transfers*/
#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT)
ret = sport_set_multichannel(sport_handle, 16, 0x3FF, 1);
#else
ret = sport_set_multichannel(sport_handle, 16, 0x1F, 1); ret = sport_set_multichannel(sport_handle, 16, 0x1F, 1);
#endif
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
ret = -EBUSY; ret = -EBUSY;
......
/* /*
* linux/sound/arm/bf5xx-ac97.h * sound/soc/blackfin/bf5xx-ac97.h
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
......
...@@ -227,7 +227,8 @@ static int bf5xx_i2s_probe(struct platform_device *pdev, ...@@ -227,7 +227,8 @@ static int bf5xx_i2s_probe(struct platform_device *pdev,
return 0; return 0;
} }
static void bf5xx_i2s_remove(struct snd_soc_dai *dai) static void bf5xx_i2s_remove(struct platform_device *pdev,
struct snd_soc_dai *dai)
{ {
pr_debug("%s enter\n", __func__); pr_debug("%s enter\n", __func__);
peripheral_free_list(&sport_req[sport_num][0]); peripheral_free_list(&sport_req[sport_num][0]);
...@@ -236,36 +237,31 @@ static void bf5xx_i2s_remove(struct snd_soc_dai *dai) ...@@ -236,36 +237,31 @@ static void bf5xx_i2s_remove(struct snd_soc_dai *dai)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int bf5xx_i2s_suspend(struct snd_soc_dai *dai) static int bf5xx_i2s_suspend(struct snd_soc_dai *dai)
{ {
struct sport_device *sport =
(struct sport_device *)dai->private_data;
pr_debug("%s : sport %d\n", __func__, dai->id); pr_debug("%s : sport %d\n", __func__, dai->id);
if (!dai->active)
return 0;
if (dai->capture.active) if (dai->capture.active)
sport_rx_stop(sport); sport_rx_stop(sport_handle);
if (dai->playback.active) if (dai->playback.active)
sport_tx_stop(sport); sport_tx_stop(sport_handle);
return 0; return 0;
} }
static int bf5xx_i2s_resume(struct snd_soc_dai *dai) static int bf5xx_i2s_resume(struct snd_soc_dai *dai)
{ {
int ret; int ret;
struct sport_device *sport =
(struct sport_device *)dai->private_data;
pr_debug("%s : sport %d\n", __func__, dai->id); pr_debug("%s : sport %d\n", __func__, dai->id);
if (!dai->active)
return 0;
ret = sport_config_rx(sport, RFSR | RCKFE, RSFSE|0x1f, 0, 0); ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1,
bf5xx_i2s.rcr2, 0, 0);
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
return -EBUSY; return -EBUSY;
} }
ret = sport_config_tx(sport, TFSR | TCKFE, TSFSE|0x1f, 0, 0); ret = sport_config_tx(sport_handle, bf5xx_i2s.tcr1,
bf5xx_i2s.tcr2, 0, 0);
if (ret) { if (ret) {
pr_err("SPORT is busy!\n"); pr_err("SPORT is busy!\n");
return -EBUSY; return -EBUSY;
......
/* /*
* linux/sound/arm/bf5xx-i2s.h * sound/soc/blackfin/bf5xx-i2s.h
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
......
...@@ -326,7 +326,7 @@ static inline int sport_hook_tx_dummy(struct sport_device *sport) ...@@ -326,7 +326,7 @@ static inline int sport_hook_tx_dummy(struct sport_device *sport)
int sport_tx_start(struct sport_device *sport) int sport_tx_start(struct sport_device *sport)
{ {
unsigned flags; unsigned long flags;
pr_debug("%s: tx_run:%d, rx_run:%d\n", __func__, pr_debug("%s: tx_run:%d, rx_run:%d\n", __func__,
sport->tx_run, sport->rx_run); sport->tx_run, sport->rx_run);
if (sport->tx_run) if (sport->tx_run)
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/device.h> #include <linux/device.h>
#include <sound/core.h> #include <sound/core.h>
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/device.h> #include <linux/device.h>
#include <sound/core.h> #include <sound/core.h>
......
...@@ -612,7 +612,7 @@ SOC_DAPM_SINGLE("Switch", WM8350_BEEP_VOLUME, 15, 1, 1); ...@@ -612,7 +612,7 @@ SOC_DAPM_SINGLE("Switch", WM8350_BEEP_VOLUME, 15, 1, 1);
/* Out4 Capture Mux */ /* Out4 Capture Mux */
static const struct snd_kcontrol_new wm8350_out4_capture_controls = static const struct snd_kcontrol_new wm8350_out4_capture_controls =
SOC_DAPM_ENUM("Route", wm8350_enum[8]); SOC_DAPM_ENUM("Route", wm8350_enum[7]);
static const struct snd_soc_dapm_widget wm8350_dapm_widgets[] = { static const struct snd_soc_dapm_widget wm8350_dapm_widgets[] = {
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/version.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
......
...@@ -512,34 +512,49 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev, ...@@ -512,34 +512,49 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,
int channel_size) int channel_size)
{ {
u32 fmt = 0; u32 fmt = 0;
u32 mask, rotate;
switch (channel_size) { switch (channel_size) {
case DAVINCI_AUDIO_WORD_8: case DAVINCI_AUDIO_WORD_8:
fmt = 0x03; fmt = 0x03;
rotate = 6;
mask = 0x000000ff;
break; break;
case DAVINCI_AUDIO_WORD_12: case DAVINCI_AUDIO_WORD_12:
fmt = 0x05; fmt = 0x05;
rotate = 5;
mask = 0x00000fff;
break; break;
case DAVINCI_AUDIO_WORD_16: case DAVINCI_AUDIO_WORD_16:
fmt = 0x07; fmt = 0x07;
rotate = 4;
mask = 0x0000ffff;
break; break;
case DAVINCI_AUDIO_WORD_20: case DAVINCI_AUDIO_WORD_20:
fmt = 0x09; fmt = 0x09;
rotate = 3;
mask = 0x000fffff;
break; break;
case DAVINCI_AUDIO_WORD_24: case DAVINCI_AUDIO_WORD_24:
fmt = 0x0B; fmt = 0x0B;
rotate = 2;
mask = 0x00ffffff;
break; break;
case DAVINCI_AUDIO_WORD_28: case DAVINCI_AUDIO_WORD_28:
fmt = 0x0D; fmt = 0x0D;
rotate = 1;
mask = 0x0fffffff;
break; break;
case DAVINCI_AUDIO_WORD_32: case DAVINCI_AUDIO_WORD_32:
fmt = 0x0F; fmt = 0x0F;
rotate = 0;
mask = 0xffffffff;
break; break;
default: default:
...@@ -550,6 +565,13 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev, ...@@ -550,6 +565,13 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,
RXSSZ(fmt), RXSSZ(0x0F)); RXSSZ(fmt), RXSSZ(0x0F));
mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG,
TXSSZ(fmt), TXSSZ(0x0F)); TXSSZ(fmt), TXSSZ(0x0F));
mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXROT(rotate),
TXROT(7));
mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXROT(rotate),
RXROT(7));
mcasp_set_reg(dev->base + DAVINCI_MCASP_TXMASK_REG, mask);
mcasp_set_reg(dev->base + DAVINCI_MCASP_RXMASK_REG, mask);
return 0; return 0;
} }
...@@ -638,7 +660,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream) ...@@ -638,7 +660,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
printk(KERN_ERR "playback tdm slot %d not supported\n", printk(KERN_ERR "playback tdm slot %d not supported\n",
dev->tdm_slots); dev->tdm_slots);
mcasp_set_reg(dev->base + DAVINCI_MCASP_TXMASK_REG, 0xFFFFFFFF);
mcasp_clr_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR); mcasp_clr_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
} else { } else {
/* bit stream is MSB first with no delay */ /* bit stream is MSB first with no delay */
...@@ -655,7 +676,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream) ...@@ -655,7 +676,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
printk(KERN_ERR "capture tdm slot %d not supported\n", printk(KERN_ERR "capture tdm slot %d not supported\n",
dev->tdm_slots); dev->tdm_slots);
mcasp_set_reg(dev->base + DAVINCI_MCASP_RXMASK_REG, 0xFFFFFFFF);
mcasp_clr_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR); mcasp_clr_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
} }
} }
......
...@@ -447,6 +447,7 @@ int mpc5200_audio_dma_create(struct of_device *op) ...@@ -447,6 +447,7 @@ int mpc5200_audio_dma_create(struct of_device *op)
int size, irq, rc; int size, irq, rc;
const __be32 *prop; const __be32 *prop;
void __iomem *regs; void __iomem *regs;
int ret;
/* Fetch the registers and IRQ of the PSC */ /* Fetch the registers and IRQ of the PSC */
irq = irq_of_parse_and_map(op->node, 0); irq = irq_of_parse_and_map(op->node, 0);
...@@ -463,14 +464,16 @@ int mpc5200_audio_dma_create(struct of_device *op) ...@@ -463,14 +464,16 @@ int mpc5200_audio_dma_create(struct of_device *op)
/* Allocate and initialize the driver private data */ /* Allocate and initialize the driver private data */
psc_dma = kzalloc(sizeof *psc_dma, GFP_KERNEL); psc_dma = kzalloc(sizeof *psc_dma, GFP_KERNEL);
if (!psc_dma) { if (!psc_dma) {
iounmap(regs); ret = -ENOMEM;
return -ENOMEM; goto out_unmap;
} }
/* Get the PSC ID */ /* Get the PSC ID */
prop = of_get_property(op->node, "cell-index", &size); prop = of_get_property(op->node, "cell-index", &size);
if (!prop || size < sizeof *prop) if (!prop || size < sizeof *prop) {
return -ENODEV; ret = -ENODEV;
goto out_free;
}
spin_lock_init(&psc_dma->lock); spin_lock_init(&psc_dma->lock);
mutex_init(&psc_dma->mutex); mutex_init(&psc_dma->mutex);
...@@ -493,9 +496,8 @@ int mpc5200_audio_dma_create(struct of_device *op) ...@@ -493,9 +496,8 @@ int mpc5200_audio_dma_create(struct of_device *op)
if (!psc_dma->capture.bcom_task || if (!psc_dma->capture.bcom_task ||
!psc_dma->playback.bcom_task) { !psc_dma->playback.bcom_task) {
dev_err(&op->dev, "Could not allocate bestcomm tasks\n"); dev_err(&op->dev, "Could not allocate bestcomm tasks\n");
iounmap(regs); ret = -ENODEV;
kfree(psc_dma); goto out_free;
return -ENODEV;
} }
/* Disable all interrupts and reset the PSC */ /* Disable all interrupts and reset the PSC */
...@@ -537,12 +539,8 @@ int mpc5200_audio_dma_create(struct of_device *op) ...@@ -537,12 +539,8 @@ int mpc5200_audio_dma_create(struct of_device *op)
&psc_dma_bcom_irq_tx, IRQF_SHARED, &psc_dma_bcom_irq_tx, IRQF_SHARED,
"psc-dma-playback", &psc_dma->playback); "psc-dma-playback", &psc_dma->playback);
if (rc) { if (rc) {
free_irq(psc_dma->irq, psc_dma); ret = -ENODEV;
free_irq(psc_dma->capture.irq, goto out_irq;
&psc_dma->capture);
free_irq(psc_dma->playback.irq,
&psc_dma->playback);
return -ENODEV;
} }
/* Save what we've done so it can be found again later */ /* Save what we've done so it can be found again later */
...@@ -550,6 +548,15 @@ int mpc5200_audio_dma_create(struct of_device *op) ...@@ -550,6 +548,15 @@ int mpc5200_audio_dma_create(struct of_device *op)
/* Tell the ASoC OF helpers about it */ /* Tell the ASoC OF helpers about it */
return snd_soc_register_platform(&mpc5200_audio_dma_platform); return snd_soc_register_platform(&mpc5200_audio_dma_platform);
out_irq:
free_irq(psc_dma->irq, psc_dma);
free_irq(psc_dma->capture.irq, &psc_dma->capture);
free_irq(psc_dma->playback.irq, &psc_dma->playback);
out_free:
kfree(psc_dma);
out_unmap:
iounmap(regs);
return ret;
} }
EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create); EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create);
......
...@@ -230,6 +230,8 @@ static void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on) ...@@ -230,6 +230,8 @@ static void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on)
pr_debug("%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);
} }
#define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
/* /*
* Wait for the LR signal to allow synchronisation to the L/R clock * Wait for the LR signal to allow synchronisation to the L/R clock
* from the codec. May only be needed for slave mode. * from the codec. May only be needed for slave mode.
...@@ -237,20 +239,22 @@ static void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on) ...@@ -237,20 +239,22 @@ static void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on)
static int s3c2412_snd_lrsync(struct s3c_i2sv2_info *i2s) static int s3c2412_snd_lrsync(struct s3c_i2sv2_info *i2s)
{ {
u32 iiscon; u32 iiscon;
unsigned long timeout = jiffies + msecs_to_jiffies(5); unsigned long loops = msecs_to_loops(5);
pr_debug("Entered %s\n", __func__); pr_debug("Entered %s\n", __func__);
while (1) { while (--loops) {
iiscon = readl(i2s->regs + S3C2412_IISCON); iiscon = readl(i2s->regs + S3C2412_IISCON);
if (iiscon & S3C2412_IISCON_LRINDEX) if (iiscon & S3C2412_IISCON_LRINDEX)
break; break;
if (timeout < jiffies) { cpu_relax();
}
if (!loops) {
printk(KERN_ERR "%s: timeout\n", __func__); printk(KERN_ERR "%s: timeout\n", __func__);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
}
return 0; return 0;
} }
......
...@@ -1135,9 +1135,10 @@ static ssize_t dapm_widget_power_read_file(struct file *file, ...@@ -1135,9 +1135,10 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
ret = snprintf(buf, PAGE_SIZE, "%s: %s in %d out %d\n", ret = snprintf(buf, PAGE_SIZE, "%s: %s in %d out %d\n",
w->name, w->power ? "On" : "Off", in, out); w->name, w->power ? "On" : "Off", in, out);
if (w->active && w->sname) if (w->sname)
ret += snprintf(buf, PAGE_SIZE - ret, " stream %s active\n", ret += snprintf(buf + ret, PAGE_SIZE - ret, " stream %s %s\n",
w->sname); w->sname,
w->active ? "active" : "inactive");
list_for_each_entry(p, &w->sources, list_sink) { list_for_each_entry(p, &w->sources, list_sink) {
if (p->connected && !p->connected(w, p->sink)) if (p->connected && !p->connected(w, p->sink))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment