Blame view
drivers/soundwire/cadence_master.h
5.06 KB
238594655
|
1 2 |
/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ /* Copyright(c) 2015-17 Intel Corporation. */ |
5d6b3c8ba
|
3 |
#include <sound/soc.h> |
2f52a5177
|
4 5 6 7 8 |
#ifndef __SDW_CADENCE_H #define __SDW_CADENCE_H /** |
07abeff1e
|
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 |
* struct sdw_cdns_pdi: PDI (Physical Data Interface) instance * * @assigned: pdi assigned * @num: pdi number * @intel_alh_id: link identifier * @l_ch_num: low channel for PDI * @h_ch_num: high channel for PDI * @ch_count: total channel count for PDI * @dir: data direction * @type: stream type, PDM or PCM */ struct sdw_cdns_pdi { bool assigned; int num; int intel_alh_id; int l_ch_num; int h_ch_num; int ch_count; enum sdw_data_direction dir; enum sdw_stream_type type; }; /** * struct sdw_cdns_port: Cadence port structure * * @num: port number * @assigned: port assigned * @ch: channel count * @direction: data port direction * @pdi: pdi for this port */ struct sdw_cdns_port { unsigned int num; bool assigned; unsigned int ch; enum sdw_data_direction direction; struct sdw_cdns_pdi *pdi; }; /** * struct sdw_cdns_streams: Cadence stream data structure * * @num_bd: number of bidirectional streams * @num_in: number of input streams * @num_out: number of output streams * @num_ch_bd: number of bidirectional stream channels * @num_ch_bd: number of input stream channels * @num_ch_bd: number of output stream channels * @num_pdi: total number of PDIs * @bd: bidirectional streams * @in: input streams * @out: output streams */ struct sdw_cdns_streams { unsigned int num_bd; unsigned int num_in; unsigned int num_out; unsigned int num_ch_bd; unsigned int num_ch_in; unsigned int num_ch_out; unsigned int num_pdi; struct sdw_cdns_pdi *bd; struct sdw_cdns_pdi *in; struct sdw_cdns_pdi *out; }; /** * struct sdw_cdns_stream_config: stream configuration * * @pcm_bd: number of bidirectional PCM streams supported * @pcm_in: number of input PCM streams supported * @pcm_out: number of output PCM streams supported * @pdm_bd: number of bidirectional PDM streams supported * @pdm_in: number of input PDM streams supported * @pdm_out: number of output PDM streams supported */ struct sdw_cdns_stream_config { unsigned int pcm_bd; unsigned int pcm_in; unsigned int pcm_out; unsigned int pdm_bd; unsigned int pdm_in; unsigned int pdm_out; }; /** |
5d6b3c8ba
|
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
* struct sdw_cdns_dma_data: Cadence DMA data * * @name: SoundWire stream name * @nr_ports: Number of ports * @port: Ports * @bus: Bus handle * @stream_type: Stream type * @link_id: Master link id */ struct sdw_cdns_dma_data { char *name; struct sdw_stream_runtime *stream; int nr_ports; struct sdw_cdns_port **port; struct sdw_bus *bus; enum sdw_stream_type stream_type; int link_id; }; /** |
2f52a5177
|
115 116 117 118 |
* struct sdw_cdns - Cadence driver context * @dev: Linux device * @bus: Bus handle * @instance: instance number |
956baa199
|
119 120 121 |
* @response_buf: SoundWire response buffer * @tx_complete: Tx completion * @defer: Defer pointer |
07abeff1e
|
122 123 124 125 |
* @ports: Data ports * @num_ports: Total number of data ports * @pcm: PCM streams * @pdm: PDM streams |
2f52a5177
|
126 127 |
* @registers: Cadence registers * @link_up: Link status |
956baa199
|
128 |
* @msg_count: Messages sent on bus |
2f52a5177
|
129 130 131 132 133 |
*/ struct sdw_cdns { struct device *dev; struct sdw_bus bus; unsigned int instance; |
956baa199
|
134 135 136 |
u32 response_buf[0x80]; struct completion tx_complete; struct sdw_defer *defer; |
07abeff1e
|
137 138 139 140 141 |
struct sdw_cdns_port *ports; int num_ports; struct sdw_cdns_streams pcm; struct sdw_cdns_streams pdm; |
2f52a5177
|
142 143 144 |
void __iomem *registers; bool link_up; |
956baa199
|
145 |
unsigned int msg_count; |
2f52a5177
|
146 147 148 149 150 |
}; #define bus_to_cdns(_bus) container_of(_bus, struct sdw_cdns, bus) /* Exported symbols */ |
956baa199
|
151 152 |
int sdw_cdns_probe(struct sdw_cdns *cdns); extern struct sdw_master_ops sdw_cdns_master_ops; |
2f52a5177
|
153 154 155 156 |
irqreturn_t sdw_cdns_irq(int irq, void *dev_id); irqreturn_t sdw_cdns_thread(int irq, void *dev_id); int sdw_cdns_init(struct sdw_cdns *cdns); |
07abeff1e
|
157 |
int sdw_cdns_pdi_init(struct sdw_cdns *cdns, |
806a11f09
|
158 |
struct sdw_cdns_stream_config config); |
956baa199
|
159 |
int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns); |
aa85066e5
|
160 161 162 |
#ifdef CONFIG_DEBUG_FS void sdw_cdns_debugfs_init(struct sdw_cdns *cdns, struct dentry *root); #endif |
5d6b3c8ba
|
163 164 165 166 |
int sdw_cdns_get_stream(struct sdw_cdns *cdns, struct sdw_cdns_streams *stream, u32 ch, u32 dir); int sdw_cdns_alloc_stream(struct sdw_cdns *cdns, |
806a11f09
|
167 168 |
struct sdw_cdns_streams *stream, struct sdw_cdns_port *port, u32 ch, u32 dir); |
5d6b3c8ba
|
169 |
void sdw_cdns_config_stream(struct sdw_cdns *cdns, struct sdw_cdns_port *port, |
806a11f09
|
170 |
u32 ch, u32 dir, struct sdw_cdns_pdi *pdi); |
5d6b3c8ba
|
171 |
|
5d6b3c8ba
|
172 |
int sdw_cdns_pcm_set_stream(struct snd_soc_dai *dai, |
806a11f09
|
173 |
void *stream, int direction); |
5d6b3c8ba
|
174 |
int sdw_cdns_pdm_set_stream(struct snd_soc_dai *dai, |
806a11f09
|
175 |
void *stream, int direction); |
5d6b3c8ba
|
176 177 178 |
enum sdw_command_response cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num); |
c91605f48
|
179 180 |
enum sdw_command_response cdns_xfer_msg(struct sdw_bus *bus, struct sdw_msg *msg); |
2f52a5177
|
181 |
|
c91605f48
|
182 183 |
enum sdw_command_response cdns_xfer_msg_defer(struct sdw_bus *bus, |
806a11f09
|
184 |
struct sdw_msg *msg, struct sdw_defer *defer); |
c91605f48
|
185 186 187 |
enum sdw_command_response cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num); |
07abeff1e
|
188 189 |
int cdns_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params); |
5d6b3c8ba
|
190 191 |
int cdns_set_sdw_stream(struct snd_soc_dai *dai, |
806a11f09
|
192 |
void *stream, bool pcm, int direction); |
2f52a5177
|
193 |
#endif /* __SDW_CADENCE_H */ |