summaryrefstree
path: root/kernel/include/linux/haven/hh_msgq.h
blob: 9944055c03782c3b76994f97f1676434a87914db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 *
 */

#ifndef __HH_MSGQ_H
#define __HH_MSGQ_H

#include <linux/types.h>
#include <linux/platform_device.h>

#include "hh_common.h"

enum hh_msgq_label {
	HH_MSGQ_LABEL_RM,
	HH_MSGQ_LABEL_MEMBUF,
	HH_MSGQ_LABEL_DISPLAY,
	HH_MSGQ_LABEL_MAX
};

#define HH_MSGQ_MAX_MSG_SIZE_BYTES 240

#define HH_MSGQ_DIRECTION_TX	0
#define HH_MSGQ_DIRECTION_RX	1

/* Possible flags to pass for Tx or Rx */
#define HH_MSGQ_TX_PUSH		BIT(0)
#define HH_MSGQ_NONBLOCK	BIT(32)

#if IS_ENABLED(CONFIG_HH_MSGQ)
void *hh_msgq_register(enum hh_msgq_label label);
int hh_msgq_unregister(void *msgq_client_desc);
int hh_msgq_send(void *msgq_client_desc,
			void *buff, size_t size, unsigned long flags);
int hh_msgq_recv(void *msgq_client_desc,
			void *buff, size_t buff_size,
			size_t *recv_size, unsigned long flags);

int hh_msgq_populate_cap_info(enum hh_msgq_label label, u64 cap_id,
				int direction, int irq);
int hh_msgq_probe(struct platform_device *pdev, enum hh_msgq_label label);
#else
static inline void *hh_msgq_register(enum hh_msgq_label label)
{
	return ERR_PTR(-ENODEV);
}

static inline int hh_msgq_unregister(void *msgq_client_desc)
{
	return ERR_PTR(-ENODEV);
}

static inline int hh_msgq_send(void *msgq_client_desc,
			void *buff, size_t size, unsigned long flags)
{
	return -EINVAL;
}

static inline int hh_msgq_recv(void *msgq_client_desc,
			void *buff, size_t buff_size,
			size_t *recv_size, unsigned long flags)
{
	return -EINVAL;
}

static inline int hh_msgq_populate_cap_info(enum hh_msgq_label label,
					    u64 cap_id,
					    int direction,
					    int irq)
{
	return -EINVAL;
}

static inline int hh_msgq_probe(struct platform_device *pdev,
				enum hh_msgq_label label)
{
	return -ENODEV;
}
#endif
#endif