Commit 17d59d9e authored by Johan Hovold's avatar Johan Hovold Committed by Mark Brown

ASoC: codecs: wcd938x: use dev_printk() for impedance logging

Pass the component structure also to the
wcd938x_mbhc_get_result_params() helper so that the component device can
be used for logging consistently.
Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230630142717.5314-4-johan+linaro@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5db9fe95
...@@ -2124,10 +2124,11 @@ static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *compon ...@@ -2124,10 +2124,11 @@ static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *compon
return wcd938x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2); return wcd938x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2);
} }
static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, static void wcd938x_mbhc_get_result_params(struct snd_soc_component *component,
s16 *d1_a, u16 noff, s16 *d1_a, u16 noff,
int32_t *zdet) int32_t *zdet)
{ {
struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
int i; int i;
int val, val1; int val, val1;
s16 c1; s16 c1;
...@@ -2154,8 +2155,8 @@ static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, ...@@ -2154,8 +2155,8 @@ static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x,
usleep_range(5000, 5050); usleep_range(5000, 5050);
if (!c1 || !x1) { if (!c1 || !x1) {
pr_err("%s: Impedance detect ramp error, c1=%d, x1=0x%x\n", dev_err(component->dev, "Impedance detect ramp error, c1=%d, x1=0x%x\n",
__func__, c1, x1); c1, x1);
goto ramp_down; goto ramp_down;
} }
d1 = d1_a[c1]; d1 = d1_a[c1];
...@@ -2165,8 +2166,8 @@ static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, ...@@ -2165,8 +2166,8 @@ static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x,
else if (x1 < minCode_param[noff]) else if (x1 < minCode_param[noff])
*zdet = WCD938X_ZDET_FLOATING_IMPEDANCE; *zdet = WCD938X_ZDET_FLOATING_IMPEDANCE;
pr_debug("%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n", dev_dbg(component->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n",
__func__, d1, c1, x1, *zdet); __func__, d1, c1, x1, *zdet);
ramp_down: ramp_down:
i = 0; i = 0;
while (x1) { while (x1) {
...@@ -2210,7 +2211,7 @@ static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, ...@@ -2210,7 +2211,7 @@ static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component,
WCD938X_ANA_MBHC_ZDET, 0x80, 0x80); WCD938X_ANA_MBHC_ZDET, 0x80, 0x80);
dev_dbg(component->dev, "%s: ramp for HPH_L, noff = %d\n", dev_dbg(component->dev, "%s: ramp for HPH_L, noff = %d\n",
__func__, zdet_param->noff); __func__, zdet_param->noff);
wcd938x_mbhc_get_result_params(wcd938x, d1_a, zdet_param->noff, &zdet); wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet);
regmap_update_bits(wcd938x->regmap, regmap_update_bits(wcd938x->regmap,
WCD938X_ANA_MBHC_ZDET, 0x80, 0x00); WCD938X_ANA_MBHC_ZDET, 0x80, 0x00);
...@@ -2224,7 +2225,7 @@ static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, ...@@ -2224,7 +2225,7 @@ static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component,
WCD938X_ANA_MBHC_ZDET, 0x40, 0x40); WCD938X_ANA_MBHC_ZDET, 0x40, 0x40);
dev_dbg(component->dev, "%s: ramp for HPH_R, noff = %d\n", dev_dbg(component->dev, "%s: ramp for HPH_R, noff = %d\n",
__func__, zdet_param->noff); __func__, zdet_param->noff);
wcd938x_mbhc_get_result_params(wcd938x, d1_a, zdet_param->noff, &zdet); wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet);
regmap_update_bits(wcd938x->regmap, regmap_update_bits(wcd938x->regmap,
WCD938X_ANA_MBHC_ZDET, 0x40, 0x00); WCD938X_ANA_MBHC_ZDET, 0x40, 0x00);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment