From 41c73b6e89c69cbe36fae5b24da04d6fb52c3b11 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Fri, 25 May 2012 17:27:20 -0300 Subject: ASoC: imx-ssi: Use clk_prepare_enable/clk_disable_unprepare Fix the following kernel crash: ------------[ cut here ]------------ WARNING: at drivers/clk/clk.c:508 __clk_enable+0x9c/0xa8() Modules linked in: Backtrace: [<80011ef4>] (dump_backtrace+0x0/0x10c) from [<803fd48c>] (dump_stack+0x18/0x1c) r7:00000009 r6:000001fc r5:803002ac r4:00000000 [<803fd474>] (dump_stack+0x0/0x1c) from [<8002003c>] (warn_slowpath_common+0x54/0x6c) [<8001ffe8>] (warn_slowpath_common+0x0/0x6c) from [<80020078>] (warn_slowpath_null+0x24/0x2c) r9:00000090 r8:8600e2c0 r7:8605c808 r6:8605c800 r5:8605d780 r4:8600e2c0 [<80020054>] (warn_slowpath_null+0x0/0x2c) from [<803002ac>] (__clk_enable+0x9c/0xa8) [<80300210>] (__clk_enable+0x0/0xa8) from [<803002d0>] (clk_enable+0x18/0x30) r5:8605d780 r4:80000013 [<803002b8>] (clk_enable+0x0/0x30) from [<803247c4>] (imx_ssi_probe+0xa0/0x4f4) r5:8605d780 r4:86174180 [<80324724>] (imx_ssi_probe+0x0/0x4f4) from [<8022b0fc>] (platform_drv_probe+0x20/0x24) [<8022b0dc>] (platform_drv_probe+0x0/0x24) from [<80229c40>] (driver_probe_device+0x80/0x1f0) [<80229bc0>] (driver_probe_device+0x0/0x1f0) from [<80229e44>] (__driver_attach+0x94/0x98) r9:00000090 r8:805b7800 r7:00000000 r6:8605c83c r5:805b1b44 r4:8605c808 [<80229db0>] (__driver_attach+0x0/0x98) from [<8022856c>] (bus_for_each_dev+0x68/0x94) r7:00000000 r6:80229db0 r5:86033eb0 r4:805b1b44 [<80228504>] (bus_for_each_dev+0x0/0x94) from [<80229aa0>] (driver_attach+0x20/0x28) r7:00000000 r6:86174100 r5:8059f6d0 r4:805b1b44 [<80229a80>] (driver_attach+0x0/0x28) from [<80228d50>] (bus_add_driver+0x18c/0x268) [<80228bc4>] (bus_add_driver+0x0/0x268) from [<8022a474>] (driver_register+0x80/0x134) [<8022a3f4>] (driver_register+0x0/0x134) from [<8022b4a4>] (platform_driver_register+0x4c/0x60) r7:00000000 r6:805b7800 r5:00000018 r4:86032000 [<8022b458>] (platform_driver_register+0x0/0x60) from [<80556890>] (imx_ssi_driver_init+0x14/0x1c) [<8055687c>] (imx_ssi_driver_init+0x0/0x1c) from [<8000868c>] (do_one_initcall+0x40/0x194) [<8000864c>] (do_one_initcall+0x0/0x194) from [<8052f3b0>] (kernel_init+0x114/0x1f0) [<8052f29c>] (kernel_init+0x0/0x1f0) from [<8002445c>] (do_exit+0x0/0x788) ---[ end trace d4aa739205917dbb ]--- asoc: mc13783-hifi <-> imx-ssi.0 mapping ok Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- sound/soc/fsl/imx-ssi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c index cf3ed0362c9c..28dd76c7cb1c 100644 --- a/sound/soc/fsl/imx-ssi.c +++ b/sound/soc/fsl/imx-ssi.c @@ -543,7 +543,7 @@ static int imx_ssi_probe(struct platform_device *pdev) ret); goto failed_clk; } - clk_enable(ssi->clk); + clk_prepare_enable(ssi->clk); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -641,7 +641,7 @@ failed_ac97: failed_ioremap: release_mem_region(res->start, resource_size(res)); failed_get_resource: - clk_disable(ssi->clk); + clk_disable_unprepare(ssi->clk); clk_put(ssi->clk); failed_clk: kfree(ssi); @@ -664,7 +664,7 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev) iounmap(ssi->base); release_mem_region(res->start, resource_size(res)); - clk_disable(ssi->clk); + clk_disable_unprepare(ssi->clk); clk_put(ssi->clk); kfree(ssi); -- cgit v1.2.3 From e42bb9bfbb43366cd1899c9564d043c41ebd8852 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 24 May 2012 23:55:11 -0700 Subject: ASoC: fsi: bugfix: enable master clock control on DMA stream DMA stream handler didn't care about master clock. This patch fixes it up. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/fsi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 7cee22515d9d..05582c12b902 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -1172,9 +1172,14 @@ static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io) static void fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io, int start) { + struct fsi_master *master = fsi_get_master(fsi); + u32 clk = fsi_is_port_a(fsi) ? CRA : CRB; u32 enable = start ? DMA_ON : 0; fsi_reg_mask_set(fsi, OUT_DMAC, DMA_ON, enable); + + if (fsi_is_clk_master(fsi)) + fsi_master_mask_set(master, CLK_RST, clk, (enable) ? clk : 0); } static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io) -- cgit v1.2.3 From 4a1b09b79b07cf70c72a091e8fe0660f68541f30 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 28 May 2012 23:27:49 -0700 Subject: ASoC: fsi: bugfix: correct dma area FSI driver is using dma_sync_single_xxx(), but the dma area was not correct. This patch fix it up. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/fsi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 05582c12b902..6e750a8ae2a9 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -1052,6 +1052,13 @@ static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io) return 0; } +static dma_addr_t fsi_dma_get_area(struct fsi_stream *io) +{ + struct snd_pcm_runtime *runtime = io->substream->runtime; + + return io->dma + samples_to_bytes(runtime, io->buff_sample_pos); +} + static void fsi_dma_complete(void *data) { struct fsi_stream *io = (struct fsi_stream *)data; @@ -1061,7 +1068,7 @@ static void fsi_dma_complete(void *data) enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ? DMA_TO_DEVICE : DMA_FROM_DEVICE; - dma_sync_single_for_cpu(dai->dev, io->dma, + dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io), samples_to_bytes(runtime, io->period_samples), dir); io->buff_sample_pos += io->period_samples; @@ -1078,13 +1085,6 @@ static void fsi_dma_complete(void *data) snd_pcm_period_elapsed(io->substream); } -static dma_addr_t fsi_dma_get_area(struct fsi_stream *io) -{ - struct snd_pcm_runtime *runtime = io->substream->runtime; - - return io->dma + samples_to_bytes(runtime, io->buff_sample_pos); -} - static void fsi_dma_do_tasklet(unsigned long data) { struct fsi_stream *io = (struct fsi_stream *)data; @@ -1110,7 +1110,7 @@ static void fsi_dma_do_tasklet(unsigned long data) len = samples_to_bytes(runtime, io->period_samples); buf = fsi_dma_get_area(io); - dma_sync_single_for_device(dai->dev, io->dma, len, dir); + dma_sync_single_for_device(dai->dev, buf, len, dir); sg_init_table(&sg, 1); sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)), -- cgit v1.2.3 From fbe42f66c66c279b4ed9b8f515058a09bc731c49 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 28 May 2012 23:28:22 -0700 Subject: ASoC: fsi: bugfix: ensure dma is terminated FSI DMAEngine has to be stopped certainly at the start/stop time. Without this patch, it will include noise on playback. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/fsi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 6e750a8ae2a9..2ef98536f1da 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -1178,6 +1178,8 @@ static void fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io, fsi_reg_mask_set(fsi, OUT_DMAC, DMA_ON, enable); + dmaengine_terminate_all(io->chan); + if (fsi_is_clk_master(fsi)) fsi_master_mask_set(master, CLK_RST, clk, (enable) ? clk : 0); } -- cgit v1.2.3 From 5cd5d7c44990658df6ab49f6253c39617c53b03d Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Fri, 18 May 2012 18:00:43 +0200 Subject: ALSA: usb-audio: fix rate_list memory leak The array of sample rates is reallocated every time when opening the PCM device, but was freed only once when unplugging the device. Reported-by: "Alexander E. Patrakov" Cc: Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/pcm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 24839d932648..cdf8b7601973 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -788,6 +788,9 @@ static int snd_usb_pcm_check_knot(struct snd_pcm_runtime *runtime, int count = 0, needs_knot = 0; int err; + kfree(subs->rate_list.list); + subs->rate_list.list = NULL; + list_for_each_entry(fp, &subs->fmt_list, list) { if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS) return 0; -- cgit v1.2.3 From a97bda7d29d02a2e9c6609d0947b15e55f5200e5 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Wed, 30 May 2012 14:23:18 +0200 Subject: ALSA: hdspm - Work around broken DDS value on PCI RME MADI On PCI RME MADI cards, the PLL register does not contain the proper value, so the calculated system_sample_rate is wrong. In this case, we simply return the cached rate from struct hdspm. Signed-off-by: Adrian Knoth Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdspm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 0a5027b94714..b8ac8710f47f 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -1988,6 +1988,13 @@ static int hdspm_get_system_sample_rate(struct hdspm *hdspm) period = hdspm_read(hdspm, HDSPM_RD_PLL_FREQ); rate = hdspm_calc_dds_value(hdspm, period); + if (rate > 207000) { + /* Unreasonable high sample rate as seen on PCI MADI cards. + * Use the cached value instead. + */ + rate = hdspm->system_sample_rate; + } + return rate; } -- cgit v1.2.3