smem_state.h 1.3 KB
Newer Older
1 2 3
#ifndef __QCOM_SMEM_STATE__
#define __QCOM_SMEM_STATE__

4 5 6
#include <linux/errno.h>

struct device_node;
7 8 9 10 11 12
struct qcom_smem_state;

struct qcom_smem_state_ops {
	int (*update_bits)(void *, u32, u32);
};

13 14
#ifdef CONFIG_QCOM_SMEM_STATE

15 16 17 18 19 20 21 22
struct qcom_smem_state *qcom_smem_state_get(struct device *dev, const char *con_id, unsigned *bit);
void qcom_smem_state_put(struct qcom_smem_state *);

int qcom_smem_state_update_bits(struct qcom_smem_state *state, u32 mask, u32 value);

struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node, const struct qcom_smem_state_ops *ops, void *data);
void qcom_smem_state_unregister(struct qcom_smem_state *state);

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#else

static inline struct qcom_smem_state *qcom_smem_state_get(struct device *dev,
	const char *con_id, unsigned *bit)
{
	return ERR_PTR(-EINVAL);
}

static inline void qcom_smem_state_put(struct qcom_smem_state *state)
{
}

static inline int qcom_smem_state_update_bits(struct qcom_smem_state *state,
	u32 mask, u32 value)
{
	return -EINVAL;
}

static inline struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node,
	const struct qcom_smem_state_ops *ops, void *data)
{
	return ERR_PTR(-EINVAL);
}

static inline void qcom_smem_state_unregister(struct qcom_smem_state *state)
{
}

#endif

53
#endif