11802d0beSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2609dad9bSLucas Stach /* 3609dad9bSLucas Stach * tegra20_ac97.h - Definitions for the Tegra20 AC97 controller driver 4609dad9bSLucas Stach * 5609dad9bSLucas Stach * Copyright (c) 2012 Lucas Stach <dev@lynxeye.de> 6609dad9bSLucas Stach * 7609dad9bSLucas Stach * Partly based on code copyright/by: 8609dad9bSLucas Stach * 9609dad9bSLucas Stach * Copyright (c) 2011,2012 Toradex Inc. 10609dad9bSLucas Stach */ 11609dad9bSLucas Stach 12609dad9bSLucas Stach #ifndef __TEGRA20_AC97_H__ 13609dad9bSLucas Stach #define __TEGRA20_AC97_H__ 14609dad9bSLucas Stach 15609dad9bSLucas Stach #include "tegra_pcm.h" 16609dad9bSLucas Stach 17609dad9bSLucas Stach #define TEGRA20_AC97_CTRL 0x00 18609dad9bSLucas Stach #define TEGRA20_AC97_CMD 0x04 19609dad9bSLucas Stach #define TEGRA20_AC97_STATUS1 0x08 20609dad9bSLucas Stach /* ... */ 21609dad9bSLucas Stach #define TEGRA20_AC97_FIFO1_SCR 0x1c 22609dad9bSLucas Stach /* ... */ 23609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_TX1 0x40 24609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_RX1 0x80 25609dad9bSLucas Stach 26609dad9bSLucas Stach /* TEGRA20_AC97_CTRL */ 27609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_STM2_EN (1 << 16) 28609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_DOUBLE_SAMPLING_EN (1 << 11) 29609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_IO_CNTRL_EN (1 << 10) 30609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_HSET_DAC_EN (1 << 9) 31609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_LINE2_DAC_EN (1 << 8) 32609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_PCM_LFE_EN (1 << 7) 33609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_PCM_SUR_EN (1 << 6) 34609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_PCM_CEN_DAC_EN (1 << 5) 35609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_LINE1_DAC_EN (1 << 4) 36609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_PCM_DAC_EN (1 << 3) 37609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_COLD_RESET (1 << 2) 38609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_WARM_RESET (1 << 1) 39609dad9bSLucas Stach #define TEGRA20_AC97_CTRL_STM_EN (1 << 0) 40609dad9bSLucas Stach 41609dad9bSLucas Stach /* TEGRA20_AC97_CMD */ 42609dad9bSLucas Stach #define TEGRA20_AC97_CMD_CMD_ADDR_SHIFT 24 43609dad9bSLucas Stach #define TEGRA20_AC97_CMD_CMD_ADDR_MASK (0xff << TEGRA20_AC97_CMD_CMD_ADDR_SHIFT) 44609dad9bSLucas Stach #define TEGRA20_AC97_CMD_CMD_DATA_SHIFT 8 45609dad9bSLucas Stach #define TEGRA20_AC97_CMD_CMD_DATA_MASK (0xffff << TEGRA20_AC97_CMD_CMD_DATA_SHIFT) 46609dad9bSLucas Stach #define TEGRA20_AC97_CMD_CMD_ID_SHIFT 2 47609dad9bSLucas Stach #define TEGRA20_AC97_CMD_CMD_ID_MASK (0x3 << TEGRA20_AC97_CMD_CMD_ID_SHIFT) 48609dad9bSLucas Stach #define TEGRA20_AC97_CMD_BUSY (1 << 0) 49609dad9bSLucas Stach 50609dad9bSLucas Stach /* TEGRA20_AC97_STATUS1 */ 51609dad9bSLucas Stach #define TEGRA20_AC97_STATUS1_STA_ADDR1_SHIFT 24 52609dad9bSLucas Stach #define TEGRA20_AC97_STATUS1_STA_ADDR1_MASK (0xff << TEGRA20_AC97_STATUS1_STA_ADDR1_SHIFT) 53609dad9bSLucas Stach #define TEGRA20_AC97_STATUS1_STA_DATA1_SHIFT 8 54609dad9bSLucas Stach #define TEGRA20_AC97_STATUS1_STA_DATA1_MASK (0xffff << TEGRA20_AC97_STATUS1_STA_DATA1_SHIFT) 55609dad9bSLucas Stach #define TEGRA20_AC97_STATUS1_STA_VALID1 (1 << 2) 56609dad9bSLucas Stach #define TEGRA20_AC97_STATUS1_STANDBY1 (1 << 1) 57609dad9bSLucas Stach #define TEGRA20_AC97_STATUS1_CODEC1_RDY (1 << 0) 58609dad9bSLucas Stach 59609dad9bSLucas Stach /* TEGRA20_AC97_FIFO1_SCR */ 60609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_REC_MT_CNT_SHIFT 27 61609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_REC_MT_CNT_MASK (0x1f << TEGRA20_AC97_FIFO_SCR_REC_MT_CNT_SHIFT) 62609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_PB_MT_CNT_SHIFT 22 63609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_PB_MT_CNT_MASK (0x1f << TEGRA20_AC97_FIFO_SCR_PB_MT_CNT_SHIFT) 64609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_REC_OVERRUN_INT_STA (1 << 19) 65609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_PB_UNDERRUN_INT_STA (1 << 18) 66609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_REC_FORCE_MT (1 << 17) 67609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_PB_FORCE_MT (1 << 16) 68609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_REC_FULL_EN (1 << 15) 69609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_REC_3QRT_FULL_EN (1 << 14) 70609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_REC_QRT_FULL_EN (1 << 13) 71609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_REC_EMPTY_EN (1 << 12) 72609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_PB_NOT_FULL_EN (1 << 11) 73609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN (1 << 10) 74609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_PB_3QRT_MT_EN (1 << 9) 75609dad9bSLucas Stach #define TEGRA20_AC97_FIFO_SCR_PB_EMPTY_MT_EN (1 << 8) 76609dad9bSLucas Stach 77609dad9bSLucas Stach struct tegra20_ac97 { 78609dad9bSLucas Stach struct clk *clk_ac97; 793489d506SLars-Peter Clausen struct snd_dmaengine_dai_dma_data capture_dma_data; 803489d506SLars-Peter Clausen struct snd_dmaengine_dai_dma_data playback_dma_data; 81*a46b7824SDmitry Osipenko struct reset_control *reset; 82609dad9bSLucas Stach struct regmap *regmap; 83609dad9bSLucas Stach int reset_gpio; 84609dad9bSLucas Stach int sync_gpio; 85609dad9bSLucas Stach }; 86609dad9bSLucas Stach #endif /* __TEGRA20_AC97_H__ */ 87