usbaudio: reset profile on device disconnect

Reset ALSA device profile on disconnect event. Entries like
supported sample rates, channel counts, formats will be repopulated
on next connect.

CRs-Fixed: 765434
Change-Id: I27d3b7fd7ff22646996f58c53de08547b1a1fb6a
Bug: 18606219
This commit is contained in:
Haynes Mathew George 2014-12-03 14:51:49 -08:00 committed by Glenn Kasten
parent 257fde6eb5
commit 2cbdfa9c99

View file

@ -58,10 +58,9 @@ extern int8_t const pcm_format_value_map[50];
static const unsigned std_sample_rates[] = static const unsigned std_sample_rates[] =
{48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000}; {48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000};
void profile_init(alsa_device_profile* profile, int direction) static void profile_reset(alsa_device_profile* profile)
{ {
profile->card = profile->device = -1; profile->card = profile->device = -1;
profile->direction = direction;
/* Fill the attribute arrays with invalid values */ /* Fill the attribute arrays with invalid values */
size_t index; size_t index;
@ -83,6 +82,12 @@ void profile_init(alsa_device_profile* profile, int direction)
profile->is_valid = false; profile->is_valid = false;
} }
void profile_init(alsa_device_profile* profile, int direction)
{
profile->direction = direction;
profile_reset(profile);
}
bool profile_is_initialized(alsa_device_profile* profile) bool profile_is_initialized(alsa_device_profile* profile)
{ {
return profile->card >= 0 && profile->device >= 0; return profile->card >= 0 && profile->device >= 0;
@ -97,7 +102,7 @@ bool profile_is_cached_for(alsa_device_profile* profile, int card, int device) {
} }
void profile_decache(alsa_device_profile* profile) { void profile_decache(alsa_device_profile* profile) {
profile->card = profile->device = -1; profile_reset(profile);
} }
/* /*