Message ID | 20200827173357.31891-2-s.nawrocki@samsung.com (mailing list archive) |
---|---|
State | Accepted |
Commit | f5a2cda4f1db89776b64c4f0f2c2ac609527ac70 |
Headers | show |
Series | [1/2] ASoC: wm8994: Skip setting of the WM8994_MICBIAS register for WM1811 | expand |
On Thu, Aug 27, 2020 at 07:33:57PM +0200, Sylwester Nawrocki wrote: > When the wm8958_mic_detect, wm8994_mic_detect functions get called from > the machine driver, e.g. from the card's late_probe() callback, the CODEC > device may be PM runtime suspended and any regmap writes have no effect. > Add PM runtime calls to these functions to ensure the device registers > are updated as expected. > This suppresses an error during boot > "wm8994-codec: ASoC: error at snd_soc_component_update_bits on wm8994-codec" > caused by the regmap access error due to the cache_only flag being set. > > Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> > --- > sound/soc/codecs/wm8994.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c > index b3ba053..fc9ea19 100644 > --- a/sound/soc/codecs/wm8994.c > +++ b/sound/soc/codecs/wm8994.c > @@ -3514,6 +3514,8 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * > return -EINVAL; > } > > + pm_runtime_get_sync(component->dev); The driver enables PM runtime unconditionally so you should probably handle the error code here. I know that driver does not do it in other cases but it should not be a reason to multiple this pattern... unless it really does not matter as there are no runtime PM ops? Best regards, Krzysztof
On 28.08.2020 08:48, Krzysztof Kozlowski wrote: >> diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c >> index b3ba053..fc9ea19 100644 >> --- a/sound/soc/codecs/wm8994.c >> +++ b/sound/soc/codecs/wm8994.c >> @@ -3514,6 +3514,8 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * >> return -EINVAL; >> } >> >> + pm_runtime_get_sync(component->dev); > The driver enables PM runtime unconditionally so you should probably > handle the error code here. I know that driver does not do it in other > cases but it should not be a reason to multiple this pattern... unless > it really does not matter as there are no runtime PM ops? The regmap is provided by the parent MFD device (drivers/mfd/wm8994-core.c) and that is where those runtime PM calls get propagated, we could possibly get en error if there is something wrong with resuming the parent device. If you don't mind I would prefer to omit the return value tests in that fix patch. Existing callers of the wm89*_mic_detect() functions are ignoring the return value anyway. Probably the checks could be added in a separate patch.
On Fri, Aug 28, 2020 at 10:50:33AM +0200, Sylwester Nawrocki wrote: > On 28.08.2020 08:48, Krzysztof Kozlowski wrote: > >> diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c > >> index b3ba053..fc9ea19 100644 > >> --- a/sound/soc/codecs/wm8994.c > >> +++ b/sound/soc/codecs/wm8994.c > >> @@ -3514,6 +3514,8 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * > >> return -EINVAL; > >> } > >> > >> + pm_runtime_get_sync(component->dev); > > > The driver enables PM runtime unconditionally so you should probably > > handle the error code here. I know that driver does not do it in other > > cases but it should not be a reason to multiple this pattern... unless > > it really does not matter as there are no runtime PM ops? > > The regmap is provided by the parent MFD device (drivers/mfd/wm8994-core.c) > and that is where those runtime PM calls get propagated, we could possibly > get en error if there is something wrong with resuming the parent device. > > If you don't mind I would prefer to omit the return value tests in that > fix patch. Existing callers of the wm89*_mic_detect() functions are > ignoring the return value anyway. Probably the checks could be added > in a separate patch. I don't mind. Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Best regards, Krzysztof
On Thu, Aug 27, 2020 at 07:33:57PM +0200, Sylwester Nawrocki wrote: > When the wm8958_mic_detect, wm8994_mic_detect functions get called from > the machine driver, e.g. from the card's late_probe() callback, the CODEC > device may be PM runtime suspended and any regmap writes have no effect. > Add PM runtime calls to these functions to ensure the device registers > are updated as expected. > This suppresses an error during boot > "wm8994-codec: ASoC: error at snd_soc_component_update_bits on wm8994-codec" > caused by the regmap access error due to the cache_only flag being set. > > Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> > --- Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Thanks, Charles
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index b3ba053..fc9ea19 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3514,6 +3514,8 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * return -EINVAL; } + pm_runtime_get_sync(component->dev); + switch (micbias) { case 1: micdet = &wm8994->micdet[0]; @@ -3561,6 +3563,8 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * snd_soc_dapm_sync(dapm); + pm_runtime_put(component->dev); + return 0; } EXPORT_SYMBOL_GPL(wm8994_mic_detect); @@ -3932,6 +3936,8 @@ int wm8958_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * return -EINVAL; } + pm_runtime_get_sync(component->dev); + if (jack) { snd_soc_dapm_force_enable_pin(dapm, "CLK_SYS"); snd_soc_dapm_sync(dapm); @@ -4000,6 +4006,8 @@ int wm8958_mic_detect(struct snd_soc_component *component, struct snd_soc_jack * snd_soc_dapm_sync(dapm); } + pm_runtime_put(component->dev); + return 0; } EXPORT_SYMBOL_GPL(wm8958_mic_detect);
When the wm8958_mic_detect, wm8994_mic_detect functions get called from the machine driver, e.g. from the card's late_probe() callback, the CODEC device may be PM runtime suspended and any regmap writes have no effect. Add PM runtime calls to these functions to ensure the device registers are updated as expected. This suppresses an error during boot "wm8994-codec: ASoC: error at snd_soc_component_update_bits on wm8994-codec" caused by the regmap access error due to the cache_only flag being set. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> --- sound/soc/codecs/wm8994.c | 8 ++++++++ 1 file changed, 8 insertions(+)