2 * Copyright (C) 2014-2015 Broadcom Corporation
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 #ifndef __CYGNUS_SSP_H__
14 #define __CYGNUS_SSP_H__
16 #define CYGNUS_TDM_DAI_MAX_SLOTS 16
18 #define CYGNUS_MAX_PLAYBACK_PORTS 4
19 #define CYGNUS_MAX_CAPTURE_PORTS 3
20 #define CYGNUS_MAX_I2S_PORTS 3
21 #define CYGNUS_MAX_PORTS CYGNUS_MAX_PLAYBACK_PORTS
22 #define CYGNUS_AUIDO_MAX_NUM_CLKS 3
24 #define CYGNUS_SSP_FRAMEBITS_DIV 1
26 #define CYGNUS_SSPMODE_I2S 0
27 #define CYGNUS_SSPMODE_TDM 1
28 #define CYGNUS_SSPMODE_UNKNOWN -1
30 #define CYGNUS_SSP_CLKSRC_PLL 0
32 /* Max string length of our dt property names */
33 #define PROP_LEN_MAX 40
40 unsigned fmark
; /* freemark for play, fullmark for caputure */
41 unsigned period_bytes
;
45 #define RINGBUF_REG_PLAYBACK(num) ((struct ringbuf_regs) { \
46 .rdaddr = SRC_RBUF_ ##num## _RDADDR_OFFSET, \
47 .wraddr = SRC_RBUF_ ##num## _WRADDR_OFFSET, \
48 .baseaddr = SRC_RBUF_ ##num## _BASEADDR_OFFSET, \
49 .endaddr = SRC_RBUF_ ##num## _ENDADDR_OFFSET, \
50 .fmark = SRC_RBUF_ ##num## _FREE_MARK_OFFSET, \
55 #define RINGBUF_REG_CAPTURE(num) ((struct ringbuf_regs) { \
56 .rdaddr = DST_RBUF_ ##num## _RDADDR_OFFSET, \
57 .wraddr = DST_RBUF_ ##num## _WRADDR_OFFSET, \
58 .baseaddr = DST_RBUF_ ##num## _BASEADDR_OFFSET, \
59 .endaddr = DST_RBUF_ ##num## _ENDADDR_OFFSET, \
60 .fmark = DST_RBUF_ ##num## _FULL_MARK_OFFSET, \
65 enum cygnus_audio_port_type
{
70 struct cygnus_ssp_regs
{
73 u32 i2s_cap_stream_cfg
;
84 struct cygnus_track_clk
{
91 struct cygnus_aio_port
{
95 int streams_on
; /* will be 0 if both capture and play are off */
104 struct cygnus_audio
*cygaud
;
105 struct cygnus_ssp_regs regs
;
107 struct ringbuf_regs play_rb_regs
;
108 struct ringbuf_regs capture_rb_regs
;
110 struct snd_pcm_substream
*play_stream
;
111 struct snd_pcm_substream
*capture_stream
;
113 struct cygnus_track_clk clk_trace
;
117 struct cygnus_audio
{
118 struct cygnus_aio_port portinfo
[CYGNUS_MAX_PORTS
];
123 void __iomem
*i2s_in
;
125 struct clk
*audio_clk
[CYGNUS_AUIDO_MAX_NUM_CLKS
];
127 unsigned long vco_rate
;
130 extern int cygnus_ssp_get_mode(struct snd_soc_dai
*cpu_dai
);
131 extern int cygnus_ssp_add_pll_tweak_controls(struct snd_soc_pcm_runtime
*rtd
);
132 extern int cygnus_ssp_set_custom_fsync_width(struct snd_soc_dai
*cpu_dai
,
134 extern int cygnus_soc_platform_register(struct device
*dev
,
135 struct cygnus_audio
*cygaud
);
136 extern int cygnus_soc_platform_unregister(struct device
*dev
);
137 extern int cygnus_ssp_set_custom_fsync_width(struct snd_soc_dai
*cpu_dai
,