davinci_voicecodec.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * DaVinci Voice Codec Core Interface for TI platforms
  4. *
  5. * Copyright (C) 2010 Texas Instruments, Inc
  6. *
  7. * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
  8. */
  9. #ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_
  10. #define __LINUX_MFD_DAVINCI_VOICECODEC_H_
  11. #include <linux/kernel.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/mfd/core.h>
  14. #include <linux/platform_data/edma.h>
  15. struct regmap;
  16. /*
  17. * Register values.
  18. */
  19. #define DAVINCI_VC_PID 0x00
  20. #define DAVINCI_VC_CTRL 0x04
  21. #define DAVINCI_VC_INTEN 0x08
  22. #define DAVINCI_VC_INTSTATUS 0x0c
  23. #define DAVINCI_VC_INTCLR 0x10
  24. #define DAVINCI_VC_EMUL_CTRL 0x14
  25. #define DAVINCI_VC_RFIFO 0x20
  26. #define DAVINCI_VC_WFIFO 0x24
  27. #define DAVINCI_VC_FIFOSTAT 0x28
  28. #define DAVINCI_VC_TST_CTRL 0x2C
  29. #define DAVINCI_VC_REG05 0x94
  30. #define DAVINCI_VC_REG09 0xA4
  31. #define DAVINCI_VC_REG12 0xB0
  32. /* DAVINCI_VC_CTRL bit fields */
  33. #define DAVINCI_VC_CTRL_MASK 0x5500
  34. #define DAVINCI_VC_CTRL_RSTADC BIT(0)
  35. #define DAVINCI_VC_CTRL_RSTDAC BIT(1)
  36. #define DAVINCI_VC_CTRL_RD_BITS_8 BIT(4)
  37. #define DAVINCI_VC_CTRL_RD_UNSIGNED BIT(5)
  38. #define DAVINCI_VC_CTRL_WD_BITS_8 BIT(6)
  39. #define DAVINCI_VC_CTRL_WD_UNSIGNED BIT(7)
  40. #define DAVINCI_VC_CTRL_RFIFOEN BIT(8)
  41. #define DAVINCI_VC_CTRL_RFIFOCL BIT(9)
  42. #define DAVINCI_VC_CTRL_RFIFOMD_WORD_1 BIT(10)
  43. #define DAVINCI_VC_CTRL_WFIFOEN BIT(12)
  44. #define DAVINCI_VC_CTRL_WFIFOCL BIT(13)
  45. #define DAVINCI_VC_CTRL_WFIFOMD_WORD_1 BIT(14)
  46. /* DAVINCI_VC_INT bit fields */
  47. #define DAVINCI_VC_INT_MASK 0x3F
  48. #define DAVINCI_VC_INT_RDRDY_MASK BIT(0)
  49. #define DAVINCI_VC_INT_RERROVF_MASK BIT(1)
  50. #define DAVINCI_VC_INT_RERRUDR_MASK BIT(2)
  51. #define DAVINCI_VC_INT_WDREQ_MASK BIT(3)
  52. #define DAVINCI_VC_INT_WERROVF_MASKBIT BIT(4)
  53. #define DAVINCI_VC_INT_WERRUDR_MASK BIT(5)
  54. /* DAVINCI_VC_REG05 bit fields */
  55. #define DAVINCI_VC_REG05_PGA_GAIN 0x07
  56. /* DAVINCI_VC_REG09 bit fields */
  57. #define DAVINCI_VC_REG09_MUTE 0x40
  58. #define DAVINCI_VC_REG09_DIG_ATTEN 0x3F
  59. /* DAVINCI_VC_REG12 bit fields */
  60. #define DAVINCI_VC_REG12_POWER_ALL_ON 0xFD
  61. #define DAVINCI_VC_REG12_POWER_ALL_OFF 0x00
  62. #define DAVINCI_VC_CELLS 2
  63. enum davinci_vc_cells {
  64. DAVINCI_VC_VCIF_CELL,
  65. DAVINCI_VC_CQ93VC_CELL,
  66. };
  67. struct davinci_vcif {
  68. struct platform_device *pdev;
  69. u32 dma_tx_channel;
  70. u32 dma_rx_channel;
  71. dma_addr_t dma_tx_addr;
  72. dma_addr_t dma_rx_addr;
  73. };
  74. struct davinci_vc {
  75. /* Device data */
  76. struct device *dev;
  77. struct platform_device *pdev;
  78. struct clk *clk;
  79. /* Memory resources */
  80. void __iomem *base;
  81. struct regmap *regmap;
  82. /* MFD cells */
  83. struct mfd_cell cells[DAVINCI_VC_CELLS];
  84. /* Client devices */
  85. struct davinci_vcif davinci_vcif;
  86. };
  87. #endif