soc: Add ratelimit to supress the pr_err/dev_err.

Add ratelimit to supress the logs flooding at the
time of SSR.In all places defined ratelimit as,
in 1sec one debug msg prints.

Change-Id: I6dfe140848e5cecb1b311c432f8311cdf0615a58
Signed-off-by: Prasad Kumpatla <nkumpat@codeaurora.org>
This commit is contained in:
Prasad Kumpatla
2020-09-02 19:59:00 +05:30
parent c7638af482
commit a07613afcd
6 changed files with 47 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
@@ -14,6 +14,7 @@
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <dt-bindings/clock/qcom,audio-ext-clk.h>
#include <linux/ratelimit.h>
#include <dsp/q6afe-v2.h>
#include "audio-ext-clk-up.h"
@@ -67,6 +68,7 @@ static int audio_ext_clk_prepare(struct clk_hw *hw)
struct audio_ext_clk_priv *clk_priv = to_audio_clk(hw);
struct pinctrl_info *pnctrl_info = &clk_priv->audio_clk.pnctrl_info;
int ret;
static DEFINE_RATELIMIT_STATE(rtl, 1 * HZ, 1);
if ((clk_priv->clk_src >= AUDIO_EXT_CLK_LPASS) &&
(clk_priv->clk_src < AUDIO_EXT_CLK_LPASS_MAX)) {
@@ -75,7 +77,8 @@ static int audio_ext_clk_prepare(struct clk_hw *hw)
__func__, clk_priv->clk_src);
ret = afe_set_lpass_clk_cfg(IDX_RSVD_3, &clk_priv->clk_cfg);
if (ret < 0) {
pr_err_ratelimited("%s afe_set_digital_codec_core_clock failed\n",
if (__ratelimit(&rtl))
pr_err_ratelimited("%s afe_set_digital_codec_core_clock failed\n",
__func__);
return ret;
}
@@ -101,6 +104,7 @@ static void audio_ext_clk_unprepare(struct clk_hw *hw)
struct audio_ext_clk_priv *clk_priv = to_audio_clk(hw);
struct pinctrl_info *pnctrl_info = &clk_priv->audio_clk.pnctrl_info;
int ret;
static DEFINE_RATELIMIT_STATE(rtl, 1 * HZ, 1);
if (pnctrl_info->pinctrl) {
ret = pinctrl_select_state(pnctrl_info->pinctrl,
@@ -118,9 +122,11 @@ static void audio_ext_clk_unprepare(struct clk_hw *hw)
trace_printk("%s: unvote for %d clock\n",
__func__, clk_priv->clk_src);
ret = afe_set_lpass_clk_cfg(IDX_RSVD_3, &clk_priv->clk_cfg);
if (ret < 0)
pr_err_ratelimited("%s: afe_set_lpass_clk_cfg failed, ret = %d\n",
if (ret < 0) {
if (__ratelimit(&rtl))
pr_err_ratelimited("%s: afe_set_lpass_clk_cfg failed, ret = %d\n",
__func__, ret);
}
}
if (pnctrl_info->base)
@@ -149,6 +155,7 @@ static int lpass_hw_vote_prepare(struct clk_hw *hw)
{
struct audio_ext_clk_priv *clk_priv = to_audio_clk(hw);
int ret;
static DEFINE_RATELIMIT_STATE(rtl, 1 * HZ, 1);
if (clk_priv->clk_src == AUDIO_EXT_CLK_LPASS_CORE_HW_VOTE) {
trace_printk("%s: vote for %d clock\n",
@@ -170,7 +177,8 @@ static int lpass_hw_vote_prepare(struct clk_hw *hw)
"LPASS_HW_DCODEC",
&clk_priv->lpass_audio_hwvote_client_handle);
if (ret < 0) {
pr_err("%s lpass audio hw vote failed %d\n",
if (__ratelimit(&rtl))
pr_err("%s lpass audio hw vote failed %d\n",
__func__, ret);
return ret;
}