| .. | .. |
|---|
| 52 | 52 | } |
|---|
| 53 | 53 | EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk); |
|---|
| 54 | 54 | |
|---|
| 55 | | -int snd_soc_component_enable_pin(struct snd_soc_component *component, |
|---|
| 56 | | - const char *pin) |
|---|
| 57 | | -{ |
|---|
| 58 | | - struct snd_soc_dapm_context *dapm = |
|---|
| 59 | | - snd_soc_component_get_dapm(component); |
|---|
| 60 | | - char *full_name; |
|---|
| 61 | | - int ret; |
|---|
| 62 | | - |
|---|
| 63 | | - if (!component->name_prefix) |
|---|
| 64 | | - return snd_soc_dapm_enable_pin(dapm, pin); |
|---|
| 65 | | - |
|---|
| 66 | | - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); |
|---|
| 67 | | - if (!full_name) |
|---|
| 68 | | - return -ENOMEM; |
|---|
| 69 | | - |
|---|
| 70 | | - ret = snd_soc_dapm_enable_pin(dapm, full_name); |
|---|
| 71 | | - kfree(full_name); |
|---|
| 72 | | - |
|---|
| 73 | | - return ret; |
|---|
| 74 | | -} |
|---|
| 75 | | -EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin); |
|---|
| 76 | | - |
|---|
| 77 | | -int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component, |
|---|
| 78 | | - const char *pin) |
|---|
| 79 | | -{ |
|---|
| 80 | | - struct snd_soc_dapm_context *dapm = |
|---|
| 81 | | - snd_soc_component_get_dapm(component); |
|---|
| 82 | | - char *full_name; |
|---|
| 83 | | - int ret; |
|---|
| 84 | | - |
|---|
| 85 | | - if (!component->name_prefix) |
|---|
| 86 | | - return snd_soc_dapm_enable_pin_unlocked(dapm, pin); |
|---|
| 87 | | - |
|---|
| 88 | | - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); |
|---|
| 89 | | - if (!full_name) |
|---|
| 90 | | - return -ENOMEM; |
|---|
| 91 | | - |
|---|
| 92 | | - ret = snd_soc_dapm_enable_pin_unlocked(dapm, full_name); |
|---|
| 93 | | - kfree(full_name); |
|---|
| 94 | | - |
|---|
| 95 | | - return ret; |
|---|
| 96 | | -} |
|---|
| 97 | | -EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin_unlocked); |
|---|
| 98 | | - |
|---|
| 99 | | -int snd_soc_component_disable_pin(struct snd_soc_component *component, |
|---|
| 100 | | - const char *pin) |
|---|
| 101 | | -{ |
|---|
| 102 | | - struct snd_soc_dapm_context *dapm = |
|---|
| 103 | | - snd_soc_component_get_dapm(component); |
|---|
| 104 | | - char *full_name; |
|---|
| 105 | | - int ret; |
|---|
| 106 | | - |
|---|
| 107 | | - if (!component->name_prefix) |
|---|
| 108 | | - return snd_soc_dapm_disable_pin(dapm, pin); |
|---|
| 109 | | - |
|---|
| 110 | | - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); |
|---|
| 111 | | - if (!full_name) |
|---|
| 112 | | - return -ENOMEM; |
|---|
| 113 | | - |
|---|
| 114 | | - ret = snd_soc_dapm_disable_pin(dapm, full_name); |
|---|
| 115 | | - kfree(full_name); |
|---|
| 116 | | - |
|---|
| 117 | | - return ret; |
|---|
| 118 | | -} |
|---|
| 119 | | -EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin); |
|---|
| 120 | | - |
|---|
| 121 | | -int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component, |
|---|
| 122 | | - const char *pin) |
|---|
| 123 | | -{ |
|---|
| 124 | | - struct snd_soc_dapm_context *dapm = |
|---|
| 125 | | - snd_soc_component_get_dapm(component); |
|---|
| 126 | | - char *full_name; |
|---|
| 127 | | - int ret; |
|---|
| 128 | | - |
|---|
| 129 | | - if (!component->name_prefix) |
|---|
| 130 | | - return snd_soc_dapm_disable_pin_unlocked(dapm, pin); |
|---|
| 131 | | - |
|---|
| 132 | | - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); |
|---|
| 133 | | - if (!full_name) |
|---|
| 134 | | - return -ENOMEM; |
|---|
| 135 | | - |
|---|
| 136 | | - ret = snd_soc_dapm_disable_pin_unlocked(dapm, full_name); |
|---|
| 137 | | - kfree(full_name); |
|---|
| 138 | | - |
|---|
| 139 | | - return ret; |
|---|
| 140 | | -} |
|---|
| 141 | | -EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin_unlocked); |
|---|
| 142 | | - |
|---|
| 143 | | -int snd_soc_component_nc_pin(struct snd_soc_component *component, |
|---|
| 144 | | - const char *pin) |
|---|
| 145 | | -{ |
|---|
| 146 | | - struct snd_soc_dapm_context *dapm = |
|---|
| 147 | | - snd_soc_component_get_dapm(component); |
|---|
| 148 | | - char *full_name; |
|---|
| 149 | | - int ret; |
|---|
| 150 | | - |
|---|
| 151 | | - if (!component->name_prefix) |
|---|
| 152 | | - return snd_soc_dapm_nc_pin(dapm, pin); |
|---|
| 153 | | - |
|---|
| 154 | | - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); |
|---|
| 155 | | - if (!full_name) |
|---|
| 156 | | - return -ENOMEM; |
|---|
| 157 | | - |
|---|
| 158 | | - ret = snd_soc_dapm_nc_pin(dapm, full_name); |
|---|
| 159 | | - kfree(full_name); |
|---|
| 160 | | - |
|---|
| 161 | | - return ret; |
|---|
| 162 | | -} |
|---|
| 163 | | -EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin); |
|---|
| 164 | | - |
|---|
| 165 | | -int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component, |
|---|
| 166 | | - const char *pin) |
|---|
| 167 | | -{ |
|---|
| 168 | | - struct snd_soc_dapm_context *dapm = |
|---|
| 169 | | - snd_soc_component_get_dapm(component); |
|---|
| 170 | | - char *full_name; |
|---|
| 171 | | - int ret; |
|---|
| 172 | | - |
|---|
| 173 | | - if (!component->name_prefix) |
|---|
| 174 | | - return snd_soc_dapm_nc_pin_unlocked(dapm, pin); |
|---|
| 175 | | - |
|---|
| 176 | | - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); |
|---|
| 177 | | - if (!full_name) |
|---|
| 178 | | - return -ENOMEM; |
|---|
| 179 | | - |
|---|
| 180 | | - ret = snd_soc_dapm_nc_pin_unlocked(dapm, full_name); |
|---|
| 181 | | - kfree(full_name); |
|---|
| 182 | | - |
|---|
| 183 | | - return ret; |
|---|
| 184 | | -} |
|---|
| 185 | | -EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin_unlocked); |
|---|
| 186 | | - |
|---|
| 187 | | -int snd_soc_component_get_pin_status(struct snd_soc_component *component, |
|---|
| 188 | | - const char *pin) |
|---|
| 189 | | -{ |
|---|
| 190 | | - struct snd_soc_dapm_context *dapm = |
|---|
| 191 | | - snd_soc_component_get_dapm(component); |
|---|
| 192 | | - char *full_name; |
|---|
| 193 | | - int ret; |
|---|
| 194 | | - |
|---|
| 195 | | - if (!component->name_prefix) |
|---|
| 196 | | - return snd_soc_dapm_get_pin_status(dapm, pin); |
|---|
| 197 | | - |
|---|
| 198 | | - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); |
|---|
| 199 | | - if (!full_name) |
|---|
| 200 | | - return -ENOMEM; |
|---|
| 201 | | - |
|---|
| 202 | | - ret = snd_soc_dapm_get_pin_status(dapm, full_name); |
|---|
| 203 | | - kfree(full_name); |
|---|
| 204 | | - |
|---|
| 205 | | - return ret; |
|---|
| 206 | | -} |
|---|
| 207 | | -EXPORT_SYMBOL_GPL(snd_soc_component_get_pin_status); |
|---|
| 208 | | - |
|---|
| 209 | | -int snd_soc_component_force_enable_pin(struct snd_soc_component *component, |
|---|
| 210 | | - const char *pin) |
|---|
| 211 | | -{ |
|---|
| 212 | | - struct snd_soc_dapm_context *dapm = |
|---|
| 213 | | - snd_soc_component_get_dapm(component); |
|---|
| 214 | | - char *full_name; |
|---|
| 215 | | - int ret; |
|---|
| 216 | | - |
|---|
| 217 | | - if (!component->name_prefix) |
|---|
| 218 | | - return snd_soc_dapm_force_enable_pin(dapm, pin); |
|---|
| 219 | | - |
|---|
| 220 | | - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); |
|---|
| 221 | | - if (!full_name) |
|---|
| 222 | | - return -ENOMEM; |
|---|
| 223 | | - |
|---|
| 224 | | - ret = snd_soc_dapm_force_enable_pin(dapm, full_name); |
|---|
| 225 | | - kfree(full_name); |
|---|
| 226 | | - |
|---|
| 227 | | - return ret; |
|---|
| 228 | | -} |
|---|
| 229 | | -EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin); |
|---|
| 230 | | - |
|---|
| 231 | | -int snd_soc_component_force_enable_pin_unlocked( |
|---|
| 232 | | - struct snd_soc_component *component, |
|---|
| 233 | | - const char *pin) |
|---|
| 234 | | -{ |
|---|
| 235 | | - struct snd_soc_dapm_context *dapm = |
|---|
| 236 | | - snd_soc_component_get_dapm(component); |
|---|
| 237 | | - char *full_name; |
|---|
| 238 | | - int ret; |
|---|
| 239 | | - |
|---|
| 240 | | - if (!component->name_prefix) |
|---|
| 241 | | - return snd_soc_dapm_force_enable_pin_unlocked(dapm, pin); |
|---|
| 242 | | - |
|---|
| 243 | | - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); |
|---|
| 244 | | - if (!full_name) |
|---|
| 245 | | - return -ENOMEM; |
|---|
| 246 | | - |
|---|
| 247 | | - ret = snd_soc_dapm_force_enable_pin_unlocked(dapm, full_name); |
|---|
| 248 | | - kfree(full_name); |
|---|
| 249 | | - |
|---|
| 250 | | - return ret; |
|---|
| 251 | | -} |
|---|
| 252 | | -EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin_unlocked); |
|---|
| 253 | | - |
|---|
| 254 | 55 | static const struct snd_pcm_hardware dummy_dma_hardware = { |
|---|
| 255 | 56 | /* Random values to keep userspace happy when checking constraints */ |
|---|
| 256 | 57 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
|---|
| .. | .. |
|---|
| 262 | 63 | .periods_max = 128, |
|---|
| 263 | 64 | }; |
|---|
| 264 | 65 | |
|---|
| 265 | | -static int dummy_dma_open(struct snd_pcm_substream *substream) |
|---|
| 66 | +static int dummy_dma_open(struct snd_soc_component *component, |
|---|
| 67 | + struct snd_pcm_substream *substream) |
|---|
| 266 | 68 | { |
|---|
| 267 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 69 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 268 | 70 | |
|---|
| 269 | 71 | /* BE's dont need dummy params */ |
|---|
| 270 | 72 | if (!rtd->dai_link->no_pcm) |
|---|
| .. | .. |
|---|
| 273 | 75 | return 0; |
|---|
| 274 | 76 | } |
|---|
| 275 | 77 | |
|---|
| 276 | | -static const struct snd_pcm_ops dummy_dma_ops = { |
|---|
| 277 | | - .open = dummy_dma_open, |
|---|
| 278 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 279 | | -}; |
|---|
| 280 | | - |
|---|
| 281 | 78 | static const struct snd_soc_component_driver dummy_platform = { |
|---|
| 282 | | - .ops = &dummy_dma_ops, |
|---|
| 79 | + .open = dummy_dma_open, |
|---|
| 283 | 80 | }; |
|---|
| 284 | 81 | |
|---|
| 285 | 82 | static const struct snd_soc_component_driver dummy_codec = { |
|---|
| .. | .. |
|---|
| 289 | 86 | .non_legacy_dai_naming = 1, |
|---|
| 290 | 87 | }; |
|---|
| 291 | 88 | |
|---|
| 292 | | -#define STUB_RATES SNDRV_PCM_RATE_8000_192000 |
|---|
| 89 | +#define STUB_RATES SNDRV_PCM_RATE_8000_384000 |
|---|
| 293 | 90 | #define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ |
|---|
| 294 | 91 | SNDRV_PCM_FMTBIT_U8 | \ |
|---|
| 295 | 92 | SNDRV_PCM_FMTBIT_S16_LE | \ |
|---|
| 296 | 93 | SNDRV_PCM_FMTBIT_U16_LE | \ |
|---|
| 297 | 94 | SNDRV_PCM_FMTBIT_S24_LE | \ |
|---|
| 95 | + SNDRV_PCM_FMTBIT_S24_3LE | \ |
|---|
| 298 | 96 | SNDRV_PCM_FMTBIT_U24_LE | \ |
|---|
| 299 | 97 | SNDRV_PCM_FMTBIT_S32_LE | \ |
|---|
| 300 | 98 | SNDRV_PCM_FMTBIT_U32_LE | \ |
|---|
| .. | .. |
|---|
| 373 | 171 | return ret; |
|---|
| 374 | 172 | } |
|---|
| 375 | 173 | |
|---|
| 376 | | -void __exit snd_soc_util_exit(void) |
|---|
| 174 | +void snd_soc_util_exit(void) |
|---|
| 377 | 175 | { |
|---|
| 378 | 176 | platform_driver_unregister(&soc_dummy_driver); |
|---|
| 379 | 177 | platform_device_unregister(soc_dummy_dev); |
|---|