tegra210_dmic.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * tegra210_dmic.h - Definitions for Tegra210 DMIC driver
  4. *
  5. * Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
  6. *
  7. */
  8. #ifndef __TEGRA210_DMIC_H__
  9. #define __TEGRA210_DMIC_H__
  10. /* Register offsets from DMIC BASE */
  11. #define TEGRA210_DMIC_TX_STATUS 0x0c
  12. #define TEGRA210_DMIC_TX_INT_STATUS 0x10
  13. #define TEGRA210_DMIC_TX_INT_MASK 0x14
  14. #define TEGRA210_DMIC_TX_INT_SET 0x18
  15. #define TEGRA210_DMIC_TX_INT_CLEAR 0x1c
  16. #define TEGRA210_DMIC_TX_CIF_CTRL 0x20
  17. #define TEGRA210_DMIC_ENABLE 0x40
  18. #define TEGRA210_DMIC_SOFT_RESET 0x44
  19. #define TEGRA210_DMIC_CG 0x48
  20. #define TEGRA210_DMIC_STATUS 0x4c
  21. #define TEGRA210_DMIC_INT_STATUS 0x50
  22. #define TEGRA210_DMIC_CTRL 0x64
  23. #define TEGRA210_DMIC_DBG_CTRL 0x70
  24. #define TEGRA210_DMIC_DCR_BIQUAD_0_COEF_4 0x88
  25. #define TEGRA210_DMIC_LP_FILTER_GAIN 0x8c
  26. #define TEGRA210_DMIC_LP_BIQUAD_0_COEF_0 0x90
  27. #define TEGRA210_DMIC_LP_BIQUAD_0_COEF_1 0x94
  28. #define TEGRA210_DMIC_LP_BIQUAD_0_COEF_2 0x98
  29. #define TEGRA210_DMIC_LP_BIQUAD_0_COEF_3 0x9c
  30. #define TEGRA210_DMIC_LP_BIQUAD_0_COEF_4 0xa0
  31. #define TEGRA210_DMIC_LP_BIQUAD_1_COEF_0 0xa4
  32. #define TEGRA210_DMIC_LP_BIQUAD_1_COEF_1 0xa8
  33. #define TEGRA210_DMIC_LP_BIQUAD_1_COEF_2 0xac
  34. #define TEGRA210_DMIC_LP_BIQUAD_1_COEF_3 0xb0
  35. #define TEGRA210_DMIC_LP_BIQUAD_1_COEF_4 0xb4
  36. /* Fields in TEGRA210_DMIC_CTRL */
  37. #define CH_SEL_SHIFT 8
  38. #define TEGRA210_DMIC_CTRL_CHANNEL_SELECT_MASK (0x3 << CH_SEL_SHIFT)
  39. #define LRSEL_POL_SHIFT 4
  40. #define TEGRA210_DMIC_CTRL_LRSEL_POLARITY_MASK (0x1 << LRSEL_POL_SHIFT)
  41. #define OSR_SHIFT 0
  42. #define TEGRA210_DMIC_CTRL_OSR_MASK (0x3 << OSR_SHIFT)
  43. #define DMIC_OSR_FACTOR 64
  44. #define DEFAULT_GAIN_Q23 0x800000
  45. /* Max boost gain factor used for mixer control */
  46. #define MAX_BOOST_GAIN 25599
  47. enum tegra_dmic_ch_select {
  48. DMIC_CH_SELECT_LEFT,
  49. DMIC_CH_SELECT_RIGHT,
  50. DMIC_CH_SELECT_STEREO,
  51. };
  52. enum tegra_dmic_osr {
  53. DMIC_OSR_64,
  54. DMIC_OSR_128,
  55. DMIC_OSR_256,
  56. };
  57. enum tegra_dmic_lrsel {
  58. DMIC_LRSEL_LEFT,
  59. DMIC_LRSEL_RIGHT,
  60. };
  61. struct tegra210_dmic {
  62. struct clk *clk_dmic;
  63. struct regmap *regmap;
  64. unsigned int mono_to_stereo;
  65. unsigned int stereo_to_mono;
  66. unsigned int boost_gain;
  67. unsigned int ch_select;
  68. unsigned int osr_val;
  69. unsigned int lrsel;
  70. };
  71. #endif