Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd214762 authored by Osvaldo Banuelos's avatar Osvaldo Banuelos
Browse files

power: qcom: apm: add msm_apm_get_supply() to determine APM mode



Add a function which consumers can call to determine the current
APM supply selection. This is useful in scenarios where consumer
drivers need to determine what the current APM mode is.

Change-Id: I16b7e6814ef98f2119899451f8700998d8ee9c9f
Signed-off-by: default avatarOsvaldo Banuelos <osvaldob@codeaurora.org>
parent 85125f66
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -392,6 +392,19 @@ static int msm_apm_switch_to_apcc(struct msm_apm_ctrl_dev *ctrl_dev)
	return ret;
}

/**
 * msm_apm_get_supply() - Returns the supply that is currently
 *			powering the memory arrays
 * @ctrl_dev:                   Pointer to an MSM APM controller device
 *
 * Returns the supply currently selected by the APM.
 */
int msm_apm_get_supply(struct msm_apm_ctrl_dev *ctrl_dev)
{
	return ctrl_dev->supply;
}
EXPORT_SYMBOL(msm_apm_get_supply);

/**
 * msm_apm_set_supply() - Perform the necessary steps to switch the voltage
 *                        source of the memory arrays to a given supply
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ struct msm_apm_ctrl_dev;
struct msm_apm_ctrl_dev *msm_apm_ctrl_dev_get(struct device *dev);
int msm_apm_set_supply(struct msm_apm_ctrl_dev *ctrl_dev,
		       enum msm_apm_supply supply);
int msm_apm_get_supply(struct msm_apm_ctrl_dev *ctrl_dev);

#else
static inline struct msm_apm_ctrl_dev *msm_apm_ctrl_dev_get(struct device *dev)
@@ -41,5 +42,7 @@ static inline struct msm_apm_ctrl_dev *msm_apm_ctrl_dev_get(struct device *dev)
static inline int msm_apm_set_supply(struct msm_apm_ctrl_dev *ctrl_dev,
		       enum msm_apm_supply supply)
{ return -EPERM; }
static inline int msm_apm_get_supply(struct msm_apm_ctrl_dev *ctrl_dev);
{ return -EPERM; }
#endif
#endif