sdk-hwV1.3/lichee/linux-4.9/drivers/power/supply/axp/axp2101/virtual2101_dev.c

157 lines
2.7 KiB
C

/*
* drivers/power/axp/axp2101/virtualaxp2101_dev.c
* (C) Copyright 2010-2016
* Allwinner Technology Co., Ltd. <www.allwinnertech.com>
* Pannan <pannan@allwinnertech.com>
*
* virtual regulator driver of axp2101
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/
#include <linux/init.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/regulator/machine.h>
#include <linux/i2c.h>
#include <linux/power_supply.h>
#include <linux/module.h>
static struct platform_device virt[] = {
{
.name = "reg-2101-cs-rtc",
.id = -1,
.dev = {
.platform_data = "axp2101_rtc",
}
},
{
.name = "reg-2101-cs-aldo1",
.id = -1,
.dev = {
.platform_data = "axp2101_aldo1",
}
},
{
.name = "reg-2101-cs-aldo2",
.id = -1,
.dev = {
.platform_data = "axp2101_aldo2",
}
},
{
.name = "reg-2101-cs-aldo3",
.id = -1,
.dev = {
.platform_data = "axp2101_aldo3",
}
},
{
.name = "reg-2101-cs-aldo4",
.id = -1,
.dev = {
.platform_data = "axp2101_aldo4",
}
},
{
.name = "reg-2101-cs-bldo1",
.id = -1,
.dev = {
.platform_data = "axp2101_bldo1",
}
},
{
.name = "reg-2101-cs-bldo2",
.id = -1,
.dev = {
.platform_data = "axp2101_bldo2",
}
},
{
.name = "reg-2101-cs-dldo1",
.id = -1,
.dev = {
.platform_data = "axp2101_dldo1",
}
},
{
.name = "reg-2101-cs-dldo2",
.id = -1,
.dev = {
.platform_data = "axp2101_dldo2",
}
},
{
.name = "reg-2101-cs-cpuldos",
.id = -1,
.dev = {
.platform_data = "axp2101_cpuldos",
}
},
{
.name = "reg-2101-cs-dcdc1",
.id = -1,
.dev = {
.platform_data = "axp2101_dcdc1",
}
},
{
.name = "reg-2101-cs-dcdc2",
.id = -1,
.dev = {
.platform_data = "axp2101_dcdc2",
}
},
{
.name = "reg-2101-cs-dcdc3",
.id = -1,
.dev = {
.platform_data = "axp2101_dcdc3",
}
},
{
.name = "reg-2101-cs-dcdc4",
.id = -1,
.dev = {
.platform_data = "axp2101_dcdc4",
}
},
};
static int __init virtual_init(void)
{
int j, ret;
for (j = 0; j < ARRAY_SIZE(virt); j++) {
ret = platform_device_register(&virt[j]);
if (ret)
goto creat_devices_failed;
}
return 0;
creat_devices_failed:
while (j--)
platform_device_register(&virt[j]);
return ret;
}
module_init(virtual_init);
static void __exit virtual_exit(void)
{
int j;
for (j = ARRAY_SIZE(virt) - 1; j >= 0; j--)
platform_device_unregister(&virt[j]);
}
module_exit(virtual_exit);
MODULE_DESCRIPTION("X-POWERS axp regulator test");
MODULE_AUTHOR("Weijin Zhong");
MODULE_LICENSE("GPL");