ALSA: hda: cs35l56: Volume/Posture controls don't need to wait for dsp_work
Subsystems (2)
Richard Fitzgerald
maintainerPATCH 1/1 ALSA: hda: cs35l56: Volume/Posture controls don't need to wait for dsp_work
Delete the calls to cs35l56_hda_wait_dsp_ready() in the get/put handlers for the Volume and Posture controls. This wait isn't necessary now.
The original reason for the wait in the get/put handlers was that the downloaded firmware can patch the registers to non-default values. To avoid the regmap cache getting out-of-sync with the actual register value, the ASoC driver fixed up the regmap content at the end of firmware download. This meant that control get/put had to wait for firmware download to complete. The HDA driver never had this fixup code so never needed the wait.
Commit df4167d658d4 ("ASoC: cs35l56: Patch soft registers to defaults") already removed this fix-up code in the ASoC driver, and instead used the regmap patch to set volume and posture registers to a default of zero. When HDA driver firmware download was moved to a workqueue in commit 634f3b4e7dde ("ALSA: hda: cs35l56: Perform firmware download in the background") the wait was added to the get/put handlers, copying the behaviour of the ASoC driver. But this was unnecessary and the equivalent wait has been removed from the ASoC driver.
When the amp is rebooted after a firmware download, cs35l56_system_reset() puts the regmap in cache-only and this is only released after the amp has rebooted. The regcache_sync() near the end of cs35l56_hda_fw_load() will overwrite the volume and posture registers with the values from the regmap patch and then write out any non-default cached values.
That means it is safe for the Volume and Posture controls to read/write regmap any time.
--- sound/hda/codecs/side-codecs/cs35l56_hda.c | 8 -------- 1 file changed, 8 deletions(-)
sound/hda/codecs/side-codecs/cs35l56_hda.c +0 -8
@@ -242,8 +242,6 @@ static int cs35l56_hda_posture_get(struct snd_kcontrol *kcontrol,unsigned int pos;int ret; -cs35l56_hda_wait_dsp_ready (cs35l56); - ret =regmap_read (cs35l56->base.regmap, cs35l56->base.fw_reg->posture_number, &pos);if (ret)
@@ -266,8 +264,6 @@ static int cs35l56_hda_posture_put(struct snd_kcontrol *kcontrol, (pos > CS35L56_MAIN_POSTURE_MAX))return -EINVAL ; -cs35l56_hda_wait_dsp_ready (cs35l56); - ret =regmap_update_bits_check (cs35l56->base.regmap, cs35l56->base.fw_reg->posture_number,CS35L56_MAIN_POSTURE_MASK , pos, &changed);if (ret)
@@ -309,8 +305,6 @@ static int cs35l56_hda_vol_get(struct snd_kcontrol *kcontrol,int vol;int ret; -cs35l56_hda_wait_dsp_ready (cs35l56); - ret =regmap_read (cs35l56->base.regmap, cs35l56->base.fw_reg->user_volume, &raw_vol);if (ret)
@@ -343,8 +337,6 @@ static int cs35l56_hda_vol_put(struct snd_kcontrol *kcontrol, raw_vol = (vol +CS35L56_MAIN_RENDER_USER_VOLUME_MIN ) <<CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT ; -cs35l56_hda_wait_dsp_ready (cs35l56); - ret =regmap_update_bits_check (cs35l56->base.regmap, cs35l56->base.fw_reg->user_volume,CS35L56_MAIN_RENDER_USER_VOLUME_MASK , raw_vol, &changed);if (ret)
Signature · 1 line
2.47.3
Takashi Iwai
AppliedQuoted 27 lines · Richard Fitzgerald
Delete the calls to
cs35l56_hda_wait_dsp_ready()in the get/put handlers for the Volume and Posture controls. This wait isn't necessary now.The original reason for the wait in the get/put handlers was that the downloaded firmware can patch the registers to non-default values. To avoid the regmap cache getting out-of-sync with the actual register value, the ASoC driver fixed up the regmap content at the end of firmware download. This meant that control get/put had to wait for firmware download to complete. The HDA driver never had this fixup code so never needed the wait.
Commit
df4167d658d4("ASoC: cs35l56: Patch soft registers to defaults") already removed this fix-up code in the ASoC driver, and instead used the regmap patch to set volume and posture registers to a default of zero. When HDA driver firmware download was moved to a workqueue in commit634f3b4e7dde("ALSA: hda: cs35l56: Perform firmware download in the background") the wait was added to the get/put handlers, copying the behaviour of the ASoC driver. But this was unnecessary and the equivalent wait has been removed from the ASoC driver.When the amp is rebooted after a firmware download,
cs35l56_system_reset()puts the regmap in cache-only and this is only released after the amp has rebooted. Theregcache_sync()near the end ofcs35l56_hda_fw_load()will overwrite the volume and posture registers with the values from the regmap patch and then write out any non-default cached values.
Quoted 4 lines
That means it is safe for the Volume and Posture controls to read/write regmap any time.
Signed-off-by Richard Fitzgerald <[email protected]>
Applied to for-next branch now. Thanks.
Takashi