// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2016, NVIDIA CORPORATION.
 */

#include <dm.h>
#include <malloc.h>
#include <power-domain.h>
#include <asm/io.h>
#include <asm/power-domain.h>

struct sandbox_power_domain_test {
	struct power_domain pd;
};

int sandbox_power_domain_test_get(struct udevice *dev)
{
	struct sandbox_power_domain_test *sbrt = dev_get_priv(dev);

	return power_domain_get(dev, &sbrt->pd);
}

int sandbox_power_domain_test_on(struct udevice *dev)
{
	struct sandbox_power_domain_test *sbrt = dev_get_priv(dev);

	return power_domain_on(&sbrt->pd);
}

int sandbox_power_domain_test_off(struct udevice *dev)
{
	struct sandbox_power_domain_test *sbrt = dev_get_priv(dev);

	return power_domain_off(&sbrt->pd);
}

int sandbox_power_domain_test_free(struct udevice *dev)
{
	struct sandbox_power_domain_test *sbrt = dev_get_priv(dev);

	return power_domain_free(&sbrt->pd);
}

static const struct udevice_id sandbox_power_domain_test_ids[] = {
	{ .compatible = "sandbox,power-domain-test" },
	{ }
};

U_BOOT_DRIVER(sandbox_power_domain_test) = {
	.name = "sandbox_power_domain_test",
	.id = UCLASS_MISC,
	.of_match = sandbox_power_domain_test_ids,
	.priv_auto	= sizeof(struct sandbox_power_domain_test),
};
