BZ: 42423
There can be race condition if _dapm_sync() is not called without
holding codec mutex. It can lead to kernel crash.
This patch adds mutex locks before invoking _dapm_sync().
The _dapm_sync() needs to be called explicitely
only when driver uses _force_enable_pin() or _disable_pin().
Removed a reduntant _dapm_sync() call in codec driver, where
neither a enable or disable pin is used.
Change-Id: I6a81572993805d3a8c1ea3dde00274638d2a0a97
Signed-off-by: Shankar D K <shankar.d.kodandaram@intel.com>
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Reviewed-on: http://android.intel.com:8080/53642
Reviewed-by: R, Dharageswari <dharageswari.r@intel.com>
Reviewed-by: Koul, Vinod <vinod.koul@intel.com>
Tested-by: Gupta, ArvindX K <arvindx.k.gupta@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
snd_soc_update_bits(codec, SN95031_SSR2, 0x10, 0x10);
snd_soc_update_bits(codec, SN95031_DACCONFIG, 0x10, 0);
}
- snd_soc_dapm_sync(&codec->dapm);
sn95031_dac_mode = ucontrol->value.integer.value[0];
return 0;
{
struct snd_soc_dai *cpu_dai = runtime->cpu_dai;
struct snd_soc_dapm_context *dapm = &runtime->codec->dapm;
+ struct snd_soc_codec *codec = runtime->codec;
snd_soc_dapm_disable_pin(dapm, "IHFOUTR");
+ mutex_lock(&codec->mutex);
snd_soc_dapm_sync(dapm);
+ mutex_unlock(&codec->mutex);
return cpu_dai->driver->ops->set_tdm_slot(cpu_dai, 0, 0, 1, 0);
}
#endif