diff options
author | Linus Torvalds | 2024-01-09 14:41:21 -0800 |
---|---|---|
committer | Linus Torvalds | 2024-01-09 14:41:21 -0800 |
commit | da96801729b43eb6229425a23b7bdf6045685251 (patch) | |
tree | 4cec3b1531cc7ea77eaf14726d915d1318805a4c /include/uapi | |
parent | 83130ff423d61b018e1018cfa9ca5c1511b5f33b (diff) | |
parent | 1cadc04c1a1ac5015c2eb0fadfabf4b61bbe167e (diff) |
Merge tag 'regulator-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown:
"The main updates for this release are around monitoring of regulators,
largely for error handling purposes. We allow the stream of regulator
events to be seen by userspace as netlink events and allow system
integrators to describe individual regulators as system critical with
information on how long the system is expected to last on error. The
system level error handling is very much about best effort problem
mitigation rather than providing something fully robust, the initial
drive was to provide a mechanism for trying to avoid initiating any
new writes to flash once we notice the power going out.
Otherwise it's very quiet, mainly several new Qualcomm devices.
- Support for marking regulators as system critical and providing
information on how long the system might last with those regulators
in a failure state, hooked into the existing critical shutdown
error handling.
- Optional support for generating netlink events for events, there
are use cases for system monitoring UIs and error handling.
- A command line option to leave unused controllable regulators
enabled, useful for debugging. We already only disable regulators
we were explicitly given permission to control.
- Support for Quacomm MP5496, PM8010 and PM8937"
* tag 'regulator-v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (31 commits)
regulator: event: Ensure atomicity for sequence number
uapi: regulator: Fix typo
regulator: Reuse LINEAR_RANGE() in REGULATOR_LINEAR_RANGE()
dt-bindings: regulator: qcom,usb-vbus-regulator: clean up example
regulator: qcom_smd: Add LDO5 MP5496 regulator
regulator: qcom-rpmh: add support for pm8010 regulators
regulator: dt-bindings: qcom,rpmh: add compatible for pm8010
regulator: qcom-rpmh: extend to support multiple linear voltage ranges
regulator: wm8350: Convert to platform remove callback returning void
regulator: virtual: Convert to platform remove callback returning void
regulator: userspace-consumer: Convert to platform remove callback returning void
regulator: uniphier: Convert to platform remove callback returning void
regulator: stm32-vrefbuf: Convert to platform remove callback returning void
regulator: db8500-prcmu: Convert to platform remove callback returning void
regulator: bd9571mwv: Convert to platform remove callback returning void
regulator: arizona-ldo1: Convert to platform remove callback returning void
regulator: event: Add regulator netlink event support
regulator: event: Add regulator netlink event support
regulator: stpmic1: Fix kernel-doc notation warnings
regulator: palmas: remove redundant initialization of pointer pdata
...
Diffstat (limited to 'include/uapi')
-rw-r--r-- | include/uapi/regulator/regulator.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/include/uapi/regulator/regulator.h b/include/uapi/regulator/regulator.h new file mode 100644 index 000000000000..71bf71a22e7f --- /dev/null +++ b/include/uapi/regulator/regulator.h @@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * Regulator uapi header + * + * Author: Naresh Solanki <Naresh.Solanki@9elements.com> + */ + +#ifndef _UAPI_REGULATOR_H +#define _UAPI_REGULATOR_H + +#ifdef __KERNEL__ +#include <linux/types.h> +#else +#include <stdint.h> +#endif + +/* + * Regulator notifier events. + * + * UNDER_VOLTAGE Regulator output is under voltage. + * OVER_CURRENT Regulator output current is too high. + * REGULATION_OUT Regulator output is out of regulation. + * FAIL Regulator output has failed. + * OVER_TEMP Regulator over temp. + * FORCE_DISABLE Regulator forcibly shut down by software. + * VOLTAGE_CHANGE Regulator voltage changed. + * Data passed is old voltage cast to (void *). + * DISABLE Regulator was disabled. + * PRE_VOLTAGE_CHANGE Regulator is about to have voltage changed. + * Data passed is "struct pre_voltage_change_data" + * ABORT_VOLTAGE_CHANGE Regulator voltage change failed for some reason. + * Data passed is old voltage cast to (void *). + * PRE_DISABLE Regulator is about to be disabled + * ABORT_DISABLE Regulator disable failed for some reason + * + * NOTE: These events can be OR'ed together when passed into handler. + */ + +#define REGULATOR_EVENT_UNDER_VOLTAGE 0x01 +#define REGULATOR_EVENT_OVER_CURRENT 0x02 +#define REGULATOR_EVENT_REGULATION_OUT 0x04 +#define REGULATOR_EVENT_FAIL 0x08 +#define REGULATOR_EVENT_OVER_TEMP 0x10 +#define REGULATOR_EVENT_FORCE_DISABLE 0x20 +#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 +#define REGULATOR_EVENT_DISABLE 0x80 +#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100 +#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200 +#define REGULATOR_EVENT_PRE_DISABLE 0x400 +#define REGULATOR_EVENT_ABORT_DISABLE 0x800 +#define REGULATOR_EVENT_ENABLE 0x1000 +/* + * Following notifications should be emitted only if detected condition + * is such that the HW is likely to still be working but consumers should + * take a recovery action to prevent problems escalating into errors. + */ +#define REGULATOR_EVENT_UNDER_VOLTAGE_WARN 0x2000 +#define REGULATOR_EVENT_OVER_CURRENT_WARN 0x4000 +#define REGULATOR_EVENT_OVER_VOLTAGE_WARN 0x8000 +#define REGULATOR_EVENT_OVER_TEMP_WARN 0x10000 +#define REGULATOR_EVENT_WARN_MASK 0x1E000 + +struct reg_genl_event { + char reg_name[32]; + uint64_t event; +}; + +/* attributes of reg_genl_family */ +enum { + REG_GENL_ATTR_UNSPEC, + REG_GENL_ATTR_EVENT, /* reg event info needed by user space */ + __REG_GENL_ATTR_MAX, +}; + +#define REG_GENL_ATTR_MAX (__REG_GENL_ATTR_MAX - 1) + +/* commands supported by the reg_genl_family */ +enum { + REG_GENL_CMD_UNSPEC, + REG_GENL_CMD_EVENT, /* kernel->user notifications for reg events */ + __REG_GENL_CMD_MAX, +}; + +#define REG_GENL_CMD_MAX (__REG_GENL_CMD_MAX - 1) + +#define REG_GENL_FAMILY_NAME "reg_event" +#define REG_GENL_VERSION 0x01 +#define REG_GENL_MCAST_GROUP_NAME "reg_mc_group" + +#endif /* _UAPI_REGULATOR_H */ |