db845c: audio_hal: Select the output/input card a bit more dynamically

This patch changes the output/input card selection from being
hard-coded to chosen at runtime.

The selection process is a bit "simple" in that it will try each
card in order and pick the first available.

Eventually, we probably need a fancier HAL to handle more dynamic
audio configs (without colliding with the in-framework usb headset
handling, for instance). It would be nicer to actually check the
/sys/class/sound/card*/id values and be able to have a preferred
name that is selected, but I figured this was a start.

With this patch, adding a usb web cam (which reorders the card
numbers) no longer breaks HDMI audio output.

Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I9504a1c50da09dfed116c32247fc79255ae5646e
2 files changed