From: Adrian Alonso Date: Mon, 14 May 2012 23:02:35 +0000 (-0500) Subject: ENGR00178459 mxc_spdif: fix read access for debug info X-Git-Tag: v3.0.35-fsl~1056 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=576f5210e55e7226c67fa143fcc8449409ba713e;p=karo-tx-linux.git ENGR00178459 mxc_spdif: fix read access for debug info * Fix read register access for debug info * Read from spdif registers with a disabled spdif core clock leads to kernel hang. * Avoid it by enabling/diabling core clk. Signed-off-by: Adrian Alonso --- diff --git a/sound/soc/codecs/mxc_spdif.c b/sound/soc/codecs/mxc_spdif.c index 29a5636cb978..26b0af1bdca2 100644 --- a/sound/soc/codecs/mxc_spdif.c +++ b/sound/soc/codecs/mxc_spdif.c @@ -81,10 +81,13 @@ struct spdif_mixer_control mxc_spdif_control; static unsigned long spdif_base_addr; #if MXC_SPDIF_DEBUG -static void dumpregs(void) +static void dumpregs(struct mxc_spdif_priv *priv) { unsigned int value, i; + if (!priv->tx_active || !priv->rx_active) + clk_enable(priv->plat_data->spdif_core_clk); + for (i = 0 ; i <= 0x38 ; i += 4) { value = readl(spdif_base_addr + i) & 0xffffff; pr_debug("reg 0x%02x = 0x%06x\n", i, value); @@ -97,9 +100,12 @@ static void dumpregs(void) i = 0x50; value = readl(spdif_base_addr + i) & 0xffffff; pr_debug("reg 0x%02x = 0x%06x\n", i, value); + + if (!priv->tx_active || !priv->rx_active) + clk_disable(priv->plat_data->spdif_core_clk); } #else -static void dumpregs(void) {} +static void dumpregs(struct mxc_spdif_priv *priv) {} #endif /* define each spdif interrupt handlers */ @@ -588,7 +594,7 @@ static int mxc_spdif_playback_prepare(struct snd_pcm_substream *substream, regval |= SCR_DMA_TX_EN; __raw_writel(regval, SPDIF_REG_SCR + spdif_base_addr); - dumpregs(); + dumpregs(spdif_priv); return 0; } @@ -603,7 +609,7 @@ static int mxc_spdif_playback_shutdown(struct snd_pcm_substream *substream, if (!plat_data->spdif_tx) return -EINVAL; - dumpregs(); + dumpregs(spdif_priv); pr_debug("SIS: 0x%08x\n", __raw_readl(spdif_base_addr + SPDIF_REG_SIS)); spdif_intr_status(); @@ -1286,7 +1292,7 @@ static int __devinit mxc_spdif_probe(struct platform_device *pdev) goto card_err; } - dumpregs(); + dumpregs(spdif_priv); return 0;