mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 21:02:43 +01:00
The way power sequencing works means that a call to pwrseq_power_on() does not necessarily result in the pwrseq target being powered-on at that time: it may have already been powered on before. Similarly: a call to pwrseq_power_off() does not have to result in an actual powering off of resources: there may still be other users that requested a power-on before. We will also introduce the concept of "non-controllable" pwrseq targets soon which further increases the disconnect between the naming convention and the actual semantics. What consumers of pwrseq descriptors actually do is: they *vote* for a powering on of a given target or retract that vote. These operations could be called get/put in line with runtime PM but this could become confusing since we already provide pwrseq_get/put() for a different purpose. pwrseq_vote_on/off() also have been rejected as unusual in the tree. Change the name of the two functions to pwrseq_enable/disable() which better reflects their purpose and semantics and also mirrors other enable-counted resources like regulators and clocks. No functional change intended. If at any point users need to know *when* the exact power event happens, we can provide that information in the form of a notifier. Acked-by: Jeff Johnson <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Acked-by: Manivannan Sadhasivam <[email protected]> Acked-by: Alessio Belle <[email protected]> # imagination Link: https://patch.msgid.link/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2024 Linaro Ltd.
|
|
*/
|
|
|
|
#ifndef __POWER_SEQUENCING_CONSUMER_H__
|
|
#define __POWER_SEQUENCING_CONSUMER_H__
|
|
|
|
#include <linux/err.h>
|
|
|
|
struct device;
|
|
struct pwrseq_desc;
|
|
|
|
#if IS_ENABLED(CONFIG_POWER_SEQUENCING)
|
|
|
|
struct pwrseq_desc * __must_check
|
|
pwrseq_get(struct device *dev, const char *target);
|
|
void pwrseq_put(struct pwrseq_desc *desc);
|
|
|
|
struct pwrseq_desc * __must_check
|
|
devm_pwrseq_get(struct device *dev, const char *target);
|
|
|
|
int pwrseq_enable(struct pwrseq_desc *desc);
|
|
int pwrseq_disable(struct pwrseq_desc *desc);
|
|
|
|
struct device *pwrseq_to_device(struct pwrseq_desc *desc);
|
|
|
|
#else /* CONFIG_POWER_SEQUENCING */
|
|
|
|
static inline struct pwrseq_desc * __must_check
|
|
pwrseq_get(struct device *dev, const char *target)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
|
|
static inline void pwrseq_put(struct pwrseq_desc *desc)
|
|
{
|
|
}
|
|
|
|
static inline struct pwrseq_desc * __must_check
|
|
devm_pwrseq_get(struct device *dev, const char *target)
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
|
|
static inline int pwrseq_enable(struct pwrseq_desc *desc)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline int pwrseq_disable(struct pwrseq_desc *desc)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline struct device *pwrseq_to_device(struct pwrseq_desc *desc)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
#endif /* CONFIG_POWER_SEQUENCING */
|
|
|
|
#endif /* __POWER_SEQUENCING_CONSUMER_H__ */
|