From 79f90bdc7de561aa31888948c0661568ccc33da1 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 6 Apr 2012 08:57:48 -0700 Subject: [PATCH] audio: added definitions for usb audio devices Change-Id: I4a4f5919708a09f87974367961b1d09664ae6c06 --- include/system/audio.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/system/audio.h b/include/system/audio.h index 02762316d..4cadb6763 100644 --- a/include/system/audio.h +++ b/include/system/audio.h @@ -290,6 +290,8 @@ typedef enum { AUDIO_DEVICE_OUT_AUX_DIGITAL = 0x400, AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800, AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000, + AUDIO_DEVICE_OUT_USB_ACCESSORY = 0x2000, + AUDIO_DEVICE_OUT_USB_DEVICE = 0x4000, AUDIO_DEVICE_OUT_DEFAULT = 0x8000, AUDIO_DEVICE_OUT_ALL = (AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_SPEAKER | @@ -304,6 +306,8 @@ typedef enum { AUDIO_DEVICE_OUT_AUX_DIGITAL | AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET | AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET | + AUDIO_DEVICE_OUT_USB_ACCESSORY | + AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_DEFAULT), AUDIO_DEVICE_OUT_ALL_A2DP = (AUDIO_DEVICE_OUT_BLUETOOTH_A2DP | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | @@ -311,6 +315,8 @@ typedef enum { AUDIO_DEVICE_OUT_ALL_SCO = (AUDIO_DEVICE_OUT_BLUETOOTH_SCO | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT), + AUDIO_DEVICE_OUT_ALL_USB = (AUDIO_DEVICE_OUT_USB_ACCESSORY | + AUDIO_DEVICE_OUT_USB_DEVICE), /* input devices */ AUDIO_DEVICE_IN_COMMUNICATION = 0x10000, @@ -368,6 +374,14 @@ static inline bool audio_is_bluetooth_sco_device(audio_devices_t device) return false; } +static inline bool audio_is_usb_device(audio_devices_t device) +{ + if ((popcount(device) == 1) && (device & AUDIO_DEVICE_OUT_ALL_USB)) + return true; + else + return false; +} + static inline bool audio_is_input_channel(uint32_t channel) { if ((channel & ~AUDIO_CHANNEL_IN_ALL) == 0)