MLK-14679-2: ASoC: fsl_asrc: Add warning message
authorShengjiu Wang <shengjiu.wang@freescale.com>
Wed, 12 Apr 2017 06:51:43 +0000 (14:51 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:21:54 +0000 (15:21 -0500)
Add warning message for both divider of input clock and output clock
exceed the maximum value. which is useful for debugging.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
sound/soc/fsl/fsl_asrc.c

index e0b8534..9ee55c6 100644 (file)
@@ -2,6 +2,7 @@
  * Freescale ASRC ALSA SoC Digital Audio Interface (DAI) driver
  *
  * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
+ * Copyright 2017 NXP
  *
  * Author: Nicolin Chen <nicoleotsuka@gmail.com>
  *
@@ -27,6 +28,9 @@
 #define pair_err(fmt, ...) \
        dev_err(&asrc_priv->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
 
+#define pair_warn(fmt, ...) \
+       dev_warn(&asrc_priv->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
+
 #define pair_dbg(fmt, ...) \
        dev_dbg(&asrc_priv->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
 
@@ -354,6 +358,11 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool p2p_in, bool p2
                return -EINVAL;
        }
 
+       if (div[IN] > 1024 && div[OUT] > 1024) {
+               pair_warn("both divider (%d, %d) are larger than threshold\n",
+                                                       div[IN], div[OUT]);
+       }
+
        if (div[IN] > 1024)
                div[IN] = 1024;