13a9cf8efSRajeev Kumar /* 29d7dd6cdSRajeev Kumar * Copyright (ST) 2012 Rajeev Kumar (rajeevkumar.linux@gmail.com) 33a9cf8efSRajeev Kumar * 43a9cf8efSRajeev Kumar * This program is free software; you can redistribute it and/or modify 53a9cf8efSRajeev Kumar * it under the terms of the GNU General Public License as published by 63a9cf8efSRajeev Kumar * the Free Software Foundation; either version 2 of the License, or 73a9cf8efSRajeev Kumar * (at your option) any later version. 83a9cf8efSRajeev Kumar * 93a9cf8efSRajeev Kumar * This program is distributed in the hope that it will be useful, 103a9cf8efSRajeev Kumar * but WITHOUT ANY WARRANTY; without even the implied warranty of 113a9cf8efSRajeev Kumar * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 123a9cf8efSRajeev Kumar * GNU General Public License for more details. 133a9cf8efSRajeev Kumar * 143a9cf8efSRajeev Kumar * You should have received a copy of the GNU General Public License 153a9cf8efSRajeev Kumar * along with this program; if not, write to the Free Software 163a9cf8efSRajeev Kumar * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 173a9cf8efSRajeev Kumar * 183a9cf8efSRajeev Kumar */ 193a9cf8efSRajeev Kumar 203a9cf8efSRajeev Kumar #ifndef __SOUND_DESIGNWARE_I2S_H 213a9cf8efSRajeev Kumar #define __SOUND_DESIGNWARE_I2S_H 223a9cf8efSRajeev Kumar 233a9cf8efSRajeev Kumar #include <linux/dmaengine.h> 243a9cf8efSRajeev Kumar #include <linux/types.h> 253a9cf8efSRajeev Kumar 263a9cf8efSRajeev Kumar /* 273a9cf8efSRajeev Kumar * struct i2s_clk_config_data - represent i2s clk configuration data 283a9cf8efSRajeev Kumar * @chan_nr: number of channel 293a9cf8efSRajeev Kumar * @data_width: number of bits per sample (8/16/24/32 bit) 303a9cf8efSRajeev Kumar * @sample_rate: sampling frequency (8Khz, 16Khz, 32Khz, 44Khz, 48Khz) 313a9cf8efSRajeev Kumar */ 323a9cf8efSRajeev Kumar struct i2s_clk_config_data { 333a9cf8efSRajeev Kumar int chan_nr; 343a9cf8efSRajeev Kumar u32 data_width; 353a9cf8efSRajeev Kumar u32 sample_rate; 363a9cf8efSRajeev Kumar }; 373a9cf8efSRajeev Kumar 383a9cf8efSRajeev Kumar struct i2s_platform_data { 393a9cf8efSRajeev Kumar #define DWC_I2S_PLAY (1 << 0) 403a9cf8efSRajeev Kumar #define DWC_I2S_RECORD (1 << 1) 411d957d86SMaruthi Srinivas Bayyavarapu #define DW_I2S_SLAVE (1 << 2) 421d957d86SMaruthi Srinivas Bayyavarapu #define DW_I2S_MASTER (1 << 3) 433a9cf8efSRajeev Kumar unsigned int cap; 443a9cf8efSRajeev Kumar int channel; 453a9cf8efSRajeev Kumar u32 snd_fmts; 463a9cf8efSRajeev Kumar u32 snd_rates; 473a9cf8efSRajeev Kumar 48e164835aSMaruthi Srinivas Bayyavarapu #define DW_I2S_QUIRK_COMP_REG_OFFSET (1 << 0) 49a242cac1SMaruthi Srinivas Bayyavarapu #define DW_I2S_QUIRK_COMP_PARAM1 (1 << 1) 50*286345eeSVijendar Mukunda #define DW_I2S_QUIRK_16BIT_IDX_OVERRIDE (1 << 2) 51e164835aSMaruthi Srinivas Bayyavarapu unsigned int quirks; 52e164835aSMaruthi Srinivas Bayyavarapu unsigned int i2s_reg_comp1; 53e164835aSMaruthi Srinivas Bayyavarapu unsigned int i2s_reg_comp2; 54e164835aSMaruthi Srinivas Bayyavarapu 553a9cf8efSRajeev Kumar void *play_dma_data; 563a9cf8efSRajeev Kumar void *capture_dma_data; 573a9cf8efSRajeev Kumar bool (*filter)(struct dma_chan *chan, void *slave); 583a9cf8efSRajeev Kumar int (*i2s_clk_cfg)(struct i2s_clk_config_data *config); 593a9cf8efSRajeev Kumar }; 603a9cf8efSRajeev Kumar 613a9cf8efSRajeev Kumar struct i2s_dma_data { 623a9cf8efSRajeev Kumar void *data; 633a9cf8efSRajeev Kumar dma_addr_t addr; 643a9cf8efSRajeev Kumar u32 max_burst; 653a9cf8efSRajeev Kumar enum dma_slave_buswidth addr_width; 663a9cf8efSRajeev Kumar bool (*filter)(struct dma_chan *chan, void *slave); 673a9cf8efSRajeev Kumar }; 683a9cf8efSRajeev Kumar 693a9cf8efSRajeev Kumar /* I2S DMA registers */ 703a9cf8efSRajeev Kumar #define I2S_RXDMA 0x01C0 713a9cf8efSRajeev Kumar #define I2S_TXDMA 0x01C8 723a9cf8efSRajeev Kumar 733a9cf8efSRajeev Kumar #define TWO_CHANNEL_SUPPORT 2 /* up to 2.0 */ 743a9cf8efSRajeev Kumar #define FOUR_CHANNEL_SUPPORT 4 /* up to 3.1 */ 753a9cf8efSRajeev Kumar #define SIX_CHANNEL_SUPPORT 6 /* up to 5.1 */ 763a9cf8efSRajeev Kumar #define EIGHT_CHANNEL_SUPPORT 8 /* up to 7.1 */ 773a9cf8efSRajeev Kumar 783a9cf8efSRajeev Kumar #endif /* __SOUND_DESIGNWARE_I2S_H */ 79