Y
  +   ˆl–Ü4ý( ©³( 	Å€fàB¦-ÿÁ„d²/_†I|¥�+ÄÆ ?÷     /* SPDX-License-Identifier: GPL-2.0-only */
/*
 * driver.h -- SoC Regulator driver support.
 *
 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
 *
 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
 *
 * Regulator Driver Interface.
 */

#ifndef __LINUX_REGULATOR_DRIVER_H_
#define __LINUX_REGULATOR_DRIVER_H_

#include <linux/device.h>
#include <linux/linear_range.h>
#include <linux/notifier.h>
#include <linux/regulator/consumer.h>
#include <linux/ww_mutex.h>

struct gpio_desc;
struct regmap;
struct regulator_dev;
struct regulator_config;
struct regulator_init_data;
struct regulator_enable_gpio;

enum regulator_status {
	REGULATOR_STATUS_OFF,
	REGULATOR_STATUS_ON,
	REGULATOR_STATUS_ERROR,
	/* fast/normal/idle/standby are flavors of "on" */
	REGULATOR_STATUS_FAST,
	REGULATOR_STATUS_NORMAL,
	REGULATOR_STATUS_IDLE,
	REGULATOR_STATUS_STANDBY,
	/* The regulator is enabled but not regulating */
	REGULATOR_STATUS_BYPASS,
	/* in case that any other status doesn't apply */
	REGULATOR_STATUS_UNDEFINED,
};

enum regulator_detection_severity {
	/* Hardware shut down voltage outputs if condition is detected */
	REGULATOR_SEVERITY_PROT,
	/* Hardware is probably damaged/inoperable */
	REGULATOR_SEVERITY_ERR,
	/* Hardware is still recoverable but recovery action must be taken */
	REGULATOR_SEVERITY_WARN,
};

/* Initialize struct linear_range for regulators */
#define REGULATOR_LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV)	\
{									\
	.min		= _min_uV,					\
	.min_sel	= _min_sel,					\
	.max_sel	= _max_sel,					\
	.step		= _step_uV,					\
}

/**
 * struct regulator_ops - regulator operations.
 *
 * @enable: Configure the regulator as enabled.
 * @disable: Configure the regulator as disabled.
 * @is_enabled: Return 1 if the regulator is enabled, 0 if not.
 *		May also return negative errno.
 *
 * @set_voltage: Set the voltage for the regulator within the range specified.
 *               The driver should select the voltage closest to min_uV.
 * @set_voltage_sel: Set the voltage for the regulator using the specified
 *                   selector.
 * @map_voltage: Convert a voltage into a selector
 * @get_voltage: Return the currently configured voltage for the regulator;
 *                   return -ENOTRECOVERABLE if regulator can't be read at
 *                   bootup and hasn't been set yet.
 * @get_voltage_sel: Return the currently configured voltage selector for the
 *                   regulator; return -ENOTRECOVERABLE if regulator can't
 *                   be read at bootup and hasn't been set yet.
 * @list_voltage: Return one of the supported voltages, in microvolts; zero
 *	if the selector indicates a voltage that is unusable on this system;
 *	or negative errno.  Selectors range from zero to one less than
 *	regulator_desc.n_voltages.  Voltages may be reported in any order.
 *
 * @set_current_limit: Configure a limit for a current-limited regulator.
 *                     The driver should select the current closest to max_uA.
 * @get_current_limit: Get the configured limit for a current-limited regulator.
 * @set_input_current_limit: Configure an input limit.
 *
 * @set_over_current_protection: Support enabling of and setting limits for over
 *	current situation detection. Detection can be configured for three
 *	levels of severity.
 *
 *	- REGULATOR_SEVERITY_PROT should automatically shut down the regulator(s).
 *
 *	- REGULATOR_SEVERITY_ERR should indicate that over-current situation is
 *		  caused by an unrecoverable error but HW does not perform
 *		  automatic shut down.
 *
 *	- REGULATOR_SEVERITY_WARN should indicate situation where hardware is
 *		  still believed to not be damaged but that a board sepcific
 *		  recovery action is needed. If lim_uA is 0 the limit should not
 *		  be changed but the detection should just be enabled/disabled as
 *		  is requested.
 *
 * @set_over_voltage_protection: Support enabling of and setting limits for over
 *	voltage situation detection. Detection can be configured for same
 *	severities as over current 