[PATCH 0/5] ASoC: codecs: wcd938x/wcd934x: loglevel fix and cleanups
When investigating a race in the wcd938x driver I noticed that the MBHC impedance measurements where printed at error loglevel which is clearly wrong.
Fix that, and clean up the logging somewhat by using dev_printk() and addressing some style issues.
Included are also two patches that drop the bogus inline keywords from the functions involved.
Johan
Johan Hovold (5): ASoC: codecs: wcd938x: fix mbhc impedance loglevel ASoC: codecs: wcd938x: drop inline keywords ASoC: codecs: wcd938x: use dev_printk() for impedance logging ASoC: codecs: wcd934x: demote impedance printk loglevel ASoC: codecs: wcd934x: drop inline keywords
sound/soc/codecs/wcd934x.c | 8 ++++---- sound/soc/codecs/wcd938x.c | 17 +++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-)
Demote the MBHC impedance measurement printk, which is not an error message, from error to debug level.
While at it, fix the capitalisation of "ohm" and add the missing space before the opening parenthesis.
Fixes: bcee7ed09b8e ("ASoC: codecs: wcd938x: add Multi Button Headset Control support") Signed-off-by: Johan Hovold johan+linaro@kernel.org --- sound/soc/codecs/wcd938x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index e3ae4fb2c4db..b8a52a1a63d5 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2165,8 +2165,8 @@ static inline void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, else if (x1 < minCode_param[noff]) *zdet = WCD938X_ZDET_FLOATING_IMPEDANCE;
- pr_err("%s: d1=%d, c1=%d, x1=0x%x, z_val=%d(milliOhm)\n", - __func__, d1, c1, x1, *zdet); + pr_debug("%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n", + __func__, d1, c1, x1, *zdet); ramp_down: i = 0; while (x1) {
On Fri, Jun 30, 2023 at 04:27:13PM +0200, Johan Hovold wrote:
- pr_err("%s: d1=%d, c1=%d, x1=0x%x, z_val=%d(milliOhm)\n",
__func__, d1, c1, x1, *zdet);
- pr_debug("%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n",
__func__, d1, c1, x1, *zdet);
Indeed we should really be able to arrange to make this a dev_dbg().
Demote the MBHC impedance measurement printk, which is only needed for development and debugging, to debug level.
While at it, fix the capitalisation of "ohm" and add the missing space before the opening parenthesis.
Signed-off-by: Johan Hovold johan+linaro@kernel.org --- sound/soc/codecs/wcd934x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index c0d1fa36d841..9d724b5710f7 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -2683,7 +2683,7 @@ static inline void wcd934x_mbhc_get_result_params(struct wcd934x_codec *wcd934x, else if (x1 < minCode_param[noff]) *zdet = WCD934X_ZDET_FLOATING_IMPEDANCE;
- dev_info(wcd934x->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%d(milliOhm)\n", + dev_dbg(wcd934x->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%di (milliohm)\n", __func__, d1, c1, x1, *zdet); ramp_down: i = 0;
The compiler is generally better at deciding what functions should be inlined than driver authors are.
Drop the bogus inline keyword from two functions that were neither very small or used in a single place.
Signed-off-by: Johan Hovold johan+linaro@kernel.org --- sound/soc/codecs/wcd934x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 9d724b5710f7..a17cd75b969b 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -2642,7 +2642,7 @@ static int wcd934x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *compon return rc; }
-static inline void wcd934x_mbhc_get_result_params(struct wcd934x_codec *wcd934x, +static void wcd934x_mbhc_get_result_params(struct wcd934x_codec *wcd934x, s16 *d1_a, u16 noff, int32_t *zdet) { @@ -2740,8 +2740,8 @@ static void wcd934x_mbhc_zdet_ramp(struct snd_soc_component *component, *zr = zdet; }
-static inline void wcd934x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component, - int32_t *z_val, int flag_l_r) +static void wcd934x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component, + int32_t *z_val, int flag_l_r) { s16 q1; int q1_cal;
The compiler is generally better at deciding what functions should be inlined than driver authors are.
Drop the bogus inline keyword from two functions that were neither very small or used in a single place.
Signed-off-by: Johan Hovold johan+linaro@kernel.org --- sound/soc/codecs/wcd938x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index b8a52a1a63d5..5ce15b622a91 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2124,7 +2124,7 @@ 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); }
-static inline void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, +static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, s16 *d1_a, u16 noff, int32_t *zdet) { @@ -2231,8 +2231,8 @@ static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, *zr = zdet; }
-static inline void wcd938x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component, - int32_t *z_val, int flag_l_r) +static void wcd938x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component, + int32_t *z_val, int flag_l_r) { s16 q1; int q1_cal;
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: Johan Hovold johan+linaro@kernel.org --- sound/soc/codecs/wcd938x.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 5ce15b622a91..ddefe4af0b1e 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -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); }
-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, int32_t *zdet) { + struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); int i; int val, val1; s16 c1; @@ -2154,8 +2155,8 @@ static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, usleep_range(5000, 5050);
if (!c1 || !x1) { - pr_err("%s: Impedance detect ramp error, c1=%d, x1=0x%x\n", - __func__, c1, x1); + dev_err(component->dev, "Impedance detect ramp error, c1=%d, x1=0x%x\n", + c1, x1); goto ramp_down; } d1 = d1_a[c1]; @@ -2165,8 +2166,8 @@ static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, else if (x1 < minCode_param[noff]) *zdet = WCD938X_ZDET_FLOATING_IMPEDANCE;
- pr_debug("%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n", - __func__, d1, c1, x1, *zdet); + dev_dbg(component->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n", + __func__, d1, c1, x1, *zdet); ramp_down: i = 0; while (x1) { @@ -2210,7 +2211,7 @@ static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, WCD938X_ANA_MBHC_ZDET, 0x80, 0x80); dev_dbg(component->dev, "%s: ramp for HPH_L, noff = %d\n", __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, WCD938X_ANA_MBHC_ZDET, 0x80, 0x00);
@@ -2224,7 +2225,7 @@ static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, WCD938X_ANA_MBHC_ZDET, 0x40, 0x40); dev_dbg(component->dev, "%s: ramp for HPH_R, noff = %d\n", __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, WCD938X_ANA_MBHC_ZDET, 0x40, 0x00);
On Fri, Jun 30, 2023 at 04:27:15PM +0200, Johan Hovold wrote:
Pass the component structure also to the wcd938x_mbhc_get_result_params() helper so that the component device can be used for logging consistently.
Ah, in fact here we are.
On 30/06/2023 15:27, Johan Hovold wrote:
When investigating a race in the wcd938x driver I noticed that the MBHC impedance measurements where printed at error loglevel which is clearly wrong.
Fix that, and clean up the logging somewhat by using dev_printk() and addressing some style issues.
Included are also two patches that drop the bogus inline keywords from the functions involved.
Johan
Johan Hovold (5): ASoC: codecs: wcd938x: fix mbhc impedance loglevel ASoC: codecs: wcd938x: drop inline keywords ASoC: codecs: wcd938x: use dev_printk() for impedance logging ASoC: codecs: wcd934x: demote impedance printk loglevel ASoC: codecs: wcd934x: drop inline keywords
lgtm,
Reviewed-by: Srinivas Kandagatla srinivas.kandagatla@linaro.org
--srini
sound/soc/codecs/wcd934x.c | 8 ++++---- sound/soc/codecs/wcd938x.c | 17 +++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-)
On Fri, 30 Jun 2023 16:27:12 +0200, Johan Hovold wrote:
When investigating a race in the wcd938x driver I noticed that the MBHC impedance measurements where printed at error loglevel which is clearly wrong.
Fix that, and clean up the logging somewhat by using dev_printk() and addressing some style issues.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/5] ASoC: codecs: wcd938x: fix mbhc impedance loglevel commit: e5ce198bd5c6923b6a51e1493b1401f84c24b26d [2/5] ASoC: codecs: wcd938x: drop inline keywords commit: 5db9fe9562aaefca3c972401a9e3d6454707b1d5 [3/5] ASoC: codecs: wcd938x: use dev_printk() for impedance logging commit: 17d59d9ed832742f9572fe5e77ed3a66f5ae404d [4/5] ASoC: codecs: wcd934x: demote impedance printk commit: cb7d60ab98cfe12fdd6052142176d42682f78540 [5/5] ASoC: codecs: wcd934x: drop inline keywords commit: c93723ada378a63929b3135b4f30483383e88e05
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (3)
-
Johan Hovold
-
Mark Brown
-
Srinivas Kandagatla