internal.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. };
  27. struct wcd_ctrl_platform_data {
  28. void *handle;
  29. int (*update_wcd_event)(void *handle, u16 event, u32 data);
  30. int (*register_notifier)(void *handle,
  31. struct notifier_block *nblock,
  32. bool enable);
  33. };
  34. struct bolero_priv {
  35. struct device *dev;
  36. struct snd_soc_component *component;
  37. struct regmap *regmap;
  38. struct mutex io_lock;
  39. struct mutex clk_lock;
  40. bool va_without_decimation;
  41. bool macros_supported[MAX_MACRO];
  42. bool dev_up;
  43. bool initial_boot;
  44. struct macro_ops macro_params[MAX_MACRO];
  45. struct snd_soc_dai_driver *bolero_dais;
  46. u16 num_dais;
  47. u16 num_macros_registered;
  48. u16 num_macros;
  49. u16 current_mclk_mux_macro[MAX_MACRO];
  50. struct work_struct bolero_add_child_devices_work;
  51. u32 version;
  52. struct clk *lpass_core_hw_vote;
  53. /* Entry for version info */
  54. struct snd_info_entry *entry;
  55. struct snd_info_entry *version_entry;
  56. int (*read_dev)(struct bolero_priv *priv,
  57. u16 macro_id, u16 reg, u8 *val);
  58. int (*write_dev)(struct bolero_priv *priv,
  59. u16 macro_id, u16 reg, u8 val);
  60. struct platform_device *pdev_child_devices
  61. [BOLERO_CDC_CHILD_DEVICES_MAX];
  62. u16 child_count;
  63. struct wcd_ctrl_platform_data plat_data;
  64. struct device *wcd_dev;
  65. struct blocking_notifier_head notifier;
  66. struct device *clk_dev;
  67. rsc_clk_cb_t rsc_clk_cb;
  68. };
  69. struct regmap *bolero_regmap_init(struct device *dev,
  70. const struct regmap_config *config);
  71. int bolero_get_macro_id(bool va_no_dec_flag, u16 reg);
  72. extern const struct regmap_config bolero_regmap_config;
  73. extern u8 *bolero_reg_access[MAX_MACRO];
  74. extern u8 bolero_va_top_reg_access[BOLERO_CDC_VA_MACRO_TOP_MAX];
  75. extern const u16 macro_id_base_offset[MAX_MACRO];
  76. #endif