asoc: codecs: Replace dev_err/info with ratelimit prints
replace all dev(pr)_err/info logs that could potentially flood kernel logs with ratelimit functions dev_err_ratelimited and dev_info_ratelimited Change-Id: I32dc6002dead1a07622978c4de63d541c01982fd Signed-off-by: Shazmaan Ali <quic_shazmaan@quicinc.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -496,13 +497,13 @@ static bool lpass_cdc_wsa2_macro_get_data(struct snd_soc_component *component,
|
||||
*wsa2_dev = lpass_cdc_get_device_ptr(component->dev,
|
||||
WSA2_MACRO);
|
||||
if (!(*wsa2_dev)) {
|
||||
dev_err(component->dev,
|
||||
dev_err_ratelimited(component->dev,
|
||||
"%s: null device for macro!\n", func_name);
|
||||
return false;
|
||||
}
|
||||
*wsa2_priv = dev_get_drvdata((*wsa2_dev));
|
||||
if (!(*wsa2_priv) || !(*wsa2_priv)->component) {
|
||||
dev_err(component->dev,
|
||||
dev_err_ratelimited(component->dev,
|
||||
"%s: priv is null for macro!\n", func_name);
|
||||
return false;
|
||||
}
|
||||
@@ -555,7 +556,7 @@ static int lpass_cdc_wsa2_macro_set_prim_interpolator_rate(struct snd_soc_dai *d
|
||||
int_1_mix1_inp = port;
|
||||
if ((int_1_mix1_inp < LPASS_CDC_WSA2_MACRO_RX0) ||
|
||||
(int_1_mix1_inp > LPASS_CDC_WSA2_MACRO_RX_MIX1)) {
|
||||
dev_err(wsa2_dev,
|
||||
dev_err_ratelimited(wsa2_dev,
|
||||
"%s: Invalid RX port, Dai ID is %d\n",
|
||||
__func__, dai->id);
|
||||
return -EINVAL;
|
||||
@@ -627,7 +628,7 @@ static int lpass_cdc_wsa2_macro_set_mix_interpolator_rate(struct snd_soc_dai *da
|
||||
int_2_inp = port;
|
||||
if ((int_2_inp < LPASS_CDC_WSA2_MACRO_RX0) ||
|
||||
(int_2_inp > LPASS_CDC_WSA2_MACRO_RX_MIX1)) {
|
||||
dev_err(wsa2_dev,
|
||||
dev_err_ratelimited(wsa2_dev,
|
||||
"%s: Invalid RX port, Dai ID is %d\n",
|
||||
__func__, dai->id);
|
||||
return -EINVAL;
|
||||
@@ -724,7 +725,7 @@ static int lpass_cdc_wsa2_macro_hw_params(struct snd_pcm_substream *substream,
|
||||
case SNDRV_PCM_STREAM_PLAYBACK:
|
||||
ret = lpass_cdc_wsa2_macro_set_interpolator_rate(dai, params_rate(params));
|
||||
if (ret) {
|
||||
dev_err(component->dev,
|
||||
dev_err_ratelimited(component->dev,
|
||||
"%s: cannot set sample rate: %u\n",
|
||||
__func__, params_rate(params));
|
||||
return ret;
|
||||
@@ -790,7 +791,7 @@ static int lpass_cdc_wsa2_macro_get_channel_map(struct snd_soc_dai *dai,
|
||||
*tx_num = cnt;
|
||||
break;
|
||||
default:
|
||||
dev_err(wsa2_dev, "%s: Invalid AIF\n", __func__);
|
||||
dev_err_ratelimited(wsa2_dev, "%s: Invalid AIF\n", __func__);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@@ -856,7 +857,7 @@ static int lpass_cdc_wsa2_macro_mclk_enable(
|
||||
int ret = 0;
|
||||
|
||||
if (regmap == NULL) {
|
||||
dev_err(wsa2_priv->dev, "%s: regmap is NULL\n", __func__);
|
||||
dev_err_ratelimited(wsa2_priv->dev, "%s: regmap is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -895,7 +896,7 @@ static int lpass_cdc_wsa2_macro_mclk_enable(
|
||||
wsa2_priv->wsa2_mclk_users++;
|
||||
} else {
|
||||
if (wsa2_priv->wsa2_mclk_users <= 0) {
|
||||
dev_err(wsa2_priv->dev, "%s: clock already disabled\n",
|
||||
dev_err_ratelimited(wsa2_priv->dev, "%s: clock already disabled\n",
|
||||
__func__);
|
||||
wsa2_priv->wsa2_mclk_users = 0;
|
||||
goto exit;
|
||||
@@ -950,7 +951,7 @@ static int lpass_cdc_wsa2_macro_mclk_event(struct snd_soc_dapm_widget *w,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dev_err(wsa2_priv->dev,
|
||||
dev_err_ratelimited(wsa2_priv->dev,
|
||||
"%s: invalid DAPM event %d\n", __func__, event);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
@@ -1227,7 +1228,7 @@ static int lpass_cdc_wsa2_macro_enable_mix_path(struct snd_soc_dapm_widget *w,
|
||||
} else if (!(strcmp(w->name, "WSA2_RX1 MIX INP"))) {
|
||||
gain_reg = LPASS_CDC_WSA2_RX1_RX_VOL_MIX_CTL;
|
||||
} else {
|
||||
dev_err(component->dev, "%s: No gain register avail for %s\n",
|
||||
dev_err_ratelimited(component->dev, "%s: No gain register avail for %s\n",
|
||||
__func__, w->name);
|
||||
return 0;
|
||||
}
|
||||
@@ -1547,7 +1548,7 @@ static int lpass_cdc_wsa2_macro_enable_interpolator(struct snd_soc_dapm_widget *
|
||||
} else if (!(strcmp(w->name, "WSA2_RX INT1 INTERP"))) {
|
||||
reg = LPASS_CDC_WSA2_RX1_RX_PATH_CTL;
|
||||
} else {
|
||||
dev_err(component->dev, "%s: Interpolator reg not found\n",
|
||||
dev_err_ratelimited(component->dev, "%s: Interpolator reg not found\n",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1627,7 +1628,7 @@ static int lpass_cdc_wsa2_macro_spk_boost_event(struct snd_soc_dapm_widget *w,
|
||||
reg = LPASS_CDC_WSA2_RX1_RX_PATH_CTL;
|
||||
reg_mix = LPASS_CDC_WSA2_RX1_RX_PATH_MIX_CTL;
|
||||
} else {
|
||||
dev_err(component->dev, "%s: unknown widget: %s\n",
|
||||
dev_err_ratelimited(component->dev, "%s: unknown widget: %s\n",
|
||||
__func__, w->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1792,7 +1793,7 @@ static int lpass_cdc_wsa2_macro_enable_vbat(struct snd_soc_dapm_widget *w,
|
||||
LPASS_CDC_WSA2_VBAT_BCL_VBAT_PATH_CTL, 0x10, 0x00);
|
||||
break;
|
||||
default:
|
||||
dev_err(wsa2_dev, "%s: Invalid event %d\n", __func__, event);
|
||||
dev_err_ratelimited(wsa2_dev, "%s: Invalid event %d\n", __func__, event);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@@ -1821,7 +1822,7 @@ static int lpass_cdc_wsa2_macro_enable_echo(struct snd_soc_dapm_widget *w,
|
||||
ec_tx = ((val & 0x38) >> 0x3) - 1;
|
||||
|
||||
if (ec_tx < 0 || ec_tx >= (LPASS_CDC_WSA2_MACRO_RX1 + 1)) {
|
||||
dev_err(wsa2_dev, "%s: EC mix control not set correctly\n",
|
||||
dev_err_ratelimited(wsa2_dev, "%s: EC mix control not set correctly\n",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1937,7 +1938,7 @@ static int lpass_cdc_wsa2_macro_set_rx_mute_status(struct snd_kcontrol *kcontrol
|
||||
0x10, value << 4);
|
||||
break;
|
||||
default:
|
||||
pr_err("%s: invalid argument rx_shift = %d\n", __func__,
|
||||
pr_err_ratelimited("%s: invalid argument rx_shift = %d\n", __func__,
|
||||
wsa2_rx_shift);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
@@ -1967,7 +1968,7 @@ static int lpass_cdc_wsa2_macro_set_digital_volume(struct snd_kcontrol *kcontrol
|
||||
return -EINVAL;
|
||||
|
||||
if (!wsa2_priv) {
|
||||
pr_err("%s: priv is null for macro!\n",
|
||||
pr_err_ratelimited("%s: priv is null for macro!\n",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1987,7 +1988,7 @@ static int lpass_cdc_wsa2_macro_set_digital_volume(struct snd_kcontrol *kcontrol
|
||||
gain = (u8)(wsa2_priv->rx1_origin_gain -
|
||||
wsa2_priv->thermal_cur_state);
|
||||
} else {
|
||||
dev_err(wsa2_priv->dev,
|
||||
dev_err_ratelimited(wsa2_priv->dev,
|
||||
"%s: Incorrect RX Path selected\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -2168,11 +2169,11 @@ static int lpass_cdc_wsa2_macro_rx_mux_put(struct snd_kcontrol *kcontrol,
|
||||
aif_rst = wsa2_priv->rx_port_value[widget->shift];
|
||||
if (!rx_port_value) {
|
||||
if (aif_rst == 0) {
|
||||
dev_err(wsa2_dev, "%s: AIF reset already\n", __func__);
|
||||
dev_err_ratelimited(wsa2_dev, "%s: AIF reset already\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
if (aif_rst >= LPASS_CDC_WSA2_MACRO_RX_MAX) {
|
||||
dev_err(wsa2_dev, "%s: Invalid AIF reset\n", __func__);
|
||||
dev_err_ratelimited(wsa2_dev, "%s: Invalid AIF reset\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -2199,7 +2200,7 @@ static int lpass_cdc_wsa2_macro_rx_mux_put(struct snd_kcontrol *kcontrol,
|
||||
wsa2_priv->active_ch_cnt[rx_port_value]++;
|
||||
break;
|
||||
default:
|
||||
dev_err(wsa2_dev,
|
||||
dev_err_ratelimited(wsa2_dev,
|
||||
"%s: Invalid AIF_ID for WSA2 RX MUX %d\n",
|
||||
__func__, rx_port_value);
|
||||
return -EINVAL;
|
||||
@@ -2754,7 +2755,7 @@ static int lpass_cdc_wsa2_macro_core_vote(void *handle, bool enable)
|
||||
struct lpass_cdc_wsa2_macro_priv *wsa2_priv = (struct lpass_cdc_wsa2_macro_priv *) handle;
|
||||
|
||||
if (wsa2_priv == NULL) {
|
||||
pr_err("%s: wsa2 priv data is NULL\n", __func__);
|
||||
pr_err_ratelimited("%s: wsa2 priv data is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (enable) {
|
||||
@@ -2777,7 +2778,7 @@ static int wsa2_swrm_clock(void *handle, bool enable)
|
||||
int ret = 0;
|
||||
|
||||
if (regmap == NULL) {
|
||||
dev_err(wsa2_priv->dev, "%s: regmap is NULL\n", __func__);
|
||||
dev_err_ratelimited(wsa2_priv->dev, "%s: regmap is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -2833,7 +2834,7 @@ static int wsa2_swrm_clock(void *handle, bool enable)
|
||||
pm_runtime_put_autosuspend(wsa2_priv->dev);
|
||||
} else {
|
||||
if (wsa2_priv->swr_clk_users <= 0) {
|
||||
dev_err(wsa2_priv->dev, "%s: clock already disabled\n",
|
||||
dev_err_ratelimited(wsa2_priv->dev, "%s: clock already disabled\n",
|
||||
__func__);
|
||||
wsa2_priv->swr_clk_users = 0;
|
||||
goto exit;
|
||||
@@ -2871,7 +2872,7 @@ static int lpass_cdc_wsa2_macro_get_max_state(
|
||||
{
|
||||
struct lpass_cdc_wsa2_macro_priv *wsa2_priv = cdev->devdata;
|
||||
if (!wsa2_priv) {
|
||||
pr_err("%s: cdev->devdata is NULL\n", __func__);
|
||||
pr_err_ratelimited("%s: cdev->devdata is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
*state = wsa2_priv->thermal_max_state;
|
||||
@@ -2886,7 +2887,7 @@ static int lpass_cdc_wsa2_macro_get_cur_state(
|
||||
struct lpass_cdc_wsa2_macro_priv *wsa2_priv = cdev->devdata;
|
||||
|
||||
if (!wsa2_priv) {
|
||||
pr_err("%s: cdev->devdata is NULL\n", __func__);
|
||||
pr_err_ratelimited("%s: cdev->devdata is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
*state = wsa2_priv->thermal_cur_state;
|
||||
@@ -2902,14 +2903,14 @@ static int lpass_cdc_wsa2_macro_set_cur_state(
|
||||
struct lpass_cdc_wsa2_macro_priv *wsa2_priv = cdev->devdata;
|
||||
|
||||
if (!wsa2_priv || !wsa2_priv->dev) {
|
||||
pr_err("%s: cdev->devdata is NULL\n", __func__);
|
||||
pr_err_ratelimited("%s: cdev->devdata is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (state <= wsa2_priv->thermal_max_state) {
|
||||
wsa2_priv->thermal_cur_state = state;
|
||||
} else {
|
||||
dev_err(wsa2_priv->dev,
|
||||
dev_err_ratelimited(wsa2_priv->dev,
|
||||
"%s: incorrect requested state:%d\n",
|
||||
__func__, state);
|
||||
return -EINVAL;
|
||||
@@ -3119,12 +3120,12 @@ static void lpass_cdc_wsa2_macro_cooling_adjust_gain(struct work_struct *work)
|
||||
wsa2_priv = container_of(work, struct lpass_cdc_wsa2_macro_priv,
|
||||
lpass_cdc_wsa2_macro_cooling_work);
|
||||
if (!wsa2_priv) {
|
||||
pr_err("%s: priv is null for macro!\n",
|
||||
pr_err_ratelimited("%s: priv is null for macro!\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
if (!wsa2_priv->dev || !wsa2_priv->dev->of_node) {
|
||||
dev_err(wsa2_priv->dev,
|
||||
dev_err_ratelimited(wsa2_priv->dev,
|
||||
"%s: DT node for wsa2_priv does not exist\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user