/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */1/*2* Regulator uapi header3*4* Author: Naresh Solanki <[email protected]>5*/67#ifndef _UAPI_REGULATOR_H8#define _UAPI_REGULATOR_H910#ifdef __KERNEL__11#include <linux/types.h>12#else13#include <stdint.h>14#endif1516/*17* Regulator notifier events.18*19* UNDER_VOLTAGE Regulator output is under voltage.20* OVER_CURRENT Regulator output current is too high.21* REGULATION_OUT Regulator output is out of regulation.22* FAIL Regulator output has failed.23* OVER_TEMP Regulator over temp.24* FORCE_DISABLE Regulator forcibly shut down by software.25* VOLTAGE_CHANGE Regulator voltage changed.26* Data passed is old voltage cast to (void *).27* DISABLE Regulator was disabled.28* PRE_VOLTAGE_CHANGE Regulator is about to have voltage changed.29* Data passed is "struct pre_voltage_change_data"30* ABORT_VOLTAGE_CHANGE Regulator voltage change failed for some reason.31* Data passed is old voltage cast to (void *).32* PRE_DISABLE Regulator is about to be disabled33* ABORT_DISABLE Regulator disable failed for some reason34*35* NOTE: These events can be OR'ed together when passed into handler.36*/3738#define REGULATOR_EVENT_UNDER_VOLTAGE 0x0139#define REGULATOR_EVENT_OVER_CURRENT 0x0240#define REGULATOR_EVENT_REGULATION_OUT 0x0441#define REGULATOR_EVENT_FAIL 0x0842#define REGULATOR_EVENT_OVER_TEMP 0x1043#define REGULATOR_EVENT_FORCE_DISABLE 0x2044#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x4045#define REGULATOR_EVENT_DISABLE 0x8046#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x10047#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x20048#define REGULATOR_EVENT_PRE_DISABLE 0x40049#define REGULATOR_EVENT_ABORT_DISABLE 0x80050#define REGULATOR_EVENT_ENABLE 0x100051/*52* Following notifications should be emitted only if detected condition53* is such that the HW is likely to still be working but consumers should54* take a recovery action to prevent problems escalating into errors.55*/56#define REGULATOR_EVENT_UNDER_VOLTAGE_WARN 0x200057#define REGULATOR_EVENT_OVER_CURRENT_WARN 0x400058#define REGULATOR_EVENT_OVER_VOLTAGE_WARN 0x800059#define REGULATOR_EVENT_OVER_TEMP_WARN 0x1000060#define REGULATOR_EVENT_WARN_MASK 0x1E0006162struct reg_genl_event {63char reg_name[32];64uint64_t event;65};6667/* attributes of reg_genl_family */68enum {69REG_GENL_ATTR_UNSPEC,70REG_GENL_ATTR_EVENT, /* reg event info needed by user space */71__REG_GENL_ATTR_MAX,72};7374#define REG_GENL_ATTR_MAX (__REG_GENL_ATTR_MAX - 1)7576/* commands supported by the reg_genl_family */77enum {78REG_GENL_CMD_UNSPEC,79REG_GENL_CMD_EVENT, /* kernel->user notifications for reg events */80__REG_GENL_CMD_MAX,81};8283#define REG_GENL_CMD_MAX (__REG_GENL_CMD_MAX - 1)8485#define REG_GENL_FAMILY_NAME "reg_event"86#define REG_GENL_VERSION 0x0187#define REG_GENL_MCAST_GROUP_NAME "reg_mc_group"8889#endif /* _UAPI_REGULATOR_H */909192