Commit 29abceb6 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'for-3.3' of...

Merge branch 'for-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into topic/asoc
parents d6b24507 36ae1a96
...@@ -268,6 +268,7 @@ static int wm8994_suspend(struct device *dev) ...@@ -268,6 +268,7 @@ static int wm8994_suspend(struct device *dev)
wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET, wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET,
wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET)); wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET));
regcache_cache_only(wm8994->regmap, true);
regcache_mark_dirty(wm8994->regmap); regcache_mark_dirty(wm8994->regmap);
wm8994->suspended = true; wm8994->suspended = true;
...@@ -298,6 +299,7 @@ static int wm8994_resume(struct device *dev) ...@@ -298,6 +299,7 @@ static int wm8994_resume(struct device *dev)
return ret; return ret;
} }
regcache_cache_only(wm8994->regmap, false);
ret = regcache_sync(wm8994->regmap); ret = regcache_sync(wm8994->regmap);
if (ret != 0) { if (ret != 0) {
dev_err(dev, "Failed to restore register map: %d\n", ret); dev_err(dev, "Failed to restore register map: %d\n", ret);
......
...@@ -847,7 +847,7 @@ struct snd_soc_card { ...@@ -847,7 +847,7 @@ struct snd_soc_card {
/* SoC machine DAI configuration, glues a codec and cpu DAI together */ /* SoC machine DAI configuration, glues a codec and cpu DAI together */
struct snd_soc_pcm_runtime { struct snd_soc_pcm_runtime {
struct device dev; struct device *dev;
struct snd_soc_card *card; struct snd_soc_card *card;
struct snd_soc_dai_link *dai_link; struct snd_soc_dai_link *dai_link;
struct mutex pcm_mutex; struct mutex pcm_mutex;
...@@ -933,12 +933,12 @@ static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platfo ...@@ -933,12 +933,12 @@ static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platfo
static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd, static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
void *data) void *data)
{ {
dev_set_drvdata(&rtd->dev, data); dev_set_drvdata(rtd->dev, data);
} }
static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd) static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
{ {
return dev_get_drvdata(&rtd->dev); return dev_get_drvdata(rtd->dev);
} }
static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
......
...@@ -26,7 +26,7 @@ config SND_AT91_SOC_SAM9G20_WM8731 ...@@ -26,7 +26,7 @@ config SND_AT91_SOC_SAM9G20_WM8731
config SND_AT91_SOC_AFEB9260 config SND_AT91_SOC_AFEB9260
tristate "SoC Audio support for AFEB9260 board" tristate "SoC Audio support for AFEB9260 board"
depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC depends on ATMEL_SSC && ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC
select SND_ATMEL_SOC_SSC select SND_ATMEL_SOC_SSC
select SND_SOC_TLV320AIC23 select SND_SOC_TLV320AIC23
help help
......
...@@ -367,7 +367,6 @@ static u64 atmel_pcm_dmamask = 0xffffffff; ...@@ -367,7 +367,6 @@ static u64 atmel_pcm_dmamask = 0xffffffff;
static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -376,14 +375,14 @@ static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -376,14 +375,14 @@ static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = 0xffffffff; card->dev->coherent_dma_mask = 0xffffffff;
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = atmel_pcm_preallocate_dma_buffer(pcm, ret = atmel_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
goto out; goto out;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
pr_debug("atmel-pcm:" pr_debug("atmel-pcm:"
"Allocating PCM capture DMA buffer\n"); "Allocating PCM capture DMA buffer\n");
ret = atmel_pcm_preallocate_dma_buffer(pcm, ret = atmel_pcm_preallocate_dma_buffer(pcm,
......
...@@ -421,7 +421,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); ...@@ -421,7 +421,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -431,14 +430,14 @@ static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) ...@@ -431,14 +430,14 @@ static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = DMA_BIT_MASK(32); card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = bf5xx_pcm_preallocate_dma_buffer(pcm, ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
goto out; goto out;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = bf5xx_pcm_preallocate_dma_buffer(pcm, ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (ret)
......
...@@ -260,7 +260,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); ...@@ -260,7 +260,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -270,14 +269,14 @@ static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) ...@@ -270,14 +269,14 @@ static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = DMA_BIT_MASK(32); card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = bf5xx_pcm_preallocate_dma_buffer(pcm, ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
goto out; goto out;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = bf5xx_pcm_preallocate_dma_buffer(pcm, ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (ret)
......
...@@ -286,7 +286,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); ...@@ -286,7 +286,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd) static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -295,14 +294,14 @@ static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -295,14 +294,14 @@ static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = DMA_BIT_MASK(32); card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = bf5xx_pcm_preallocate_dma_buffer(pcm, ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
goto out; goto out;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = bf5xx_pcm_preallocate_dma_buffer(pcm, ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (ret)
......
...@@ -831,7 +831,6 @@ static u64 davinci_pcm_dmamask = 0xffffffff; ...@@ -831,7 +831,6 @@ static u64 davinci_pcm_dmamask = 0xffffffff;
static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret; int ret;
...@@ -840,7 +839,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -840,7 +839,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = 0xffffffff; card->dev->coherent_dma_mask = 0xffffffff;
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = davinci_pcm_preallocate_dma_buffer(pcm, ret = davinci_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK, SNDRV_PCM_STREAM_PLAYBACK,
pcm_hardware_playback.buffer_bytes_max); pcm_hardware_playback.buffer_bytes_max);
...@@ -848,7 +847,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -848,7 +847,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = davinci_pcm_preallocate_dma_buffer(pcm, ret = davinci_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE, SNDRV_PCM_STREAM_CAPTURE,
pcm_hardware_capture.buffer_bytes_max); pcm_hardware_capture.buffer_bytes_max);
......
...@@ -286,7 +286,6 @@ static u64 ep93xx_pcm_dmamask = 0xffffffff; ...@@ -286,7 +286,6 @@ static u64 ep93xx_pcm_dmamask = 0xffffffff;
static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd) static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -295,14 +294,14 @@ static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -295,14 +294,14 @@ static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = 0xffffffff; card->dev->coherent_dma_mask = 0xffffffff;
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = ep93xx_pcm_preallocate_dma_buffer(pcm, ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
return ret; return ret;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = ep93xx_pcm_preallocate_dma_buffer(pcm, ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (ret)
......
...@@ -302,7 +302,6 @@ static u64 jz4740_pcm_dmamask = DMA_BIT_MASK(32); ...@@ -302,7 +302,6 @@ static u64 jz4740_pcm_dmamask = DMA_BIT_MASK(32);
static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd) static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -312,14 +311,14 @@ static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -312,14 +311,14 @@ static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = DMA_BIT_MASK(32); card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = jz4740_pcm_preallocate_dma_buffer(pcm, ret = jz4740_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
goto err; goto err;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = jz4740_pcm_preallocate_dma_buffer(pcm, ret = jz4740_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (ret)
......
...@@ -315,7 +315,6 @@ static int kirkwood_dma_preallocate_dma_buffer(struct snd_pcm *pcm, ...@@ -315,7 +315,6 @@ static int kirkwood_dma_preallocate_dma_buffer(struct snd_pcm *pcm,
static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd) static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret; int ret;
...@@ -324,14 +323,14 @@ static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd) ...@@ -324,14 +323,14 @@ static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = 0xffffffff; card->dev->coherent_dma_mask = 0xffffffff;
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = kirkwood_dma_preallocate_dma_buffer(pcm, ret = kirkwood_dma_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
return ret; return ret;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = kirkwood_dma_preallocate_dma_buffer(pcm, ret = kirkwood_dma_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (ret)
......
...@@ -446,13 +446,12 @@ static void sst_pcm_free(struct snd_pcm *pcm) ...@@ -446,13 +446,12 @@ static void sst_pcm_free(struct snd_pcm *pcm)
static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int retval = 0; int retval = 0;
pr_debug("sst_pcm_new called\n"); pr_debug("sst_pcm_new called\n");
if (dai->driver->playback.channels_min || if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
dai->driver->capture.channels_min) { pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
retval = snd_pcm_lib_preallocate_pages_for_all(pcm, retval = snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_CONTINUOUS, SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_KERNEL), snd_dma_continuous_data(GFP_KERNEL),
......
...@@ -378,7 +378,6 @@ static void omap_pcm_free_dma_buffers(struct snd_pcm *pcm) ...@@ -378,7 +378,6 @@ static void omap_pcm_free_dma_buffers(struct snd_pcm *pcm)
static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -387,14 +386,14 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -387,14 +386,14 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = DMA_BIT_MASK(64); card->dev->coherent_dma_mask = DMA_BIT_MASK(64);
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = omap_pcm_preallocate_dma_buffer(pcm, ret = omap_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
goto out; goto out;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = omap_pcm_preallocate_dma_buffer(pcm, ret = omap_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (ret)
......
...@@ -403,7 +403,6 @@ static u64 dma_mask = DMA_BIT_MASK(32); ...@@ -403,7 +403,6 @@ static u64 dma_mask = DMA_BIT_MASK(32);
static int dma_new(struct snd_soc_pcm_runtime *rtd) static int dma_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -414,14 +413,14 @@ static int dma_new(struct snd_soc_pcm_runtime *rtd) ...@@ -414,14 +413,14 @@ static int dma_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = 0xffffffff; card->dev->coherent_dma_mask = 0xffffffff;
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = preallocate_dma_buffer(pcm, ret = preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
goto out; goto out;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = preallocate_dma_buffer(pcm, ret = preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (ret)
......
...@@ -387,7 +387,6 @@ static u64 idma_mask = DMA_BIT_MASK(32); ...@@ -387,7 +387,6 @@ static u64 idma_mask = DMA_BIT_MASK(32);
static int idma_new(struct snd_soc_pcm_runtime *rtd) static int idma_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -396,9 +395,10 @@ static int idma_new(struct snd_soc_pcm_runtime *rtd) ...@@ -396,9 +395,10 @@ static int idma_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = DMA_BIT_MASK(32); card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
if (dai->driver->playback.channels_min) if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = preallocate_idma_buffer(pcm, ret = preallocate_idma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
}
return ret; return ret;
} }
......
...@@ -169,8 +169,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf, ...@@ -169,8 +169,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf,
static ssize_t codec_reg_show(struct device *dev, static ssize_t codec_reg_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct snd_soc_pcm_runtime *rtd = struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
container_of(dev, struct snd_soc_pcm_runtime, dev);
return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0); return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0);
} }
...@@ -180,8 +179,7 @@ static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL); ...@@ -180,8 +179,7 @@ static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL);
static ssize_t pmdown_time_show(struct device *dev, static ssize_t pmdown_time_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct snd_soc_pcm_runtime *rtd = struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
container_of(dev, struct snd_soc_pcm_runtime, dev);
return sprintf(buf, "%ld\n", rtd->pmdown_time); return sprintf(buf, "%ld\n", rtd->pmdown_time);
} }
...@@ -190,8 +188,7 @@ static ssize_t pmdown_time_set(struct device *dev, ...@@ -190,8 +188,7 @@ static ssize_t pmdown_time_set(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct snd_soc_pcm_runtime *rtd = struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
container_of(dev, struct snd_soc_pcm_runtime, dev);
int ret; int ret;
ret = strict_strtol(buf, 10, &rtd->pmdown_time); ret = strict_strtol(buf, 10, &rtd->pmdown_time);
...@@ -884,9 +881,9 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order) ...@@ -884,9 +881,9 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
/* unregister the rtd device */ /* unregister the rtd device */
if (rtd->dev_registered) { if (rtd->dev_registered) {
device_remove_file(&rtd->dev, &dev_attr_pmdown_time); device_remove_file(rtd->dev, &dev_attr_pmdown_time);
device_remove_file(&rtd->dev, &dev_attr_codec_reg); device_remove_file(rtd->dev, &dev_attr_codec_reg);
device_unregister(&rtd->dev); device_unregister(rtd->dev);
rtd->dev_registered = 0; rtd->dev_registered = 0;
} }
...@@ -1061,7 +1058,10 @@ static int soc_probe_platform(struct snd_soc_card *card, ...@@ -1061,7 +1058,10 @@ static int soc_probe_platform(struct snd_soc_card *card,
return ret; return ret;
} }
static void rtd_release(struct device *dev) {} static void rtd_release(struct device *dev)
{
kfree(dev);
}
static int soc_post_component_init(struct snd_soc_card *card, static int soc_post_component_init(struct snd_soc_card *card,
struct snd_soc_codec *codec, struct snd_soc_codec *codec,
...@@ -1104,11 +1104,17 @@ static int soc_post_component_init(struct snd_soc_card *card, ...@@ -1104,11 +1104,17 @@ static int soc_post_component_init(struct snd_soc_card *card,
/* register the rtd device */ /* register the rtd device */
rtd->codec = codec; rtd->codec = codec;
rtd->dev.parent = card->dev;
rtd->dev.release = rtd_release; rtd->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
rtd->dev.init_name = name; if (!rtd->dev)
return -ENOMEM;
device_initialize(rtd->dev);
rtd->dev->parent = card->dev;
rtd->dev->release = rtd_release;
rtd->dev->init_name = name;
dev_set_drvdata(rtd->dev, rtd);
mutex_init(&rtd->pcm_mutex); mutex_init(&rtd->pcm_mutex);
ret = device_register(&rtd->dev); ret = device_add(rtd->dev);
if (ret < 0) { if (ret < 0) {
dev_err(card->dev, dev_err(card->dev,
"asoc: failed to register runtime device: %d\n", ret); "asoc: failed to register runtime device: %d\n", ret);
...@@ -1117,14 +1123,14 @@ static int soc_post_component_init(struct snd_soc_card *card, ...@@ -1117,14 +1123,14 @@ static int soc_post_component_init(struct snd_soc_card *card,
rtd->dev_registered = 1; rtd->dev_registered = 1;
/* add DAPM sysfs entries for this codec */ /* add DAPM sysfs entries for this codec */
ret = snd_soc_dapm_sys_add(&rtd->dev); ret = snd_soc_dapm_sys_add(rtd->dev);
if (ret < 0) if (ret < 0)
dev_err(codec->dev, dev_err(codec->dev,
"asoc: failed to add codec dapm sysfs entries: %d\n", "asoc: failed to add codec dapm sysfs entries: %d\n",
ret); ret);
/* add codec sysfs entries */ /* add codec sysfs entries */
ret = device_create_file(&rtd->dev, &dev_attr_codec_reg); ret = device_create_file(rtd->dev, &dev_attr_codec_reg);
if (ret < 0) if (ret < 0)
dev_err(codec->dev, dev_err(codec->dev,
"asoc: failed to add codec sysfs files: %d\n", ret); "asoc: failed to add codec sysfs files: %d\n", ret);
...@@ -1213,7 +1219,7 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order) ...@@ -1213,7 +1219,7 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order)
if (ret) if (ret)
return ret; return ret;
ret = device_create_file(&rtd->dev, &dev_attr_pmdown_time); ret = device_create_file(rtd->dev, &dev_attr_pmdown_time);
if (ret < 0) if (ret < 0)
printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n"); printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n");
...@@ -1311,8 +1317,8 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num) ...@@ -1311,8 +1317,8 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num)
/* unregister the rtd device */ /* unregister the rtd device */
if (rtd->dev_registered) { if (rtd->dev_registered) {
device_remove_file(&rtd->dev, &dev_attr_codec_reg); device_remove_file(rtd->dev, &dev_attr_codec_reg);
device_unregister(&rtd->dev); device_del(rtd->dev);
rtd->dev_registered = 0; rtd->dev_registered = 0;
} }
......
...@@ -1738,8 +1738,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, ...@@ -1738,8 +1738,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
static ssize_t dapm_widget_show(struct device *dev, static ssize_t dapm_widget_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct snd_soc_pcm_runtime *rtd = struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
container_of(dev, struct snd_soc_pcm_runtime, dev);
struct snd_soc_codec *codec =rtd->codec; struct snd_soc_codec *codec =rtd->codec;
struct snd_soc_dapm_widget *w; struct snd_soc_dapm_widget *w;
int count = 0; int count = 0;
......
...@@ -330,7 +330,6 @@ static u64 tegra_dma_mask = DMA_BIT_MASK(32); ...@@ -330,7 +330,6 @@ static u64 tegra_dma_mask = DMA_BIT_MASK(32);
static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd) static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
struct snd_soc_dai *dai = rtd->cpu_dai;
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
int ret = 0; int ret = 0;
...@@ -339,14 +338,14 @@ static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -339,14 +338,14 @@ static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd)
if (!card->dev->coherent_dma_mask) if (!card->dev->coherent_dma_mask)
card->dev->coherent_dma_mask = 0xffffffff; card->dev->coherent_dma_mask = 0xffffffff;
if (dai->driver->playback.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
ret = tegra_pcm_preallocate_dma_buffer(pcm, ret = tegra_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_PLAYBACK); SNDRV_PCM_STREAM_PLAYBACK);
if (ret) if (ret)
goto err; goto err;
} }
if (dai->driver->capture.channels_min) { if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = tegra_pcm_preallocate_dma_buffer(pcm, ret = tegra_pcm_preallocate_dma_buffer(pcm,
SNDRV_PCM_STREAM_CAPTURE); SNDRV_PCM_STREAM_CAPTURE);
if (ret) if (ret)
......
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