From eb28b49bccbd9763300faab8f4aeee088fd58bf2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=AE=B8=E7=9B=9B=E9=A3=9E?= Date: Mon, 24 Nov 2014 12:00:21 +0800 Subject: [PATCH] test-power: add testpower dts-config MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: 许盛飞 --- arch/arm/configs/rockchip_defconfig | 3 ++- drivers/power/test_power.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/arm/configs/rockchip_defconfig b/arch/arm/configs/rockchip_defconfig index aff193274495..f5dd5ff8c760 100644 --- a/arch/arm/configs/rockchip_defconfig +++ b/arch/arm/configs/rockchip_defconfig @@ -351,6 +351,7 @@ CONFIG_BATTERY_RT5025=y CONFIG_CHARGER_RT5036=y CONFIG_RT_POWER=y CONFIG_BATTERY_RICOH619=y +CONFIG_TEST_POWER=y CONFIG_BATTERY_BQ24296=y CONFIG_BATTERY_BQ27320=y CONFIG_BATTERY_RK30_ADC_FAC=y @@ -439,8 +440,8 @@ CONFIG_SND_RK_SOC_HDMI_I2S=y CONFIG_SND_RK_SOC_SPDIF_CARD=y CONFIG_SND_RK_SOC_RT5631=y CONFIG_SND_RK_SOC_RT3224=y -CONFIG_SND_RK_SOC_RK312X=y CONFIG_SND_RK_SOC_RK3036=y +CONFIG_SND_RK_SOC_RK312X=y CONFIG_HID_BATTERY_STRENGTH=y CONFIG_HIDRAW=y CONFIG_UHID=y diff --git a/drivers/power/test_power.c b/drivers/power/test_power.c index 0152f35dca5c..2e994e52f3c7 100644 --- a/drivers/power/test_power.c +++ b/drivers/power/test_power.c @@ -20,6 +20,10 @@ #include #include #include +#include +#include +#include + static int ac_online = 1; static int usb_online = 1; @@ -177,6 +181,18 @@ 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 (IS_ERR_OR_NULL(dev_node)) { + pr_info("not find %s dev node\n", __func__); + return 0; + } + if (!of_device_is_available(dev_node)) { + pr_info("test power disabled\n"); + return 0; + } for (i = 0; i < ARRAY_SIZE(test_power_supplies); i++) { ret = power_supply_register(NULL, &test_power_supplies[i]); -- 2.34.1