diff options
Diffstat (limited to 'sound/soc/omap/mcbsp.h')
-rw-r--r-- | sound/soc/omap/mcbsp.h | 104 |
1 files changed, 81 insertions, 23 deletions
diff --git a/sound/soc/omap/mcbsp.h b/sound/soc/omap/mcbsp.h index 5590ab271eec..6d579938a154 100644 --- a/sound/soc/omap/mcbsp.h +++ b/sound/soc/omap/mcbsp.h | |||
@@ -24,6 +24,8 @@ | |||
24 | #ifndef __ASOC_MCBSP_H | 24 | #ifndef __ASOC_MCBSP_H |
25 | #define __ASOC_MCBSP_H | 25 | #define __ASOC_MCBSP_H |
26 | 26 | ||
27 | #include "omap-pcm.h" | ||
28 | |||
27 | /* McBSP register numbers. Register address offset = num * reg_step */ | 29 | /* McBSP register numbers. Register address offset = num * reg_step */ |
28 | enum { | 30 | enum { |
29 | /* Common registers */ | 31 | /* Common registers */ |
@@ -257,36 +259,92 @@ struct omap_mcbsp_reg_cfg { | |||
257 | u16 rccr; | 259 | u16 rccr; |
258 | }; | 260 | }; |
259 | 261 | ||
260 | void omap_mcbsp_config(unsigned int id, | 262 | struct omap_mcbsp_st_data { |
263 | void __iomem *io_base_st; | ||
264 | bool running; | ||
265 | bool enabled; | ||
266 | s16 taps[128]; /* Sidetone filter coefficients */ | ||
267 | int nr_taps; /* Number of filter coefficients in use */ | ||
268 | s16 ch0gain; | ||
269 | s16 ch1gain; | ||
270 | }; | ||
271 | |||
272 | struct omap_mcbsp_data { | ||
273 | struct omap_mcbsp_reg_cfg regs; | ||
274 | struct omap_pcm_dma_data dma_data[2]; | ||
275 | unsigned int fmt; | ||
276 | /* | ||
277 | * Flags indicating is the bus already activated and configured by | ||
278 | * another substream | ||
279 | */ | ||
280 | int active; | ||
281 | int configured; | ||
282 | unsigned int in_freq; | ||
283 | int clk_div; | ||
284 | int wlen; | ||
285 | }; | ||
286 | |||
287 | struct omap_mcbsp { | ||
288 | struct device *dev; | ||
289 | unsigned long phys_base; | ||
290 | unsigned long phys_dma_base; | ||
291 | void __iomem *io_base; | ||
292 | u8 id; | ||
293 | u8 free; | ||
294 | |||
295 | int rx_irq; | ||
296 | int tx_irq; | ||
297 | |||
298 | /* DMA stuff */ | ||
299 | u8 dma_rx_sync; | ||
300 | u8 dma_tx_sync; | ||
301 | |||
302 | /* Protect the field .free, while checking if the mcbsp is in use */ | ||
303 | spinlock_t lock; | ||
304 | struct omap_mcbsp_platform_data *pdata; | ||
305 | struct clk *fclk; | ||
306 | struct omap_mcbsp_st_data *st_data; | ||
307 | struct omap_mcbsp_data mcbsp_data; | ||
308 | int dma_op_mode; | ||
309 | u16 max_tx_thres; | ||
310 | u16 max_rx_thres; | ||
311 | void *reg_cache; | ||
312 | int reg_cache_size; | ||
313 | }; | ||
314 | |||
315 | void omap_mcbsp_config(struct omap_mcbsp *mcbsp, | ||
261 | const struct omap_mcbsp_reg_cfg *config); | 316 | const struct omap_mcbsp_reg_cfg *config); |
262 | void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold); | 317 | void omap_mcbsp_set_tx_threshold(struct omap_mcbsp *mcbsp, u16 threshold); |
263 | void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold); | 318 | void omap_mcbsp_set_rx_threshold(struct omap_mcbsp *mcbsp, u16 threshold); |
264 | u16 omap_mcbsp_get_max_tx_threshold(unsigned int id); | 319 | u16 omap_mcbsp_get_max_tx_threshold(struct omap_mcbsp *mcbsp); |
265 | u16 omap_mcbsp_get_max_rx_threshold(unsigned int id); | 320 | u16 omap_mcbsp_get_max_rx_threshold(struct omap_mcbsp *mcbsp); |
266 | u16 omap_mcbsp_get_fifo_size(unsigned int id); | 321 | u16 omap_mcbsp_get_fifo_size(struct omap_mcbsp *mcbsp); |
267 | u16 omap_mcbsp_get_tx_delay(unsigned int id); | 322 | u16 omap_mcbsp_get_tx_delay(struct omap_mcbsp *mcbsp); |
268 | u16 omap_mcbsp_get_rx_delay(unsigned int id); | 323 | u16 omap_mcbsp_get_rx_delay(struct omap_mcbsp *mcbsp); |
269 | int omap_mcbsp_get_dma_op_mode(unsigned int id); | 324 | int omap_mcbsp_get_dma_op_mode(struct omap_mcbsp *mcbsp); |
270 | int omap_mcbsp_request(unsigned int id); | 325 | int omap_mcbsp_request(struct omap_mcbsp *mcbsp); |
271 | void omap_mcbsp_free(unsigned int id); | 326 | void omap_mcbsp_free(struct omap_mcbsp *mcbsp); |
272 | void omap_mcbsp_start(unsigned int id, int tx, int rx); | 327 | void omap_mcbsp_start(struct omap_mcbsp *mcbsp, int tx, int rx); |
273 | void omap_mcbsp_stop(unsigned int id, int tx, int rx); | 328 | void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int tx, int rx); |
274 | 329 | ||
275 | /* McBSP functional clock source changing function */ | 330 | /* McBSP functional clock source changing function */ |
276 | int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id); | 331 | int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id); |
277 | 332 | ||
278 | /* McBSP signal muxing API */ | 333 | /* McBSP signal muxing API */ |
279 | void omap2_mcbsp1_mux_clkr_src(u8 mux); | 334 | void omap2_mcbsp1_mux_clkr_src(struct omap_mcbsp *mcbsp, u8 mux); |
280 | void omap2_mcbsp1_mux_fsr_src(u8 mux); | 335 | void omap2_mcbsp1_mux_fsr_src(struct omap_mcbsp *mcbsp, u8 mux); |
281 | 336 | ||
282 | int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream); | 337 | int omap_mcbsp_dma_ch_params(struct omap_mcbsp *mcbsp, unsigned int stream); |
283 | int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream); | 338 | int omap_mcbsp_dma_reg_params(struct omap_mcbsp *mcbsp, unsigned int stream); |
284 | 339 | ||
285 | /* Sidetone specific API */ | 340 | /* Sidetone specific API */ |
286 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); | 341 | int omap_st_set_chgain(struct omap_mcbsp *mcbsp, int channel, s16 chgain); |
287 | int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain); | 342 | int omap_st_get_chgain(struct omap_mcbsp *mcbsp, int channel, s16 *chgain); |
288 | int omap_st_enable(unsigned int id); | 343 | int omap_st_enable(struct omap_mcbsp *mcbsp); |
289 | int omap_st_disable(unsigned int id); | 344 | int omap_st_disable(struct omap_mcbsp *mcbsp); |
290 | int omap_st_is_enabled(unsigned int id); | 345 | int omap_st_is_enabled(struct omap_mcbsp *mcbsp); |
346 | |||
347 | int __devinit omap_mcbsp_probe(struct platform_device *pdev); | ||
348 | int __devexit omap_mcbsp_remove(struct platform_device *pdev); | ||
291 | 349 | ||
292 | #endif /* __ASOC_MCBSP_H */ | 350 | #endif /* __ASOC_MCBSP_H */ |