1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * atmel_ssc_dai.h - ALSA SSC interface for the Atmel SoC
5 * Copyright (C) 2005 SAN People
6 * Copyright (C) 2008 Atmel
8 * Author: Sedji Gaouaou <sedji.gaouaou@atmel.com>
11 * Based on at91-ssc.c by
12 * Frank Mandarino <fmandarino@endrelia.com>
13 * Based on pxa2xx Platform drivers by
14 * Liam Girdwood <lrg@slimlogic.co.uk>
17 #ifndef _ATMEL_SSC_DAI_H
18 #define _ATMEL_SSC_DAI_H
20 #include <linux/types.h>
21 #include <linux/atmel-ssc.h>
23 #include "atmel-pcm.h"
25 /* SSC system clock ids */
26 #define ATMEL_SYSCLK_MCK 0 /* SSC uses AT91 MCK as system clock */
29 #define ATMEL_SSC_CMR_DIV 0 /* MCK divider for BCLK */
30 #define ATMEL_SSC_TCMR_PERIOD 1 /* BCLK divider for transmit FS */
31 #define ATMEL_SSC_RCMR_PERIOD 2 /* BCLK divider for receive FS */
35 #define SSC_DIR_MASK_UNUSED 0
36 #define SSC_DIR_MASK_PLAYBACK 1
37 #define SSC_DIR_MASK_CAPTURE 2
40 * SSC register values that Atmel left out of <linux/atmel-ssc.h>. These
41 * are expected to be used with SSC_BF
43 /* START bit field values */
44 #define SSC_START_CONTINUOUS 0
45 #define SSC_START_TX_RX 1
46 #define SSC_START_LOW_RF 2
47 #define SSC_START_HIGH_RF 3
48 #define SSC_START_FALLING_RF 4
49 #define SSC_START_RISING_RF 5
50 #define SSC_START_LEVEL_RF 6
51 #define SSC_START_EDGE_RF 7
52 #define SSS_START_COMPARE_0 8
54 /* CKI bit field values */
55 #define SSC_CKI_FALLING 0
56 #define SSC_CKI_RISING 1
58 /* CKO bit field values */
59 #define SSC_CKO_NONE 0
60 #define SSC_CKO_CONTINUOUS 1
61 #define SSC_CKO_TRANSFER 2
63 /* CKS bit field values */
65 #define SSC_CKS_CLOCK 1
68 /* FSEDGE bit field values */
69 #define SSC_FSEDGE_POSITIVE 0
70 #define SSC_FSEDGE_NEGATIVE 1
72 /* FSOS bit field values */
73 #define SSC_FSOS_NONE 0
74 #define SSC_FSOS_NEGATIVE 1
75 #define SSC_FSOS_POSITIVE 2
76 #define SSC_FSOS_LOW 3
77 #define SSC_FSOS_HIGH 4
78 #define SSC_FSOS_TOGGLE 5
82 struct atmel_ssc_state
{
93 struct atmel_ssc_info
{
95 struct ssc_device
*ssc
;
96 unsigned short dir_mask
; /* 0=unused, 1=playback, 2=capture */
97 unsigned short initialized
; /* true if SSC has been initialized */
98 unsigned short daifmt
;
99 unsigned short cmr_div
;
100 unsigned short tcmr_period
;
101 unsigned short rcmr_period
;
102 unsigned int forced_divider
;
103 struct atmel_pcm_dma_params
*dma_params
[2];
104 struct atmel_ssc_state ssc_state
;
105 unsigned long mck_rate
;
108 int atmel_ssc_set_audio(int ssc_id
);
109 void atmel_ssc_put_audio(int ssc_id
);
111 #endif /* _AT91_SSC_DAI_H */