Repository navigation
Volume: Fix handling of mute and unmute control - #2196
Conversation
There was a problem hiding this comment.
I can accept it as is even though in general my rule is to have renames and other pass-by coding style improvements as separate commits.
The comment of changing variable names (in the commit message) also hints at a possible split. I won't force it though.
Main change looks good to me.
lyakh
left a comment
There was a problem hiding this comment.
minor comments, most (or all?) commented code is are also not introduced by this patch, but it could be improved, while at it.
There was a problem hiding this comment.
nitpick: with your addition I'd regroup this as
if (again)
return SOF_TASK_STATE_RESCHEDULE;
cd->vol_ramp_active = false;
return SOF_TASK_STATE_COMPLETED;
There was a problem hiding this comment.
Yep, makes sense. I was about to do this myself as well.
There was a problem hiding this comment.
<rant> I find we use zero-initialising allocations (rzalloc()) exceedingly, sometimes also where they aren't really required, and then we also additionally initialise fields of the just allocated object with 0 or NULL of false... Seems strange to me </rant>
There was a problem hiding this comment.
@lyakh I'd find it safer than forgetting to zero-initialize where it's needed, for one.
There was a problem hiding this comment.
I'll do whatever you recommend. I'm myself preferring to be explicit with things that need to be initialized. Let me know your preference.
There was a problem hiding this comment.
Don't we need to error out in this case? If we do, I'd revert the test to do
if (chan_is_invalid) {
trace();
return -EBADERROR;
}
normal_case();
There was a problem hiding this comment.
Maybe some ret = -EINVAL so the following if (ret) return ret; will trigger. Agreed.
There was a problem hiding this comment.
This is the only path where ret is set and thus, where we might have to abort. I would move the ret < 0 check here and limit the scope of ret definition to just this branch.
There was a problem hiding this comment.
Yes, makes sense.
There was a problem hiding this comment.
ch is defined as int and you check it for < 0, so, I think %d is a better choice here.
d17f34a to
38452aa
Compare
There was a problem hiding this comment.
@singalsu typo here "set if channel is muted"?
There was a problem hiding this comment.
You could also move the declaration here
int ret = volume_set_...();
to make it clear that ret isn't needed anywhere else. But probably not worth redoing the patch just for this.
There was a problem hiding this comment.
Unless I'm mistaken that's not done in SOF. I'll fix the typo any way, it's safe to change without need for me to re-test stuff.
There was a problem hiding this comment.
This patch fixes the issue of audio left muted after a cycle of mute and unmute commands. The additional improvements are applying of gain ramp for mute that helps to avoid annoying click sounds. Also since the driver issues both volume and switch commands back to back the duplicate scheduling of ramp update is prevented if there is already a ramp happening. The old ramp will operate based on new step and direction if it was changed. Some variable names were changed in function volume_set_chan() for better readability. The impacted trace print commands were also updated to not split strings unnecessarily. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
38452aa to
4243981
Compare
|
Looks like checkpatch doesn't understand strings in our traces, it's something that should be fixed |
This patch fixes the issue of audio left muted after a cycle
of mute and unmute commands. The additional improvements are
applying of gain ramp for mute that helps to avoid annoying click
sounds. Also since the driver issues both volume and switch
commands back to back the duplicate scheduling of ramp update is
prevented if there is already a ramp happening. The old ramp
will operate based on new step and direction if it was changed.
Some variable names were changed in function volume_set_chan()
for better readability. The impacted trace print commands were
also updated to not split strings unnecessarily.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com