^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef __SOC_QCOM_RPMH_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __SOC_QCOM_RPMH_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <soc/qcom/tcs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #if IS_ENABLED(CONFIG_QCOM_RPMH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) int rpmh_write(const struct device *dev, enum rpmh_state state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) const struct tcs_cmd *cmd, u32 n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) int rpmh_write_async(const struct device *dev, enum rpmh_state state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) const struct tcs_cmd *cmd, u32 n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) int rpmh_write_batch(const struct device *dev, enum rpmh_state state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) const struct tcs_cmd *cmd, u32 *n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) void rpmh_invalidate(const struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static inline int rpmh_write(const struct device *dev, enum rpmh_state state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) const struct tcs_cmd *cmd, u32 n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) { return -ENODEV; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) static inline int rpmh_write_async(const struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) enum rpmh_state state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) const struct tcs_cmd *cmd, u32 n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) { return -ENODEV; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static inline int rpmh_write_batch(const struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) enum rpmh_state state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) const struct tcs_cmd *cmd, u32 *n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) { return -ENODEV; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static inline void rpmh_invalidate(const struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #endif /* CONFIG_QCOM_RPMH */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #endif /* __SOC_QCOM_RPMH_H__ */