/* 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#include <linux/types.h>1112/*13* Regulator notifier events.14*15* UNDER_VOLTAGE Regulator output is under voltage.16* OVER_CURRENT Regulator output current is too high.17* REGULATION_OUT Regulator output is out of regulation.18* FAIL Regulator output has failed.19* OVER_TEMP Regulator over temp.20* FORCE_DISABLE Regulator forcibly shut down by software.21* VOLTAGE_CHANGE Regulator voltage changed.22* Data passed is old voltage cast to (void *).23* DISABLE Regulator was disabled.24* PRE_VOLTAGE_CHANGE Regulator is about to have voltage changed.25* Data passed is "struct pre_voltage_change_data"26* ABORT_VOLTAGE_CHANGE Regulator voltage change failed for some reason.27* Data passed is old voltage cast to (void *).28* PRE_DISABLE Regulator is about to be disabled29* ABORT_DISABLE Regulator disable failed for some reason30*31* NOTE: These events can be OR'ed together when passed into handler.32*/3334#define REGULATOR_EVENT_UNDER_VOLTAGE 0x0135#define REGULATOR_EVENT_OVER_CURRENT 0x0236#define REGULATOR_EVENT_REGULATION_OUT 0x0437#define REGULATOR_EVENT_FAIL 0x0838#define REGULATOR_EVENT_OVER_TEMP 0x1039#define REGULATOR_EVENT_FORCE_DISABLE 0x2040#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x4041#define REGULATOR_EVENT_DISABLE 0x8042#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x10043#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x20044#define REGULATOR_EVENT_PRE_DISABLE 0x40045#define REGULATOR_EVENT_ABORT_DISABLE 0x80046#define REGULATOR_EVENT_ENABLE 0x100047/*48* Following notifications should be emitted only if detected condition49* is such that the HW is likely to still be working but consumers should50* take a recovery action to prevent problems escalating into errors.51*/52#define REGULATOR_EVENT_UNDER_VOLTAGE_WARN 0x200053#define REGULATOR_EVENT_OVER_CURRENT_WARN 0x400054#define REGULATOR_EVENT_OVER_VOLTAGE_WARN 0x800055#define REGULATOR_EVENT_OVER_TEMP_WARN 0x1000056#define REGULATOR_EVENT_WARN_MASK 0x1E0005758struct reg_genl_event {59char reg_name[32];60__u64 event;61};6263/* attributes of reg_genl_family */64enum {65REG_GENL_ATTR_UNSPEC,66REG_GENL_ATTR_EVENT, /* reg event info needed by user space */67__REG_GENL_ATTR_MAX,68};6970#define REG_GENL_ATTR_MAX (__REG_GENL_ATTR_MAX - 1)7172/* commands supported by the reg_genl_family */73enum {74REG_GENL_CMD_UNSPEC,75REG_GENL_CMD_EVENT, /* kernel->user notifications for reg events */76__REG_GENL_CMD_MAX,77};7879#define REG_GENL_CMD_MAX (__REG_GENL_CMD_MAX - 1)8081#define REG_GENL_FAMILY_NAME "reg_event"82#define REG_GENL_VERSION 0x0183#define REG_GENL_MCAST_GROUP_NAME "reg_mc_group"8485#endif /* _UAPI_REGULATOR_H */868788