internal.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Copyright (c) 2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _BOLERO_INTERNAL_H
  13. #define _BOLERO_INTERNAL_H
  14. #include "bolero-cdc-registers.h"
  15. enum {
  16. REG_NO_ACCESS,
  17. RD_REG,
  18. WR_REG,
  19. RD_WR_REG
  20. };
  21. struct bolero_priv {
  22. struct device *dev;
  23. struct snd_soc_codec *codec;
  24. struct regmap *regmap;
  25. struct mutex io_lock;
  26. struct mutex clk_lock;
  27. bool va_without_decimation;
  28. bool macros_supported[MAX_MACRO];
  29. struct macro_ops macro_params[MAX_MACRO];
  30. struct snd_soc_dai_driver *bolero_dais;
  31. u16 num_dais;
  32. u16 num_macros_registered;
  33. u16 child_num;
  34. u16 current_mclk_mux_macro[MAX_MACRO];
  35. struct work_struct bolero_add_child_devices_work;
  36. int (*read_dev)(struct bolero_priv *priv,
  37. u16 macro_id, u16 reg, u8 *val);
  38. int (*write_dev)(struct bolero_priv *priv,
  39. u16 macro_id, u16 reg, u8 val);
  40. };
  41. struct regmap *bolero_regmap_init(struct device *dev,
  42. const struct regmap_config *config);
  43. int bolero_get_macro_id(bool va_no_dec_flag, u16 reg);
  44. extern const struct regmap_config bolero_regmap_config;
  45. extern u8 *bolero_reg_access[MAX_MACRO];
  46. extern u8 bolero_va_top_reg_access[BOLERO_CDC_VA_MACRO_TOP_MAX];
  47. extern const u16 macro_id_base_offset[MAX_MACRO];
  48. #endif