audio: Add audio amplifier HAL

This is a squash of the following commits.

Author: Ethan Chen <intervigil@gmail.com>
Date:   Fri, 03 Jul 2015 21:35:30 -0700
    audio: Notify amplifier HAL of device enable/disable
    Change-Id: Ice808c9b55a9e3bc8bafe5ca3ff555377d38dd8f

Author: Scott Mertz <scott@cyngn.com>
Date:   Fri, 11 Sep 2015 12:09:06 -0700
    amplifier: add set_parameters method
    - audio hal should pass the audio_device parameters to the amplifier
      to allow the amplifier to make decisions based on the additional
      parameters.  For example, we may want to change settings for DTS
      TrueMedia use case.
    Change-Id: Iccf6ef7ced2abd2e12e857eea8e580cda15eec04

Author: Scott Mertz <scott@cyngn.com>
Date: Wed, 21 Oct 2015 10:11:49 -0700
    audio_amplifier: fix compilation
    stdlib.h is needed explicitely with the new
    toolchain/toolchain options.
    Change-Id: I876041828310ec8f9fb1e0d636a38cce1977d9b9

Author: Ethan Chen <intervigil@gmail.com>
Date: Fri, 15 Jan 2016 16:12:39 -0800
    amplifier: Fix compilation warning
    * Forward declare str_parms
    Change-Id: Iafb0ad8e4b0696807cfe568d0f89ce5dad6bcade

Author: codeworkx <daniel.hillenbrand@codeworkx.de>
Date:   Sat Mar 24 21:30:34 2018 +0100
    audio_amplifier: add hooks for stream parameter manipulation
    This allows to modify audio parameters before the first
    device selection happens which is necessary when setting ANC parameter
    since it must happen before audio hal hits voice_start_call() and
    selects devices. If setting ANC after stream has been started it will
    trigger a re-selection of devices and cause a short downtime.
    Change-Id: Icfddab5ce27235c1567a0557e63b3a7421778187

Author: Pig <pig.priv@gmail.com>
Date:   Tue Sep 22 21:41:59 2020 +0800
    audio_amplifier: Add new hook for setting amp feedback
    Change-Id: Ied5e1ccecd1eec39522055b9fdcfb21f8c101670

Author: Alexander Koskovich <akoskovich@pm.me>
Date:   Sun Jul 31 12:12:39 2022 -0700
    libhardware: audio_ampifier: Fix compile
     * Compiled as apart of vendor-snapshot, so need to
       make sure it compiles.
    Change-Id: Iae8a50a440e5cdc3c89a2e752e86adccbb50a506

Change-Id: I0473143057d542c8fa0a3ec4a67ce277900badbe

audio_amplifier: Add hook for amplifier calibration

Sometimes the amplifier will need to do calibration and fw download
on the very first boot. For example, it will need to load calibration
files from another partition, download calibration firmware to the
amplifier and play silence sound for some seconds.

While the current interface, amp_module_open, is able to handle most
of the operations mentioned above, it is not able to allow the HAL
to play silence sound, because it cannot get the needed audio_device,
or adev, it is not able to enable the snd device, and write silence
pcm data using pcm_write interface.

This change adds an interface to allow the audio_amplifier HAL to
calibrate the amplifier. It passes the required audio_device struct
to audio_amplifier as a parameter, and is called after opening the
audio_amplifier module.

Signed-off-by: Luofan Chen <clfbbn@gmail.com>
Change-Id: I9d497fb5d9716bbcbc6ef9035205ee18da994e72
(cherry picked from commit d05ce0065b8147d05adf0d68c8a182ebbe668d27)

fixup! audio: Add audio amplifier HAL

Change-Id: I64d6ce16e1ec36188273dda5eaeae7f49dcb8c15

libhardware: Fix symlink for audio_amplifier

* By running running 'update-includes.sh' script

Change-Id: I2ca261ab41cf42a66345862f09cad9fde715c691
4 files changed