power: test_power: add testpower dts-config

Change-Id: Ib2c78602f604d610a648397cbf08c56cdbd77eab
Signed-off-by: Shengfei Xu <xsf@rock-chips.com>
This commit is contained in:
Shengfei Xu
2019-10-23 12:01:00 +08:00
committed by Tao Huang
parent af506e6ac5
commit 540b08cd42

View File

@@ -20,6 +20,7 @@
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/vermagic.h>
#include <linux/of.h>
enum test_power_id {
TEST_AC,
@@ -197,6 +198,19 @@ static int __init test_power_init(void)
{
int i;
int ret;
struct device_node *dev_node;
dev_node = of_find_node_by_name(NULL, "test-power");
if (!dev_node) {
pr_info("%s: could not find dev node\n", __func__);
return 0;
}
if (!of_device_is_available(dev_node)) {
pr_info("%s: test power disabled\n", __func__);
return 0;
}
of_node_put(dev_node);
BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_supplies));
BUILD_BUG_ON(TEST_POWER_NUM != ARRAY_SIZE(test_power_configs));