UPSTREAM: drivers: adc: add ADC emulator

ADC emulator is designed to be used in tests on native_posix board. It
supports 1-16 bit resolution range and all GAINs from enum adc_gain.
Reference voltages and number of emulated channels are set through dts.
Using special API from drivers/adc/adc_emul.h it is possible to set
constant voltage value returned by given ADC channel or set custom
function which allows to simulate complex output.
Also reference voltages can be changed in runtime using the API.

The CL also includes:
- Add adc definitions of ADC emulator in
  tests/drivers/adc/adc_api/src/test_adc.c for supporting test suites.
- Add test for ADC emulator API in tests/drivers/adc/adc_emul/

Signed-off-by: Tomasz Michalec <tm@semihalf.com>
(cherry picked from commit d83647dea6f9f7f5b1697ea1ce92a7bb1de7b654)

BUG=b:185209714
TEST=zmake testall

Change-Id: I2518b08c8df3f6caf0e34a676f06c69e59a51e49
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/2886928
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
Tested-by: Tomasz Michalec <tm@semihalf.com>
19 files changed