tegra210_ope.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * tegra210_ope.h - Definitions for Tegra210 OPE driver
  4. *
  5. * Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
  6. *
  7. */
  8. #ifndef __TEGRA210_OPE_H__
  9. #define __TEGRA210_OPE_H__
  10. #include <linux/regmap.h>
  11. #include <sound/soc.h>
  12. #include "tegra210_peq.h"
  13. /*
  14. * OPE_RX registers are with respect to XBAR.
  15. * The data comes from XBAR to OPE
  16. */
  17. #define TEGRA210_OPE_RX_STATUS 0xc
  18. #define TEGRA210_OPE_RX_INT_STATUS 0x10
  19. #define TEGRA210_OPE_RX_INT_MASK 0x14
  20. #define TEGRA210_OPE_RX_INT_SET 0x18
  21. #define TEGRA210_OPE_RX_INT_CLEAR 0x1c
  22. #define TEGRA210_OPE_RX_CIF_CTRL 0x20
  23. /*
  24. * OPE_TX registers are with respect to XBAR.
  25. * The data goes out from OPE to XBAR
  26. */
  27. #define TEGRA210_OPE_TX_STATUS 0x4c
  28. #define TEGRA210_OPE_TX_INT_STATUS 0x50
  29. #define TEGRA210_OPE_TX_INT_MASK 0x54
  30. #define TEGRA210_OPE_TX_INT_SET 0x58
  31. #define TEGRA210_OPE_TX_INT_CLEAR 0x5c
  32. #define TEGRA210_OPE_TX_CIF_CTRL 0x60
  33. /* OPE Gloabal registers */
  34. #define TEGRA210_OPE_ENABLE 0x80
  35. #define TEGRA210_OPE_SOFT_RESET 0x84
  36. #define TEGRA210_OPE_CG 0x88
  37. #define TEGRA210_OPE_STATUS 0x8c
  38. #define TEGRA210_OPE_INT_STATUS 0x90
  39. #define TEGRA210_OPE_DIR 0x94
  40. /* Fields for TEGRA210_OPE_ENABLE */
  41. #define TEGRA210_OPE_EN_SHIFT 0
  42. #define TEGRA210_OPE_EN (1 << TEGRA210_OPE_EN_SHIFT)
  43. /* Fields for TEGRA210_OPE_SOFT_RESET */
  44. #define TEGRA210_OPE_SOFT_RESET_SHIFT 0
  45. #define TEGRA210_OPE_SOFT_RESET_EN (1 << TEGRA210_OPE_SOFT_RESET_SHIFT)
  46. #define TEGRA210_OPE_DIR_SHIFT 0
  47. struct tegra210_ope {
  48. struct regmap *regmap;
  49. struct regmap *peq_regmap;
  50. struct regmap *mbdrc_regmap;
  51. u32 peq_biquad_gains[TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH];
  52. u32 peq_biquad_shifts[TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH];
  53. unsigned int data_dir;
  54. };
  55. /* Extension of soc_bytes structure defined in sound/soc.h */
  56. struct tegra_soc_bytes {
  57. struct soc_bytes soc;
  58. u32 shift; /* Used as offset for AHUB RAM related programing */
  59. };
  60. /* Utility structures for using mixer control of type snd_soc_bytes */
  61. #define TEGRA_SOC_BYTES_EXT(xname, xbase, xregs, xshift, xmask, \
  62. xhandler_get, xhandler_put, xinfo) \
  63. { \
  64. .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
  65. .name = xname, \
  66. .info = xinfo, \
  67. .get = xhandler_get, \
  68. .put = xhandler_put, \
  69. .private_value = ((unsigned long)&(struct tegra_soc_bytes) \
  70. { \
  71. .soc.base = xbase, \
  72. .soc.num_regs = xregs, \
  73. .soc.mask = xmask, \
  74. .shift = xshift \
  75. }) \
  76. }
  77. #endif