internal.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2018-2019, 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. /* from bolero to WCD events */
  9. enum {
  10. BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR = 1,
  11. BOLERO_WCD_EVT_PA_OFF_PRE_SSR,
  12. BOLERO_WCD_EVT_SSR_DOWN,
  13. BOLERO_WCD_EVT_SSR_UP,
  14. };
  15. enum {
  16. REG_NO_ACCESS,
  17. RD_REG,
  18. WR_REG,
  19. RD_WR_REG
  20. };
  21. /* from WCD to bolero events */
  22. enum {
  23. WCD_BOLERO_EVT_RX_MUTE = 1, /* for RX mute/unmute */
  24. WCD_BOLERO_EVT_IMPED_TRUE, /* for imped true */
  25. WCD_BOLERO_EVT_IMPED_FALSE, /* for imped false */
  26. WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
  27. };
  28. struct wcd_ctrl_platform_data {
  29. void *handle;
  30. int (*update_wcd_event)(void *handle, u16 event, u32 data);
  31. int (*register_notifier)(void *handle,
  32. struct notifier_block *nblock,
  33. bool enable);
  34. };
  35. struct bolero_priv {
  36. struct device *dev;
  37. struct snd_soc_component *component;
  38. struct regmap *regmap;
  39. struct mutex io_lock;
  40. struct mutex clk_lock;
  41. bool va_without_decimation;
  42. bool macros_supported[MAX_MACRO];
  43. bool dev_up;
  44. bool initial_boot;
  45. struct macro_ops macro_params[MAX_MACRO];
  46. struct snd_soc_dai_driver *bolero_dais;
  47. u16 num_dais;
  48. u16 num_macros_registered;
  49. u16 num_macros;
  50. u16 current_mclk_mux_macro[MAX_MACRO];
  51. struct work_struct bolero_add_child_devices_work;
  52. u32 version;
  53. struct clk *lpass_core_hw_vote;
  54. struct clk *lpass_audio_hw_vote;
  55. /* Entry for version info */
  56. struct snd_info_entry *entry;
  57. struct snd_info_entry *version_entry;
  58. int (*read_dev)(struct bolero_priv *priv,
  59. u16 macro_id, u16 reg, u8 *val);
  60. int (*write_dev)(struct bolero_priv *priv,
  61. u16 macro_id, u16 reg, u8 val);
  62. struct platform_device *pdev_child_devices
  63. [BOLERO_CDC_CHILD_DEVICES_MAX];
  64. u16 child_count;
  65. struct wcd_ctrl_platform_data plat_data;
  66. struct device *wcd_dev;
  67. struct blocking_notifier_head notifier;
  68. struct device *clk_dev;
  69. rsc_clk_cb_t rsc_clk_cb;
  70. };
  71. struct regmap *bolero_regmap_init(struct device *dev,
  72. const struct regmap_config *config);
  73. int bolero_get_macro_id(bool va_no_dec_flag, u16 reg);
  74. extern const struct regmap_config bolero_regmap_config;
  75. extern u8 *bolero_reg_access[MAX_MACRO];
  76. extern u8 bolero_va_top_reg_access[BOLERO_CDC_VA_MACRO_TOP_MAX];
  77. extern const u16 macro_id_base_offset[MAX_MACRO];
  78. #endif