wcd934x-dsd.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Copyright (c) 2016-2017, 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 __WCD934X_DSD_H__
  13. #define __WCD934X_DSD_H__
  14. #include <sound/soc.h>
  15. #include "wcd934x.h"
  16. enum {
  17. DSD0,
  18. DSD1,
  19. DSD_MAX,
  20. };
  21. enum {
  22. DSD_INP_SEL_ZERO = 0,
  23. DSD_INP_SEL_RX0,
  24. DSD_INP_SEL_RX1,
  25. DSD_INP_SEL_RX2,
  26. DSD_INP_SEL_RX3,
  27. DSD_INP_SEL_RX4,
  28. DSD_INP_SEL_RX5,
  29. DSD_INP_SEL_RX6,
  30. DSD_INP_SEL_RX7,
  31. };
  32. struct tavil_dsd_config {
  33. struct snd_soc_codec *codec;
  34. unsigned int dsd_interp_mixer[INTERP_MAX];
  35. u32 base_sample_rate[DSD_MAX];
  36. int volume[DSD_MAX];
  37. struct mutex vol_mutex;
  38. int version;
  39. };
  40. #if IS_ENABLED(CONFIG_SND_SOC_WCD934X_DSD)
  41. int tavil_dsd_set_mixer_value(struct tavil_dsd_config *dsd_conf,
  42. int interp_num, int sw_value);
  43. int tavil_dsd_get_current_mixer_value(struct tavil_dsd_config *dsd_conf,
  44. int interp_num);
  45. int tavil_dsd_set_out_select(struct tavil_dsd_config *dsd_conf,
  46. int interp_num);
  47. void tavil_dsd_reset(struct tavil_dsd_config *dsd_conf);
  48. void tavil_dsd_set_interp_rate(struct tavil_dsd_config *dsd_conf, u16 rx_port,
  49. u32 sample_rate, u8 sample_rate_val);
  50. struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_codec *codec);
  51. void tavil_dsd_deinit(struct tavil_dsd_config *dsd_config);
  52. int tavil_dsd_post_ssr_init(struct tavil_dsd_config *dsd_config);
  53. #else
  54. int tavil_dsd_set_mixer_value(struct tavil_dsd_config *dsd_conf,
  55. int interp_num, int sw_value)
  56. {
  57. return 0;
  58. }
  59. int tavil_dsd_get_current_mixer_value(struct tavil_dsd_config *dsd_conf,
  60. int interp_num)
  61. {
  62. return 0;
  63. }
  64. int tavil_dsd_set_out_select(struct tavil_dsd_config *dsd_conf,
  65. int interp_num)
  66. {
  67. return 0;
  68. }
  69. void tavil_dsd_reset(struct tavil_dsd_config *dsd_conf)
  70. { }
  71. void tavil_dsd_set_interp_rate(struct tavil_dsd_config *dsd_conf, u16 rx_port,
  72. u32 sample_rate, u8 sample_rate_val)
  73. { }
  74. struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_codec *codec)
  75. {
  76. return NULL;
  77. }
  78. void tavil_dsd_deinit(struct tavil_dsd_config *dsd_config)
  79. { }
  80. int tavil_dsd_post_ssr_init(struct tavil_dsd_config *dsd_config)
  81. {
  82. return 0;
  83. }
  84. #endif
  85. #endif