-
Notifications
You must be signed in to change notification settings - Fork 350
Expand file tree
/
Copy pathacp_bt_dai.c
More file actions
94 lines (83 loc) · 2.2 KB
/
acp_bt_dai.c
File metadata and controls
94 lines (83 loc) · 2.2 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
// SPDX-License-Identifier: BSD-3-Clause
//
//Copyright(c) 2023, 2026 AMD. All rights reserved.
//
//Author: Basavaraj Hiregoudar <basavaraj.hiregoudar@amd.com>
// SaiSurya, Ch <saisurya.chakkaveeravenkatanaga@amd.com>
// Sivasubramanian <sravisar@amd.com>
#include <sof/audio/component.h>
#include <sof/drivers/acp_dai_dma.h>
#include <rtos/interrupt.h>
#include <rtos/alloc.h>
#include <sof/lib/dai.h>
#include <sof/lib/dma.h>
#include <sof/lib/uuid.h>
#include <ipc/dai.h>
#include <ipc/topology.h>
#include <platform/fw_scratch_mem.h>
#include <sof/lib/io.h>
#include <platform/chip_offset_byte.h>
SOF_DEFINE_REG_UUID(btdai);
DECLARE_TR_CTX(btdai_tr, SOF_UUID(btdai_uuid), LOG_LEVEL_INFO);
static inline int btdai_set_config(struct dai *dai, struct ipc_config_dai *common_config,
const void *spec_config)
{
/* nothing to do */
return 0;
}
static int btdai_trigger(struct dai *dai, int cmd, int direction)
{
/* nothing to do */
return 0;
}
static int btdai_probe(struct dai *dai)
{
/* TODO */
return 0;
}
static int btdai_remove(struct dai *dai)
{
/* TODO */
return 0;
}
static int btdai_get_fifo(struct dai *dai, int direction, int stream_id)
{
switch (direction) {
case DAI_DIR_PLAYBACK:
case DAI_DIR_CAPTURE:
return dai_fifo(dai, direction);
default:
dai_err(dai, "Not a valid direction");
return -EINVAL;
}
}
static int btdai_get_handshake(struct dai *dai, int direction, int stream_id)
{
return dai->plat_data.fifo[direction].handshake;
}
static int btdai_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params, int dir)
{
/* supported parameters */
params->rate = ACP_DEFAULT_SAMPLE_RATE;
params->channels = ACP_DEFAULT_NUM_CHANNELS;
params->buffer_fmt = SOF_IPC_BUFFER_INTERLEAVED;
params->frame_fmt = SOF_IPC_FRAME_S16_LE;
return 0;
}
const struct dai_driver acp_btdai_driver = {
.type = SOF_DAI_AMD_BT,
.uid = SOF_UUID(btdai_uuid),
.tctx = &btdai_tr,
.dma_dev = SOF_DMA_DEV_BT,
.dma_caps = SOF_DMA_CAP_BT,
.ops = {
.trigger = btdai_trigger,
.set_config = btdai_set_config,
.probe = btdai_probe,
.remove = btdai_remove,
.get_fifo = btdai_get_fifo,
.get_handshake = btdai_get_handshake,
.get_hw_params = btdai_get_hw_params,
},
};