lpass.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (c) 2010-2011,2013-2015 The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * lpass.h - Definitions for the QTi LPASS
  14. */
  15. #ifndef __LPASS_H__
  16. #define __LPASS_H__
  17. #include <linux/clk.h>
  18. #include <linux/compiler.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/regmap.h>
  21. #define LPASS_AHBIX_CLOCK_FREQUENCY 131072000
  22. #define LPASS_MAX_MI2S_PORTS (8)
  23. #define LPASS_MAX_DMA_CHANNELS (8)
  24. /* Both the CPU DAI and platform drivers will access this data */
  25. struct lpass_data {
  26. /* AHB-I/X bus clocks inside the low-power audio subsystem (LPASS) */
  27. struct clk *ahbix_clk;
  28. /* MI2S system clock */
  29. struct clk *mi2s_osr_clk[LPASS_MAX_MI2S_PORTS];
  30. /* MI2S bit clock (derived from system clock by a divider */
  31. struct clk *mi2s_bit_clk[LPASS_MAX_MI2S_PORTS];
  32. /* low-power audio interface (LPAIF) registers */
  33. void __iomem *lpaif;
  34. /* regmap backed by the low-power audio interface (LPAIF) registers */
  35. struct regmap *lpaif_map;
  36. /* interrupts from the low-power audio interface (LPAIF) */
  37. int lpaif_irq;
  38. /* SOC specific variations in the LPASS IP integration */
  39. struct lpass_variant *variant;
  40. /* bit map to keep track of static channel allocations */
  41. unsigned long dma_ch_bit_map;
  42. /* used it for handling interrupt per dma channel */
  43. struct snd_pcm_substream *substream[LPASS_MAX_DMA_CHANNELS];
  44. /* 8016 specific */
  45. struct clk *pcnoc_mport_clk;
  46. struct clk *pcnoc_sway_clk;
  47. };
  48. /* Vairant data per each SOC */
  49. struct lpass_variant {
  50. u32 i2sctrl_reg_base;
  51. u32 i2sctrl_reg_stride;
  52. u32 i2s_ports;
  53. u32 irq_reg_base;
  54. u32 irq_reg_stride;
  55. u32 irq_ports;
  56. u32 rdma_reg_base;
  57. u32 rdma_reg_stride;
  58. u32 rdma_channels;
  59. u32 wrdma_reg_base;
  60. u32 wrdma_reg_stride;
  61. u32 wrdma_channels;
  62. /**
  63. * on SOCs like APQ8016 the channel control bits start
  64. * at different offset to ipq806x
  65. **/
  66. u32 dmactl_audif_start;
  67. u32 wrdma_channel_start;
  68. /* SOC specific intialization like clocks */
  69. int (*init)(struct platform_device *pdev);
  70. int (*exit)(struct platform_device *pdev);
  71. int (*alloc_dma_channel)(struct lpass_data *data, int direction);
  72. int (*free_dma_channel)(struct lpass_data *data, int ch);
  73. /* SOC specific dais */
  74. struct snd_soc_dai_driver *dai_driver;
  75. int num_dai;
  76. };
  77. /* register the platform driver from the CPU DAI driver */
  78. int asoc_qcom_lpass_platform_register(struct platform_device *);
  79. int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev);
  80. int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev);
  81. int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai);
  82. extern const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops;
  83. #endif /* __LPASS_H__ */