mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-06 05:04:26 +00:00
e180c2b129
The test flags used by driver model are currently not available to other tests. Rather than creating two sets of flags, make these flags generic by changing the DM_ prefix to UT_ and moving them to the test.h header. This will allow adding other test flags without confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
35 lines
922 B
C
35 lines
922 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright 2018 Google LLC
|
|
* Written by Simon Glass <sjg@chromium.org>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <audio_codec.h>
|
|
#include <dm.h>
|
|
#include <dm/test.h>
|
|
#include <test/test.h>
|
|
#include <test/ut.h>
|
|
#include <asm/test.h>
|
|
|
|
/* Basic test of the audio codec uclass */
|
|
static int dm_test_audio(struct unit_test_state *uts)
|
|
{
|
|
int interface, rate, mclk_freq, bits_per_sample;
|
|
struct udevice *dev;
|
|
uint channels;
|
|
|
|
/* check probe success */
|
|
ut_assertok(uclass_first_device_err(UCLASS_AUDIO_CODEC, &dev));
|
|
ut_assertok(audio_codec_set_params(dev, 1, 2, 3, 4, 5));
|
|
sandbox_get_codec_params(dev, &interface, &rate, &mclk_freq,
|
|
&bits_per_sample, &channels);
|
|
ut_asserteq(1, interface);
|
|
ut_asserteq(2, rate);
|
|
ut_asserteq(3, mclk_freq);
|
|
ut_asserteq(4, bits_per_sample);
|
|
ut_asserteq(5, channels);
|
|
|
|
return 0;
|
|
}
|
|
DM_TEST(dm_test_audio, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|