18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci// linux/sound/soc/bcm/bcm63xx-i2s.h 38c2ecf20Sopenharmony_ci// Copyright (c) 2020 Broadcom Corporation 48c2ecf20Sopenharmony_ci// Author: Kevin-Ke Li <kevin-ke.li@broadcom.com> 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#ifndef __BCM63XX_I2S_H 78c2ecf20Sopenharmony_ci#define __BCM63XX_I2S_H 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define I2S_DESC_FIFO_DEPTH 8 108c2ecf20Sopenharmony_ci#define I2S_MISC_CFG (0x003C) 118c2ecf20Sopenharmony_ci#define I2S_PAD_LVL_LOOP_DIS_MASK (1 << 2) 128c2ecf20Sopenharmony_ci#define I2S_PAD_LVL_LOOP_DIS_ENABLE I2S_PAD_LVL_LOOP_DIS_MASK 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define I2S_TX_ENABLE_MASK (1 << 31) 158c2ecf20Sopenharmony_ci#define I2S_TX_ENABLE I2S_TX_ENABLE_MASK 168c2ecf20Sopenharmony_ci#define I2S_TX_OUT_R (1 << 19) 178c2ecf20Sopenharmony_ci#define I2S_TX_DATA_ALIGNMENT (1 << 2) 188c2ecf20Sopenharmony_ci#define I2S_TX_DATA_ENABLE (1 << 1) 198c2ecf20Sopenharmony_ci#define I2S_TX_CLOCK_ENABLE (1 << 0) 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define I2S_TX_DESC_OFF_LEVEL_SHIFT 12 228c2ecf20Sopenharmony_ci#define I2S_TX_DESC_OFF_LEVEL_MASK (0x0F << I2S_TX_DESC_OFF_LEVEL_SHIFT) 238c2ecf20Sopenharmony_ci#define I2S_TX_DESC_IFF_LEVEL_SHIFT 8 248c2ecf20Sopenharmony_ci#define I2S_TX_DESC_IFF_LEVEL_MASK (0x0F << I2S_TX_DESC_IFF_LEVEL_SHIFT) 258c2ecf20Sopenharmony_ci#define I2S_TX_DESC_OFF_INTR_EN_MSK (1 << 1) 268c2ecf20Sopenharmony_ci#define I2S_TX_DESC_OFF_INTR_EN I2S_TX_DESC_OFF_INTR_EN_MSK 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define I2S_TX_CFG (0x0000) 298c2ecf20Sopenharmony_ci#define I2S_TX_IRQ_CTL (0x0004) 308c2ecf20Sopenharmony_ci#define I2S_TX_IRQ_EN (0x0008) 318c2ecf20Sopenharmony_ci#define I2S_TX_IRQ_IFF_THLD (0x000c) 328c2ecf20Sopenharmony_ci#define I2S_TX_IRQ_OFF_THLD (0x0010) 338c2ecf20Sopenharmony_ci#define I2S_TX_DESC_IFF_ADDR (0x0014) 348c2ecf20Sopenharmony_ci#define I2S_TX_DESC_IFF_LEN (0x0018) 358c2ecf20Sopenharmony_ci#define I2S_TX_DESC_OFF_ADDR (0x001C) 368c2ecf20Sopenharmony_ci#define I2S_TX_DESC_OFF_LEN (0x0020) 378c2ecf20Sopenharmony_ci#define I2S_TX_CFG_2 (0x0024) 388c2ecf20Sopenharmony_ci#define I2S_TX_SLAVE_MODE_SHIFT 13 398c2ecf20Sopenharmony_ci#define I2S_TX_SLAVE_MODE_MASK (1 << I2S_TX_SLAVE_MODE_SHIFT) 408c2ecf20Sopenharmony_ci#define I2S_TX_SLAVE_MODE I2S_TX_SLAVE_MODE_MASK 418c2ecf20Sopenharmony_ci#define I2S_TX_MASTER_MODE 0 428c2ecf20Sopenharmony_ci#define I2S_TX_INTR_MASK 0x0F 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define I2S_RX_ENABLE_MASK (1 << 31) 458c2ecf20Sopenharmony_ci#define I2S_RX_ENABLE I2S_RX_ENABLE_MASK 468c2ecf20Sopenharmony_ci#define I2S_RX_IN_R (1 << 19) 478c2ecf20Sopenharmony_ci#define I2S_RX_DATA_ALIGNMENT (1 << 2) 488c2ecf20Sopenharmony_ci#define I2S_RX_CLOCK_ENABLE (1 << 0) 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define I2S_RX_DESC_OFF_LEVEL_SHIFT 12 518c2ecf20Sopenharmony_ci#define I2S_RX_DESC_OFF_LEVEL_MASK (0x0F << I2S_RX_DESC_OFF_LEVEL_SHIFT) 528c2ecf20Sopenharmony_ci#define I2S_RX_DESC_IFF_LEVEL_SHIFT 8 538c2ecf20Sopenharmony_ci#define I2S_RX_DESC_IFF_LEVEL_MASK (0x0F << I2S_RX_DESC_IFF_LEVEL_SHIFT) 548c2ecf20Sopenharmony_ci#define I2S_RX_DESC_OFF_INTR_EN_MSK (1 << 1) 558c2ecf20Sopenharmony_ci#define I2S_RX_DESC_OFF_INTR_EN I2S_RX_DESC_OFF_INTR_EN_MSK 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define I2S_RX_CFG (0x0040) /* 20c0 */ 588c2ecf20Sopenharmony_ci#define I2S_RX_IRQ_CTL (0x0044) 598c2ecf20Sopenharmony_ci#define I2S_RX_IRQ_EN (0x0048) 608c2ecf20Sopenharmony_ci#define I2S_RX_IRQ_IFF_THLD (0x004C) 618c2ecf20Sopenharmony_ci#define I2S_RX_IRQ_OFF_THLD (0x0050) 628c2ecf20Sopenharmony_ci#define I2S_RX_DESC_IFF_ADDR (0x0054) 638c2ecf20Sopenharmony_ci#define I2S_RX_DESC_IFF_LEN (0x0058) 648c2ecf20Sopenharmony_ci#define I2S_RX_DESC_OFF_ADDR (0x005C) 658c2ecf20Sopenharmony_ci#define I2S_RX_DESC_OFF_LEN (0x0060) 668c2ecf20Sopenharmony_ci#define I2S_RX_CFG_2 (0x0064) 678c2ecf20Sopenharmony_ci#define I2S_RX_SLAVE_MODE_SHIFT 13 688c2ecf20Sopenharmony_ci#define I2S_RX_SLAVE_MODE_MASK (1 << I2S_RX_SLAVE_MODE_SHIFT) 698c2ecf20Sopenharmony_ci#define I2S_RX_SLAVE_MODE I2S_RX_SLAVE_MODE_MASK 708c2ecf20Sopenharmony_ci#define I2S_RX_MASTER_MODE 0 718c2ecf20Sopenharmony_ci#define I2S_RX_INTR_MASK 0x0F 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define I2S_REG_MAX 0x007C 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistruct bcm_i2s_priv { 768c2ecf20Sopenharmony_ci struct device *dev; 778c2ecf20Sopenharmony_ci struct resource *r_irq; 788c2ecf20Sopenharmony_ci struct regmap *regmap_i2s; 798c2ecf20Sopenharmony_ci struct clk *i2s_clk; 808c2ecf20Sopenharmony_ci struct snd_pcm_substream *play_substream; 818c2ecf20Sopenharmony_ci struct snd_pcm_substream *capture_substream; 828c2ecf20Sopenharmony_ci struct i2s_dma_desc *play_dma_desc; 838c2ecf20Sopenharmony_ci struct i2s_dma_desc *capture_dma_desc; 848c2ecf20Sopenharmony_ci}; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ciextern int bcm63xx_soc_platform_probe(struct platform_device *pdev, 878c2ecf20Sopenharmony_ci struct bcm_i2s_priv *i2s_priv); 888c2ecf20Sopenharmony_ciextern int bcm63xx_soc_platform_remove(struct platform_device *pdev); 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#endif 91