ASoC: codecs: wcd938x/wcd934x: loglevel fix and cleanups
Subsystems (3)
cover 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(-)
Signature · 1 line
2.39.3
PATCH 2/5 ASoC: codecs: wcd938x: drop inline keywords
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.
--- sound/soc/codecs/wcd938x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wcd938x.c +3 -3
@@ -2124,7 +2124,7 @@ static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *componreturn 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;
Signature · 1 line
2.39.3
PATCH 4/5 ASoC: codecs: wcd934x: demote impedance printk
In reply to Johan HovoldDemote 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.
--- sound/soc/codecs/wcd934x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wcd934x.c +1 -1
@@ -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 ;
Signature · 1 line
2.39.3
PATCH 5/5 ASoC: codecs: wcd934x: drop inline keywords
In reply to Johan HovoldThe 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.
--- sound/soc/codecs/wcd934x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wcd934x.c +3 -3
@@ -2642,7 +2642,7 @@ static int wcd934x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *componreturn 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;
Signature · 1 line
2.39.3
PATCH 1/5 ASoC: codecs: wcd938x: fix mbhc impedance loglevel
In reply to Johan HovoldDemote 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.
--- sound/soc/codecs/wcd938x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wcd938x.c +2 -2
@@ -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) {
Signature · 1 line
2.39.3
PATCH 3/5 ASoC: codecs: wcd938x: use dev_printk() for impedance logging
In reply to Johan HovoldPass the component structure also to the wcd938x_mbhc_get_result_params() helper so that the component device can be used for logging consistently.
--- sound/soc/codecs/wcd938x.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
sound/soc/codecs/wcd938x.c +8 -7
@@ -2124,10 +2124,11 @@ static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *componreturn 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 );
Signature · 1 line
2.39.3
Quoted 13 lines · Johan Hovold
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
Quoted 7 lines
Johan Hovold (5):
ASoC: codecs: wcd938x: fix mbhc impedance loglevel
ASoC: codecs: wcd938x: drop inline keywords
ASoC: codecs: wcd938x: usedev_printk()for impedance logging
ASoC: codecs: wcd934x: demote impedance printk loglevel
ASoC: codecs: wcd934x: drop inline keywords
lgtm,
--srini
Quoted 4 lines
sound/soc/codecs/wcd934x.c | 8 ++++---- sound/soc/codecs/wcd938x.c | 17 +++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-)
Mark Brown
maintainerRe: [PATCH 1/5] ASoC: codecs: wcd938x: fix mbhc impedance loglevel
In reply to Johan Hovoldsound/soc/codecs/wcd938x.c static inline void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, · line 2169
Quoted 4 lines · Johan Hovold
sound/soc/codecs/wcd938x.c +2
-2-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().
Mark Brown
maintainerRe: [PATCH 3/5] ASoC: codecs: wcd938x: use dev_printk() for impedance logging
In reply to Johan HovoldQuoted 3 lines · Johan Hovold
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.
Mark Brown
maintainerQuoted 8 lines · Johan Hovold
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: c93723ada378a63929b3135b4f30483383e88e05All 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