1 /*- 2 * Copyright (c) 2019 Oleksandr Tymoshenko <gonzo@FreeBSD.org> 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 */ 24 25 #ifndef __DAI_H__ 26 #define __DAI_H__ 27 28 #define AUDIO_DAI_FORMAT_I2S 0 29 #define AUDIO_DAI_FORMAT_RJ 1 30 #define AUDIO_DAI_FORMAT_LJ 2 31 #define AUDIO_DAI_FORMAT_DSPA 3 32 #define AUDIO_DAI_FORMAT_DSPB 4 33 #define AUDIO_DAI_FORMAT_AC97 5 34 #define AUDIO_DAI_FORMAT_PDM 6 35 36 /* 37 * Polarity: Normal/Inverted BCLK/Frame 38 */ 39 #define AUDIO_DAI_POLARITY_NB_NF 0 40 #define AUDIO_DAI_POLARITY_NB_IF 1 41 #define AUDIO_DAI_POLARITY_IB_NF 2 42 #define AUDIO_DAI_POLARITY_IB_IF 3 43 #define AUDIO_DAI_POLARITY_INVERTED_FRAME(n) ((n) & 0x01) 44 #define AUDIO_DAI_POLARITY_INVERTED_BCLK(n) ((n) & 0x2) 45 46 #define AUDIO_DAI_CLOCK_CBM_CFM 0 47 #define AUDIO_DAI_CLOCK_CBS_CFM 1 48 #define AUDIO_DAI_CLOCK_CBM_CFS 2 49 #define AUDIO_DAI_CLOCK_CBS_CFS 3 50 51 #define AUDIO_DAI_CLOCK_IN 0 52 #define AUDIO_DAI_CLOCK_OUT 1 53 54 #define AUDIO_DAI_JACK_HP 0 55 #define AUDIO_DAI_JACK_MIC 1 56 57 /* 58 * Signal to audio_soc that chn_intr required 59 * for either recording or playback 60 */ 61 #define AUDIO_DAI_REC_INTR (1 << 1) 62 #define AUDIO_DAI_PLAY_INTR (1 << 0) 63 64 #define AUDIO_DAI_FORMAT(fmt, pol, clk) (((fmt) << 16) | ((pol) << 8) | (clk)) 65 #define AUDIO_DAI_FORMAT_FORMAT(format) (((format) >> 16) & 0xff) 66 #define AUDIO_DAI_FORMAT_POLARITY(format) (((format) >> 8) & 0xff) 67 #define AUDIO_DAI_FORMAT_CLOCK(format) (((format) >> 0) & 0xff) 68 69 70 #endif /* __DAI_H__ */ 71