]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00178459 mxc_spdif: fix read access for debug info
authorAdrian Alonso <aalonso@freescale.com>
Mon, 14 May 2012 23:02:35 +0000 (18:02 -0500)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:34:36 +0000 (08:34 +0200)
* 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 <aalonso@freescale.com>
sound/soc/codecs/mxc_spdif.c

index 29a5636cb9782958f07e6a3d00b7a70e4d573a88..26b0af1bdca28df1b183c005446a689aa97ea230 100644 (file)
@@ -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;