1 // SPDX-License-Identifier: GPL-2.0
6 enum sprd_mcdt_channel_type {
9 SPRD_MCDT_UNKNOWN_CHAN,
12 enum sprd_mcdt_dma_chan {
20 struct sprd_mcdt_chan_callback {
21 void (*notify)(void *data);
26 * struct sprd_mcdt_chan - this struct represents a single channel instance
27 * @mcdt: the mcdt controller
29 * @fifo_phys: channel fifo physical address which is used for DMA transfer
31 * @cb: channel fifo interrupt's callback interface to notify the fifo events
32 * @dma_enable: indicate if use DMA mode to transfer data
33 * @int_enable: indicate if use interrupt mode to notify users to read or
35 * @list: used to link into the global list
37 * Note: users should not modify any members of this structure.
39 struct sprd_mcdt_chan {
40 struct sprd_mcdt_dev *mcdt;
42 unsigned long fifo_phys;
43 enum sprd_mcdt_channel_type type;
44 enum sprd_mcdt_dma_chan dma_chan;
45 struct sprd_mcdt_chan_callback *cb;
48 struct list_head list;
51 #if IS_ENABLED(CONFIG_SND_SOC_SPRD_MCDT)
52 struct sprd_mcdt_chan *sprd_mcdt_request_chan(u8 channel,
53 enum sprd_mcdt_channel_type type);
54 void sprd_mcdt_free_chan(struct sprd_mcdt_chan *chan);
56 int sprd_mcdt_chan_write(struct sprd_mcdt_chan *chan, char *tx_buf, u32 size);
57 int sprd_mcdt_chan_read(struct sprd_mcdt_chan *chan, char *rx_buf, u32 size);
58 int sprd_mcdt_chan_int_enable(struct sprd_mcdt_chan *chan, u32 water_mark,
59 struct sprd_mcdt_chan_callback *cb);
60 void sprd_mcdt_chan_int_disable(struct sprd_mcdt_chan *chan);
62 int sprd_mcdt_chan_dma_enable(struct sprd_mcdt_chan *chan,
63 enum sprd_mcdt_dma_chan dma_chan, u32 water_mark);
64 void sprd_mcdt_chan_dma_disable(struct sprd_mcdt_chan *chan);
68 struct sprd_mcdt_chan *sprd_mcdt_request_chan(u8 channel,
69 enum sprd_mcdt_channel_type type)
74 void sprd_mcdt_free_chan(struct sprd_mcdt_chan *chan)
77 int sprd_mcdt_chan_write(struct sprd_mcdt_chan *chan, char *tx_buf, u32 size)
82 int sprd_mcdt_chan_read(struct sprd_mcdt_chan *chan, char *rx_buf, u32 size)
87 int sprd_mcdt_chan_int_enable(struct sprd_mcdt_chan *chan, u32 water_mark,
88 struct sprd_mcdt_chan_callback *cb)
93 void sprd_mcdt_chan_int_disable(struct sprd_mcdt_chan *chan)
96 int sprd_mcdt_chan_dma_enable(struct sprd_mcdt_chan *chan,
97 enum sprd_mcdt_dma_chan dma_chan, u32 water_mark)
102 void sprd_mcdt_chan_dma_disable(struct sprd_mcdt_chan *chan)
107 #endif /* __SPRD_MCDT_H */