0
  *   ˆl–Ü4ý( ©³( 	Å€fàB¦-ÿÁƒ}çC_†I|¥�+ÁÀ &�    /* SPDX-License-Identifier: GPL-2.0-only */
/*
 * machine.h -- SoC Regulator support, machine/board driver API.
 *
 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
 *
 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
 *
 * Regulator Machine/Board Interface.
 */

#ifndef __LINUX_REGULATOR_MACHINE_H_
#define __LINUX_REGULATOR_MACHINE_H_

#include <linux/regulator/consumer.h>
#include <linux/suspend.h>

struct regulator;

/*
 * Regulator operation constraint flags. These flags are used to enable
 * certain regulator operations and can be OR'ed together.
 *
 * VOLTAGE:  Regulator output voltage can be changed by software on this
 *           board/machine.
 * CURRENT:  Regulator output current can be changed by software on this
 *           board/machine.
 * MODE:     Regulator operating mode can be changed by software on this
 *           board/machine.
 * STATUS:   Regulator can be enabled and disabled.
 * DRMS:     Dynamic Regulator Mode Switching is enabled for this regulator.
 * BYPASS:   Regulator can be put into bypass mode
 */

#define REGULATOR_CHANGE_VOLTAGE	0x1
#define REGULATOR_CHANGE_CURRENT	0x2
#define REGULATOR_CHANGE_MODE		0x4
#define REGULATOR_CHANGE_STATUS		0x8
#define REGULATOR_CHANGE_DRMS		0x10
#define REGULATOR_CHANGE_BYPASS		0x20

/*
 * operations in suspend mode
 * DO_NOTHING_IN_SUSPEND - the default value
 * DISABLE_IN_SUSPEND	- turn off regulator in suspend states
 * ENABLE_IN_SUSPEND	- keep regulator on in suspend states
 */
#define DO_NOTHING_IN_SUSPEND	0
#define DISABLE_IN_SUSPEND	1
#define ENABLE_IN_SUSPEND	2

/* Regulator active discharge flags */
enum regulator_active_discharge {
	REGULATOR_ACTIVE_DISCHARGE_DEFAULT,
	REGULATOR_ACTIVE_DISCHARGE_DISABLE,
	REGULATOR_ACTIVE_DISCHARGE_ENABLE,
};

/**
 * struct regulator_state - regulator state during low power system states
 *
 * This describes a regulators state during a system wide low power
 * state.  One of enabled or disabled must be set for the
 * configuration to be applied.
 *
 * @uV: Default operating voltage during suspend, it can be adjusted
 *	among <min_uV, max_uV>.
 * @min_uV: Minimum suspend voltage may be set.
 * @max_uV: Maximum suspend voltage may be set.
 * @mode: Operating mode during suspend.
 * @enabled: operations during suspend.
 *	     - DO_NOTHING_IN_SUSPEND
 *	     - DISABLE_IN_SUSPEND
 *	     - ENABLE_IN_SUSPEND
 * @changeable: Is this state can be switched between enabled/disabled,
 */
struct regulator_state {
	int uV;
	int min_uV;
	int max_uV;
	unsigned int mode;
	int enabled;
	bool changeable;
};

#define REGULATOR_NOTIF_LIMIT_DISABLE -1
#define REGULATOR_NOTIF_LIMIT_ENABLE -2
struct notification_limit {
	int prot;
	int err;
	int warn;
};

/**
 * struct regulation_constraints - regulator operating constraints.
 *
 * This struct describes regulator and board/machine specific constraints.
 *
 * @name: Descriptive name for the constraints, used for display purposes.
 *
 * @min_uV: Smallest voltage consumers may set.
 * @max_uV: Largest voltage consumers may set.
 * @uV_offset: Offset applied to voltages from consumer to compensate for
 *             voltage drops.
 *
 * @min_uA: Smallest current consumers may set.
 * @max_uA: Largest current consumers may set.
 * @ilim_uA: Maximum input current.
 * @system_load: Load that isn't captured by any consumer requests.
 *
 * @over_curr_limits:		Limits for acting on over current.
 * @over_voltage_limits:	Limits for acting on over voltage.
 * @under_voltage_limits:	Limits for acting on under voltage.
 * @temp_limits:		Limits for acting on over temperature.

 * @max_spread: Max possible spread between coupled regulators
 * @max_uV_step: Max possible step change in voltage
 * @valid_modes_mask: Mask of modes which may be configured by consumers.
 * @valid_ops_mask: Operations which may be performed by consumers.
 *
 * @always_on: Set if the regulator should never be disabled.
 * @boot_on: Set if the regulator is enabled when the system is initially
 *           started.  If the regulator is not enabled by the hardwa