Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/extres/regulator/regulator.c
Show All 12 Lines | |||||
#include <dev/fdt/fdt_common.h> | #include <dev/fdt/fdt_common.h> | ||||
#include <dev/ofw/ofw_bus.h> | #include <dev/ofw/ofw_bus.h> | ||||
#include <dev/ofw/ofw_bus_subr.h> | #include <dev/ofw/ofw_bus_subr.h> | ||||
#endif | #endif | ||||
#include <dev/extres/regulator/regulator.h> | #include <dev/extres/regulator/regulator.h> | ||||
#include "regdev_if.h" | #include "regdev_if.h" | ||||
SYSCTL_NODE(_hw, OID_AUTO, regulator, CTLFLAG_RD, NULL, "Regulators"); | SYSCTL_NODE(_hw, OID_AUTO, regulator, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, | ||||
"Regulators"); | |||||
MALLOC_DEFINE(M_REGULATOR, "regulator", "Regulator framework"); | MALLOC_DEFINE(M_REGULATOR, "regulator", "Regulator framework"); | ||||
#define DIV_ROUND_UP(n,d) howmany(n, d) | #define DIV_ROUND_UP(n,d) howmany(n, d) | ||||
/* Forward declarations. */ | /* Forward declarations. */ | ||||
struct regulator; | struct regulator; | ||||
struct regnode; | struct regnode; | ||||
Show All 24 Lines | |||||
#ifdef FDT | #ifdef FDT | ||||
regnode->ofw_node = def->ofw_node; | regnode->ofw_node = def->ofw_node; | ||||
#endif | #endif | ||||
sysctl_ctx_init(®node->sysctl_ctx); | sysctl_ctx_init(®node->sysctl_ctx); | ||||
regnode_oid = SYSCTL_ADD_NODE(®node->sysctl_ctx, | regnode_oid = SYSCTL_ADD_NODE(®node->sysctl_ctx, | ||||
SYSCTL_STATIC_CHILDREN(_hw_regulator), | SYSCTL_STATIC_CHILDREN(_hw_regulator), | ||||
OID_AUTO, regnode->name, | OID_AUTO, regnode->name, | ||||
CTLFLAG_RD, 0, "A regulator node"); | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "A regulator node"); | ||||
SYSCTL_ADD_INT(®node->sysctl_ctx, | SYSCTL_ADD_INT(®node->sysctl_ctx, | ||||
SYSCTL_CHILDREN(regnode_oid), | SYSCTL_CHILDREN(regnode_oid), | ||||
OID_AUTO, "min_uvolt", | OID_AUTO, "min_uvolt", | ||||
CTLFLAG_RD, ®node->std_param.min_uvolt, 0, | CTLFLAG_RD, ®node->std_param.min_uvolt, 0, | ||||
"Minimal voltage (in uV)"); | "Minimal voltage (in uV)"); | ||||
SYSCTL_ADD_INT(®node->sysctl_ctx, | SYSCTL_ADD_INT(®node->sysctl_ctx, | ||||
SYSCTL_CHILDREN(regnode_oid), | SYSCTL_CHILDREN(regnode_oid), | ||||
Show All 24 Lines | |||||
SYSCTL_CHILDREN(regnode_oid), | SYSCTL_CHILDREN(regnode_oid), | ||||
OID_AUTO, "always_on", | OID_AUTO, "always_on", | ||||
CTLFLAG_RD, (uint8_t *)®node->std_param.always_on, 0, | CTLFLAG_RD, (uint8_t *)®node->std_param.always_on, 0, | ||||
"Is always enabled"); | "Is always enabled"); | ||||
SYSCTL_ADD_PROC(®node->sysctl_ctx, | SYSCTL_ADD_PROC(®node->sysctl_ctx, | ||||
SYSCTL_CHILDREN(regnode_oid), | SYSCTL_CHILDREN(regnode_oid), | ||||
OID_AUTO, "uvolt", | OID_AUTO, "uvolt", | ||||
CTLTYPE_INT | CTLFLAG_RD, | CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | ||||
regnode, 0, regnode_uvolt_sysctl, | regnode, 0, regnode_uvolt_sysctl, | ||||
"I", | "I", | ||||
"Current voltage (in uV)"); | "Current voltage (in uV)"); | ||||
return (regnode); | return (regnode); | ||||
} | } | ||||
/* Register regulator object. */ | /* Register regulator object. */ | ||||
Show All 12 Lines |