summaryrefstree
path: root/kernel/drivers/vision/dsp/hardware/dsp-mailbox.h
blob: 04c9b39ab0153f0ec183836b80ba164ee3e0526d (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
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Samsung Exynos SoC series dsp driver
 *
 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
 *              http://www.samsung.com/
 */

#ifndef __DSP_MAILBOX_H__
#define __DSP_MAILBOX_H__

#include "dsp-util.h"
#include "dsp-task.h"
#include "dsp-time.h"
#include "dsp-hw-mailbox.h"

struct dsp_system;

struct dsp_mailbox_pool_manager {
	spinlock_t			slock;
	struct list_head		pool_list;
	unsigned int			pool_count;
	struct dsp_util_bitmap		pool_map;

	size_t				size;
	dma_addr_t			iova;
	void				*kva;

	unsigned int			block_size;
	unsigned int			block_count;
	unsigned int			used_count;
};

struct dsp_mailbox_pool {
	unsigned int			block_count;
	int				block_start;
	size_t				size;
	size_t				used_size;
	dma_addr_t			iova;
	void				*kva;
	struct list_head		list;
	int				pm_qos;

	struct dsp_mailbox_pool_manager	*owner;
	struct dsp_time			time;
};

struct dsp_mailbox_pool *dsp_mailbox_alloc_pool(struct dsp_mailbox *mbox,
		unsigned int size);
void dsp_mailbox_free_pool(struct dsp_mailbox_pool *pool);
void dsp_mailbox_dump_pool(struct dsp_mailbox_pool *pool);

int dsp_mailbox_send_task(struct dsp_mailbox *mbox, struct dsp_task *task);
int dsp_mailbox_receive_task(struct dsp_mailbox *mbox);

int dsp_mailbox_send_message(struct dsp_mailbox *mbox, unsigned int message_id);

int dsp_mailbox_start(struct dsp_mailbox *mbox);
int dsp_mailbox_stop(struct dsp_mailbox *mbox);

int dsp_mailbox_open(struct dsp_mailbox *mbox);
int dsp_mailbox_close(struct dsp_mailbox *mbox);

int dsp_mailbox_probe(struct dsp_system *sys);
void dsp_mailbox_remove(struct dsp_mailbox *mbox);

#endif