CRAS: system_state - Store target capture gain

System capture gain is subjected to supported gain range.
This causes a problem that when desired capture gain is out of supported
gain range, it can not be retained after supported gain range is
changed because the information is lost.
To solve above problem, system state can add a field capture_gain_target
to store the desired capture gain. Then, when the supported range is
changed, system state can try to re-apply capture_gain_target.

Initalize device setting in alsa_iodev_set_active_node so the gain limit
and system gain can be adjusted based on the latest active device and
active node.

BUG=chrome-os-partner:60744, chromium:692187
TEST=make check
TEST=on kevin, check cras_test_client --dump_s and see default system
gain is 20.0 dB, not 0.0dB.
TEST=Use apprtc, switch between internal mic and external mic and see
the gain adjusted on one node is retained after switching back to that node.

Change-Id: I48653c7d5035ec2ca8a53d300772bfc529c8b7ad
Reviewed-on: https://chromium-review.googlesource.com/430527
Commit-Ready: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
4 files changed