msm-ds2-dap-config.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _MSM_DS2_DAP_CONFIG_H_
  14. #define _MSM_DS2_DAP_CONFIG_H_
  15. #include <sound/soc.h>
  16. #include "msm-dolby-common.h"
  17. #include <sound/hwdep.h>
  18. #include <uapi/sound/devdep_params.h>
  19. #ifdef CONFIG_COMPAT
  20. struct dolby_param_data32 {
  21. s32 version;
  22. s32 device_id;
  23. s32 be_id;
  24. s32 param_id;
  25. s32 length;
  26. compat_uptr_t data;
  27. };
  28. struct dolby_param_license32 {
  29. compat_uptr_t dmid;
  30. compat_uptr_t license_key;
  31. };
  32. #define SNDRV_DEVDEP_DAP_IOCTL_SET_PARAM32\
  33. _IOWR('U', 0x10, struct dolby_param_data32)
  34. #define SNDRV_DEVDEP_DAP_IOCTL_GET_PARAM32\
  35. _IOR('U', 0x11, struct dolby_param_data32)
  36. #define SNDRV_DEVDEP_DAP_IOCTL_DAP_COMMAND32\
  37. _IOWR('U', 0x13, struct dolby_param_data32)
  38. #define SNDRV_DEVDEP_DAP_IOCTL_DAP_LICENSE32\
  39. _IOWR('U', 0x14, struct dolby_param_license32)
  40. #define SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER32\
  41. _IOR('U', 0x15, struct dolby_param_data32)
  42. #endif
  43. #if defined(CONFIG_DOLBY_DS2) || defined(CONFIG_DOLBY_LICENSE)
  44. /* DOLBY DOLBY GUIDS */
  45. #define DS2_MODULE_ID 0x00010775
  46. #define DS2_DSP_SUPPORTED_ENDP_DEVICE 17
  47. #define DS2_DEVICES_ALL 32 /* enum val is 4 bytes */
  48. enum {
  49. DAP_CMD_COMMIT_ALL = 0,
  50. DAP_CMD_COMMIT_CHANGED = 1,
  51. DAP_CMD_USE_CACHE_FOR_INIT = 2,
  52. DAP_CMD_SET_BYPASS = 3,
  53. DAP_CMD_SET_ACTIVE_DEVICE = 4,
  54. DAP_CMD_SET_BYPASS_TYPE = 5,
  55. };
  56. #define DOLBY_PARAM_INT_ENDP_LENGTH 1
  57. #define DOLBY_PARAM_INT_ENDP_OFFSET (DOLBY_PARAM_PSTG_OFFSET + \
  58. DOLBY_PARAM_PSTG_LENGTH)
  59. #define MAX_DS2_PARAMS 48
  60. #define MAX_DS2_CTRL_PARAMS 4
  61. #define ALL_DS2_PARAMS (MAX_DS2_PARAMS + \
  62. MAX_DS2_CTRL_PARAMS)
  63. #define TOTAL_LENGTH_DS2_PARAM (TOTAL_LENGTH_DOLBY_PARAM + 1)
  64. int msm_ds2_dap_update_port_parameters(struct snd_hwdep *hw, struct file *file,
  65. bool open);
  66. int msm_ds2_dap_ioctl(struct snd_hwdep *hw, struct file *file,
  67. u32 cmd, void *arg);
  68. int msm_ds2_dap_compat_ioctl(struct snd_hwdep *hw,
  69. struct file *file,
  70. u32 cmd, void *arg);
  71. int msm_ds2_dap_init(int port_id, int copp_idx, int channels,
  72. bool is_custom_stereo_on);
  73. void msm_ds2_dap_deinit(int port_id);
  74. int msm_ds2_dap_set_custom_stereo_onoff(int port_id, int copp_idx,
  75. bool is_custom_stereo_enabled);
  76. /* Dolby DOLBY end */
  77. #else
  78. static inline int msm_ds2_dap_update_port_parameters(struct snd_hwdep *hw,
  79. struct file *file,
  80. bool open)
  81. {
  82. return 0;
  83. }
  84. static inline int msm_ds2_dap_ioctl(struct snd_hwdep *hw, struct file *file,
  85. u32 cmd, void *arg)
  86. {
  87. return 0;
  88. }
  89. static inline int msm_ds2_dap_compat_ioctl(struct snd_hwdep *hw,
  90. struct file *file,
  91. u32 cmd, void *arg)
  92. {
  93. return 0;
  94. }
  95. static inline int msm_ds2_dap_init(int port_id, int copp_idx, int channels,
  96. bool is_custom_stereo_on)
  97. {
  98. return 0;
  99. }
  100. static inline void msm_ds2_dap_deinit(int port_id) { }
  101. static inline int msm_ds2_dap_set_custom_stereo_onoff(int port_id, int copp_idx,
  102. bool is_custom_stereo_enabled)
  103. {
  104. return 0;
  105. }
  106. #endif
  107. #endif