axg-fifo.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
  2. /*
  3. * Copyright (c) 2018 BayLibre, SAS.
  4. * Author: Jerome Brunet <jbrunet@baylibre.com>
  5. */
  6. #ifndef _MESON_AXG_FIFO_H
  7. #define _MESON_AXG_FIFO_H
  8. struct clk;
  9. struct platform_device;
  10. struct regmap;
  11. struct reset_control;
  12. struct snd_soc_component_driver;
  13. struct snd_soc_dai;
  14. struct snd_soc_dai_driver;
  15. struct snd_pcm_ops;
  16. struct snd_soc_pcm_runtime;
  17. #define AXG_FIFO_CH_MAX 128
  18. #define AXG_FIFO_RATES (SNDRV_PCM_RATE_5512 | \
  19. SNDRV_PCM_RATE_8000_192000)
  20. #define AXG_FIFO_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
  21. SNDRV_PCM_FMTBIT_S16_LE | \
  22. SNDRV_PCM_FMTBIT_S20_LE | \
  23. SNDRV_PCM_FMTBIT_S24_LE | \
  24. SNDRV_PCM_FMTBIT_S32_LE)
  25. #define AXG_FIFO_BURST 8
  26. #define AXG_FIFO_MIN_CNT 64
  27. #define AXG_FIFO_MIN_DEPTH (AXG_FIFO_BURST * AXG_FIFO_MIN_CNT)
  28. #define FIFO_INT_ADDR_FINISH BIT(0)
  29. #define FIFO_INT_ADDR_INT BIT(1)
  30. #define FIFO_INT_COUNT_REPEAT BIT(2)
  31. #define FIFO_INT_COUNT_ONCE BIT(3)
  32. #define FIFO_INT_FIFO_ZERO BIT(4)
  33. #define FIFO_INT_FIFO_DEPTH BIT(5)
  34. #define FIFO_INT_MASK GENMASK(7, 0)
  35. #define FIFO_CTRL0 0x00
  36. #define CTRL0_DMA_EN BIT(31)
  37. #define CTRL0_INT_EN(x) ((x) << 16)
  38. #define CTRL0_SEL_MASK GENMASK(2, 0)
  39. #define CTRL0_SEL_SHIFT 0
  40. #define FIFO_CTRL1 0x04
  41. #define CTRL1_INT_CLR(x) ((x) << 0)
  42. #define CTRL1_STATUS2_SEL_MASK GENMASK(11, 8)
  43. #define CTRL1_STATUS2_SEL(x) ((x) << 8)
  44. #define STATUS2_SEL_DDR_READ 0
  45. #define CTRL1_THRESHOLD_MASK GENMASK(23, 16)
  46. #define CTRL1_THRESHOLD(x) ((x) << 16)
  47. #define CTRL1_FRDDR_DEPTH_MASK GENMASK(31, 24)
  48. #define CTRL1_FRDDR_DEPTH(x) ((x) << 24)
  49. #define FIFO_START_ADDR 0x08
  50. #define FIFO_FINISH_ADDR 0x0c
  51. #define FIFO_INT_ADDR 0x10
  52. #define FIFO_STATUS1 0x14
  53. #define STATUS1_INT_STS(x) ((x) << 0)
  54. #define FIFO_STATUS2 0x18
  55. struct axg_fifo {
  56. struct regmap *map;
  57. struct clk *pclk;
  58. struct reset_control *arb;
  59. int irq;
  60. };
  61. struct axg_fifo_match_data {
  62. const struct snd_soc_component_driver *component_drv;
  63. struct snd_soc_dai_driver *dai_drv;
  64. };
  65. extern const struct snd_pcm_ops axg_fifo_pcm_ops;
  66. int axg_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, unsigned int type);
  67. int axg_fifo_probe(struct platform_device *pdev);
  68. #endif /* _MESON_AXG_FIFO_H */