Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved. |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 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 | |
| 13 | #ifndef _MSM_DS2_DAP_CONFIG_H_ |
| 14 | #define _MSM_DS2_DAP_CONFIG_H_ |
| 15 | |
| 16 | #include <sound/soc.h> |
| 17 | #include "msm-dolby-common.h" |
| 18 | #include <sound/hwdep.h> |
| 19 | #include <uapi/sound/devdep_params.h> |
| 20 | |
| 21 | #ifdef CONFIG_COMPAT |
| 22 | struct dolby_param_data32 { |
| 23 | s32 version; |
| 24 | s32 device_id; |
| 25 | s32 be_id; |
| 26 | s32 param_id; |
| 27 | s32 length; |
| 28 | compat_uptr_t data; |
| 29 | }; |
| 30 | |
| 31 | struct dolby_param_license32 { |
| 32 | compat_uptr_t dmid; |
| 33 | compat_uptr_t license_key; |
| 34 | }; |
| 35 | |
| 36 | |
| 37 | #define SNDRV_DEVDEP_DAP_IOCTL_SET_PARAM32\ |
| 38 | _IOWR('U', 0x10, struct dolby_param_data32) |
| 39 | #define SNDRV_DEVDEP_DAP_IOCTL_GET_PARAM32\ |
| 40 | _IOR('U', 0x11, struct dolby_param_data32) |
| 41 | #define SNDRV_DEVDEP_DAP_IOCTL_DAP_COMMAND32\ |
| 42 | _IOWR('U', 0x13, struct dolby_param_data32) |
| 43 | #define SNDRV_DEVDEP_DAP_IOCTL_DAP_LICENSE32\ |
| 44 | _IOWR('U', 0x14, struct dolby_param_license32) |
| 45 | #define SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER32\ |
| 46 | _IOR('U', 0x15, struct dolby_param_data32) |
| 47 | #endif |
| 48 | |
| 49 | #if defined(CONFIG_DOLBY_DS2) || defined(CONFIG_DOLBY_LICENSE) |
| 50 | /* DOLBY DOLBY GUIDS */ |
| 51 | #define DS2_MODULE_ID 0x00010775 |
| 52 | |
| 53 | #define DS2_DSP_SUPPORTED_ENDP_DEVICE 17 |
| 54 | #define DS2_DEVICES_ALL 32 /* enum val is 4 bytes */ |
| 55 | |
| 56 | enum { |
| 57 | |
| 58 | DAP_CMD_COMMIT_ALL = 0, |
| 59 | DAP_CMD_COMMIT_CHANGED = 1, |
| 60 | DAP_CMD_USE_CACHE_FOR_INIT = 2, |
| 61 | DAP_CMD_SET_BYPASS = 3, |
| 62 | DAP_CMD_SET_ACTIVE_DEVICE = 4, |
| 63 | DAP_CMD_SET_BYPASS_TYPE = 5, |
| 64 | }; |
| 65 | |
| 66 | #define DOLBY_PARAM_INT_ENDP_LENGTH 1 |
| 67 | #define DOLBY_PARAM_INT_ENDP_OFFSET (DOLBY_PARAM_PSTG_OFFSET + \ |
| 68 | DOLBY_PARAM_PSTG_LENGTH) |
| 69 | #define MAX_DS2_PARAMS 48 |
| 70 | #define MAX_DS2_CTRL_PARAMS 4 |
| 71 | #define ALL_DS2_PARAMS (MAX_DS2_PARAMS + \ |
| 72 | MAX_DS2_CTRL_PARAMS) |
| 73 | #define TOTAL_LENGTH_DS2_PARAM (TOTAL_LENGTH_DOLBY_PARAM + 1) |
| 74 | |
| 75 | int msm_ds2_dap_update_port_parameters(struct snd_hwdep *hw, struct file *file, |
| 76 | bool open); |
| 77 | int msm_ds2_dap_ioctl(struct snd_hwdep *hw, struct file *file, |
| 78 | u32 cmd, void *arg); |
| 79 | int msm_ds2_dap_compat_ioctl(struct snd_hwdep *hw, |
| 80 | struct file *file, |
| 81 | u32 cmd, void *arg); |
| 82 | int msm_ds2_dap_init(int port_id, int copp_idx, int channels, |
| 83 | bool is_custom_stereo_on); |
| 84 | void msm_ds2_dap_deinit(int port_id); |
| 85 | int msm_ds2_dap_set_custom_stereo_onoff(int port_id, int copp_idx, |
| 86 | bool is_custom_stereo_enabled); |
| 87 | /* Dolby DOLBY end */ |
| 88 | #else |
| 89 | |
| 90 | static inline int msm_ds2_dap_update_port_parameters(struct snd_hwdep *hw, |
| 91 | struct file *file, |
| 92 | bool open) |
| 93 | { |
| 94 | return 0; |
| 95 | } |
| 96 | |
| 97 | static inline int msm_ds2_dap_ioctl(struct snd_hwdep *hw, struct file *file, |
| 98 | u32 cmd, void *arg) |
| 99 | { |
| 100 | return 0; |
| 101 | } |
| 102 | |
| 103 | static inline int msm_ds2_dap_compat_ioctl(struct snd_hwdep *hw, |
| 104 | struct file *file, |
| 105 | u32 cmd, void *arg) |
| 106 | { |
| 107 | return 0; |
| 108 | } |
| 109 | static inline int msm_ds2_dap_init(int port_id, int copp_idx, int channels, |
| 110 | bool is_custom_stereo_on) |
| 111 | { |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | static inline void msm_ds2_dap_deinit(int port_id) { } |
| 116 | |
| 117 | static inline int msm_ds2_dap_set_custom_stereo_onoff(int port_id, int copp_idx, |
| 118 | bool is_custom_stereo_enabled) |
| 119 | { |
| 120 | return 0; |
| 121 | } |
| 122 | #endif |
| 123 | #endif |