internal.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
  3. */
  4. #ifndef _BOLERO_INTERNAL_H
  5. #define _BOLERO_INTERNAL_H
  6. #include "bolero-cdc-registers.h"
  7. #define BOLERO_CDC_CHILD_DEVICES_MAX 6
  8. enum {
  9. REG_NO_ACCESS,
  10. RD_REG,
  11. WR_REG,
  12. RD_WR_REG
  13. };
  14. struct wcd_ctrl_platform_data {
  15. void *handle;
  16. int (*update_wcd_event)(void *handle, u16 event, u32 data);
  17. int (*register_notifier)(void *handle,
  18. struct notifier_block *nblock,
  19. bool enable);
  20. };
  21. struct bolero_priv {
  22. struct device *dev;
  23. struct snd_soc_component *component;
  24. struct regmap *regmap;
  25. struct mutex io_lock;
  26. struct mutex clk_lock;
  27. struct mutex vote_lock;
  28. bool va_without_decimation;
  29. bool macros_supported[MAX_MACRO];
  30. bool dev_up;
  31. bool initial_boot;
  32. struct macro_ops macro_params[MAX_MACRO];
  33. struct snd_soc_dai_driver *bolero_dais;
  34. u16 num_dais;
  35. u16 num_macros_registered;
  36. u16 num_macros;
  37. u16 current_mclk_mux_macro[MAX_MACRO];
  38. struct work_struct bolero_add_child_devices_work;
  39. u32 version;
  40. struct clk *lpass_core_hw_vote;
  41. struct clk *lpass_audio_hw_vote;
  42. int core_hw_vote_count;
  43. int core_audio_vote_count;
  44. /* Entry for version info */
  45. struct snd_info_entry *entry;
  46. struct snd_info_entry *version_entry;
  47. int (*read_dev)(struct bolero_priv *priv,
  48. u16 macro_id, u16 reg, u8 *val);
  49. int (*write_dev)(struct bolero_priv *priv,
  50. u16 macro_id, u16 reg, u8 val);
  51. struct platform_device *pdev_child_devices
  52. [BOLERO_CDC_CHILD_DEVICES_MAX];
  53. u16 child_count;
  54. struct wcd_ctrl_platform_data plat_data;
  55. struct device *wcd_dev;
  56. struct blocking_notifier_head notifier;
  57. struct device *clk_dev;
  58. rsc_clk_cb_t rsc_clk_cb;
  59. s32 dmic_0_1_clk_cnt;
  60. s32 dmic_2_3_clk_cnt;
  61. s32 dmic_4_5_clk_cnt;
  62. s32 dmic_6_7_clk_cnt;
  63. u8 dmic_0_1_clk_div;
  64. u8 dmic_2_3_clk_div;
  65. u8 dmic_4_5_clk_div;
  66. u8 dmic_6_7_clk_div;
  67. };
  68. struct regmap *bolero_regmap_init(struct device *dev,
  69. const struct regmap_config *config);
  70. int bolero_get_macro_id(bool va_no_dec_flag, u16 reg);
  71. extern const struct regmap_config bolero_regmap_config;
  72. extern u8 *bolero_reg_access[MAX_MACRO];
  73. extern u8 bolero_va_top_reg_access[BOLERO_CDC_VA_MACRO_TOP_MAX];
  74. extern u8 bolero_va_reg_access_v2[BOLERO_CDC_VA_MACRO_MAX];
  75. extern u8 bolero_va_reg_access_v3[BOLERO_CDC_VA_MACRO_MAX];
  76. extern u8 bolero_tx_reg_access_v2[BOLERO_CDC_TX_MACRO_MAX];
  77. extern const u16 macro_id_base_offset[MAX_MACRO];
  78. #endif