2008-04-30 22:10:07 +08:00
|
|
|
/*
|
|
|
|
* consumer.h -- SoC Regulator consumer support.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
|
|
|
|
*
|
2009-02-03 05:43:31 +08:00
|
|
|
* Author: Liam Girdwood <lrg@slimlogic.co.uk>
|
2008-04-30 22:10:07 +08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* Regulator Consumer Interface.
|
|
|
|
*
|
|
|
|
* A Power Management Regulator framework for SoC based devices.
|
|
|
|
* Features:-
|
|
|
|
* o Voltage and current level control.
|
|
|
|
* o Operating mode control.
|
|
|
|
* o Regulator status.
|
|
|
|
* o sysfs entries for showing client devices and status
|
|
|
|
*
|
|
|
|
* EXPERIMENTAL FEATURES:
|
|
|
|
* Dynamic Regulator operating Mode Switching (DRMS) - allows regulators
|
|
|
|
* to use most efficient operating mode depending upon voltage and load and
|
|
|
|
* is transparent to client drivers.
|
|
|
|
*
|
|
|
|
* e.g. Devices x,y,z share regulator r. Device x and y draw 20mA each during
|
|
|
|
* IO and 1mA at idle. Device z draws 100mA when under load and 5mA when
|
|
|
|
* idling. Regulator r has > 90% efficiency in NORMAL mode at loads > 100mA
|
|
|
|
* but this drops rapidly to 60% when below 100mA. Regulator r has > 90%
|
|
|
|
* efficiency in IDLE mode at loads < 10mA. Thus regulator r will operate
|
|
|
|
* in normal mode for loads > 10mA and in IDLE mode for load <= 10mA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LINUX_REGULATOR_CONSUMER_H_
|
|
|
|
#define __LINUX_REGULATOR_CONSUMER_H_
|
|
|
|
|
2014-10-10 03:43:27 +08:00
|
|
|
#include <linux/err.h>
|
|
|
|
|
2012-01-31 00:46:54 +08:00
|
|
|
struct device;
|
|
|
|
struct notifier_block;
|
2014-07-21 23:38:48 +08:00
|
|
|
struct regmap;
|
2009-11-11 22:16:10 +08:00
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
/*
|
|
|
|
* Regulator operating modes.
|
|
|
|
*
|
|
|
|
* Regulators can run in a variety of different operating modes depending on
|
|
|
|
* output load. This allows further system power savings by selecting the
|
|
|
|
* best (and most efficient) regulator mode for a desired load.
|
|
|
|
*
|
|
|
|
* Most drivers will only care about NORMAL. The modes below are generic and
|
|
|
|
* will probably not match the naming convention of your regulator data sheet
|
|
|
|
* but should match the use cases in the datasheet.
|
|
|
|
*
|
|
|
|
* In order of power efficiency (least efficient at top).
|
|
|
|
*
|
|
|
|
* Mode Description
|
|
|
|
* FAST Regulator can handle fast changes in it's load.
|
|
|
|
* e.g. useful in CPU voltage & frequency scaling where
|
|
|
|
* load can quickly increase with CPU frequency increases.
|
|
|
|
*
|
|
|
|
* NORMAL Normal regulator power supply mode. Most drivers will
|
|
|
|
* use this mode.
|
|
|
|
*
|
|
|
|
* IDLE Regulator runs in a more efficient mode for light
|
|
|
|
* loads. Can be used for devices that have a low power
|
|
|
|
* requirement during periods of inactivity. This mode
|
|
|
|
* may be more noisy than NORMAL and may not be able
|
|
|
|
* to handle fast load switching.
|
|
|
|
*
|
|
|
|
* STANDBY Regulator runs in the most efficient mode for very
|
|
|
|
* light loads. Can be used by devices when they are
|
|
|
|
* in a sleep/standby state. This mode is likely to be
|
|
|
|
* the most noisy and may not be able to handle fast load
|
|
|
|
* switching.
|
|
|
|
*
|
|
|
|
* NOTE: Most regulators will only support a subset of these modes. Some
|
|
|
|
* will only just support NORMAL.
|
|
|
|
*
|
|
|
|
* These modes can be OR'ed together to make up a mask of valid register modes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define REGULATOR_MODE_FAST 0x1
|
|
|
|
#define REGULATOR_MODE_NORMAL 0x2
|
|
|
|
#define REGULATOR_MODE_IDLE 0x4
|
|
|
|
#define REGULATOR_MODE_STANDBY 0x8
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
2009-12-02 05:12:27 +08:00
|
|
|
* FORCE_DISABLE Regulator forcibly shut down by software.
|
2009-01-20 02:20:58 +08:00
|
|
|
* VOLTAGE_CHANGE Regulator voltage changed.
|
2014-08-29 03:36:04 +08:00
|
|
|
* Data passed is old voltage cast to (void *).
|
2009-12-02 05:12:27 +08:00
|
|
|
* DISABLE Regulator was disabled.
|
2014-08-29 03:36:04 +08:00
|
|
|
* 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 *).
|
2014-11-24 22:10:52 +08:00
|
|
|
* PRE_DISABLE Regulator is about to be disabled
|
|
|
|
* ABORT_DISABLE Regulator disable failed for some reason
|
2008-04-30 22:10:07 +08:00
|
|
|
*
|
|
|
|
* 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
|
2009-01-20 02:20:58 +08:00
|
|
|
#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
|
2015-02-24 00:10:03 +08:00
|
|
|
#define REGULATOR_EVENT_DISABLE 0x80
|
2014-08-29 03:36:04 +08:00
|
|
|
#define REGULATOR_EVENT_PRE_VOLTAGE_CHANGE 0x100
|
|
|
|
#define REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE 0x200
|
2014-11-24 22:10:52 +08:00
|
|
|
#define REGULATOR_EVENT_PRE_DISABLE 0x400
|
|
|
|
#define REGULATOR_EVENT_ABORT_DISABLE 0x800
|
2014-08-29 03:36:04 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* struct pre_voltage_change_data - Data sent with PRE_VOLTAGE_CHANGE event
|
|
|
|
*
|
|
|
|
* @old_uV: Current voltage before change.
|
|
|
|
* @min_uV: Min voltage we'll change to.
|
|
|
|
* @max_uV: Max voltage we'll change to.
|
|
|
|
*/
|
|
|
|
struct pre_voltage_change_data {
|
|
|
|
unsigned long old_uV;
|
|
|
|
unsigned long min_uV;
|
|
|
|
unsigned long max_uV;
|
|
|
|
};
|
2008-04-30 22:10:07 +08:00
|
|
|
|
|
|
|
struct regulator;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct regulator_bulk_data - Data used for bulk regulator operations.
|
|
|
|
*
|
2008-12-31 20:52:41 +08:00
|
|
|
* @supply: The name of the supply. Initialised by the user before
|
|
|
|
* using the bulk regulator APIs.
|
|
|
|
* @consumer: The regulator consumer for the supply. This will be managed
|
|
|
|
* by the bulk API.
|
2008-04-30 22:10:07 +08:00
|
|
|
*
|
|
|
|
* The regulator APIs provide a series of regulator_bulk_() API calls as
|
|
|
|
* a convenience to consumers which require multiple supplies. This
|
|
|
|
* structure is used to manage data for these calls.
|
|
|
|
*/
|
|
|
|
struct regulator_bulk_data {
|
|
|
|
const char *supply;
|
|
|
|
struct regulator *consumer;
|
2011-05-24 08:12:40 +08:00
|
|
|
|
2011-09-09 01:16:47 +08:00
|
|
|
/* private: Internal use */
|
2011-05-24 08:12:40 +08:00
|
|
|
int ret;
|
2008-04-30 22:10:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#if defined(CONFIG_REGULATOR)
|
|
|
|
|
|
|
|
/* regulator get and put */
|
|
|
|
struct regulator *__must_check regulator_get(struct device *dev,
|
|
|
|
const char *id);
|
2012-01-17 11:39:58 +08:00
|
|
|
struct regulator *__must_check devm_regulator_get(struct device *dev,
|
|
|
|
const char *id);
|
2009-07-21 23:00:23 +08:00
|
|
|
struct regulator *__must_check regulator_get_exclusive(struct device *dev,
|
|
|
|
const char *id);
|
2013-08-25 23:54:13 +08:00
|
|
|
struct regulator *__must_check devm_regulator_get_exclusive(struct device *dev,
|
|
|
|
const char *id);
|
2013-07-30 04:42:42 +08:00
|
|
|
struct regulator *__must_check regulator_get_optional(struct device *dev,
|
|
|
|
const char *id);
|
|
|
|
struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
|
|
|
|
const char *id);
|
2008-04-30 22:10:07 +08:00
|
|
|
void regulator_put(struct regulator *regulator);
|
2012-01-29 17:52:37 +08:00
|
|
|
void devm_regulator_put(struct regulator *regulator);
|
2008-04-30 22:10:07 +08:00
|
|
|
|
2013-10-16 03:14:20 +08:00
|
|
|
int regulator_register_supply_alias(struct device *dev, const char *id,
|
|
|
|
struct device *alias_dev,
|
|
|
|
const char *alias_id);
|
|
|
|
void regulator_unregister_supply_alias(struct device *dev, const char *id);
|
|
|
|
|
2014-05-23 23:44:10 +08:00
|
|
|
int regulator_bulk_register_supply_alias(struct device *dev,
|
|
|
|
const char *const *id,
|
2013-10-16 03:14:20 +08:00
|
|
|
struct device *alias_dev,
|
2014-05-23 23:44:10 +08:00
|
|
|
const char *const *alias_id,
|
|
|
|
int num_id);
|
2013-10-16 03:14:20 +08:00
|
|
|
void regulator_bulk_unregister_supply_alias(struct device *dev,
|
2014-05-23 23:44:10 +08:00
|
|
|
const char * const *id, int num_id);
|
2013-10-16 03:14:20 +08:00
|
|
|
|
|
|
|
int devm_regulator_register_supply_alias(struct device *dev, const char *id,
|
|
|
|
struct device *alias_dev,
|
|
|
|
const char *alias_id);
|
|
|
|
void devm_regulator_unregister_supply_alias(struct device *dev,
|
|
|
|
const char *id);
|
|
|
|
|
|
|
|
int devm_regulator_bulk_register_supply_alias(struct device *dev,
|
2014-05-23 23:44:10 +08:00
|
|
|
const char *const *id,
|
2013-10-16 03:14:20 +08:00
|
|
|
struct device *alias_dev,
|
2014-05-23 23:44:10 +08:00
|
|
|
const char *const *alias_id,
|
2013-10-16 03:14:20 +08:00
|
|
|
int num_id);
|
|
|
|
void devm_regulator_bulk_unregister_supply_alias(struct device *dev,
|
2014-05-23 23:44:10 +08:00
|
|
|
const char *const *id,
|
2013-10-16 03:14:20 +08:00
|
|
|
int num_id);
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
/* regulator output control and status */
|
2012-03-20 00:35:48 +08:00
|
|
|
int __must_check regulator_enable(struct regulator *regulator);
|
2008-04-30 22:10:07 +08:00
|
|
|
int regulator_disable(struct regulator *regulator);
|
|
|
|
int regulator_force_disable(struct regulator *regulator);
|
|
|
|
int regulator_is_enabled(struct regulator *regulator);
|
2011-09-11 16:53:50 +08:00
|
|
|
int regulator_disable_deferred(struct regulator *regulator, int ms);
|
2008-04-30 22:10:07 +08:00
|
|
|
|
2012-03-20 00:35:48 +08:00
|
|
|
int __must_check regulator_bulk_get(struct device *dev, int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers);
|
|
|
|
int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers);
|
|
|
|
int __must_check regulator_bulk_enable(int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers);
|
2008-04-30 22:10:07 +08:00
|
|
|
int regulator_bulk_disable(int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers);
|
2012-01-03 15:22:03 +08:00
|
|
|
int regulator_bulk_force_disable(int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers);
|
2008-04-30 22:10:07 +08:00
|
|
|
void regulator_bulk_free(int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers);
|
|
|
|
|
2012-12-04 22:01:01 +08:00
|
|
|
int regulator_can_change_voltage(struct regulator *regulator);
|
2009-02-27 03:48:36 +08:00
|
|
|
int regulator_count_voltages(struct regulator *regulator);
|
|
|
|
int regulator_list_voltage(struct regulator *regulator, unsigned selector);
|
2009-07-21 23:00:24 +08:00
|
|
|
int regulator_is_supported_voltage(struct regulator *regulator,
|
|
|
|
int min_uV, int max_uV);
|
2013-06-07 16:06:56 +08:00
|
|
|
unsigned int regulator_get_linear_step(struct regulator *regulator);
|
2008-04-30 22:10:07 +08:00
|
|
|
int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
|
2011-03-17 20:24:52 +08:00
|
|
|
int regulator_set_voltage_time(struct regulator *regulator,
|
|
|
|
int old_uV, int new_uV);
|
2008-04-30 22:10:07 +08:00
|
|
|
int regulator_get_voltage(struct regulator *regulator);
|
2010-12-16 23:49:36 +08:00
|
|
|
int regulator_sync_voltage(struct regulator *regulator);
|
2008-04-30 22:10:07 +08:00
|
|
|
int regulator_set_current_limit(struct regulator *regulator,
|
|
|
|
int min_uA, int max_uA);
|
|
|
|
int regulator_get_current_limit(struct regulator *regulator);
|
|
|
|
|
|
|
|
int regulator_set_mode(struct regulator *regulator, unsigned int mode);
|
|
|
|
unsigned int regulator_get_mode(struct regulator *regulator);
|
2015-02-12 11:35:27 +08:00
|
|
|
int regulator_set_load(struct regulator *regulator, int load_uA);
|
2008-04-30 22:10:07 +08:00
|
|
|
|
2012-09-01 01:36:37 +08:00
|
|
|
int regulator_allow_bypass(struct regulator *regulator, bool allow);
|
|
|
|
|
2014-07-21 23:38:48 +08:00
|
|
|
struct regmap *regulator_get_regmap(struct regulator *regulator);
|
|
|
|
int regulator_get_hardware_vsel_register(struct regulator *regulator,
|
|
|
|
unsigned *vsel_reg,
|
|
|
|
unsigned *vsel_mask);
|
|
|
|
int regulator_list_hardware_vsel(struct regulator *regulator,
|
|
|
|
unsigned selector);
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
/* regulator notifier block */
|
|
|
|
int regulator_register_notifier(struct regulator *regulator,
|
|
|
|
struct notifier_block *nb);
|
2015-03-05 23:39:20 +08:00
|
|
|
int devm_regulator_register_notifier(struct regulator *regulator,
|
|
|
|
struct notifier_block *nb);
|
2008-04-30 22:10:07 +08:00
|
|
|
int regulator_unregister_notifier(struct regulator *regulator,
|
|
|
|
struct notifier_block *nb);
|
2015-03-05 23:39:20 +08:00
|
|
|
void devm_regulator_unregister_notifier(struct regulator *regulator,
|
|
|
|
struct notifier_block *nb);
|
2008-04-30 22:10:07 +08:00
|
|
|
|
|
|
|
/* driver data - core doesn't touch */
|
|
|
|
void *regulator_get_drvdata(struct regulator *regulator);
|
|
|
|
void regulator_set_drvdata(struct regulator *regulator, void *data);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure client drivers will still build on systems with no software
|
|
|
|
* controllable voltage or current regulators.
|
|
|
|
*/
|
|
|
|
static inline struct regulator *__must_check regulator_get(struct device *dev,
|
|
|
|
const char *id)
|
|
|
|
{
|
|
|
|
/* Nothing except the stubbed out regulator API should be
|
|
|
|
* looking at the value except to check if it is an error
|
2010-04-03 23:37:45 +08:00
|
|
|
* value. Drivers are free to handle NULL specifically by
|
|
|
|
* skipping all regulator API calls, but they don't have to.
|
|
|
|
* Drivers which don't, should make sure they properly handle
|
|
|
|
* corner cases of the API, such as regulator_get_voltage()
|
|
|
|
* returning 0.
|
2008-04-30 22:10:07 +08:00
|
|
|
*/
|
2010-04-03 23:37:45 +08:00
|
|
|
return NULL;
|
2008-04-30 22:10:07 +08:00
|
|
|
}
|
2012-01-17 11:39:58 +08:00
|
|
|
|
|
|
|
static inline struct regulator *__must_check
|
|
|
|
devm_regulator_get(struct device *dev, const char *id)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-30 04:00:53 +08:00
|
|
|
static inline struct regulator *__must_check
|
|
|
|
regulator_get_exclusive(struct device *dev, const char *id)
|
|
|
|
{
|
2014-10-25 04:56:58 +08:00
|
|
|
return ERR_PTR(-ENODEV);
|
2013-07-30 04:00:53 +08:00
|
|
|
}
|
|
|
|
|
2013-07-30 04:42:42 +08:00
|
|
|
static inline struct regulator *__must_check
|
|
|
|
regulator_get_optional(struct device *dev, const char *id)
|
|
|
|
{
|
2014-04-18 02:55:24 +08:00
|
|
|
return ERR_PTR(-ENODEV);
|
2013-07-30 04:42:42 +08:00
|
|
|
}
|
|
|
|
|
2013-07-30 04:00:53 +08:00
|
|
|
|
2012-01-17 11:39:58 +08:00
|
|
|
static inline struct regulator *__must_check
|
2013-07-30 04:42:42 +08:00
|
|
|
devm_regulator_get_optional(struct device *dev, const char *id)
|
2012-01-17 11:39:58 +08:00
|
|
|
{
|
2014-04-18 02:55:24 +08:00
|
|
|
return ERR_PTR(-ENODEV);
|
2012-01-17 11:39:58 +08:00
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline void regulator_put(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-01-29 17:52:37 +08:00
|
|
|
static inline void devm_regulator_put(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-10-16 03:14:20 +08:00
|
|
|
static inline int regulator_register_supply_alias(struct device *dev,
|
|
|
|
const char *id,
|
|
|
|
struct device *alias_dev,
|
|
|
|
const char *alias_id)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void regulator_unregister_supply_alias(struct device *dev,
|
|
|
|
const char *id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int regulator_bulk_register_supply_alias(struct device *dev,
|
2014-05-23 23:44:10 +08:00
|
|
|
const char *const *id,
|
|
|
|
struct device *alias_dev,
|
|
|
|
const char * const *alias_id,
|
|
|
|
int num_id)
|
2013-10-16 03:14:20 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void regulator_bulk_unregister_supply_alias(struct device *dev,
|
2014-05-23 23:44:10 +08:00
|
|
|
const char * const *id,
|
|
|
|
int num_id)
|
2013-10-16 03:14:20 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int devm_regulator_register_supply_alias(struct device *dev,
|
|
|
|
const char *id,
|
|
|
|
struct device *alias_dev,
|
|
|
|
const char *alias_id)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void devm_regulator_unregister_supply_alias(struct device *dev,
|
|
|
|
const char *id)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-05-23 23:44:10 +08:00
|
|
|
static inline int devm_regulator_bulk_register_supply_alias(struct device *dev,
|
|
|
|
const char *const *id,
|
|
|
|
struct device *alias_dev,
|
|
|
|
const char *const *alias_id,
|
|
|
|
int num_id)
|
2013-10-16 03:14:20 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void devm_regulator_bulk_unregister_supply_alias(
|
2014-05-23 23:44:10 +08:00
|
|
|
struct device *dev, const char *const *id, int num_id)
|
2013-10-16 03:14:20 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline int regulator_enable(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int regulator_disable(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-02 17:49:32 +08:00
|
|
|
static inline int regulator_force_disable(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-09-11 16:53:50 +08:00
|
|
|
static inline int regulator_disable_deferred(struct regulator *regulator,
|
|
|
|
int ms)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline int regulator_is_enabled(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int regulator_bulk_get(struct device *dev,
|
|
|
|
int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-27 12:55:28 +08:00
|
|
|
static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline int regulator_bulk_enable(int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int regulator_bulk_disable(int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-03 15:22:03 +08:00
|
|
|
static inline int regulator_bulk_force_disable(int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline void regulator_bulk_free(int num_consumers,
|
|
|
|
struct regulator_bulk_data *consumers)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-06-04 22:46:00 +08:00
|
|
|
static inline int regulator_can_change_voltage(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2008-04-30 22:10:07 +08:00
|
|
|
|
|
|
|
static inline int regulator_set_voltage(struct regulator *regulator,
|
|
|
|
int min_uV, int max_uV)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-27 20:07:29 +08:00
|
|
|
static inline int regulator_set_voltage_time(struct regulator *regulator,
|
|
|
|
int old_uV, int new_uV)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline int regulator_get_voltage(struct regulator *regulator)
|
|
|
|
{
|
2012-06-11 20:14:24 +08:00
|
|
|
return -EINVAL;
|
2008-04-30 22:10:07 +08:00
|
|
|
}
|
|
|
|
|
2012-07-01 07:05:36 +08:00
|
|
|
static inline int regulator_is_supported_voltage(struct regulator *regulator,
|
|
|
|
int min_uV, int max_uV)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline int regulator_set_current_limit(struct regulator *regulator,
|
|
|
|
int min_uA, int max_uA)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int regulator_get_current_limit(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int regulator_set_mode(struct regulator *regulator,
|
|
|
|
unsigned int mode)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int regulator_get_mode(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
return REGULATOR_MODE_NORMAL;
|
|
|
|
}
|
|
|
|
|
2015-02-12 11:35:27 +08:00
|
|
|
static inline int regulator_set_load(struct regulator *regulator, int load_uA)
|
2008-04-30 22:10:07 +08:00
|
|
|
{
|
|
|
|
return REGULATOR_MODE_NORMAL;
|
|
|
|
}
|
|
|
|
|
2012-09-01 01:36:37 +08:00
|
|
|
static inline int regulator_allow_bypass(struct regulator *regulator,
|
|
|
|
bool allow)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-07-26 02:07:11 +08:00
|
|
|
static inline struct regmap *regulator_get_regmap(struct regulator *regulator)
|
2014-07-21 23:38:48 +08:00
|
|
|
{
|
|
|
|
return ERR_PTR(-EOPNOTSUPP);
|
|
|
|
}
|
|
|
|
|
2014-07-26 02:07:11 +08:00
|
|
|
static inline int regulator_get_hardware_vsel_register(struct regulator *regulator,
|
|
|
|
unsigned *vsel_reg,
|
|
|
|
unsigned *vsel_mask)
|
2014-07-21 23:38:48 +08:00
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
2014-07-26 02:07:11 +08:00
|
|
|
static inline int regulator_list_hardware_vsel(struct regulator *regulator,
|
|
|
|
unsigned selector)
|
2014-07-21 23:38:48 +08:00
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline int regulator_register_notifier(struct regulator *regulator,
|
|
|
|
struct notifier_block *nb)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-03-05 23:39:20 +08:00
|
|
|
static inline int devm_regulator_register_notifier(struct regulator *regulator,
|
|
|
|
struct notifier_block *nb)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline int regulator_unregister_notifier(struct regulator *regulator,
|
|
|
|
struct notifier_block *nb)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-03-05 23:39:20 +08:00
|
|
|
static inline int devm_regulator_unregister_notifier(struct regulator *regulator,
|
|
|
|
struct notifier_block *nb)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
static inline void *regulator_get_drvdata(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void regulator_set_drvdata(struct regulator *regulator,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-11-21 01:07:41 +08:00
|
|
|
static inline int regulator_count_voltages(struct regulator *regulator)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2008-04-30 22:10:07 +08:00
|
|
|
#endif
|
|
|
|
|
2012-08-05 23:05:20 +08:00
|
|
|
static inline int regulator_set_voltage_tol(struct regulator *regulator,
|
|
|
|
int new_uV, int tol_uV)
|
|
|
|
{
|
2013-07-05 00:27:14 +08:00
|
|
|
if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return regulator_set_voltage(regulator,
|
|
|
|
new_uV - tol_uV, new_uV + tol_uV);
|
2012-08-05 23:05:20 +08:00
|
|
|
}
|
|
|
|
|
2012-11-14 15:47:10 +08:00
|
|
|
static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
|
|
|
|
int target_uV, int tol_uV)
|
|
|
|
{
|
|
|
|
return regulator_is_supported_voltage(regulator,
|
|
|
|
target_uV - tol_uV,
|
|
|
|
target_uV + tol_uV);
|
|
|
|
}
|
|
|
|
|
2008-04-30 22:10:07 +08:00
|
|
|
#endif
|