From: 许盛飞 Date: Mon, 24 Nov 2014 04:00:21 +0000 (+0800) Subject: test-power: add testpower dts-config X-Git-Tag: firefly_0821_release~4449 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=eb28b49bccbd9763300faab8f4aeee088fd58bf2;p=firefly-linux-kernel-4.4.55.git test-power: add testpower dts-config Signed-off-by: 许盛飞 --- 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]);