bcm63xx-i2s.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. // linux/sound/soc/bcm/bcm63xx-i2s.h
  3. // Copyright (c) 2020 Broadcom Corporation
  4. // Author: Kevin-Ke Li <kevin-ke.li@broadcom.com>
  5. #ifndef __BCM63XX_I2S_H
  6. #define __BCM63XX_I2S_H
  7. #define I2S_DESC_FIFO_DEPTH 8
  8. #define I2S_MISC_CFG (0x003C)
  9. #define I2S_PAD_LVL_LOOP_DIS_MASK (1 << 2)
  10. #define I2S_PAD_LVL_LOOP_DIS_ENABLE I2S_PAD_LVL_LOOP_DIS_MASK
  11. #define I2S_TX_ENABLE_MASK (1 << 31)
  12. #define I2S_TX_ENABLE I2S_TX_ENABLE_MASK
  13. #define I2S_TX_OUT_R (1 << 19)
  14. #define I2S_TX_DATA_ALIGNMENT (1 << 2)
  15. #define I2S_TX_DATA_ENABLE (1 << 1)
  16. #define I2S_TX_CLOCK_ENABLE (1 << 0)
  17. #define I2S_TX_DESC_OFF_LEVEL_SHIFT 12
  18. #define I2S_TX_DESC_OFF_LEVEL_MASK (0x0F << I2S_TX_DESC_OFF_LEVEL_SHIFT)
  19. #define I2S_TX_DESC_IFF_LEVEL_SHIFT 8
  20. #define I2S_TX_DESC_IFF_LEVEL_MASK (0x0F << I2S_TX_DESC_IFF_LEVEL_SHIFT)
  21. #define I2S_TX_DESC_OFF_INTR_EN_MSK (1 << 1)
  22. #define I2S_TX_DESC_OFF_INTR_EN I2S_TX_DESC_OFF_INTR_EN_MSK
  23. #define I2S_TX_CFG (0x0000)
  24. #define I2S_TX_IRQ_CTL (0x0004)
  25. #define I2S_TX_IRQ_EN (0x0008)
  26. #define I2S_TX_IRQ_IFF_THLD (0x000c)
  27. #define I2S_TX_IRQ_OFF_THLD (0x0010)
  28. #define I2S_TX_DESC_IFF_ADDR (0x0014)
  29. #define I2S_TX_DESC_IFF_LEN (0x0018)
  30. #define I2S_TX_DESC_OFF_ADDR (0x001C)
  31. #define I2S_TX_DESC_OFF_LEN (0x0020)
  32. #define I2S_TX_CFG_2 (0x0024)
  33. #define I2S_TX_SLAVE_MODE_SHIFT 13
  34. #define I2S_TX_SLAVE_MODE_MASK (1 << I2S_TX_SLAVE_MODE_SHIFT)
  35. #define I2S_TX_SLAVE_MODE I2S_TX_SLAVE_MODE_MASK
  36. #define I2S_TX_MASTER_MODE 0
  37. #define I2S_TX_INTR_MASK 0x0F
  38. #define I2S_RX_ENABLE_MASK (1 << 31)
  39. #define I2S_RX_ENABLE I2S_RX_ENABLE_MASK
  40. #define I2S_RX_IN_R (1 << 19)
  41. #define I2S_RX_DATA_ALIGNMENT (1 << 2)
  42. #define I2S_RX_CLOCK_ENABLE (1 << 0)
  43. #define I2S_RX_DESC_OFF_LEVEL_SHIFT 12
  44. #define I2S_RX_DESC_OFF_LEVEL_MASK (0x0F << I2S_RX_DESC_OFF_LEVEL_SHIFT)
  45. #define I2S_RX_DESC_IFF_LEVEL_SHIFT 8
  46. #define I2S_RX_DESC_IFF_LEVEL_MASK (0x0F << I2S_RX_DESC_IFF_LEVEL_SHIFT)
  47. #define I2S_RX_DESC_OFF_INTR_EN_MSK (1 << 1)
  48. #define I2S_RX_DESC_OFF_INTR_EN I2S_RX_DESC_OFF_INTR_EN_MSK
  49. #define I2S_RX_CFG (0x0040) /* 20c0 */
  50. #define I2S_RX_IRQ_CTL (0x0044)
  51. #define I2S_RX_IRQ_EN (0x0048)
  52. #define I2S_RX_IRQ_IFF_THLD (0x004C)
  53. #define I2S_RX_IRQ_OFF_THLD (0x0050)
  54. #define I2S_RX_DESC_IFF_ADDR (0x0054)
  55. #define I2S_RX_DESC_IFF_LEN (0x0058)
  56. #define I2S_RX_DESC_OFF_ADDR (0x005C)
  57. #define I2S_RX_DESC_OFF_LEN (0x0060)
  58. #define I2S_RX_CFG_2 (0x0064)
  59. #define I2S_RX_SLAVE_MODE_SHIFT 13
  60. #define I2S_RX_SLAVE_MODE_MASK (1 << I2S_RX_SLAVE_MODE_SHIFT)
  61. #define I2S_RX_SLAVE_MODE I2S_RX_SLAVE_MODE_MASK
  62. #define I2S_RX_MASTER_MODE 0
  63. #define I2S_RX_INTR_MASK 0x0F
  64. #define I2S_REG_MAX 0x007C
  65. struct bcm_i2s_priv {
  66. struct device *dev;
  67. struct regmap *regmap_i2s;
  68. struct clk *i2s_clk;
  69. struct snd_pcm_substream *play_substream;
  70. struct snd_pcm_substream *capture_substream;
  71. struct i2s_dma_desc *play_dma_desc;
  72. struct i2s_dma_desc *capture_dma_desc;
  73. };
  74. extern int bcm63xx_soc_platform_probe(struct platform_device *pdev,
  75. struct bcm_i2s_priv *i2s_priv);
  76. extern int bcm63xx_soc_platform_remove(struct platform_device *pdev);
  77. #endif