tegra20_ac97.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * tegra20_ac97.h - Definitions for the Tegra20 AC97 controller driver
  3. *
  4. * Copyright (c) 2012 Lucas Stach <dev@lynxeye.de>
  5. *
  6. * Partly based on code copyright/by:
  7. *
  8. * Copyright (c) 2011,2012 Toradex Inc.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * version 2 as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. */
  20. #ifndef __TEGRA20_AC97_H__
  21. #define __TEGRA20_AC97_H__
  22. #include "tegra_pcm.h"
  23. #define TEGRA20_AC97_CTRL 0x00
  24. #define TEGRA20_AC97_CMD 0x04
  25. #define TEGRA20_AC97_STATUS1 0x08
  26. /* ... */
  27. #define TEGRA20_AC97_FIFO1_SCR 0x1c
  28. /* ... */
  29. #define TEGRA20_AC97_FIFO_TX1 0x40
  30. #define TEGRA20_AC97_FIFO_RX1 0x80
  31. /* TEGRA20_AC97_CTRL */
  32. #define TEGRA20_AC97_CTRL_STM2_EN (1 << 16)
  33. #define TEGRA20_AC97_CTRL_DOUBLE_SAMPLING_EN (1 << 11)
  34. #define TEGRA20_AC97_CTRL_IO_CNTRL_EN (1 << 10)
  35. #define TEGRA20_AC97_CTRL_HSET_DAC_EN (1 << 9)
  36. #define TEGRA20_AC97_CTRL_LINE2_DAC_EN (1 << 8)
  37. #define TEGRA20_AC97_CTRL_PCM_LFE_EN (1 << 7)
  38. #define TEGRA20_AC97_CTRL_PCM_SUR_EN (1 << 6)
  39. #define TEGRA20_AC97_CTRL_PCM_CEN_DAC_EN (1 << 5)
  40. #define TEGRA20_AC97_CTRL_LINE1_DAC_EN (1 << 4)
  41. #define TEGRA20_AC97_CTRL_PCM_DAC_EN (1 << 3)
  42. #define TEGRA20_AC97_CTRL_COLD_RESET (1 << 2)
  43. #define TEGRA20_AC97_CTRL_WARM_RESET (1 << 1)
  44. #define TEGRA20_AC97_CTRL_STM_EN (1 << 0)
  45. /* TEGRA20_AC97_CMD */
  46. #define TEGRA20_AC97_CMD_CMD_ADDR_SHIFT 24
  47. #define TEGRA20_AC97_CMD_CMD_ADDR_MASK (0xff << TEGRA20_AC97_CMD_CMD_ADDR_SHIFT)
  48. #define TEGRA20_AC97_CMD_CMD_DATA_SHIFT 8
  49. #define TEGRA20_AC97_CMD_CMD_DATA_MASK (0xffff << TEGRA20_AC97_CMD_CMD_DATA_SHIFT)
  50. #define TEGRA20_AC97_CMD_CMD_ID_SHIFT 2
  51. #define TEGRA20_AC97_CMD_CMD_ID_MASK (0x3 << TEGRA20_AC97_CMD_CMD_ID_SHIFT)
  52. #define TEGRA20_AC97_CMD_BUSY (1 << 0)
  53. /* TEGRA20_AC97_STATUS1 */
  54. #define TEGRA20_AC97_STATUS1_STA_ADDR1_SHIFT 24
  55. #define TEGRA20_AC97_STATUS1_STA_ADDR1_MASK (0xff << TEGRA20_AC97_STATUS1_STA_ADDR1_SHIFT)
  56. #define TEGRA20_AC97_STATUS1_STA_DATA1_SHIFT 8
  57. #define TEGRA20_AC97_STATUS1_STA_DATA1_MASK (0xffff << TEGRA20_AC97_STATUS1_STA_DATA1_SHIFT)
  58. #define TEGRA20_AC97_STATUS1_STA_VALID1 (1 << 2)
  59. #define TEGRA20_AC97_STATUS1_STANDBY1 (1 << 1)
  60. #define TEGRA20_AC97_STATUS1_CODEC1_RDY (1 << 0)
  61. /* TEGRA20_AC97_FIFO1_SCR */
  62. #define TEGRA20_AC97_FIFO_SCR_REC_MT_CNT_SHIFT 27
  63. #define TEGRA20_AC97_FIFO_SCR_REC_MT_CNT_MASK (0x1f << TEGRA20_AC97_FIFO_SCR_REC_MT_CNT_SHIFT)
  64. #define TEGRA20_AC97_FIFO_SCR_PB_MT_CNT_SHIFT 22
  65. #define TEGRA20_AC97_FIFO_SCR_PB_MT_CNT_MASK (0x1f << TEGRA20_AC97_FIFO_SCR_PB_MT_CNT_SHIFT)
  66. #define TEGRA20_AC97_FIFO_SCR_REC_OVERRUN_INT_STA (1 << 19)
  67. #define TEGRA20_AC97_FIFO_SCR_PB_UNDERRUN_INT_STA (1 << 18)
  68. #define TEGRA20_AC97_FIFO_SCR_REC_FORCE_MT (1 << 17)
  69. #define TEGRA20_AC97_FIFO_SCR_PB_FORCE_MT (1 << 16)
  70. #define TEGRA20_AC97_FIFO_SCR_REC_FULL_EN (1 << 15)
  71. #define TEGRA20_AC97_FIFO_SCR_REC_3QRT_FULL_EN (1 << 14)
  72. #define TEGRA20_AC97_FIFO_SCR_REC_QRT_FULL_EN (1 << 13)
  73. #define TEGRA20_AC97_FIFO_SCR_REC_EMPTY_EN (1 << 12)
  74. #define TEGRA20_AC97_FIFO_SCR_PB_NOT_FULL_EN (1 << 11)
  75. #define TEGRA20_AC97_FIFO_SCR_PB_QRT_MT_EN (1 << 10)
  76. #define TEGRA20_AC97_FIFO_SCR_PB_3QRT_MT_EN (1 << 9)
  77. #define TEGRA20_AC97_FIFO_SCR_PB_EMPTY_MT_EN (1 << 8)
  78. struct tegra20_ac97 {
  79. struct clk *clk_ac97;
  80. struct snd_dmaengine_dai_dma_data capture_dma_data;
  81. struct snd_dmaengine_dai_dma_data playback_dma_data;
  82. struct regmap *regmap;
  83. int reset_gpio;
  84. int sync_gpio;
  85. };
  86. #endif /* __TEGRA20_AC97_H__ */