~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/sprd/sprd-mcdt.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 
  3 #ifndef __SPRD_MCDT_H
  4 #define __SPRD_MCDT_H
  5 
  6 enum sprd_mcdt_channel_type {
  7         SPRD_MCDT_DAC_CHAN,
  8         SPRD_MCDT_ADC_CHAN,
  9         SPRD_MCDT_UNKNOWN_CHAN,
 10 };
 11 
 12 enum sprd_mcdt_dma_chan {
 13         SPRD_MCDT_DMA_CH0,
 14         SPRD_MCDT_DMA_CH1,
 15         SPRD_MCDT_DMA_CH2,
 16         SPRD_MCDT_DMA_CH3,
 17         SPRD_MCDT_DMA_CH4,
 18 };
 19 
 20 struct sprd_mcdt_chan_callback {
 21         void (*notify)(void *data);
 22         void *data;
 23 };
 24 
 25 /**
 26  * struct sprd_mcdt_chan - this struct represents a single channel instance
 27  * @mcdt: the mcdt controller
 28  * @id: channel id
 29  * @fifo_phys: channel fifo physical address which is used for DMA transfer
 30  * @type: channel type
 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
 34  * write data manually
 35  * @list: used to link into the global list
 36  *
 37  * Note: users should not modify any members of this structure.
 38  */
 39 struct sprd_mcdt_chan {
 40         struct sprd_mcdt_dev *mcdt;
 41         u8 id;
 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;
 46         bool dma_enable;
 47         bool int_enable;
 48         struct list_head list;
 49 };
 50 
 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);
 55 
 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);
 61 
 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);
 65 
 66 #else
 67 
 68 struct sprd_mcdt_chan *sprd_mcdt_request_chan(u8 channel,
 69                                               enum sprd_mcdt_channel_type type)
 70 {
 71         return NULL;
 72 }
 73 
 74 void sprd_mcdt_free_chan(struct sprd_mcdt_chan *chan)
 75 { }
 76 
 77 int sprd_mcdt_chan_write(struct sprd_mcdt_chan *chan, char *tx_buf, u32 size)
 78 {
 79         return -EINVAL;
 80 }
 81 
 82 int sprd_mcdt_chan_read(struct sprd_mcdt_chan *chan, char *rx_buf, u32 size)
 83 {
 84         return 0;
 85 }
 86 
 87 int sprd_mcdt_chan_int_enable(struct sprd_mcdt_chan *chan, u32 water_mark,
 88                               struct sprd_mcdt_chan_callback *cb)
 89 {
 90         return -EINVAL;
 91 }
 92 
 93 void sprd_mcdt_chan_int_disable(struct sprd_mcdt_chan *chan)
 94 { }
 95 
 96 int sprd_mcdt_chan_dma_enable(struct sprd_mcdt_chan *chan,
 97                               enum sprd_mcdt_dma_chan dma_chan, u32 water_mark)
 98 {
 99         return -EINVAL;
100 }
101 
102 void sprd_mcdt_chan_dma_disable(struct sprd_mcdt_chan *chan)
103 { }
104 
105 #endif
106 
107 #endif /* __SPRD_MCDT_H */
108 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php