bolero-cdc.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_CDC_H
  13. #define BOLERO_CDC_H
  14. #include <sound/soc.h>
  15. #include <linux/regmap.h>
  16. enum {
  17. START_MACRO,
  18. TX_MACRO = START_MACRO,
  19. RX_MACRO,
  20. WSA_MACRO,
  21. VA_MACRO,
  22. MAX_MACRO
  23. };
  24. enum mclk_mux {
  25. MCLK_MUX0,
  26. MCLK_MUX1,
  27. MCLK_MUX_MAX
  28. };
  29. struct macro_ops {
  30. int (*init)(struct snd_soc_codec *codec);
  31. int (*exit)(struct snd_soc_codec *codec);
  32. u16 num_dais;
  33. struct device *dev;
  34. struct snd_soc_dai_driver *dai_ptr;
  35. int (*mclk_fn)(struct device *dev, bool enable);
  36. char __iomem *io_base;
  37. };
  38. #if IS_ENABLED(CONFIG_SND_SOC_BOLERO)
  39. int bolero_register_macro(struct device *dev, u16 macro_id,
  40. struct macro_ops *ops);
  41. void bolero_unregister_macro(struct device *dev, u16 macro_id);
  42. struct device *bolero_get_device_ptr(struct device *dev, u16 macro_id);
  43. int bolero_request_clock(struct device *dev, u16 macro_id,
  44. enum mclk_mux mclk_mux_id,
  45. bool enable);
  46. #else
  47. static inline int bolero_register_macro(struct device *dev,
  48. u16 macro_id,
  49. struct macro_ops *ops)
  50. {
  51. return 0;
  52. }
  53. static inline void bolero_unregister_macro(struct device *dev, u16 macro_id)
  54. {
  55. }
  56. static inline struct device *bolero_get_device_ptr(struct device *dev,
  57. u16 macro_id)
  58. {
  59. return NULL;
  60. }
  61. static inline int bolero_request_clock(struct device *dev, u16 macro_id,
  62. enum mclk_mux mclk_mux_id,
  63. bool enable)
  64. {
  65. return 0;
  66. }
  67. #endif /* CONFIG_SND_SOC_BOLERO */
  68. #endif /* BOLERO_CDC_H */