hal: Upstream offload fixes

hal: Fix backend configuration during stream switch

-Currently, input stream sample rate and/or bit width is compared
with current backend sample rate and/or bit width. Backend is
re-configured only if input stream's rate/width is higher. This
causes incorrect sampling rate during stream switch of varying
sample rates.
-The backend is configured at highest bit width and/or sample rate
amongst all active playback usecases.
-By setting the backend re-configuration flag only when the selected
sample rate and/or bit width differ with current backend sample rate
and/or bit width, re-routing is enabled and backend is re-configured.
-Exception: 16 bit playbacks is allowed through 16/48 backend only.
-Enable logs for app type, acdb id and sample rate.

Change-Id: I09bfe30ebf8bdb3f9b481d7375ce7450fa67270c

hal: allow to get render position for non-offload use cases

For pcm voip use case which goes with direct output, render
position can be queried from HAL, while currently it is not
supported and always return with invalid status.

Return with written frames for pcm use cases when render
position queried from HAL.

CRs-Fixed: 828864

Change-Id: I5fec7f5fc1f61dc36cbeb41a4121c2c83f63b7f4

hal: Fix backend configuration for 24 bit offload playback

Backend sample rate configuration follows:
16 bit playback - 48khz for streams at any valid sample rate
24 bit playback - 48khz for stream sample rate upto 48khz
24 bit playback - 96khz for sample rate range of 48khz to 96khz
24 bit playback - 192khz for sample rate range of 96khz to 192 khz
For invalid or out of range sample rate, default rate is 48K
Upper limit is inclusive in the sample rate range

Change-Id: I48ace6d9135b1e0a450bcc5cc39498da619115a5

hal: Fix backend for 24 bit playback on speaker

Configure backend at 48khz for 24 bit playback on speakers.
Currently, ADM can be configured only at the begining of stream
playback. During device switch, in the middle of a playback, the
backend remains at the previous configuration.
By allowing ADM and backend re-configuration during playback, 24-bit
playback is enforced on appropriate backend.

Change-Id: I6a6df5699972b0992a217fb2a4c9dc94fd2230ce

hal: Fix combo device configuration for 24 bit playback on speaker

-Fix combo device configuration for 24 bit playback on speaker
-Move exception hadndling code to audio_extn

Change-Id: Ia0985a284042a5ac5e3de64aaf5e4d57462ceb85

hal: fix voice call mute issue

The backend is always configured with default bit width and sample
rate for voice calls. The backend reconfiguration should not be done
when a new stream starts during voice call.

Change-Id: I9fda27c4fb1925b3ddeec929ad986886dc4d695e
CRs-fixed: 747001

hal: expose offload functions only for offload playback

- Expose compress offload related functions only when
  AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD is set.
- Do not use them for direct PCM format to avoid unnecessary
  calls to compress driver.

CRs-Fixed: 913925
Change-Id: I8f93b1c697794e686d19c6c78823a095333b5369

hal: set output bitwidth to 24 bit for 32 bit data.

 - parser gives 32 bit data for 24 bit AIFF playback and same
   is sent down to HAL.
 - So update bit width to 24 bit if offload info bit width is 32 bit
   to configure back end to 24 bit for 24 bit e2e playback.

Change-Id: I17cf4430b9d401c42817b75c4456617bdda78647

hal: Increase PCM offload buffering

Increase PCM offload buffering to 40ms

CRs-Fixed: 924443
Change-Id: I67be148f85acc7c155ed222d652d5fedfb6a5e9b

hal: Cleanup dead code

Change-Id: I21cc1a85cbad67bf67d13b72ca2bdaa5069a8f89
4 files changed