• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __QCOM_SMEM_STATE__
3 #define __QCOM_SMEM_STATE__
4 
5 #include <linux/err.h>
6 
7 struct device_node;
8 struct qcom_smem_state;
9 
10 struct qcom_smem_state_ops {
11 	int (*update_bits)(void *, u32, u32);
12 };
13 
14 #ifdef CONFIG_QCOM_SMEM_STATE
15 
16 struct qcom_smem_state *qcom_smem_state_get(struct device *dev, const char *con_id, unsigned *bit);
17 void qcom_smem_state_put(struct qcom_smem_state *);
18 
19 int qcom_smem_state_update_bits(struct qcom_smem_state *state, u32 mask, u32 value);
20 
21 struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node, const struct qcom_smem_state_ops *ops, void *data);
22 void qcom_smem_state_unregister(struct qcom_smem_state *state);
23 
24 #else
25 
qcom_smem_state_get(struct device * dev,const char * con_id,unsigned * bit)26 static inline struct qcom_smem_state *qcom_smem_state_get(struct device *dev,
27 	const char *con_id, unsigned *bit)
28 {
29 	return ERR_PTR(-EINVAL);
30 }
31 
qcom_smem_state_put(struct qcom_smem_state * state)32 static inline void qcom_smem_state_put(struct qcom_smem_state *state)
33 {
34 }
35 
qcom_smem_state_update_bits(struct qcom_smem_state * state,u32 mask,u32 value)36 static inline int qcom_smem_state_update_bits(struct qcom_smem_state *state,
37 	u32 mask, u32 value)
38 {
39 	return -EINVAL;
40 }
41 
qcom_smem_state_register(struct device_node * of_node,const struct qcom_smem_state_ops * ops,void * data)42 static inline struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node,
43 	const struct qcom_smem_state_ops *ops, void *data)
44 {
45 	return ERR_PTR(-EINVAL);
46 }
47 
qcom_smem_state_unregister(struct qcom_smem_state * state)48 static inline void qcom_smem_state_unregister(struct qcom_smem_state *state)
49 {
50 }
51 
52 #endif
53 
54 #endif
55