mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-06-21 15:43:21 +02:00
9085f71285
The consumer drivers can make use of the pwrseq device's 'dev' pointer to query the pwrseq provider's DT node to check for existence of specific properties. Hence, add an API to return the pwrseq device's 'dev' pointer to consumers. Note that since pwrseq_get() would've increased the pwrseq refcount, there is no need to increase the refcount in this API again. Tested-by: Wei Deng <wei.deng@oss.qualcomm.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Link: https://patch.msgid.link/20260519-pwrseq-m2-bt-v3-6-b39dc2ae3966@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
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_power_on(struct pwrseq_desc *desc);
|
|
int pwrseq_power_off(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_power_on(struct pwrseq_desc *desc)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
static inline int pwrseq_power_off(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__ */
|