0001
0002 #ifndef __QCOM_SMEM_STATE__
0003 #define __QCOM_SMEM_STATE__
0004
0005 #include <linux/err.h>
0006
0007 struct device_node;
0008 struct qcom_smem_state;
0009
0010 struct qcom_smem_state_ops {
0011 int (*update_bits)(void *, u32, u32);
0012 };
0013
0014 #ifdef CONFIG_QCOM_SMEM_STATE
0015
0016 struct qcom_smem_state *qcom_smem_state_get(struct device *dev, const char *con_id, unsigned *bit);
0017 struct qcom_smem_state *devm_qcom_smem_state_get(struct device *dev, const char *con_id, unsigned *bit);
0018 void qcom_smem_state_put(struct qcom_smem_state *);
0019
0020 int qcom_smem_state_update_bits(struct qcom_smem_state *state, u32 mask, u32 value);
0021
0022 struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node, const struct qcom_smem_state_ops *ops, void *data);
0023 void qcom_smem_state_unregister(struct qcom_smem_state *state);
0024
0025 #else
0026
0027 static inline struct qcom_smem_state *qcom_smem_state_get(struct device *dev,
0028 const char *con_id, unsigned *bit)
0029 {
0030 return ERR_PTR(-EINVAL);
0031 }
0032
0033 static inline struct qcom_smem_state *devm_qcom_smem_state_get(struct device *dev,
0034 const char *con_id,
0035 unsigned *bit)
0036 {
0037 return ERR_PTR(-EINVAL);
0038 }
0039
0040 static inline void qcom_smem_state_put(struct qcom_smem_state *state)
0041 {
0042 }
0043
0044 static inline int qcom_smem_state_update_bits(struct qcom_smem_state *state,
0045 u32 mask, u32 value)
0046 {
0047 return -EINVAL;
0048 }
0049
0050 static inline struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node,
0051 const struct qcom_smem_state_ops *ops, void *data)
0052 {
0053 return ERR_PTR(-EINVAL);
0054 }
0055
0056 static inline void qcom_smem_state_unregister(struct qcom_smem_state *state)
0057 {
0058 }
0059
0060 #endif
0061
0062 #endif