u-boot-brain/test/dm/pmic.c
Tom Rini 83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07 09:34:12 -04:00

67 lines
1.5 KiB
C

// SPDX-License-Identifier: GPL-2.0+
/*
* Tests for the driver model pmic API
*
* Copyright (c) 2015 Samsung Electronics
* Przemyslaw Marczak <p.marczak@samsung.com>
*/
#include <common.h>
#include <errno.h>
#include <dm.h>
#include <fdtdec.h>
#include <malloc.h>
#include <dm/device-internal.h>
#include <dm/root.h>
#include <dm/util.h>
#include <dm/test.h>
#include <dm/uclass-internal.h>
#include <power/pmic.h>
#include <power/sandbox_pmic.h>
#include <test/ut.h>
/* Test PMIC get method */
static int dm_test_power_pmic_get(struct unit_test_state *uts)
{
const char *name = "sandbox_pmic";
struct udevice *dev;
ut_assertok(pmic_get(name, &dev));
ut_assertnonnull(dev);
/* Check PMIC's name */
ut_asserteq_str(name, dev->name);
return 0;
}
DM_TEST(dm_test_power_pmic_get, DM_TESTF_SCAN_FDT);
/* Test PMIC I/O */
static int dm_test_power_pmic_io(struct unit_test_state *uts)
{
const char *name = "sandbox_pmic";
uint8_t out_buffer, in_buffer;
struct udevice *dev;
int reg_count, i;
ut_assertok(pmic_get(name, &dev));
reg_count = pmic_reg_count(dev);
ut_asserteq(reg_count, SANDBOX_PMIC_REG_COUNT);
/*
* Test PMIC I/O - write and read a loop counter.
* usually we can't write to all PMIC's registers in the real hardware,
* but we can to the sandbox pmic.
*/
for (i = 0; i < reg_count; i++) {
out_buffer = i;
ut_assertok(pmic_write(dev, i, &out_buffer, 1));
ut_assertok(pmic_read(dev, i, &in_buffer, 1));
ut_asserteq(out_buffer, in_buffer);
}
return 0;
}
DM_TEST(dm_test_power_pmic_io, DM_TESTF_SCAN_FDT);