├── Makefile ├── NOTICE ├── asoc ├── Makefile ├── codecs │ ├── Makefile │ ├── audio-ext-clk-up.c │ ├── audio-ext-clk-up.h │ ├── audio-ext-clk.c │ ├── core.h │ ├── cpe_cmi.h │ ├── cpe_core.h │ ├── cpe_err.h │ ├── max │ │ ├── max98927.c │ │ └── max98927.h │ ├── msm-cdc-pinctrl.c │ ├── msm-cdc-pinctrl.h │ ├── msm-cdc-supply.c │ ├── msm-cdc-supply.h │ ├── msm_hdmi_codec_rx.c │ ├── msm_sdw │ │ ├── Makefile │ │ ├── msm-sdw-tables.c │ │ ├── msm_sdw.h │ │ ├── msm_sdw_cdc.c │ │ ├── msm_sdw_cdc_utils.c │ │ ├── msm_sdw_registers.h │ │ └── msm_sdw_regmap.c │ ├── msm_stub.c │ ├── pdata.h │ ├── sdm660_cdc │ │ ├── Makefile │ │ ├── msm-analog-cdc-regmap.h │ │ ├── msm-analog-cdc.c │ │ ├── msm-analog-cdc.h │ │ ├── msm-cdc-common.h │ │ ├── msm-digital-cdc-regmap.c │ │ ├── msm-digital-cdc.c │ │ ├── msm-digital-cdc.h │ │ ├── sdm660-cdc-irq.c │ │ ├── sdm660-cdc-irq.h │ │ └── sdm660-cdc-registers.h │ ├── tfa9890 │ │ ├── config.h │ │ ├── tfa.h │ │ ├── tfa1_tfafieldnames.h │ │ ├── tfa2_tfafieldnames_N1C.h │ │ ├── tfa9887B_init.c │ │ ├── tfa9887_init.c │ │ ├── tfa9887_tfafieldnames.h │ │ ├── tfa9888_init.c │ │ ├── tfa9890_init.c │ │ ├── tfa9890_tfafieldnames.h │ │ ├── tfa9891_genregs.h │ │ ├── tfa9891_init.c │ │ ├── tfa9891_tfafieldnames.h │ │ ├── tfa9897_init.c │ │ ├── tfa98xx.c │ │ ├── tfa98xx_genregs_N1C.h │ │ ├── tfa98xx_parameters.h │ │ ├── tfa98xx_temp.c │ │ ├── tfa98xx_tfafieldnames.h │ │ ├── tfa_container.c │ │ ├── tfa_container.h │ │ ├── tfa_container_crc32.c │ │ ├── tfa_debug.c │ │ ├── tfa_dsp.c │ │ ├── tfa_dsp_fw.h │ │ ├── tfa_hal.c │ │ ├── tfa_internal.h │ │ ├── tfa_osal.c │ │ └── tfa_service.h │ ├── wcd-dsp-mgr.c │ ├── wcd-dsp-utils.c │ ├── wcd-dsp-utils.h │ ├── wcd-mbhc-adc.c │ ├── wcd-mbhc-adc.h │ ├── wcd-mbhc-legacy.c │ ├── wcd-mbhc-legacy.h │ ├── wcd-mbhc-v2-api.h │ ├── wcd-mbhc-v2.c │ ├── wcd-mbhc-v2.h │ ├── wcd-spi-registers.h │ ├── wcd-spi.c │ ├── wcd9335-regmap.c │ ├── wcd9335-tables.c │ ├── wcd9335.c │ ├── wcd9335.h │ ├── wcd9335_irq.h │ ├── wcd9335_registers.h │ ├── wcd934x │ │ ├── Makefile │ │ ├── wcd934x-dsd.c │ │ ├── wcd934x-dsd.h │ │ ├── wcd934x-dsp-cntl.c │ │ ├── wcd934x-dsp-cntl.h │ │ ├── wcd934x-mbhc.c │ │ ├── wcd934x-mbhc.h │ │ ├── wcd934x-regmap.c │ │ ├── wcd934x-routing.h │ │ ├── wcd934x-tables.c │ │ ├── wcd934x.c │ │ ├── wcd934x.h │ │ └── wcd934x_irq.h │ ├── wcd9xxx-common-v2.c │ ├── wcd9xxx-common-v2.h │ ├── wcd9xxx-core-init.c │ ├── wcd9xxx-core.c │ ├── wcd9xxx-irq.c │ ├── wcd9xxx-irq.h │ ├── wcd9xxx-regmap.h │ ├── wcd9xxx-resmgr-v2.c │ ├── wcd9xxx-resmgr-v2.h │ ├── wcd9xxx-rst.c │ ├── wcd9xxx-slimslave.c │ ├── wcd9xxx-slimslave.h │ ├── wcd9xxx-soc-init.c │ ├── wcd9xxx-utils.c │ ├── wcd9xxx-utils.h │ ├── wcd_cmi_api.h │ ├── wcd_cpe_core.c │ ├── wcd_cpe_core.h │ ├── wcd_cpe_services.c │ ├── wcd_cpe_services.h │ ├── wcdcal-hwdep.c │ ├── wcdcal-hwdep.h │ ├── wsa881x-registers.h │ ├── wsa881x-regmap.c │ ├── wsa881x-tables.c │ ├── wsa881x-temp-sensor.c │ ├── wsa881x-temp-sensor.h │ ├── wsa881x.c │ └── wsa881x.h ├── device_event.h ├── msm-audio-effects-q6-v2.c ├── msm-compress-q6-v2.c ├── msm-cpe-lsm.c ├── msm-dai-fe.c ├── msm-dai-q6-hdmi-v2.c ├── msm-dai-q6-v2.c ├── msm-dai-q6-v2.h ├── msm-dai-slim.c ├── msm-dai-stub-v2.c ├── msm-dolby-common.h ├── msm-dolby-dap-config.h ├── msm-ds2-dap-config.c ├── msm-ds2-dap-config.h ├── msm-dts-srs-tm-config.c ├── msm-lsm-client.c ├── msm-pcm-afe-v2.c ├── msm-pcm-afe-v2.h ├── msm-pcm-dtmf-v2.c ├── msm-pcm-host-voice-v2.c ├── msm-pcm-hostless.c ├── msm-pcm-loopback-v2.c ├── msm-pcm-q6-noirq.c ├── msm-pcm-q6-v2.c ├── msm-pcm-q6-v2.h ├── msm-pcm-routing-devdep.c ├── msm-pcm-routing-devdep.h ├── msm-pcm-routing-v2.c ├── msm-pcm-routing-v2.h ├── msm-pcm-voice-v2.c ├── msm-pcm-voice-v2.h ├── msm-pcm-voip-v2.c ├── msm-qti-pp-config.c ├── msm-qti-pp-config.h ├── msm-slim-dma.h ├── msm-transcode-loopback-q6-v2.c ├── msm8998.c ├── sdm660-common.c ├── sdm660-common.h ├── sdm660-ext-dai-links.c ├── sdm660-external.c ├── sdm660-external.h ├── sdm660-internal.c ├── sdm660-internal.h ├── sdm845.c └── sdxpoorwills.c ├── config ├── sdm670auto.conf ├── sdm670autoconf.h ├── sdm845auto.conf ├── sdm845autoconf.h ├── sdxpoorwillsauto.conf └── sdxpoorwillsautoconf.h ├── dsp ├── Makefile ├── adsp-loader.c ├── adsp_err.c ├── adsp_err.h ├── audio_cal_utils.c ├── audio_calibration.c ├── audio_notifier.c ├── audio_pdr.c ├── audio_pdr.h ├── audio_slimslave.c ├── audio_ssr.c ├── audio_ssr.h ├── avtimer.c ├── codecs │ ├── Makefile │ ├── aac_in.c │ ├── amrnb_in.c │ ├── amrwb_in.c │ ├── audio_aac.c │ ├── audio_alac.c │ ├── audio_amrnb.c │ ├── audio_amrwb.c │ ├── audio_amrwbplus.c │ ├── audio_ape.c │ ├── audio_evrc.c │ ├── audio_g711alaw.c │ ├── audio_g711mlaw.c │ ├── audio_hwacc_effects.c │ ├── audio_mp3.c │ ├── audio_multi_aac.c │ ├── audio_qcelp.c │ ├── audio_utils.c │ ├── audio_utils.h │ ├── audio_utils_aio.c │ ├── audio_utils_aio.h │ ├── audio_wma.c │ ├── audio_wmapro.c │ ├── evrc_in.c │ ├── g711alaw_in.c │ ├── g711mlaw_in.c │ ├── q6audio_common.h │ ├── q6audio_v2.c │ ├── q6audio_v2_aio.c │ └── qcelp_in.c ├── msm_audio_ion.c ├── q6adm.c ├── q6afe.c ├── q6asm.c ├── q6audio-v2.c ├── q6core.c ├── q6lsm.c ├── q6usm.c ├── q6usm.h ├── q6voice.c ├── rtac.c ├── usf.c ├── usf.h ├── usfcdev.c └── usfcdev.h ├── include ├── Kbuild ├── asoc │ ├── msm-dts-srs-tm-config.h │ └── wcd934x_registers.h ├── dsp │ ├── apr_audio-v2.h │ ├── audio_cal_utils.h │ ├── audio_calibration.h │ ├── audio_notifier.h │ ├── msm-audio-effects-q6-v2.h │ ├── msm_audio_ion.h │ ├── q6adm-v2.h │ ├── q6afe-v2.h │ ├── q6asm-v2.h │ ├── q6audio-v2.h │ ├── q6core.h │ ├── q6lsm.h │ ├── q6voice.h │ └── rtac.h ├── ipc │ ├── apr.h │ ├── apr_tal.h │ └── apr_us.h ├── soc │ ├── internal.h │ ├── soundwire.h │ └── swr-wcd.h └── uapi │ ├── Kbuild │ ├── linux │ ├── Kbuild │ ├── avtimer.h │ ├── msm_audio.h │ ├── msm_audio_aac.h │ ├── msm_audio_ac3.h │ ├── msm_audio_alac.h │ ├── msm_audio_amrnb.h │ ├── msm_audio_amrwb.h │ ├── msm_audio_amrwbplus.h │ ├── msm_audio_ape.h │ ├── msm_audio_calibration.h │ ├── msm_audio_g711.h │ ├── msm_audio_g711_dec.h │ ├── msm_audio_mvs.h │ ├── msm_audio_qcp.h │ ├── msm_audio_sbc.h │ ├── msm_audio_voicememo.h │ ├── msm_audio_wma.h │ └── msm_audio_wmapro.h │ └── sound │ ├── Kbuild │ ├── audio_effects.h │ ├── audio_slimslave.h │ ├── devdep_params.h │ ├── lsm_params.h │ ├── msmcal-hwdep.h │ ├── voice_params.h │ └── wcd-dsp-glink.h ├── ipc ├── Makefile ├── apr.c ├── apr_tal_glink.c ├── apr_v2.c ├── apr_v3.c └── wcd-dsp-glink.c └── soc ├── Makefile ├── core.h ├── pinctrl-lpi.c ├── pinctrl-utils.h ├── pinctrl-wcd.c ├── regmap-swr.c ├── soundwire.c ├── swr-wcd-ctrl.c ├── swr-wcd-ctrl.h └── swrm_registers.h /Makefile: -------------------------------------------------------------------------------- 1 | # auto-detect subdirs 2 | ifeq ($(CONFIG_ARCH_SDM845), y) 3 | include $(srctree)/techpack/audio/config/sdm845auto.conf 4 | export 5 | endif 6 | ifeq ($(CONFIG_ARCH_SDM670), y) 7 | include $(srctree)/techpack/audio/config/sdm670auto.conf 8 | export 9 | endif 10 | ifeq ($(CONFIG_ARCH_SDXPOORWILLS), y) 11 | include $(srctree)/techpack/audio/config/sdxpoorwillsauto.conf 12 | export 13 | endif 14 | 15 | # Use USERINCLUDE when you must reference the UAPI directories only. 16 | USERINCLUDE += \ 17 | -I$(srctree)/techpack/audio/include/uapi \ 18 | 19 | # Use LINUXINCLUDE when you must reference the include/ directory. 20 | # Needed to be compatible with the O= option 21 | LINUXINCLUDE += \ 22 | -I$(srctree)/techpack/audio/include/uapi \ 23 | -I$(srctree)/techpack/audio/include 24 | 25 | ifeq ($(CONFIG_ARCH_SDM845), y) 26 | LINUXINCLUDE += \ 27 | -include $(srctree)/techpack/audio/config/sdm845autoconf.h 28 | endif 29 | ifeq ($(CONFIG_ARCH_SDM670), y) 30 | LINUXINCLUDE += \ 31 | -include $(srctree)/techpack/audio/config/sdm670autoconf.h 32 | endif 33 | ifeq ($(CONFIG_ARCH_SDXPOORWILLS), y) 34 | LINUXINCLUDE += \ 35 | -include $(srctree)/techpack/audio/config/sdxpoorwillsautoconf.h 36 | endif 37 | 38 | obj-y += asoc/ 39 | obj-y += dsp/ 40 | obj-y += ipc/ 41 | obj-y += soc/ 42 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-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 | 13 | Copyright (C) 2008 Google, Inc. 14 | Copyright (C) 2008 HTC Corporation 15 | Copyright (c) 2010-2017, The Linux Foundation. All rights reserved. 16 | 17 | This software is licensed under the terms of the GNU General Public 18 | License version 2, as published by the Free Software Foundation, and 19 | may be copied, distributed, and modified under those terms. 20 | 21 | This program is distributed in the hope that it will be useful, 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | GNU General Public License for more details. 25 | -------------------------------------------------------------------------------- /asoc/Makefile: -------------------------------------------------------------------------------- 1 | # MSM Machine Support 2 | 3 | snd-soc-hostless-pcm-objs := msm-pcm-hostless.o 4 | obj-$(CONFIG_SND_SOC_MSM_HOSTLESS_PCM) += snd-soc-hostless-pcm.o 5 | 6 | 7 | snd-soc-qdsp6v2-objs := msm-dai-fe.o 8 | obj-$(CONFIG_SND_SOC_QDSP6V2) += snd-soc-qdsp6v2.o 9 | 10 | #for CPE drivers 11 | snd-soc-cpe-objs := msm-cpe-lsm.o 12 | obj-$(CONFIG_SND_SOC_CPE) += snd-soc-cpe.o 13 | 14 | # for MSM8998 sound card driver 15 | snd-soc-msm8998-objs := msm8998.o 16 | obj-$(CONFIG_SND_SOC_MACHINE_MSM8998) += snd-soc-msm8998.o 17 | 18 | # for SDM670 sound card driver 19 | snd-soc-sdm670-objs := sdm660-common.o sdm660-internal.o sdm660-external.o sdm660-ext-dai-links.o 20 | obj-$(CONFIG_SND_SOC_SDM670) += snd-soc-sdm670.o 21 | 22 | # for SDM845 sound card driver 23 | snd-soc-sdm845-objs := sdm845.o 24 | obj-$(CONFIG_SND_SOC_MACHINE_SDM845) += snd-soc-sdm845.o 25 | 26 | # for SDXPOORWILLS sound card driver 27 | snd-soc-sdxpoorwills-objs := sdxpoorwills.o 28 | obj-$(CONFIG_SND_SOC_MACHINE_SDXPOORWILLS) += snd-soc-sdxpoorwills.o 29 | 30 | snd-soc-qdsp6v2-objs += msm-dai-q6-v2.o msm-pcm-q6-v2.o \ 31 | msm-pcm-routing-v2.o msm-compress-q6-v2.o \ 32 | msm-pcm-afe-v2.o msm-pcm-voip-v2.o \ 33 | msm-pcm-voice-v2.o msm-dai-q6-hdmi-v2.o \ 34 | msm-lsm-client.o msm-pcm-host-voice-v2.o \ 35 | msm-audio-effects-q6-v2.o msm-pcm-loopback-v2.o \ 36 | msm-dai-slim.o msm-transcode-loopback-q6-v2.o msm-pcm-q6-noirq.o 37 | obj-$(CONFIG_SND_SOC_QDSP6V2) += snd-soc-qdsp6v2.o msm-pcm-dtmf-v2.o \ 38 | msm-dai-stub-v2.o 39 | obj-$(CONFIG_SND_HWDEP) += msm-pcm-routing-devdep.o 40 | obj-$(CONFIG_DOLBY_DAP) += msm-dolby-dap-config.o 41 | obj-$(CONFIG_DOLBY_DS2) += msm-ds2-dap-config.o 42 | obj-$(CONFIG_DOLBY_LICENSE) += msm-ds2-dap-config.o 43 | obj-$(CONFIG_DTS_SRS_TM) += msm-dts-srs-tm-config.o 44 | obj-$(CONFIG_QTI_PP) += msm-qti-pp-config.o 45 | obj-y += codecs/ 46 | -------------------------------------------------------------------------------- /asoc/codecs/Makefile: -------------------------------------------------------------------------------- 1 | snd-soc-wcd9xxx-objs := wcd9xxx-common-v2.o wcd9xxx-resmgr-v2.o \ 2 | wcdcal-hwdep.o wcd9xxx-soc-init.o wcd-dsp-utils.o \ 3 | wcd-dsp-mgr.o audio-ext-clk-up.o 4 | snd-soc-wcd-cpe-objs := wcd_cpe_services.o wcd_cpe_core.o 5 | snd-soc-wsa881x-objs := wsa881x.o wsa881x-tables.o wsa881x-regmap.o wsa881x-temp-sensor.o 6 | snd-soc-wcd-mbhc-objs := wcd-mbhc-v2.o 7 | ifneq (,$(filter $(CONFIG_SND_SOC_WCD_MBHC_LEGACY),y m)) 8 | snd-soc-wcd-mbhc-objs += wcd-mbhc-legacy.o 9 | endif 10 | ifneq (,$(filter $(CONFIG_SND_SOC_WCD_MBHC_ADC),y m)) 11 | snd-soc-wcd-mbhc-objs += wcd-mbhc-adc.o 12 | endif 13 | snd-soc-wcd-spi-objs := wcd-spi.o 14 | snd-soc-wcd9335-objs := wcd9335.o 15 | snd-soc-wcd-cpe-objs := wcd_cpe_services.o wcd_cpe_core.o 16 | 17 | obj-$(CONFIG_SND_SOC_WCD9335) += snd-soc-wcd9335.o 18 | obj-$(CONFIG_SND_SOC_WCD_CPE) += snd-soc-wcd-cpe.o 19 | obj-$(CONFIG_SND_SOC_WCD934X) += wcd934x/ 20 | obj-$(CONFIG_SND_SOC_SDM660_CDC) += sdm660_cdc/ 21 | obj-$(CONFIG_SND_SOC_MSM_SDW) += msm_sdw/ 22 | 23 | obj-$(CONFIG_SND_SOC_WCD9XXX_V2) += snd-soc-wcd9xxx.o 24 | obj-$(CONFIG_SND_SOC_WCD_MBHC) += snd-soc-wcd-mbhc.o 25 | obj-$(CONFIG_SND_SOC_WSA881X) += snd-soc-wsa881x.o 26 | obj-$(CONFIG_SND_SOC_WCD_SPI) += snd-soc-wcd-spi.o 27 | 28 | snd-soc-msm-stub-objs := msm_stub.o 29 | obj-$(CONFIG_SND_SOC_MSM_STUB) += snd-soc-msm-stub.o 30 | 31 | wcd-core-objs := wcd9xxx-rst.o wcd9xxx-core-init.o \ 32 | wcd9xxx-core.o wcd9xxx-irq.o \ 33 | wcd9xxx-slimslave.o wcd9xxx-utils.o \ 34 | wcd9335-regmap.o wcd9335-tables.o \ 35 | msm-cdc-pinctrl.o msm-cdc-supply.o 36 | wcd-core-objs += wcd934x/wcd934x-regmap.o 37 | wcd-core-objs += wcd934x/wcd934x-tables.o 38 | 39 | obj-$(CONFIG_WCD9XXX_CODEC_CORE) += wcd-core.o 40 | obj-$(CONFIG_SND_SOC_MSM_HDMI_CODEC_RX) += msm_hdmi_codec_rx.o 41 | 42 | #wangdongdong@MultiMediaService,2017/09/11,add for tfa9890 43 | #obj-y += snd-soc-tfa98xx.o 44 | 45 | #snd-soc-tfa98xx-objs += tfa9890/tfa98xx.o 46 | #snd-soc-tfa98xx-objs += tfa9890/tfa_container.o 47 | #snd-soc-tfa98xx-objs += tfa9890/tfa_dsp.o 48 | #snd-soc-tfa98xx-objs += tfa9890/tfa9888_init.o 49 | #snd-soc-tfa98xx-objs += tfa9890/tfa9891_init.o 50 | #snd-soc-tfa98xx-objs += tfa9890/tfa9897_init.o 51 | #snd-soc-tfa98xx-objs += tfa9890/tfa9890_init.o 52 | #snd-soc-tfa98xx-objs += tfa9890/tfa9887B_init.o 53 | #snd-soc-tfa98xx-objs += tfa9890/tfa9887_init.o 54 | 55 | obj-y += max/max98927.o 56 | -------------------------------------------------------------------------------- /asoc/codecs/audio-ext-clk-up.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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 | 14 | #ifndef __AUDIO_EXT_CLK_UP_H_ 15 | #define __AUDIO_EXT_CLK_UP_H_ 16 | 17 | int audio_ref_clk_platform_init(void); 18 | void audio_ref_clk_platform_exit(void); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /asoc/codecs/msm-cdc-pinctrl.h: -------------------------------------------------------------------------------- 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 | 13 | #ifndef __MFD_CDC_PINCTRL_H_ 14 | #define __MFD_CDC_PINCTRL_H_ 15 | 16 | #include 17 | #include 18 | 19 | #if IS_ENABLED(CONFIG_MSM_CDC_PINCTRL) 20 | extern int msm_cdc_pinctrl_select_sleep_state(struct device_node *np); 21 | extern int msm_cdc_pinctrl_select_active_state(struct device_node *np); 22 | extern bool msm_cdc_pinctrl_get_state(struct device_node *np); 23 | extern int msm_cdc_get_gpio_state(struct device_node *np); 24 | int msm_cdc_pinctrl_drv_init(void); 25 | void msm_cdc_pinctrl_drv_exit(void); 26 | 27 | #else 28 | int msm_cdc_pinctrl_select_sleep_state(struct device_node *np) 29 | { 30 | return 0; 31 | } 32 | int msm_cdc_pinctrl_select_active_state(struct device_node *np) 33 | { 34 | return 0; 35 | } 36 | int msm_cdc_get_gpio_state(struct device_node *np) 37 | { 38 | return 0; 39 | } 40 | int msm_cdc_pinctrl_drv_init(void) 41 | { 42 | return 0; 43 | } 44 | void msm_cdc_pinctrl_drv_exit(void) 45 | { 46 | } 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /asoc/codecs/msm-cdc-supply.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016, 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 | 13 | #ifndef __CODEC_POWER_SUPPLY_H__ 14 | #define __CODEC_POWER_SUPPLY_H__ 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | struct cdc_regulator { 21 | const char *name; 22 | int min_uV; 23 | int max_uV; 24 | int optimum_uA; 25 | bool ondemand; 26 | struct regulator *regulator; 27 | }; 28 | 29 | extern int msm_cdc_get_power_supplies(struct device *dev, 30 | struct cdc_regulator **cdc_vreg, 31 | int *total_num_supplies); 32 | extern int msm_cdc_disable_static_supplies(struct device *dev, 33 | struct regulator_bulk_data *supplies, 34 | struct cdc_regulator *cdc_vreg, 35 | int num_supplies); 36 | extern int msm_cdc_release_supplies(struct device *dev, 37 | struct regulator_bulk_data *supplies, 38 | struct cdc_regulator *cdc_vreg, 39 | int num_supplies); 40 | extern int msm_cdc_enable_static_supplies(struct device *dev, 41 | struct regulator_bulk_data *supplies, 42 | struct cdc_regulator *cdc_vreg, 43 | int num_supplies); 44 | extern int msm_cdc_init_supplies(struct device *dev, 45 | struct regulator_bulk_data **supplies, 46 | struct cdc_regulator *cdc_vreg, 47 | int num_supplies); 48 | #endif 49 | -------------------------------------------------------------------------------- /asoc/codecs/msm_sdw/Makefile: -------------------------------------------------------------------------------- 1 | snd-soc-msm-sdw-objs := msm_sdw_cdc.o msm_sdw_regmap.o msm-sdw-tables.o msm_sdw_cdc_utils.o 2 | obj-$(CONFIG_SND_SOC_MSM_SDW) += snd-soc-msm-sdw.o 3 | -------------------------------------------------------------------------------- /asoc/codecs/msm_stub.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2014, 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 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | /* A dummy driver useful only to advertise hardware parameters */ 21 | static struct snd_soc_dai_driver msm_stub_dais[] = { 22 | { 23 | .name = "msm-stub-rx", 24 | .playback = { /* Support maximum range */ 25 | .stream_name = "Playback", 26 | .channels_min = 1, 27 | .channels_max = 8, 28 | .rates = SNDRV_PCM_RATE_8000_48000, 29 | .formats = SNDRV_PCM_FMTBIT_S16_LE, 30 | }, 31 | }, 32 | { 33 | .name = "msm-stub-tx", 34 | .capture = { /* Support maximum range */ 35 | .stream_name = "Record", 36 | .channels_min = 1, 37 | .channels_max = 8, 38 | .rates = SNDRV_PCM_RATE_8000_48000, 39 | .formats = (SNDRV_PCM_FMTBIT_S16_LE | 40 | SNDRV_PCM_FMTBIT_S24_LE), 41 | }, 42 | }, 43 | }; 44 | 45 | static struct snd_soc_codec_driver soc_msm_stub = {}; 46 | 47 | static int msm_stub_dev_probe(struct platform_device *pdev) 48 | { 49 | dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev)); 50 | 51 | return snd_soc_register_codec(&pdev->dev, 52 | &soc_msm_stub, msm_stub_dais, ARRAY_SIZE(msm_stub_dais)); 53 | } 54 | 55 | static int msm_stub_dev_remove(struct platform_device *pdev) 56 | { 57 | snd_soc_unregister_codec(&pdev->dev); 58 | return 0; 59 | } 60 | static const struct of_device_id msm_stub_codec_dt_match[] = { 61 | { .compatible = "qcom,msm-stub-codec", }, 62 | {} 63 | }; 64 | 65 | static struct platform_driver msm_stub_driver = { 66 | .driver = { 67 | .name = "msm-stub-codec", 68 | .owner = THIS_MODULE, 69 | .of_match_table = msm_stub_codec_dt_match, 70 | }, 71 | .probe = msm_stub_dev_probe, 72 | .remove = msm_stub_dev_remove, 73 | }; 74 | 75 | static int __init msm_stub_init(void) 76 | { 77 | return platform_driver_register(&msm_stub_driver); 78 | } 79 | module_init(msm_stub_init); 80 | 81 | static void __exit msm_stub_exit(void) 82 | { 83 | platform_driver_unregister(&msm_stub_driver); 84 | } 85 | module_exit(msm_stub_exit); 86 | 87 | MODULE_DESCRIPTION("Generic MSM CODEC driver"); 88 | MODULE_LICENSE("GPL v2"); 89 | -------------------------------------------------------------------------------- /asoc/codecs/sdm660_cdc/Makefile: -------------------------------------------------------------------------------- 1 | snd-soc-analog-cdc-objs := sdm660-cdc-irq.o msm-analog-cdc.o 2 | snd-soc-digital-cdc-objs := msm-digital-cdc.o msm-digital-cdc-regmap.o 3 | obj-$(CONFIG_SND_SOC_ANALOG_CDC) += snd-soc-analog-cdc.o 4 | obj-$(CONFIG_SND_SOC_DIGITAL_CDC) += snd-soc-digital-cdc.o 5 | -------------------------------------------------------------------------------- /asoc/codecs/sdm660_cdc/msm-cdc-common.h: -------------------------------------------------------------------------------- 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 | 13 | #include 14 | #include "sdm660-cdc-registers.h" 15 | 16 | extern struct reg_default 17 | msm89xx_cdc_core_defaults[MSM89XX_CDC_CORE_CACHE_SIZE]; 18 | extern struct reg_default 19 | msm89xx_pmic_cdc_defaults[MSM89XX_PMIC_CDC_CACHE_SIZE]; 20 | 21 | bool msm89xx_cdc_core_readable_reg(struct device *dev, unsigned int reg); 22 | bool msm89xx_cdc_core_writeable_reg(struct device *dev, unsigned int reg); 23 | bool msm89xx_cdc_core_volatile_reg(struct device *dev, unsigned int reg); 24 | 25 | enum { 26 | AIF1_PB = 0, 27 | AIF1_CAP, 28 | AIF2_VIFEED, 29 | AIF3_SVA, 30 | NUM_CODEC_DAIS, 31 | }; 32 | 33 | enum codec_versions { 34 | TOMBAK_1_0, 35 | TOMBAK_2_0, 36 | CONGA, 37 | CAJON, 38 | CAJON_2_0, 39 | DIANGU, 40 | DRAX_CDC, 41 | UNSUPPORTED, 42 | }; 43 | 44 | /* Support different hph modes */ 45 | enum { 46 | NORMAL_MODE = 0, 47 | HD2_MODE, 48 | }; 49 | 50 | enum dig_cdc_notify_event { 51 | DIG_CDC_EVENT_INVALID, 52 | DIG_CDC_EVENT_CLK_ON, 53 | DIG_CDC_EVENT_CLK_OFF, 54 | DIG_CDC_EVENT_RX1_MUTE_ON, 55 | DIG_CDC_EVENT_RX1_MUTE_OFF, 56 | DIG_CDC_EVENT_RX2_MUTE_ON, 57 | DIG_CDC_EVENT_RX2_MUTE_OFF, 58 | DIG_CDC_EVENT_RX3_MUTE_ON, 59 | DIG_CDC_EVENT_RX3_MUTE_OFF, 60 | DIG_CDC_EVENT_PRE_RX1_INT_ON, 61 | DIG_CDC_EVENT_PRE_RX2_INT_ON, 62 | DIG_CDC_EVENT_POST_RX1_INT_OFF, 63 | DIG_CDC_EVENT_POST_RX2_INT_OFF, 64 | DIG_CDC_EVENT_SSR_DOWN, 65 | DIG_CDC_EVENT_SSR_UP, 66 | DIG_CDC_EVENT_LAST, 67 | }; 68 | -------------------------------------------------------------------------------- /asoc/codecs/sdm660_cdc/msm-digital-cdc.h: -------------------------------------------------------------------------------- 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 MSM_DIGITAL_CDC_H 13 | #define MSM_DIGITAL_CDC_H 14 | 15 | #define HPHL_PA_DISABLE (0x01 << 1) 16 | #define HPHR_PA_DISABLE (0x01 << 2) 17 | #define SPKR_PA_DISABLE (0x01 << 3) 18 | 19 | #define NUM_DECIMATORS 5 20 | /* Codec supports 1 compander */ 21 | enum { 22 | COMPANDER_NONE = 0, 23 | COMPANDER_1, /* HPHL/R */ 24 | COMPANDER_MAX, 25 | }; 26 | 27 | /* Number of output I2S port */ 28 | enum { 29 | MSM89XX_RX1 = 0, 30 | MSM89XX_RX2, 31 | MSM89XX_RX3, 32 | MSM89XX_RX_MAX, 33 | }; 34 | 35 | struct tx_mute_work { 36 | struct msm_dig_priv *dig_cdc; 37 | u32 decimator; 38 | struct delayed_work dwork; 39 | }; 40 | 41 | struct msm_dig_priv { 42 | struct snd_soc_codec *codec; 43 | u32 comp_enabled[MSM89XX_RX_MAX]; 44 | int (*codec_hph_comp_gpio)(bool enable, struct snd_soc_codec *codec); 45 | s32 dmic_1_2_clk_cnt; 46 | s32 dmic_3_4_clk_cnt; 47 | bool dec_active[NUM_DECIMATORS]; 48 | int version; 49 | /* Entry for version info */ 50 | struct snd_info_entry *entry; 51 | struct snd_info_entry *version_entry; 52 | char __iomem *dig_base; 53 | struct regmap *regmap; 54 | struct notifier_block nblock; 55 | u32 mute_mask; 56 | int dapm_bias_off; 57 | void *handle; 58 | void (*set_compander_mode)(void *handle, int val); 59 | void (*update_clkdiv)(void *handle, int val); 60 | int (*get_cdc_version)(void *handle); 61 | int (*register_notifier)(void *handle, 62 | struct notifier_block *nblock, 63 | bool enable); 64 | struct tx_mute_work tx_mute_dwork[NUM_DECIMATORS]; 65 | }; 66 | 67 | struct dig_ctrl_platform_data { 68 | void *handle; 69 | void (*set_compander_mode)(void *handle, int val); 70 | void (*update_clkdiv)(void *handle, int val); 71 | int (*get_cdc_version)(void *handle); 72 | int (*register_notifier)(void *handle, 73 | struct notifier_block *nblock, 74 | bool enable); 75 | }; 76 | 77 | struct hpf_work { 78 | struct msm_dig_priv *dig_cdc; 79 | u32 decimator; 80 | u8 tx_hpf_cut_of_freq; 81 | struct delayed_work dwork; 82 | }; 83 | 84 | /* Codec supports 5 bands */ 85 | enum { 86 | BAND1 = 0, 87 | BAND2, 88 | BAND3, 89 | BAND4, 90 | BAND5, 91 | BAND_MAX, 92 | }; 93 | 94 | extern void msm_dig_cdc_hph_comp_cb( 95 | int (*codec_hph_comp_gpio)( 96 | bool enable, struct snd_soc_codec *codec), 97 | struct snd_soc_codec *codec); 98 | int msm_dig_codec_info_create_codec_entry(struct snd_info_entry *codec_root, 99 | struct snd_soc_codec *codec); 100 | #endif 101 | -------------------------------------------------------------------------------- /asoc/codecs/sdm660_cdc/sdm660-cdc-irq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-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 __WCD9XXX_SPMI_IRQ_H__ 13 | #define __WCD9XXX_SPMI_IRQ_H__ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | extern void wcd9xxx_spmi_enable_irq(int irq); 22 | extern void wcd9xxx_spmi_disable_irq(int irq); 23 | extern int wcd9xxx_spmi_request_irq(int irq, irq_handler_t handler, 24 | const char *name, void *priv); 25 | extern int wcd9xxx_spmi_free_irq(int irq, void *priv); 26 | extern void wcd9xxx_spmi_set_codec(struct snd_soc_codec *codec); 27 | extern void wcd9xxx_spmi_set_dev(struct platform_device *spmi, int i); 28 | extern int wcd9xxx_spmi_irq_init(void); 29 | extern int wcd9xxx_spmi_suspend(pm_message_t pmesg); 30 | extern int wcd9xxx_spmi_resume(void); 31 | bool wcd9xxx_spmi_lock_sleep(void); 32 | void wcd9xxx_spmi_unlock_sleep(void); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/config.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONFIG_LINUX_KERNEL_INC__ 2 | #define __CONFIG_LINUX_KERNEL_INC__ 3 | 4 | #ifdef pr_fmt 5 | #undef pr_fmt 6 | #endif 7 | #define pr_fmt(fmt) "%s:" fmt,__func__ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | /* 19 | i2c transaction on Linux limited to 64k 20 | (See Linux kernel documentation: Documentation/i2c/writing-clients) 21 | */ 22 | #define MAX_I2C_BUFFER_SIZE 65536 23 | 24 | /* max. length of a alsa mixer control name */ 25 | #define MAX_CONTROL_NAME 48 26 | 27 | /* dbgprint.h */ 28 | #define PRINT(fmt) "%s: " fmt, __func__ 29 | 30 | #define _ASSERT(e) 31 | #define PRINT_ASSERT(e)if ((e)) printk(KERN_ERR "PrintAssert:%s (%s:%d) error code:%d\n",__FUNCTION__,__FILE__,__LINE__, e) 32 | 33 | #define TFA98XX_MAX_REGISTER 0xff 34 | 35 | #define TFA98XX_FLAG_DSP_START_ON_MUTE (1 << 0) 36 | #define TFA98XX_FLAG_SKIP_INTERRUPTS (1 << 1) 37 | #define TFA98XX_FLAG_SAAM_AVAILABLE (1 << 2) 38 | #define TFA98XX_FLAG_STEREO_DEVICE (1 << 3) 39 | #define TFA98XX_FLAG_MULTI_MIC_INPUTS (1 << 4) 40 | #define TFA98XX_FLAG_TAPDET_AVAILABLE (1 << 5) 41 | #define TFA98XX_FLAG_TFA9890_FAM_DEV (1 << 6) 42 | #define TFA98XX_FLAG_TFA9897_FAM_DEV (1 << 7) 43 | 44 | #define TFA98XX_NUM_RATES 9 45 | /* DSP init status */ 46 | enum tfa98xx_dsp_init_state { 47 | TFA98XX_DSP_INIT_STOPPED, /* DSP not running */ 48 | TFA98XX_DSP_INIT_RECOVER, /* DSP error detected at runtime */ 49 | TFA98XX_DSP_INIT_FAIL, /* DSP init failed */ 50 | TFA98XX_DSP_INIT_PENDING, /* DSP start requested */ 51 | TFA98XX_DSP_INIT_DONE, /* DSP running */ 52 | TFA98XX_DSP_INIT_INVALIDATED, /* DSP was running, requires re-init */ 53 | }; 54 | 55 | enum tfa98xx_dsp_fw_state { 56 | TFA98XX_DSP_FW_NONE = 0, 57 | TFA98XX_DSP_FW_PENDING, 58 | TFA98XX_DSP_FW_FAIL, 59 | TFA98XX_DSP_FW_OK, 60 | }; 61 | 62 | struct tfa98xx_firmware { 63 | void *base; 64 | struct tfa98xx_device *dev; 65 | char name[9]; //TODO get length from tfa parameter defs 66 | }; 67 | 68 | struct tfa98xx_baseprofile { 69 | char basename[MAX_CONTROL_NAME]; /* profile basename */ 70 | int len; /* profile length */ 71 | int item_id; /* profile id */ 72 | int sr_rate_sup[TFA98XX_NUM_RATES]; /* sample rates supported by this profile */ 73 | struct list_head list; /* list of all profiles */ 74 | }; 75 | 76 | struct tfa98xx { 77 | struct regmap *regmap; 78 | struct i2c_client *i2c; 79 | struct regulator *vdd; 80 | struct snd_soc_codec *codec; 81 | struct workqueue_struct *tfa98xx_wq; 82 | struct delayed_work init_work; 83 | struct delayed_work monitor_work; 84 | struct delayed_work interrupt_work; 85 | struct delayed_work tapdet_work; 86 | struct mutex dsp_lock; 87 | int dsp_init; 88 | int dsp_fw_state; 89 | int sysclk; 90 | int rst_gpio; 91 | u16 rev; 92 | int has_drc; 93 | int audio_mode; 94 | struct tfa98xx_firmware fw; 95 | char *fw_name; 96 | int rate; 97 | wait_queue_head_t wq; 98 | struct device *dev; 99 | unsigned int init_count; 100 | int pstream; 101 | int cstream; 102 | struct input_dev *input; 103 | bool tapdet_enabled; /* service enabled */ 104 | bool tapdet_open; /* device file opened */ 105 | unsigned int tapdet_profiles; /* tapdet profile bitfield */ 106 | bool tapdet_poll; /* tapdet running on polling mode */ 107 | 108 | unsigned int rate_constraint_list[TFA98XX_NUM_RATES]; 109 | struct snd_pcm_hw_constraint_list rate_constraint; 110 | 111 | int reset_gpio; 112 | int power_gpio; 113 | int irq_gpio; 114 | 115 | int handle; 116 | 117 | #ifdef CONFIG_DEBUG_FS 118 | struct dentry *dbg_dir; 119 | #endif 120 | u8 reg; 121 | 122 | //su 123 | bool startInit; 124 | 125 | unsigned int count_wait_for_source_state; 126 | unsigned int count_noclk; 127 | unsigned int flags; 128 | }; 129 | 130 | #if defined(CONFIG_TRACING) && defined(DEBUG) 131 | #define tfa98xx_trace_printk(...) trace_printk(__VA_ARGS__) 132 | #else 133 | #define tfa98xx_trace_printk(...) 134 | #endif 135 | 136 | /* 137 | i2c transaction on Linux limited to 64k 138 | (See Linux kernel documentation: Documentation/i2c/writing-clients) 139 | */ 140 | static inline int NXP_I2C_BufferSize(void) 141 | { 142 | return 65536; 143 | } 144 | 145 | #endif /* __CONFIG_LINUX_KERNEL_INC__ */ 146 | 147 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/tfa.h: -------------------------------------------------------------------------------- 1 | /* 2 | *Copyright 2015 NXP Semiconductors 3 | * 4 | *Licensed under the Apache License, Version 2.0 (the "License"); 5 | *you may not use this file except in compliance with the License. 6 | *You may obtain a copy of the License at 7 | * 8 | *http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | *Unless required by applicable law or agreed to in writing, software 11 | *distributed under the License is distributed on an "AS IS" BASIS, 12 | *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | *See the License for the specific language governing permissions and 14 | *limitations under the License. 15 | */ 16 | 17 | #ifndef TFA_H_ 18 | #define TFA_H_ 19 | 20 | /* set the limit for the container file length */ 21 | #define TFA_MAX_CNT_LENGTH (256*1024) 22 | 23 | /** 24 | * tfa error returns 25 | */ 26 | enum tfa_error { 27 | tfa_error_ok, /**< no error */ 28 | tfa_error_device, /**< no response from device */ 29 | tfa_error_bad_param, /**< parameter no accepted */ 30 | tfa_error_noclock, /**< required clock not present */ 31 | tfa_error_timeout, /**< a timeout occurred */ 32 | tfa_error_dsp, /**< a DSP error was returned */ 33 | tfa_error_container, /**< no or wrong container file */ 34 | tfa_error_max /**< impossible value, max enum */ 35 | }; 36 | 37 | /** 38 | * Pass the container buffer, initialize and allocate internal memory. 39 | * 40 | * Note that this buffer will be kept and should not be freed until 41 | * tfa_deinit() has been called 42 | * 43 | * @param pointer to the start of the buffer holding the container file 44 | * @param length of the data in bytes 45 | * @return 46 | * - tfa_error_ok if normal 47 | * - tfa_error_container invalid container data 48 | * - tfa_error_bad_param invalid parameter 49 | * 50 | */ 51 | enum tfa_error tfa_load_cnt(void *cnt, int length); 52 | 53 | /** 54 | * Probe/init the device. 55 | * 56 | * This function should only be called when the container file is loaded. 57 | * It checks if an device with slave address is available in the container file. 58 | * When a container file is available its assigns an handle matching the index 59 | * in the container file and otherwise it will assign the first handle. 60 | * It will check the device type and fill the device specific structures and 61 | * functions. 62 | * 63 | * @param slave_address i2c slave address (8 bit format) 64 | * @param pDevice the index in the conainer file 65 | * @return enum tfa_error 66 | */ 67 | enum Tfa98xx_Error 68 | tfa_probe(unsigned char slave_address, int *pDevice); 69 | 70 | /** 71 | * Start/Restart the SpeakerBoost on all devices/channels. 72 | * 73 | * This should only be called when the audio input clock is active.\n 74 | * When the device is in coldstart-state (ACS=1) then a full initialization 75 | * will be performed.\n 76 | * In case of a warm start only a power-on and un-mute will be executed.\n 77 | * 78 | * @param profile the profile to load, if -1 then don't change profile 79 | * @param vsteps the volume step selections for each channel, if -1 then softmute 80 | * 0 sets the maximum volume 81 | * @return enum tfa_error 82 | */ 83 | enum tfa_error tfa_start(int profile, int *vstep); 84 | 85 | /** 86 | * Stop SpeakerBoost on all devices/channels. 87 | * 88 | * This the notification of the audio clock to be taken away by the host. 89 | * 90 | * Note that the function will block until the amplifiers are actually switched 91 | * off unless timed-out. 92 | * 93 | * @return enum tfa_error 94 | */ 95 | enum tfa_error tfa_stop(void); 96 | 97 | /** 98 | * discard container buffer and free all resources.\n 99 | * This includes discarding all callbacks. 100 | */ 101 | void tfa_deinit(void); 102 | 103 | /** 104 | * bring all devices/channels in the cold state (ACS==1).\n 105 | * This will cause reloading of all data at the next start 106 | * 107 | * @return 108 | * - tfa_error_ok if normal 109 | * - tfa_error_container invalid container data 110 | * - tfa_error_device channel error 111 | * - tfa_error_noclock only register level init could be preformed 112 | */ 113 | enum tfa_error tfa_reset(void); 114 | 115 | enum Tfa98xx_Error tfa_write_filters(int dev_idx, int prof_idx); 116 | 117 | #endif /* TFA_H_ */ 118 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/tfa9887B_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | *Copyright 2014,2015 NXP Semiconductors 3 | * 4 | *Licensed under the Apache License, Version 2.0 (the "License"); 5 | *you may not use this file except in compliance with the License. 6 | *You may obtain a copy of the License at 7 | * 8 | *http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | *Unless required by applicable law or agreed to in writing, software 11 | *distributed under the License is distributed on an "AS IS" BASIS, 12 | *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | *See the License for the specific language governing permissions and 14 | *limitations under the License. 15 | */ 16 | 17 | #include "tfa_dsp_fw.h" 18 | #include "tfa_service.h" 19 | #include "tfa_internal.h" 20 | 21 | #include "tfa98xx_tfafieldnames.h" 22 | 23 | #ifdef TFA98XX_FULL 24 | /** clockless way to determine if this is the tfa9887 25 | * by testing if the PVP bit is writable 26 | */ 27 | int tfa9887B_is87(Tfa98xx_handle_t handle) 28 | { 29 | unsigned short save_value, check_value; 30 | 31 | tfa98xx_read_register16(handle, 0x08, &save_value); 32 | if ( (save_value&0x0400) == 0 ) // if clear it's 87 33 | return 1; 34 | /* try to clear pvp bit */ 35 | tfa98xx_write_register16(handle, 0x08, (save_value & ~0x0400)); 36 | tfa98xx_read_register16(handle, 0x08, &check_value); 37 | /* restore */ 38 | tfa98xx_write_register16(handle, 0x08, save_value); 39 | /* could we write the bit */ 40 | return (check_value!=save_value) ? 1 : 0; // if changed it's the 87 41 | } 42 | #endif 43 | 44 | static enum Tfa98xx_Error tfa9887B_specific(Tfa98xx_handle_t handle) 45 | { 46 | enum Tfa98xx_Error error = Tfa98xx_Error_Ok; 47 | int result; 48 | 49 | if (!tfa98xx_handle_is_open(handle)) 50 | return Tfa98xx_Error_NotOpen; 51 | 52 | /* all i2C registers are already set to default */ 53 | 54 | result = TFA_SET_BF(handle, AMPE, 1); 55 | if (result < 0) 56 | return -result; 57 | 58 | /* some other registers must be set for optimal amplifier behaviour */ 59 | tfa98xx_write_register16(handle, 0x05, 0x13AB); 60 | tfa98xx_write_register16(handle, 0x06, 0x001F); 61 | /* peak voltage protection is always on, but may be written */ 62 | tfa98xx_write_register16(handle, 0x08, 0x3C4E); 63 | /*TFA98XX_SYSCTRL_DCA=0*/ 64 | tfa98xx_write_register16(handle, 0x09, 0x024D); 65 | tfa98xx_write_register16(handle, 0x41, 0x0308); 66 | error = tfa98xx_write_register16(handle, 0x49, 0x0E82); 67 | 68 | return error; 69 | } 70 | 71 | /* 72 | * register device specifics functions 73 | */ 74 | void tfa9887B_ops(struct tfa_device_ops *ops) { 75 | ops->tfa_init=tfa9887B_specific; 76 | } 77 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/tfa9887_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | *Copyright 2014,215 NXP Semiconductors 3 | * 4 | *Licensed under the Apache License, Version 2.0 (the "License"); 5 | *you may not use this file except in compliance with the License. 6 | *You may obtain a copy of the License at 7 | * 8 | *http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | *Unless required by applicable law or agreed to in writing, software 11 | *distributed under the License is distributed on an "AS IS" BASIS, 12 | *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | *See the License for the specific language governing permissions and 14 | *limitations under the License. 15 | */ 16 | 17 | #include "tfa_dsp_fw.h" 18 | #include "tfa_service.h" 19 | #include "tfa_internal.h" 20 | 21 | #include "tfa98xx_tfafieldnames.h" 22 | 23 | static enum Tfa98xx_Error tfa9887_specific(Tfa98xx_handle_t handle) 24 | { 25 | enum Tfa98xx_Error error = Tfa98xx_Error_Ok; 26 | int result; 27 | 28 | if (!tfa98xx_handle_is_open(handle)) 29 | return Tfa98xx_Error_NotOpen; 30 | 31 | /* all i2C registers are already set to default */ 32 | 33 | result = TFA_SET_BF(handle, AMPE, 1); 34 | if (result < 0) 35 | return -result; 36 | 37 | /* some other registers must be set for optimal amplifier behaviour */ 38 | tfa98xx_write_register16(handle, 0x05, 0x13AB); 39 | tfa98xx_write_register16(handle, 0x06, 0x001F); 40 | tfa98xx_write_register16(handle, 0x08, 0x3C4E); 41 | /*TFA98XX_SYSCTRL_DCA=0*/ 42 | tfa98xx_write_register16(handle, 0x09, 0x024D); 43 | tfa98xx_write_register16(handle, 0x0A, 0x3EC3); 44 | tfa98xx_write_register16(handle, 0x41, 0x0308); 45 | error = tfa98xx_write_register16(handle, 0x49, 0x0E82); 46 | 47 | return error; 48 | } 49 | 50 | /* 51 | * register device specifics functions 52 | */ 53 | void tfa9887_ops(struct tfa_device_ops *ops) { 54 | ops->tfa_init=tfa9887_specific; 55 | } 56 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/tfa9891_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | *Copyright 2014,2015 NXP Semiconductors 3 | * 4 | *Licensed under the Apache License, Version 2.0 (the "License"); 5 | *you may not use this file except in compliance with the License. 6 | *You may obtain a copy of the License at 7 | * 8 | *http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | *Unless required by applicable law or agreed to in writing, software 11 | *distributed under the License is distributed on an "AS IS" BASIS, 12 | *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | *See the License for the specific language governing permissions and 14 | *limitations under the License. 15 | */ 16 | 17 | 18 | #include "tfa_dsp_fw.h" 19 | #include "tfa_service.h" 20 | #include "tfa_internal.h" 21 | 22 | #include "tfa98xx_tfafieldnames.h" 23 | 24 | static enum Tfa98xx_Error tfa9891_specific(Tfa98xx_handle_t handle) 25 | { 26 | enum Tfa98xx_Error error = Tfa98xx_Error_Ok; 27 | 28 | if (!tfa98xx_handle_is_open(handle)) 29 | return Tfa98xx_Error_NotOpen; 30 | 31 | /* ----- generated code start ----- */ 32 | /* ----- version 18.0 ----- */ 33 | tfa98xx_write_register16(handle, 0x09, 0x025d); //POR=0x024d 34 | tfa98xx_write_register16(handle, 0x10, 0x0018); //POR=0x0024 35 | tfa98xx_write_register16(handle, 0x22, 0x0003); //POR=0x0023 36 | tfa98xx_write_register16(handle, 0x25, 0x0001); //POR=0x0000 37 | tfa98xx_write_register16(handle, 0x46, 0x0000); //POR=0x4000 38 | tfa98xx_write_register16(handle, 0x55, 0x3ffb); //POR=0x7fff 39 | /* ----- generated code end ----- */ 40 | 41 | return error; 42 | } 43 | 44 | 45 | /* 46 | * register device specifics functions 47 | */ 48 | void tfa9891_ops(struct tfa_device_ops *ops) { 49 | ops->tfa_init=tfa9891_specific; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/tfa98xx_tfafieldnames.h: -------------------------------------------------------------------------------- 1 | 2 | typedef struct TfaBfName { 3 | unsigned short bfEnum; 4 | char *bfName; 5 | } tfaBfName_t; 6 | 7 | typedef struct TfaIrqName { 8 | unsigned short irqEnum; 9 | char *irqName; 10 | } tfaIrqName_t; 11 | 12 | #include "tfa1_tfafieldnames.h" 13 | #include "tfa2_tfafieldnames_N1C.h" 14 | /* diffs for specific devices */ 15 | #include "tfa9887_tfafieldnames.h" 16 | #include "tfa9890_tfafieldnames.h" 17 | #include "tfa9891_tfafieldnames.h" 18 | 19 | /* missing 'common' defs break the build but unused in TFA1 context */ 20 | #define TFA1_BF_AMPINSEL -1 21 | #define TFA1_BF_MANSCONF -1 22 | #define TFA1_BF_MANCOLD -1 23 | #define TFA1_BF_INTSMUTE -1 24 | #define TFA1_BF_CFSMR -1 25 | #define TFA1_BF_CFSML -1 26 | #define TFA1_BF_DCMCCAPI -1 27 | #define TFA1_BF_DCMCCSB -1 28 | #define TFA1_BF_USERDEF -1 29 | #define TFA1_BF_MANSTATE -1 30 | #define TFA1_BF_MANOPER -1 31 | #define TFA1_BF_REFCKSEL -1 32 | #define TFA1_BF_VOLSEC -1 33 | #define TFA1_BF_FRACTDEL -1 34 | #define TFA1_BF_ACKDMG -1 35 | #define TFA1_BF_SSRIGHTE -1 36 | #define TFA1_BF_SSLEFTE -1 37 | #define TFA1_BF_SWPROFIL 0x8045 /*!< profile save */ 38 | #define TFA1_BF_SWVSTEP 0x80a5 /*!< vstep save */ 39 | 40 | /* missing 'common' defs break the build but unused in TFA2 context */ 41 | #define TFA2_BF_CFSM -1 42 | 43 | 44 | /* MTP access uses registers 45 | * defs are derived from corresponding bitfield names as used in the BF macros 46 | */ 47 | #define MTPKEY2 MTPK /* unlock key2 MTPK */ 48 | #define MTP0 MTPOTC /* MTP data */ 49 | #define MTP_CONTROL CIMTP /* copy i2c to mtp */ 50 | 51 | /* interrupt enable register uses HW name in TFA2 */ 52 | #define TFA2_BF_INTENVDDS TFA2_BF_IEVDDS 53 | 54 | 55 | /* interrupt bit field names of TFA2 and TFA1 do not match */ 56 | #define TFA1_BF_IEACS TFA1_BF_INTENACS 57 | #define TFA1_BF_IPOACS TFA1_BF_INTPOLACS 58 | #define TFA1_BF_ISTACS TFA1_BF_INTOACS 59 | #define TFA1_BF_ISTVDDS TFA1_BF_INTOVDDS 60 | #define TFA1_BF_ICLVDDS TFA1_BF_INTIVDDS 61 | #define TFA1_BF_IPOVDDS TFA1_BF_INTPOLVDDS 62 | #define TFA1_BF_IENOCLK TFA1_BF_INTENNOCLK 63 | #define TFA1_BF_ISTNOCLK TFA1_BF_INTONOCLK 64 | #define TFA1_BF_IPONOCLK TFA1_BF_INTPOLNOCLK 65 | 66 | /* interrupt bit fields not available on TFA1 */ 67 | #define TFA1_BF_IECLKOOR -1 68 | #define TFA1_BF_ISTCLKOOR -1 69 | #define TFA1_BF_IEMWSRC -1 70 | #define TFA1_BF_ISTMWSRC -1 71 | #define TFA1_BF_IPOMWSRC -1 72 | #define TFA1_BF_IEMWSMU -1 73 | #define TFA1_BF_ISTMWSMU -1 74 | #define TFA1_BF_IPOMWSMU -1 75 | #define TFA1_BF_IEMWCFC -1 76 | #define TFA1_BF_ISTMWCFC -1 77 | #define TFA1_BF_IPOMWCFC -1 78 | #define TFA1_BF_CLKOOR -1 79 | #define TFA1_BF_MANWAIT1 -1 80 | #define TFA1_BF_MANWAIT2 -1 81 | #define TFA1_BF_MANMUTE -1 82 | #define TFA1_BF_IPCLKOOR -1 83 | #define TFA1_BF_ICLCLKOOR -1 84 | #define TFA1_BF_IPOSWS -1 85 | #define TFA1_BF_IESWS -1 86 | #define TFA1_BF_ISTSWS -1 87 | #define TFA1_BF_IESPKS -1 88 | #define TFA1_BF_ISTSPKS -1 89 | #define TFA1_BF_IPOSPKS -1 90 | 91 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/tfa_dsp_fw.h: -------------------------------------------------------------------------------- 1 | #ifndef TFA98XX_INTERNALS_H 2 | #define TFA98XX_INTERNALS_H 3 | 4 | #include "tfa_service.h" 5 | 6 | /* 7 | * the order matches the ACK bits order in TFA98XX_CF_STATUS 8 | */ 9 | enum tfa_fw_event { /* not all available on each device */ 10 | tfa_fw_i2c_cmd_ack, 11 | tfa_fw_reset_start, 12 | tfa_fw_short_on_mips, 13 | tfa_fw_soft_mute_ready, 14 | tfa_fw_volume_ready, 15 | tfa_fw_error_damage, 16 | tfa_fw_calibrate_done, 17 | tfa_fw_max 18 | }; 19 | 20 | /* the following type mappings are compiler specific */ 21 | #define subaddress_t unsigned char 22 | 23 | /* module Ids */ 24 | #define MODULE_FRAMEWORK 0 25 | #define MODULE_SPEAKERBOOST 1 26 | #define MODULE_BIQUADFILTERBANK 2 27 | #define MODULE_SETRE 9 28 | 29 | /* RPC commands */ 30 | /* SET */ 31 | #define FW_PAR_ID_SET_MEMORY 0x03 32 | #define FW_PAR_ID_SET_SENSES_DELAY 0x04 33 | #define FW_PAR_ID_SETSENSESCAL 0x05 34 | #define FW_PAR_ID_SET_INPUT_SELECTOR 0x06 35 | #define FW_PAR_ID_SET_OUTPUT_SELECTOR 0x08 36 | #define FW_PAR_ID_SET_PROGRAM_CONFIG 0x09 37 | #define FW_PAR_ID_SET_GAINS 0x0A 38 | #define FW_PAR_ID_SET_MEMTRACK 0x0B 39 | #define TFA1_FW_PAR_ID_SET_CURRENT_DELAY 0x03 40 | #define TFA1_FW_PAR_ID_SET_CURFRAC_DELAY 0x06 41 | /* GET */ 42 | #define FW_PAR_ID_GET_MEMORY 0x83 43 | #define FW_PAR_ID_GLOBAL_GET_INFO 0x84 44 | #define FW_PAR_ID_GET_FEATURE_INFO 0x85 45 | #define FW_PAR_ID_GET_MEMTRACK 0x8B 46 | #define FW_PAR_ID_GET_TAG 0xFF 47 | 48 | /* Load a full model into SpeakerBoost. */ 49 | /* SET */ 50 | #define SB_PARAM_SET_ALGO_PARAMS 0x00 51 | #define SB_PARAM_SET_LAGW 0x01 52 | #define SB_PARAM_SET_ALGO_PARAMS_WITHOUT_RESET 0x02 53 | #define SB_PARAM_SET_LSMODEL 0x06 54 | #define SB_PARAM_SET_MBDRC 0x07 55 | #define SB_PARAM_SET_MBDRC_WITHOUT_RESET 0x08 56 | #define SB_PARAM_SET_DRC 0x0F 57 | /* GET */ 58 | #define SB_PARAM_GET_ALGO_PARAMS 0x80 59 | #define SB_PARAM_GET_LAGW 0x81 60 | #define SB_PARAM_GET_RE0 0x85 61 | #define SB_PARAM_GET_LSMODEL 0x86 62 | #define SB_PARAM_GET_MBDRC 0x87 63 | #define SB_PARAM_GET_MBDRC_DYNAMICS 0x89 64 | #define SB_PARAM_GET_TAG 0xFF 65 | 66 | #define SB_PARAM_SET_EQ 0x0A /* 2 Equaliser Filters. */ 67 | #define SB_PARAM_SET_PRESET 0x0D /* Load a preset */ 68 | #define SB_PARAM_SET_CONFIG 0x0E /* Load a config */ 69 | #define SB_PARAM_SET_AGCINS 0x10 70 | #define SB_PARAM_SET_CURRENT_DELAY 0x03 71 | #define SB_PARAM_GET_STATE 0xC0 72 | #define SB_PARAM_GET_XMODEL 0xC1 /* Gets current Excursion Model. */ 73 | 74 | /* sets the speaker calibration impedance (@25 degrees celsius) */ 75 | #define SB_PARAM_SET_RE0 0x89 76 | 77 | #define BFB_PAR_ID_SET_COEFS 0x00 78 | #define BFB_PAR_ID_GET_COEFS 0x80 79 | #define BFB_PAR_ID_GET_CONFIG 0x81 80 | 81 | /* for compatibility */ 82 | #define FW_PARAM_GET_STATE FW_PAR_ID_GLOBAL_GET_INFO 83 | #define FW_PARAM_GET_FEATURE_BITS FW_PAR_ID_GET_FEATURE_BITS 84 | 85 | 86 | /* RPC Status results */ 87 | #define STATUS_OK 0 88 | #define STATUS_INVALID_MODULE_ID 2 89 | #define STATUS_INVALID_PARAM_ID 3 90 | #define STATUS_INVALID_INFO_ID 4 91 | 92 | /* the maximum message length in the communication with the DSP */ 93 | #define TFA2_MAX_PARAM_SIZE (507*3) /* TFA2 */ 94 | #define TFA1_MAX_PARAM_SIZE (145*3) /* TFA1 */ 95 | 96 | #define ROUND_DOWN(a,n) (((a)/(n))*(n)) 97 | 98 | /* feature bits */ 99 | #define FEATURE1_TCOEF 0x100 /* bit8 set means tCoefA expected */ 100 | #define FEATURE1_DRC 0x200 /* bit9 NOT set means DRC expected */ 101 | 102 | /* DSP firmware xmem defines */ 103 | #define TFA1_FW_XMEM_CALIBRATION_DONE 231 104 | #define TFA2_FW_XMEM_CALIBRATION_DONE 516 105 | #define TFA1_FW_XMEM_COUNT_BOOT 0xa1 106 | #define TFA2_FW_XMEM_COUNT_BOOT 512 107 | #define TFA2_FW_XMEM_CMD_COUNT 520 108 | 109 | /* note that the following defs rely on the handle variable */ 110 | #define TFA_FW_XMEM_CALIBRATION_DONE TFA_FAM_FW(handle,XMEM_CALIBRATION_DONE) 111 | #define TFA_FW_XMEM_COUNT_BOOT TFA_FAM_FW(handle,XMEM_COUNT_BOOT) 112 | #define TFA_FW_XMEM_CMD_COUNT TFA_FAM_FW(handle,XMEM_CMD_COUNT) 113 | 114 | #define TFA2_FW_ReZ_SCALE 65536 115 | #define TFA1_FW_ReZ_SCALE 16384 116 | #define TFA_FW_ReZ_SCALE TFA_FAM_FW(handle,ReZ_SCALE) 117 | 118 | 119 | #endif /* TFA98XX_INTERNALS_H */ 120 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/tfa_hal.c: -------------------------------------------------------------------------------- 1 | /* 2 | *Copyright 2015 NXP Semiconductors 3 | * 4 | *Licensed under the Apache License, Version 2.0 (the "License"); 5 | *you may not use this file except in compliance with the License. 6 | *You may obtain a copy of the License at 7 | * 8 | *http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | *Unless required by applicable law or agreed to in writing, software 11 | *distributed under the License is distributed on an "AS IS" BASIS, 12 | *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | *See the License for the specific language governing permissions and 14 | *limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include "tfa_dsp_fw.h" 21 | #include "dbgprint.h" 22 | 23 | #include "NXP_I2C.h" 24 | #include "tfa_internal.h" 25 | 26 | 27 | /* translate a I2C driver error into an error for Tfa9887 API */ 28 | static enum Tfa98xx_Error tfa98xx_classify_i2c_error(enum NXP_I2C_Error i2c_error) 29 | { 30 | switch (i2c_error) { 31 | case NXP_I2C_Ok: 32 | return Tfa98xx_Error_Ok; 33 | case NXP_I2C_NoAck: 34 | case NXP_I2C_ArbLost: 35 | case NXP_I2C_TimeOut: 36 | return Tfa98xx_Error_I2C_NonFatal; 37 | default: 38 | return Tfa98xx_Error_I2C_Fatal; 39 | } 40 | } 41 | /* 42 | * write a 16 bit subaddress 43 | */ 44 | enum Tfa98xx_Error 45 | tfa98xx_write_register16(Tfa98xx_handle_t handle, 46 | unsigned char subaddress, unsigned short value) 47 | { 48 | enum NXP_I2C_Error i2c_error; 49 | unsigned char write_data[3]; /* subaddress and 2 bytes of the value */ 50 | if (!tfa98xx_handle_is_open(handle)) 51 | return Tfa98xx_Error_NotOpen; 52 | 53 | write_data[0] = subaddress; 54 | write_data[1] = (value >> 8) & 0xFF; 55 | write_data[2] = value & 0xFF; 56 | 57 | i2c_error = NXP_I2C_WriteRead(handles_local[handle].slave_address, sizeof(write_data), write_data, 0, NULL); 58 | 59 | return tfa98xx_classify_i2c_error(i2c_error); 60 | } 61 | 62 | enum Tfa98xx_Error 63 | tfa98xx_read_register16(Tfa98xx_handle_t handle, 64 | unsigned char subaddress, unsigned short *pValue) 65 | { 66 | enum NXP_I2C_Error i2c_error; 67 | unsigned char write_data[1]; /* subaddress */ 68 | unsigned char read_buffer[2]; /* 2 data bytes */ 69 | 70 | _ASSERT(pValue != NULL); 71 | if (!tfa98xx_handle_is_open(handle)) 72 | return Tfa98xx_Error_NotOpen; 73 | write_data[0] = subaddress; 74 | read_buffer[0] = read_buffer[1] = 0; 75 | 76 | i2c_error = NXP_I2C_WriteRead(handles_local[handle].slave_address, 77 | sizeof(write_data), write_data, sizeof(read_buffer), read_buffer); 78 | if (tfa98xx_classify_i2c_error(i2c_error) != Tfa98xx_Error_Ok) { 79 | return tfa98xx_classify_i2c_error(i2c_error); 80 | } else { 81 | *pValue = (read_buffer[0] << 8) + read_buffer[1]; 82 | return Tfa98xx_Error_Ok; 83 | } 84 | } 85 | 86 | enum Tfa98xx_Error 87 | tfa98xx_read_data(Tfa98xx_handle_t handle, 88 | unsigned char subaddress, int num_bytes, unsigned char data[]) 89 | { 90 | enum NXP_I2C_Error i2c_error; 91 | unsigned char write_data[1]; /* subaddress */ 92 | 93 | if (!tfa98xx_handle_is_open(handle)) 94 | return Tfa98xx_Error_NotOpen; 95 | if (num_bytes > handles_local[handle].buffer_size) 96 | return Tfa98xx_Error_Bad_Parameter; 97 | 98 | write_data[0] = subaddress; 99 | i2c_error = 100 | NXP_I2C_WriteRead(handles_local[handle].slave_address, sizeof(write_data), 101 | write_data, num_bytes, data); 102 | return tfa98xx_classify_i2c_error(i2c_error); 103 | } 104 | 105 | /* 106 | * Write raw I2C data with no sub address 107 | */ 108 | enum Tfa98xx_Error 109 | tfa98xx_write_raw(Tfa98xx_handle_t handle, 110 | int num_bytes, 111 | const unsigned char data[]) 112 | { 113 | enum NXP_I2C_Error i2c_error; 114 | 115 | if (!tfa98xx_handle_is_open(handle)) 116 | return Tfa98xx_Error_NotOpen; 117 | if (num_bytes > handles_local[handle].buffer_size) 118 | return Tfa98xx_Error_Bad_Parameter; 119 | i2c_error = 120 | NXP_I2C_WriteRead(handles_local[handle].slave_address, num_bytes, 121 | data, 0, NULL); 122 | return tfa98xx_classify_i2c_error(i2c_error); 123 | } 124 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/tfa_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | internal functions for TFA layer (not shared with SRV and HAL layer!) 3 | */ 4 | 5 | #ifndef __TFA_INTERNAL_H__ 6 | #define __TFA_INTERNAL_H__ 7 | 8 | #include "tfa_dsp_fw.h" 9 | #include "tfa_service.h" 10 | #include "config.h" 11 | 12 | #if __GNUC__ >= 4 13 | #define TFA_INTERNAL __attribute__ ((visibility ("hidden"))) 14 | #else 15 | #define TFA_INTERNAL 16 | #endif 17 | 18 | 19 | #define TFA98XX_GENERIC_SLAVE_ADDRESS 0x1C 20 | 21 | enum featureSupport { 22 | supportNotSet, /* the default is not set yet, so = 0 */ 23 | supportNo, 24 | supportYes 25 | }; 26 | 27 | typedef enum featureSupport featureSupport_t; 28 | 29 | /* 30 | * tfa98xx control structure gathers data related to a single control 31 | * (a 'control' can be related to an interface file) 32 | * Some operations can be flagged as deferrable, meaning that they can be 33 | * scheduled for later execution. This can be used for operations that 34 | * require the i2s clock to run, and if it is not available while applying 35 | * the control. 36 | * The Some operations can as well be cache-able (supposedly they are the same 37 | * operations as the deferrable). Cache-able means that the status or 38 | * register value may not be accesable while accessing the control. Caching 39 | * allows to get the last programmed value. 40 | * 41 | * Fields: 42 | * deferrable: 43 | * true: means the action or register accces can be run later (for example 44 | * when an active i2s clock will be available). 45 | * false: meams the operation can be applied immediately 46 | * triggered: true if the deferred operation was triggered and is scheduled 47 | * to run later 48 | * wr_value: the value to write in the deferred action (if applicable) 49 | * rd_value: the cached value to report on a cached read (if applicable) 50 | * rd_valid: true if the rd_value was initialized (and can be reported) 51 | */ 52 | 53 | struct tfa98xx_control { 54 | bool deferrable; 55 | bool triggered; 56 | int wr_value; 57 | int rd_value; 58 | bool rd_valid; 59 | }; 60 | 61 | struct tfa98xx_controls { 62 | struct tfa98xx_control otc; 63 | struct tfa98xx_control mtpex; 64 | struct tfa98xx_control calib; 65 | // struct tfa98xx_control r; 66 | // struct tfa98xx_control temp; 67 | }; 68 | 69 | struct tfa_device_ops { 70 | enum Tfa98xx_Error (*tfa_init)(Tfa98xx_handle_t dev_idx); 71 | enum Tfa98xx_Error (*tfa_dsp_reset)(Tfa98xx_handle_t dev_idx, int state); 72 | enum Tfa98xx_Error (*tfa_dsp_system_stable)(Tfa98xx_handle_t handle, int *ready); 73 | enum Tfa98xx_Error (*tfa_dsp_write_tables)(Tfa98xx_handle_t dev_idx, int sample_rate); 74 | struct tfa98xx_controls controls; 75 | }; 76 | 77 | struct Tfa98xx_handle_private { 78 | int in_use; 79 | int buffer_size; 80 | unsigned char slave_address; 81 | unsigned short rev; 82 | unsigned char tfa_family; /* tfa1/tfa2 */ 83 | enum featureSupport supportDrc; 84 | enum featureSupport supportFramework; 85 | enum featureSupport support_saam; 86 | int sw_feature_bits[2]; /* cached feature bits data */ 87 | int hw_feature_bits; /* cached feature bits data */ 88 | int profile; /* cached active profile */ 89 | int vstep[2]; /* cached active vsteps */ 90 | // TODO add? unsigned char rev_major; /* void tfa98xx_rev(int *major, int *minor, int *revision)*/ 91 | // unsigned char rev_minor; 92 | // unsigned char rev_build; 93 | unsigned char spkr_count; 94 | unsigned char spkr_select; 95 | unsigned char support_tcoef; 96 | enum Tfa98xx_DAI daimap; 97 | int mohm[3]; /* > speaker calibration values in milli ohms -1 is error */ 98 | struct tfa_device_ops dev_ops; 99 | uint16_t interrupt_enable[3]; 100 | uint16_t interrupt_status[3]; 101 | }; 102 | 103 | /* tfa_core.c */ 104 | extern TFA_INTERNAL struct Tfa98xx_handle_private handles_local[]; 105 | TFA_INTERNAL int tfa98xx_handle_is_open(Tfa98xx_handle_t h); 106 | TFA_INTERNAL enum Tfa98xx_Error tfa98xx_check_rpc_status(Tfa98xx_handle_t handle, int *pRpcStatus); 107 | TFA_INTERNAL enum Tfa98xx_Error tfa98xx_wait_result(Tfa98xx_handle_t handle, int waitRetryCount); 108 | TFA_INTERNAL void tfa98xx_apply_deferred_calibration(Tfa98xx_handle_t handle); 109 | TFA_INTERNAL void tfa98xx_deferred_calibration_status(Tfa98xx_handle_t handle, int calibrateDone); 110 | TFA_INTERNAL int print_calibration(Tfa98xx_handle_t handle, char *str, size_t size); 111 | /*wangdongdong@MultiMedia,2016/11/30,add for calibrate node*/ 112 | TFA_INTERNAL int print_calibration_modify(Tfa98xx_handle_t handle, char *str, size_t size); 113 | 114 | #endif /* __TFA_INTERNAL_H__ */ 115 | 116 | -------------------------------------------------------------------------------- /asoc/codecs/tfa9890/tfa_osal.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #if (defined(WIN32) || defined(_X64)) 4 | #include 5 | #else 6 | #include 7 | #endif 8 | 9 | #include "tfa_internal.h" 10 | 11 | void *kmalloc(size_t size, gfpt_t flags) 12 | { 13 | /* flags are not used outside the Linux kernel */ 14 | (void)flags; 15 | 16 | #if !defined(__REDLIB__) 17 | return malloc(size); 18 | #else 19 | // TODO !need malloc here 20 | #endif 21 | } 22 | 23 | void kfree(const void *ptr) 24 | { 25 | #if !defined(__REDLIB__) 26 | free((void *)ptr); 27 | #else 28 | // TODO !need free here 29 | #endif 30 | } 31 | 32 | unsigned long msleep_interruptible(unsigned int msecs) 33 | { 34 | #if (defined(WIN32) || defined(_X64)) 35 | Sleep(msecs); 36 | #else 37 | usleep(1000 * msecs); 38 | #endif 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /asoc/codecs/wcd-dsp-utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-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 | 14 | #ifndef __WCD_DSP_UTILS_H__ 15 | #define __WCD_DSP_UTILS_H__ 16 | 17 | #define WDSP_IMG_NAME_LEN_MAX 64 18 | 19 | #define WDSP_ELF_FLAG_EXECUTE (1 << 0) 20 | #define WDSP_ELF_FLAG_WRITE (1 << 1) 21 | #define WDSP_ELF_FLAG_READ (1 << 2) 22 | 23 | #define WDSP_ELF_FLAG_RE (WDSP_ELF_FLAG_READ | WDSP_ELF_FLAG_EXECUTE) 24 | 25 | struct wdsp_img_segment { 26 | 27 | /* Firmware for the slit image */ 28 | const struct firmware *split_fw; 29 | 30 | /* Name of the split firmware file */ 31 | char split_fname[WDSP_IMG_NAME_LEN_MAX]; 32 | 33 | /* Address where the segment is to be loaded */ 34 | u32 load_addr; 35 | 36 | /* Buffer to hold the data to be loaded */ 37 | u8 *data; 38 | 39 | /* Size of the data to be loaded */ 40 | size_t size; 41 | 42 | /* List node pointing to next segment */ 43 | struct list_head list; 44 | }; 45 | 46 | int wdsp_get_segment_list(struct device *dev, const char *img_fname, 47 | unsigned int segment_type, struct list_head *seg_list, 48 | u32 *entry_point); 49 | void wdsp_flush_segment_list(struct list_head *seg_list); 50 | 51 | #endif /* __WCD_DSP_UTILS_H__ */ 52 | -------------------------------------------------------------------------------- /asoc/codecs/wcd-mbhc-adc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 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 __WCD_MBHC_ADC_H__ 13 | #define __WCD_MBHC_ADC_H__ 14 | 15 | #include "wcd-mbhc-v2.h" 16 | 17 | enum wcd_mbhc_adc_mux_ctl { 18 | MUX_CTL_AUTO = 0, 19 | MUX_CTL_IN2P, 20 | MUX_CTL_IN3P, 21 | MUX_CTL_IN4P, 22 | MUX_CTL_HPH_L, 23 | MUX_CTL_HPH_R, 24 | MUX_CTL_NONE, 25 | }; 26 | 27 | #if IS_ENABLED(CONFIG_SND_SOC_WCD_MBHC_ADC) 28 | void wcd_mbhc_adc_init(struct wcd_mbhc *mbhc); 29 | #else 30 | static inline void wcd_mbhc_adc_init(struct wcd_mbhc *mbhc) 31 | { 32 | 33 | } 34 | #endif 35 | #endif /* __WCD_MBHC_ADC_H__ */ 36 | -------------------------------------------------------------------------------- /asoc/codecs/wcd-mbhc-legacy.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014-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 __WCD_MBHC_LEGACY_H__ 13 | #define __WCD_MBHC_LEGACY_H__ 14 | 15 | #include "wcdcal-hwdep.h" 16 | #include "wcd-mbhc-v2.h" 17 | 18 | #ifdef CONFIG_SND_SOC_WCD_MBHC_LEGACY 19 | void wcd_mbhc_legacy_init(struct wcd_mbhc *mbhc); 20 | #else 21 | static inline void wcd_mbhc_legacy_init(struct wcd_mbhc *mbhc) 22 | { 23 | } 24 | #endif 25 | 26 | #endif /* __WCD_MBHC_LEGACY_H__ */ 27 | -------------------------------------------------------------------------------- /asoc/codecs/wcd-mbhc-v2-api.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014-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 __WCD_MBHC_V2_API_H__ 13 | #define __WCD_MBHC_V2_API_H__ 14 | 15 | #include "wcd-mbhc-v2.h" 16 | 17 | #if IS_ENABLED(CONFIG_SND_SOC_WCD_MBHC) 18 | int wcd_mbhc_start(struct wcd_mbhc *mbhc, 19 | struct wcd_mbhc_config *mbhc_cfg); 20 | void wcd_mbhc_stop(struct wcd_mbhc *mbhc); 21 | int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, 22 | const struct wcd_mbhc_cb *mbhc_cb, 23 | const struct wcd_mbhc_intr *mbhc_cdc_intr_ids, 24 | struct wcd_mbhc_register *wcd_mbhc_regs, 25 | bool impedance_det_en); 26 | int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, uint32_t *zl, 27 | uint32_t *zr); 28 | void wcd_mbhc_deinit(struct wcd_mbhc *mbhc); 29 | 30 | #else 31 | static inline void wcd_mbhc_stop(struct wcd_mbhc *mbhc) 32 | { 33 | } 34 | int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, 35 | const struct wcd_mbhc_cb *mbhc_cb, 36 | const struct wcd_mbhc_intr *mbhc_cdc_intr_ids, 37 | struct wcd_mbhc_register *wcd_mbhc_regs, 38 | bool impedance_det_en) 39 | { 40 | return 0; 41 | } 42 | static inline int wcd_mbhc_start(struct wcd_mbhc *mbhc, 43 | struct wcd_mbhc_config *mbhc_cfg) 44 | { 45 | return 0; 46 | } 47 | static inline int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, 48 | uint32_t *zl, 49 | uint32_t *zr) 50 | { 51 | *zl = 0; 52 | *zr = 0; 53 | return -EINVAL; 54 | } 55 | static inline void wcd_mbhc_deinit(struct wcd_mbhc *mbhc) 56 | { 57 | } 58 | #endif 59 | 60 | #endif /* __WCD_MBHC_V2_API_H__ */ 61 | -------------------------------------------------------------------------------- /asoc/codecs/wcd-spi-registers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 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 | 14 | #ifndef __WCD_SPI_REGISTERS_H__ 15 | #define __WCD_SPI_REGISTERS_H__ 16 | 17 | #include 18 | 19 | #define WCD_SPI_SLAVE_SANITY (0x00) 20 | #define WCD_SPI_SLAVE_DEVICE_ID (0x04) 21 | #define WCD_SPI_SLAVE_STATUS (0x08) 22 | #define WCD_SPI_SLAVE_CONFIG (0x0c) 23 | #define WCD_SPI_SLAVE_SW_RESET (0x10) 24 | #define WCD_SPI_SLAVE_IRQ_STATUS (0x14) 25 | #define WCD_SPI_SLAVE_IRQ_EN (0x18) 26 | #define WCD_SPI_SLAVE_IRQ_CLR (0x1c) 27 | #define WCD_SPI_SLAVE_IRQ_FORCE (0x20) 28 | #define WCD_SPI_SLAVE_TX (0x24) 29 | #define WCD_SPI_SLAVE_TEST_BUS_DATA (0x2c) 30 | #define WCD_SPI_SLAVE_TEST_BUS_CTRL (0x30) 31 | #define WCD_SPI_SLAVE_SW_RST_IRQ (0x34) 32 | #define WCD_SPI_SLAVE_CHAR_CFG (0x38) 33 | #define WCD_SPI_SLAVE_CHAR_DATA_MOSI (0x3c) 34 | #define WCD_SPI_SLAVE_CHAR_DATA_CS_N (0x40) 35 | #define WCD_SPI_SLAVE_CHAR_DATA_MISO (0x44) 36 | #define WCD_SPI_SLAVE_TRNS_BYTE_CNT (0x4c) 37 | #define WCD_SPI_SLAVE_TRNS_LEN (0x50) 38 | #define WCD_SPI_SLAVE_FIFO_LEVEL (0x54) 39 | #define WCD_SPI_SLAVE_GENERICS (0x58) 40 | #define WCD_SPI_SLAVE_EXT_BASE_ADDR (0x5c) 41 | #define WCD_SPI_MAX_REGISTER (0x5F) 42 | 43 | #endif /* End __WCD_SPI_REGISTERS_H__ */ 44 | -------------------------------------------------------------------------------- /asoc/codecs/wcd9335_irq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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 | 14 | #ifndef __WCD9335_IRQ_H_ 15 | #define __WCD9335_IRQ_H_ 16 | 17 | enum { 18 | /* INTR_REG 0 */ 19 | WCD9335_IRQ_FLL_LOCK_LOSS = 1, 20 | WCD9335_IRQ_HPH_PA_OCPL_FAULT, 21 | WCD9335_IRQ_HPH_PA_OCPR_FAULT, 22 | WCD9335_IRQ_EAR_PA_OCP_FAULT, 23 | WCD9335_IRQ_HPH_PA_CNPL_COMPLETE, 24 | WCD9335_IRQ_HPH_PA_CNPR_COMPLETE, 25 | WCD9335_IRQ_EAR_PA_CNP_COMPLETE, 26 | /* INTR_REG 1 */ 27 | WCD9335_IRQ_MBHC_SW_DET, 28 | WCD9335_IRQ_MBHC_ELECT_INS_REM_DET, 29 | WCD9335_IRQ_MBHC_BUTTON_PRESS_DET, 30 | WCD9335_IRQ_MBHC_BUTTON_RELEASE_DET, 31 | WCD9335_IRQ_MBHC_ELECT_INS_REM_LEG_DET, 32 | WCD9335_IRQ_RESERVED_0, 33 | WCD9335_IRQ_RESERVED_1, 34 | WCD9335_IRQ_RESERVED_2, 35 | /* INTR_REG 2 */ 36 | WCD9335_IRQ_LINE_PA1_CNP_COMPLETE, 37 | WCD9335_IRQ_LINE_PA2_CNP_COMPLETE, 38 | WCD9335_IRQ_LINE_PA3_CNP_COMPLETE, 39 | WCD9335_IRQ_LINE_PA4_CNP_COMPLETE, 40 | WCD9335_IRQ_SOUNDWIRE, 41 | WCD9335_IRQ_VDD_DIG_RAMP_COMPLETE, 42 | WCD9335_IRQ_RCO_ERROR, 43 | WCD9335_IRQ_SVA_ERROR, 44 | /* INTR_REG 3 */ 45 | WCD9335_IRQ_MAD_AUDIO, 46 | WCD9335_IRQ_MAD_BEACON, 47 | WCD9335_IRQ_MAD_ULTRASOUND, 48 | WCD9335_IRQ_VBAT_ATTACK, 49 | WCD9335_IRQ_VBAT_RESTORE, 50 | WCD9335_IRQ_SVA_OUTBOX1, 51 | WCD9335_IRQ_SVA_OUTBOX2, 52 | WCD9335_NUM_IRQS, 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /asoc/codecs/wcd934x/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for wcd934x codec driver. 3 | # 4 | snd-soc-wcd934x-objs := wcd934x.o wcd934x-dsp-cntl.o \ 5 | wcd934x-mbhc.o wcd934x-dsd.o 6 | obj-$(CONFIG_SND_SOC_WCD934X) += snd-soc-wcd934x.o 7 | -------------------------------------------------------------------------------- /asoc/codecs/wcd934x/wcd934x-dsd.h: -------------------------------------------------------------------------------- 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 | 13 | #ifndef __WCD934X_DSD_H__ 14 | #define __WCD934X_DSD_H__ 15 | 16 | #include 17 | #include "wcd934x.h" 18 | 19 | enum { 20 | DSD0, 21 | DSD1, 22 | DSD_MAX, 23 | }; 24 | 25 | enum { 26 | DSD_INP_SEL_ZERO = 0, 27 | DSD_INP_SEL_RX0, 28 | DSD_INP_SEL_RX1, 29 | DSD_INP_SEL_RX2, 30 | DSD_INP_SEL_RX3, 31 | DSD_INP_SEL_RX4, 32 | DSD_INP_SEL_RX5, 33 | DSD_INP_SEL_RX6, 34 | DSD_INP_SEL_RX7, 35 | }; 36 | 37 | struct tavil_dsd_config { 38 | struct snd_soc_codec *codec; 39 | unsigned int dsd_interp_mixer[INTERP_MAX]; 40 | u32 base_sample_rate[DSD_MAX]; 41 | int volume[DSD_MAX]; 42 | struct mutex vol_mutex; 43 | int version; 44 | }; 45 | 46 | #if IS_ENABLED(CONFIG_SND_SOC_WCD934X_DSD) 47 | int tavil_dsd_set_mixer_value(struct tavil_dsd_config *dsd_conf, 48 | int interp_num, int sw_value); 49 | int tavil_dsd_get_current_mixer_value(struct tavil_dsd_config *dsd_conf, 50 | int interp_num); 51 | int tavil_dsd_set_out_select(struct tavil_dsd_config *dsd_conf, 52 | int interp_num); 53 | void tavil_dsd_reset(struct tavil_dsd_config *dsd_conf); 54 | void tavil_dsd_set_interp_rate(struct tavil_dsd_config *dsd_conf, u16 rx_port, 55 | u32 sample_rate, u8 sample_rate_val); 56 | struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_codec *codec); 57 | void tavil_dsd_deinit(struct tavil_dsd_config *dsd_config); 58 | int tavil_dsd_post_ssr_init(struct tavil_dsd_config *dsd_config); 59 | #else 60 | int tavil_dsd_set_mixer_value(struct tavil_dsd_config *dsd_conf, 61 | int interp_num, int sw_value) 62 | { 63 | return 0; 64 | } 65 | 66 | int tavil_dsd_get_current_mixer_value(struct tavil_dsd_config *dsd_conf, 67 | int interp_num) 68 | { 69 | return 0; 70 | } 71 | 72 | int tavil_dsd_set_out_select(struct tavil_dsd_config *dsd_conf, 73 | int interp_num) 74 | { 75 | return 0; 76 | } 77 | 78 | void tavil_dsd_reset(struct tavil_dsd_config *dsd_conf) 79 | { } 80 | 81 | void tavil_dsd_set_interp_rate(struct tavil_dsd_config *dsd_conf, u16 rx_port, 82 | u32 sample_rate, u8 sample_rate_val) 83 | { } 84 | 85 | struct tavil_dsd_config *tavil_dsd_init(struct snd_soc_codec *codec) 86 | { 87 | return NULL; 88 | } 89 | 90 | void tavil_dsd_deinit(struct tavil_dsd_config *dsd_config) 91 | { } 92 | int tavil_dsd_post_ssr_init(struct tavil_dsd_config *dsd_config) 93 | { 94 | return 0; 95 | } 96 | #endif 97 | #endif 98 | -------------------------------------------------------------------------------- /asoc/codecs/wcd934x/wcd934x-dsp-cntl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, 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 | 14 | #ifndef __WCD934X_DSP_CNTL_H__ 15 | #define __WCD934X_DSP_CNTL_H__ 16 | 17 | #include 18 | #include 19 | 20 | enum cdc_ssr_event { 21 | WCD_CDC_DOWN_EVENT, 22 | WCD_CDC_UP_EVENT, 23 | }; 24 | 25 | struct wcd_dsp_cdc_cb { 26 | /* Callback to enable codec clock */ 27 | int (*cdc_clk_en)(struct snd_soc_codec *, bool); 28 | /* Callback to vote and unvote for SVS2 mode */ 29 | void (*cdc_vote_svs)(struct snd_soc_codec *, bool); 30 | }; 31 | 32 | struct wcd_dsp_irq_info { 33 | /* IPC interrupt */ 34 | int cpe_ipc1_irq; 35 | 36 | /* CPE error summary interrupt */ 37 | int cpe_err_irq; 38 | 39 | /* 40 | * Bit mask to indicate which of the 41 | * error interrupts are to be considered 42 | * as fatal. 43 | */ 44 | u16 fatal_irqs; 45 | }; 46 | 47 | struct wcd_dsp_params { 48 | struct wcd_dsp_cdc_cb *cb; 49 | struct wcd_dsp_irq_info irqs; 50 | 51 | /* Rate at which the codec clock operates */ 52 | u32 clk_rate; 53 | 54 | /* 55 | * Represents the dsp instance, will be used 56 | * to create sysfs and debugfs entries with 57 | * directory wdsp 58 | */ 59 | u32 dsp_instance; 60 | }; 61 | 62 | struct wdsp_ssr_entry { 63 | u8 offline; 64 | u8 offline_change; 65 | wait_queue_head_t offline_poll_wait; 66 | struct snd_info_entry *entry; 67 | }; 68 | 69 | struct wcd_dsp_cntl { 70 | /* Handle to codec */ 71 | struct snd_soc_codec *codec; 72 | 73 | /* Clk rate of the codec clock */ 74 | u32 clk_rate; 75 | 76 | /* Callbacks to codec driver */ 77 | const struct wcd_dsp_cdc_cb *cdc_cb; 78 | 79 | /* Completion to indicate WDSP boot done */ 80 | struct completion boot_complete; 81 | 82 | struct wcd_dsp_irq_info irqs; 83 | u32 dsp_instance; 84 | 85 | /* Sysfs entries related */ 86 | int boot_reqs; 87 | struct kobject wcd_kobj; 88 | 89 | /* Debugfs related */ 90 | struct dentry *entry; 91 | u32 debug_mode; 92 | bool ramdump_enable; 93 | 94 | /* WDSP manager drivers data */ 95 | struct device *m_dev; 96 | struct wdsp_mgr_ops *m_ops; 97 | 98 | /* clk related */ 99 | struct mutex clk_mutex; 100 | bool is_clk_enabled; 101 | 102 | /* Keep track of WDSP boot status */ 103 | bool is_wdsp_booted; 104 | 105 | /* SSR related */ 106 | struct wdsp_ssr_entry ssr_entry; 107 | struct mutex ssr_mutex; 108 | 109 | /* Misc device related */ 110 | char miscdev_name[256]; 111 | struct miscdevice miscdev; 112 | }; 113 | 114 | void wcd_dsp_cntl_init(struct snd_soc_codec *codec, 115 | struct wcd_dsp_params *params, 116 | struct wcd_dsp_cntl **cntl); 117 | void wcd_dsp_cntl_deinit(struct wcd_dsp_cntl **cntl); 118 | int wcd_dsp_ssr_event(struct wcd_dsp_cntl *cntl, enum cdc_ssr_event event); 119 | #endif /* end __WCD_DSP_CONTROL_H__ */ 120 | -------------------------------------------------------------------------------- /asoc/codecs/wcd934x/wcd934x-mbhc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-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 __WCD934X_MBHC_H__ 14 | #define __WCD934X_MBHC_H__ 15 | #include "../wcd-mbhc-v2.h" 16 | 17 | enum wcd934x_on_demand_supply_name { 18 | WCD934X_ON_DEMAND_MICBIAS = 0, 19 | WCD934X_ON_DEMAND_SUPPLIES_MAX, 20 | }; 21 | 22 | struct wcd934x_on_demand_supply { 23 | struct regulator *supply; 24 | int ondemand_supply_count; 25 | }; 26 | 27 | struct wcd934x_mbhc { 28 | struct wcd_mbhc wcd_mbhc; 29 | struct blocking_notifier_head notifier; 30 | struct wcd934x_on_demand_supply on_demand_list[ 31 | WCD934X_ON_DEMAND_SUPPLIES_MAX]; 32 | struct wcd9xxx *wcd9xxx; 33 | struct fw_info *fw_data; 34 | bool mbhc_started; 35 | bool is_hph_recover; 36 | }; 37 | 38 | #if IS_ENABLED(CONFIG_SND_SOC_WCD934X_MBHC) 39 | extern int tavil_mbhc_init(struct wcd934x_mbhc **mbhc, 40 | struct snd_soc_codec *codec, 41 | struct fw_info *fw_data); 42 | extern void tavil_mbhc_hs_detect_exit(struct snd_soc_codec *codec); 43 | extern int tavil_mbhc_hs_detect(struct snd_soc_codec *codec, 44 | struct wcd_mbhc_config *mbhc_cfg); 45 | extern void tavil_mbhc_deinit(struct snd_soc_codec *codec); 46 | extern int tavil_mbhc_post_ssr_init(struct wcd934x_mbhc *mbhc, 47 | struct snd_soc_codec *codec); 48 | extern int tavil_mbhc_get_impedance(struct wcd934x_mbhc *wcd934x_mbhc, 49 | uint32_t *zl, uint32_t *zr); 50 | #else 51 | static inline int tavil_mbhc_init(struct wcd934x_mbhc **mbhc, 52 | struct snd_soc_codec *codec, 53 | struct fw_info *fw_data) 54 | { 55 | return 0; 56 | } 57 | static inline void tavil_mbhc_hs_detect_exit(struct snd_soc_codec *codec) 58 | { 59 | } 60 | static inline int tavil_mbhc_hs_detect(struct snd_soc_codec *codec, 61 | struct wcd_mbhc_config *mbhc_cfg) 62 | { 63 | return 0; 64 | } 65 | static inline void tavil_mbhc_deinit(struct snd_soc_codec *codec) 66 | { 67 | } 68 | static inline int tavil_mbhc_post_ssr_init(struct wcd934x_mbhc *mbhc, 69 | struct snd_soc_codec *codec) 70 | { 71 | return 0; 72 | } 73 | static inline int tavil_mbhc_get_impedance(struct wcd934x_mbhc *wcd934x_mbhc, 74 | uint32_t *zl, uint32_t *zr) 75 | { 76 | if (zl) 77 | *zl = 0; 78 | if (zr) 79 | *zr = 0; 80 | return -EINVAL; 81 | } 82 | #endif 83 | 84 | #endif /* __WCD934X_MBHC_H__ */ 85 | -------------------------------------------------------------------------------- /asoc/codecs/wcd934x/wcd934x_irq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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 | 14 | #ifndef __WCD934X_IRQ_H_ 15 | #define __WCD934X_IRQ_H_ 16 | 17 | enum { 18 | /* INTR_REG 0 */ 19 | WCD934X_IRQ_MISC = 1, 20 | WCD934X_IRQ_HPH_PA_OCPL_FAULT, 21 | WCD934X_IRQ_HPH_PA_OCPR_FAULT, 22 | WCD934X_IRQ_EAR_PA_OCP_FAULT, 23 | WCD934X_IRQ_HPH_PA_CNPL_COMPLETE, 24 | WCD934X_IRQ_HPH_PA_CNPR_COMPLETE, 25 | WCD934X_IRQ_EAR_PA_CNP_COMPLETE, 26 | /* INTR_REG 1 */ 27 | WCD934X_IRQ_MBHC_SW_DET, 28 | WCD934X_IRQ_MBHC_ELECT_INS_REM_DET, 29 | WCD934X_IRQ_MBHC_BUTTON_PRESS_DET, 30 | WCD934X_IRQ_MBHC_BUTTON_RELEASE_DET, 31 | WCD934X_IRQ_MBHC_ELECT_INS_REM_LEG_DET, 32 | WCD934X_IRQ_RESERVED_0, 33 | WCD934X_IRQ_RESERVED_1, 34 | WCD934X_IRQ_RESERVED_2, 35 | /* INTR_REG 2 */ 36 | WCD934X_IRQ_LINE_PA1_CNP_COMPLETE, 37 | WCD934X_IRQ_LINE_PA2_CNP_COMPLETE, 38 | WCD934X_IRQ_SLNQ_ANALOG_ERROR, 39 | WCD934X_IRQ_RESERVED_3, 40 | WCD934X_IRQ_SOUNDWIRE, 41 | WCD934X_IRQ_VDD_DIG_RAMP_COMPLETE, 42 | WCD934X_IRQ_RCO_ERROR, 43 | WCD934X_IRQ_CPE_ERROR, 44 | /* INTR_REG 3 */ 45 | WCD934X_IRQ_MAD_AUDIO, 46 | WCD934X_IRQ_MAD_BEACON, 47 | WCD934X_IRQ_MAD_ULTRASOUND, 48 | WCD934X_IRQ_VBAT_ATTACK, 49 | WCD934X_IRQ_VBAT_RESTORE, 50 | WCD934X_IRQ_CPE1_INTR, 51 | WCD934X_IRQ_RESERVED_4, 52 | WCD934X_IRQ_SLNQ_DIGITAL, 53 | WCD934X_NUM_IRQS, 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /asoc/codecs/wcd9xxx-core-init.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 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 | 13 | #include 14 | #include "msm-cdc-pinctrl.h" 15 | #include "wcd9xxx-irq.h" 16 | #include "core.h" 17 | 18 | #define NUM_DRIVERS_REG_RET 3 19 | 20 | static int __init wcd9xxx_core_init(void) 21 | { 22 | int ret[NUM_DRIVERS_REG_RET] = {0}; 23 | int i = 0; 24 | 25 | ret[0] = msm_cdc_pinctrl_drv_init(); 26 | if (ret[0]) 27 | pr_err("%s: Failed init pinctrl drv: %d\n", __func__, ret[0]); 28 | 29 | ret[1] = wcd9xxx_irq_drv_init(); 30 | if (ret[1]) 31 | pr_err("%s: Failed init irq drv: %d\n", __func__, ret[1]); 32 | 33 | ret[2] = wcd9xxx_init(); 34 | if (ret[2]) 35 | pr_err("%s: Failed wcd core drv: %d\n", __func__, ret[2]); 36 | 37 | for (i = 0; i < NUM_DRIVERS_REG_RET; i++) { 38 | if (ret[i]) 39 | return ret[i]; 40 | } 41 | 42 | return 0; 43 | } 44 | module_init(wcd9xxx_core_init); 45 | 46 | static void __exit wcd9xxx_core_exit(void) 47 | { 48 | wcd9xxx_exit(); 49 | wcd9xxx_irq_drv_exit(); 50 | msm_cdc_pinctrl_drv_exit(); 51 | } 52 | module_exit(wcd9xxx_core_exit); 53 | 54 | MODULE_DESCRIPTION("WCD9XXX CODEC core init driver"); 55 | MODULE_LICENSE("GPL v2"); 56 | -------------------------------------------------------------------------------- /asoc/codecs/wcd9xxx-irq.h: -------------------------------------------------------------------------------- 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 | 13 | #include 14 | #include "core.h" 15 | 16 | #ifndef __MFD_WCD9XXX_IRQ_H 17 | #define __MFD_WCD9XXX_IRQ_H 18 | bool wcd9xxx_lock_sleep(struct wcd9xxx_core_resource *wcd9xxx_res); 19 | void wcd9xxx_unlock_sleep(struct wcd9xxx_core_resource *wcd9xxx_res); 20 | void wcd9xxx_nested_irq_lock(struct wcd9xxx_core_resource *wcd9xxx_res); 21 | void wcd9xxx_nested_irq_unlock(struct wcd9xxx_core_resource *wcd9xxx_res); 22 | int wcd9xxx_request_irq(struct wcd9xxx_core_resource *wcd9xxx_res, int irq, 23 | irq_handler_t handler, const char *name, void *data); 24 | 25 | void wcd9xxx_free_irq(struct wcd9xxx_core_resource *wcd9xxx_res, 26 | int irq, void *data); 27 | void wcd9xxx_enable_irq(struct wcd9xxx_core_resource *wcd9xxx_res, int irq); 28 | void wcd9xxx_disable_irq(struct wcd9xxx_core_resource *wcd9xxx_res, 29 | int irq); 30 | void wcd9xxx_disable_irq_sync(struct wcd9xxx_core_resource *wcd9xxx_res, 31 | int irq); 32 | 33 | int wcd9xxx_irq_init(struct wcd9xxx_core_resource *wcd9xxx_res); 34 | void wcd9xxx_irq_exit(struct wcd9xxx_core_resource *wcd9xxx_res); 35 | int wcd9xxx_irq_drv_init(void); 36 | void wcd9xxx_irq_drv_exit(void); 37 | #endif 38 | -------------------------------------------------------------------------------- /asoc/codecs/wcd9xxx-regmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-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 | 14 | #ifndef _WCD9XXX_REGMAP_ 15 | #define _WCD9XXX_REGMAP_ 16 | 17 | #include 18 | #include "core.h" 19 | 20 | typedef int (*regmap_patch_fptr)(struct regmap *, int); 21 | 22 | extern struct regmap_config wcd934x_regmap_config; 23 | extern int wcd934x_regmap_register_patch(struct regmap *regmap, 24 | int version); 25 | 26 | extern struct regmap_config wcd9335_regmap_config; 27 | extern int wcd9335_regmap_register_patch(struct regmap *regmap, 28 | int version); 29 | 30 | static inline struct regmap_config *wcd9xxx_get_regmap_config(int type) 31 | { 32 | struct regmap_config *regmap_config; 33 | 34 | switch (type) { 35 | case WCD934X: 36 | regmap_config = &wcd934x_regmap_config; 37 | break; 38 | case WCD9335: 39 | regmap_config = &wcd9335_regmap_config; 40 | break; 41 | default: 42 | regmap_config = NULL; 43 | break; 44 | }; 45 | 46 | return regmap_config; 47 | } 48 | 49 | static inline regmap_patch_fptr wcd9xxx_get_regmap_reg_patch(int type) 50 | { 51 | regmap_patch_fptr apply_patch; 52 | 53 | switch (type) { 54 | case WCD9335: 55 | apply_patch = wcd9335_regmap_register_patch; 56 | break; 57 | case WCD934X: 58 | apply_patch = wcd934x_regmap_register_patch; 59 | break; 60 | default: 61 | apply_patch = NULL; 62 | break; 63 | } 64 | 65 | return apply_patch; 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /asoc/codecs/wcd9xxx-resmgr-v2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-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 __WCD9XXX_COMMON_V2_H__ 14 | #define __WCD9XXX_COMMON_V2_H__ 15 | 16 | #include 17 | #include "core.h" 18 | 19 | enum wcd_clock_type { 20 | WCD_CLK_OFF, 21 | WCD_CLK_RCO, 22 | WCD_CLK_MCLK, 23 | }; 24 | 25 | enum { 26 | SIDO_SOURCE_INTERNAL, 27 | SIDO_SOURCE_RCO_BG, 28 | }; 29 | 30 | struct wcd_resmgr_cb { 31 | int (*cdc_rco_ctrl)(struct snd_soc_codec *, bool); 32 | }; 33 | 34 | struct wcd9xxx_resmgr_v2 { 35 | struct snd_soc_codec *codec; 36 | struct wcd9xxx_core_resource *core_res; 37 | 38 | int master_bias_users; 39 | int clk_mclk_users; 40 | int clk_rco_users; 41 | 42 | struct mutex codec_bg_clk_lock; 43 | struct mutex master_bias_lock; 44 | 45 | enum codec_variant codec_type; 46 | enum wcd_clock_type clk_type; 47 | 48 | const struct wcd_resmgr_cb *resmgr_cb; 49 | int sido_input_src; 50 | }; 51 | 52 | #define WCD9XXX_V2_BG_CLK_LOCK(resmgr) \ 53 | { \ 54 | struct wcd9xxx_resmgr_v2 *__resmgr = resmgr; \ 55 | pr_debug("%s: Acquiring BG_CLK\n", __func__); \ 56 | mutex_lock(&__resmgr->codec_bg_clk_lock); \ 57 | pr_debug("%s: Acquiring BG_CLK done\n", __func__); \ 58 | } 59 | 60 | #define WCD9XXX_V2_BG_CLK_UNLOCK(resmgr) \ 61 | { \ 62 | struct wcd9xxx_resmgr_v2 *__resmgr = resmgr; \ 63 | pr_debug("%s: Releasing BG_CLK\n", __func__); \ 64 | mutex_unlock(&__resmgr->codec_bg_clk_lock); \ 65 | } 66 | 67 | #define WCD9XXX_V2_BG_CLK_ASSERT_LOCKED(resmgr) \ 68 | { \ 69 | WARN_ONCE(!mutex_is_locked(&resmgr->codec_bg_clk_lock), \ 70 | "%s: BG_CLK lock should have acquired\n", __func__); \ 71 | } 72 | 73 | int wcd_resmgr_enable_master_bias(struct wcd9xxx_resmgr_v2 *resmgr); 74 | int wcd_resmgr_disable_master_bias(struct wcd9xxx_resmgr_v2 *resmgr); 75 | struct wcd9xxx_resmgr_v2 *wcd_resmgr_init( 76 | struct wcd9xxx_core_resource *core_res, 77 | struct snd_soc_codec *codec); 78 | void wcd_resmgr_remove(struct wcd9xxx_resmgr_v2 *resmgr); 79 | int wcd_resmgr_post_init(struct wcd9xxx_resmgr_v2 *resmgr, 80 | const struct wcd_resmgr_cb *resmgr_cb, 81 | struct snd_soc_codec *codec); 82 | int wcd_resmgr_enable_clk_block(struct wcd9xxx_resmgr_v2 *resmgr, 83 | enum wcd_clock_type type); 84 | int wcd_resmgr_disable_clk_block(struct wcd9xxx_resmgr_v2 *resmgr, 85 | enum wcd_clock_type type); 86 | int wcd_resmgr_get_clk_type(struct wcd9xxx_resmgr_v2 *resmgr); 87 | void wcd_resmgr_post_ssr_v2(struct wcd9xxx_resmgr_v2 *resmgr); 88 | void wcd_resmgr_set_sido_input_src_locked(struct wcd9xxx_resmgr_v2 *resmgr, 89 | int sido_src); 90 | void wcd_resmgr_set_sido_input_src(struct wcd9xxx_resmgr_v2 *resmgr, 91 | int sido_src); 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /asoc/codecs/wcd9xxx-soc-init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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 | 14 | #include 15 | #include 16 | #include "audio-ext-clk-up.h" 17 | 18 | static int __init wcd9xxx_soc_init(void) 19 | { 20 | int ret = 0; 21 | 22 | ret = wcd_dsp_mgr_init(); 23 | if (!ret) { 24 | ret = audio_ref_clk_platform_init(); 25 | if (ret) { 26 | pr_err("%s: init extclk fail: %d\n", __func__, ret); 27 | wcd_dsp_mgr_exit(); 28 | } 29 | } else { 30 | pr_err("%s: init dsp mgr fail: %d\n", __func__, ret); 31 | } 32 | 33 | return ret; 34 | } 35 | module_init(wcd9xxx_soc_init); 36 | 37 | static void __exit wcd9xxx_soc_exit(void) 38 | { 39 | audio_ref_clk_platform_exit(); 40 | wcd_dsp_mgr_exit(); 41 | } 42 | module_exit(wcd9xxx_soc_exit); 43 | 44 | MODULE_DESCRIPTION("WCD9XXX CODEC soc init driver"); 45 | MODULE_LICENSE("GPL v2"); 46 | -------------------------------------------------------------------------------- /asoc/codecs/wcd9xxx-utils.h: -------------------------------------------------------------------------------- 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 | 13 | #ifndef __WCD9XXX_UTILS_H__ 14 | #define __WCD9XXX_UTILS_H__ 15 | 16 | #include 17 | #include 18 | #include 19 | #include "pdata.h" 20 | #include "core.h" 21 | 22 | struct wcd9xxx_pdata *wcd9xxx_populate_dt_data(struct device *dev); 23 | int wcd9xxx_bringup(struct device *dev); 24 | int wcd9xxx_bringdown(struct device *dev); 25 | struct regmap *wcd9xxx_regmap_init(struct device *dev, 26 | const struct regmap_config *config); 27 | int wcd9xxx_reset(struct device *dev); 28 | int wcd9xxx_reset_low(struct device *dev); 29 | int wcd9xxx_get_codec_info(struct device *dev); 30 | 31 | typedef int (*codec_bringup_fn)(struct wcd9xxx *); 32 | typedef int (*codec_bringdown_fn)(struct wcd9xxx *); 33 | typedef int (*codec_type_fn)(struct wcd9xxx *, 34 | struct wcd9xxx_codec_type *); 35 | 36 | codec_bringdown_fn wcd9xxx_bringdown_fn(int type); 37 | codec_bringup_fn wcd9xxx_bringup_fn(int type); 38 | codec_type_fn wcd9xxx_get_codec_info_fn(int type); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /asoc/codecs/wcd_cmi_api.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 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 | 13 | #ifndef __CMI_API__ 14 | #define __CMI_API__ 15 | 16 | enum cmi_api_result { 17 | CMI_API_FAILED = 1, 18 | CMI_API_BUSY, 19 | CMI_API_NO_MEMORY, 20 | CMI_API_NOT_READY, 21 | }; 22 | 23 | enum cmi_api_event { 24 | CMI_API_MSG = 1, 25 | CMI_API_OFFLINE, 26 | CMI_API_ONLINE, 27 | CMI_API_DEINITIALIZED, 28 | }; 29 | 30 | struct cmi_api_notification { 31 | enum cmi_api_event event; 32 | enum cmi_api_result result; 33 | void *message; 34 | }; 35 | 36 | void *cmi_register( 37 | void notification_callback 38 | (const struct cmi_api_notification *parameter), 39 | u32 service); 40 | enum cmi_api_result cmi_deregister(void *reg_handle); 41 | enum cmi_api_result cmi_send_msg(void *message); 42 | 43 | #endif /*__CMI_API__*/ 44 | -------------------------------------------------------------------------------- /asoc/codecs/wcdcal-hwdep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, 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 __WCD9XXX_HWDEP_H__ 14 | #define __WCD9XXX_HWDEP_H__ 15 | #include 16 | 17 | enum wcd_cal_states { 18 | WCDCAL_UNINITIALISED, 19 | WCDCAL_INITIALISED, 20 | WCDCAL_RECIEVED 21 | }; 22 | 23 | struct fw_info { 24 | struct firmware_cal *fw[WCD9XXX_MAX_CAL]; 25 | DECLARE_BITMAP(cal_bit, WCD9XXX_MAX_CAL); 26 | /* for calibration tracking */ 27 | unsigned long wcdcal_state[WCD9XXX_MAX_CAL]; 28 | struct mutex lock; 29 | }; 30 | 31 | struct firmware_cal { 32 | u8 *data; 33 | size_t size; 34 | }; 35 | 36 | struct snd_soc_codec; 37 | int wcd_cal_create_hwdep(void *fw, int node, struct snd_soc_codec *codec); 38 | struct firmware_cal *wcdcal_get_fw_cal(struct fw_info *fw_data, 39 | enum wcd_cal_type type); 40 | #endif /* __WCD9XXX_HWDEP_H__ */ 41 | -------------------------------------------------------------------------------- /asoc/codecs/wsa881x-temp-sensor.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, 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 WSA881X_TEMP_SENSOR_H 13 | #define WSA881X_TEMP_SENSOR_H 14 | 15 | #include 16 | #include 17 | 18 | struct wsa_temp_register { 19 | u8 d1_msb; 20 | u8 d1_lsb; 21 | u8 d2_msb; 22 | u8 d2_lsb; 23 | u8 dmeas_msb; 24 | u8 dmeas_lsb; 25 | }; 26 | typedef int32_t (*wsa_temp_register_read)(struct snd_soc_codec *codec, 27 | struct wsa_temp_register *wsa_temp_reg); 28 | struct wsa881x_tz_priv { 29 | struct thermal_zone_device *tz_dev; 30 | struct snd_soc_codec *codec; 31 | struct wsa_temp_register *wsa_temp_reg; 32 | char name[80]; 33 | wsa_temp_register_read wsa_temp_reg_read; 34 | }; 35 | 36 | int wsa881x_get_temp(struct thermal_zone_device *tz_dev, int *temp); 37 | int wsa881x_init_thermal(struct wsa881x_tz_priv *tz_pdata); 38 | void wsa881x_deinit_thermal(struct thermal_zone_device *tz_dev); 39 | #endif 40 | -------------------------------------------------------------------------------- /asoc/codecs/wsa881x.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-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 | 13 | #ifndef _WSA881X_H 14 | #define _WSA881X_H 15 | 16 | #include 17 | #include 18 | #include 19 | #include "wsa881x-registers.h" 20 | 21 | #define WSA881X_MAX_SWR_PORTS 4 22 | 23 | #if IS_ENABLED(CONFIG_SND_SOC_WSA881X) 24 | extern int wsa881x_set_channel_map(struct snd_soc_codec *codec, u8 *port, 25 | u8 num_port, unsigned int *ch_mask, 26 | unsigned int *ch_rate); 27 | 28 | extern const u8 wsa881x_reg_readable[WSA881X_CACHE_SIZE]; 29 | extern struct regmap_config wsa881x_regmap_config; 30 | extern int wsa881x_codec_info_create_codec_entry( 31 | struct snd_info_entry *codec_root, 32 | struct snd_soc_codec *codec); 33 | void wsa881x_regmap_defaults(struct regmap *regmap, u8 version); 34 | 35 | #else 36 | extern int wsa881x_set_channel_map(struct snd_soc_codec *codec, u8 *port, 37 | u8 num_port, unsigned int *ch_mask, 38 | unsigned int *ch_rate) 39 | { 40 | return 0; 41 | } 42 | 43 | extern int wsa881x_codec_info_create_codec_entry( 44 | struct snd_info_entry *codec_root, 45 | struct snd_soc_codec *codec) 46 | { 47 | return 0; 48 | } 49 | 50 | void wsa881x_regmap_defaults(struct regmap *regmap, u8 version) 51 | { 52 | } 53 | 54 | #endif 55 | 56 | #endif /* _WSA881X_H */ 57 | -------------------------------------------------------------------------------- /asoc/device_event.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 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 | 13 | #ifndef __DEVICE_EVENT_H 14 | #define __DEVICE_EVENT_H 15 | 16 | #define QC_AUDIO_EXTERNAL_SPK_1_EVENT "qc_ext_spk_1" 17 | #define QC_AUDIO_EXTERNAL_SPK_2_EVENT "qc_ext_spk_2" 18 | #define QC_AUDIO_EXTERNAL_MIC_EVENT "qc_ext_mic" 19 | 20 | #endif /* __DEVICE_EVENT_H */ 21 | -------------------------------------------------------------------------------- /asoc/msm-dai-q6-v2.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-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 | 13 | #ifndef __MSM_DAI_Q6_PDATA_H__ 14 | 15 | #define __MSM_DAI_Q6_PDATA_H__ 16 | 17 | #define MSM_MI2S_SD0 (1 << 0) 18 | #define MSM_MI2S_SD1 (1 << 1) 19 | #define MSM_MI2S_SD2 (1 << 2) 20 | #define MSM_MI2S_SD3 (1 << 3) 21 | #define MSM_MI2S_CAP_RX 0 22 | #define MSM_MI2S_CAP_TX 1 23 | 24 | #define MSM_PRIM_MI2S 0 25 | #define MSM_SEC_MI2S 1 26 | #define MSM_TERT_MI2S 2 27 | #define MSM_QUAT_MI2S 3 28 | #define MSM_QUIN_MI2S 4 29 | #define MSM_SEC_MI2S_SD1 5 30 | #define MSM_SENARY_MI2S 6 31 | #define MSM_INT0_MI2S 7 32 | #define MSM_INT1_MI2S 8 33 | #define MSM_INT2_MI2S 9 34 | #define MSM_INT3_MI2S 10 35 | #define MSM_INT4_MI2S 11 36 | #define MSM_INT5_MI2S 12 37 | #define MSM_INT6_MI2S 13 38 | #define MSM_MI2S_MIN MSM_PRIM_MI2S 39 | #define MSM_MI2S_MAX MSM_INT6_MI2S 40 | 41 | struct msm_dai_auxpcm_config { 42 | u16 mode; 43 | u16 sync; 44 | u16 frame; 45 | u16 quant; 46 | u16 num_slots; 47 | u16 *slot_mapping; 48 | u16 data; 49 | u32 pcm_clk_rate; 50 | }; 51 | 52 | struct msm_dai_auxpcm_pdata { 53 | struct msm_dai_auxpcm_config mode_8k; 54 | struct msm_dai_auxpcm_config mode_16k; 55 | }; 56 | 57 | struct msm_mi2s_pdata { 58 | u16 rx_sd_lines; 59 | u16 tx_sd_lines; 60 | u16 intf_id; 61 | }; 62 | 63 | struct msm_i2s_data { 64 | u32 capability; /* RX or TX */ 65 | u16 sd_lines; 66 | }; 67 | 68 | struct msm_dai_tdm_group_config { 69 | u16 group_id; 70 | u16 num_ports; 71 | u16 *port_id; 72 | u32 clk_rate; 73 | }; 74 | 75 | struct msm_dai_tdm_config { 76 | u16 sync_mode; 77 | u16 sync_src; 78 | u16 data_out; 79 | u16 invert_sync; 80 | u16 data_delay; 81 | u32 data_align; 82 | u16 header_start_offset; 83 | u16 header_width; 84 | u16 header_num_frame_repeat; 85 | }; 86 | 87 | struct msm_dai_tdm_pdata { 88 | struct msm_dai_tdm_group_config group_config; 89 | struct msm_dai_tdm_config config; 90 | }; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /asoc/msm-dolby-dap-config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved. 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_DOLBY_DAP_CONFIG_H_ 14 | #define _MSM_DOLBY_DAP_CONFIG_H_ 15 | 16 | #include 17 | #include "msm-dolby-common.h" 18 | 19 | #ifdef CONFIG_DOLBY_DAP 20 | /* DOLBY DOLBY GUIDS */ 21 | #define DOLBY_ADM_COPP_TOPOLOGY_ID 0x0001033B 22 | #define NUM_DOLBY_ENDP_DEVICE 23 23 | 24 | #define DOLBY_NUM_ENDP_DEPENDENT_PARAMS 3 25 | #define DOLBY_ENDDEP_PARAM_DVLO_OFFSET 0 26 | #define DOLBY_ENDDEP_PARAM_DVLO_LENGTH 1 27 | #define DOLBY_ENDDEP_PARAM_DVLI_OFFSET (DOLBY_ENDDEP_PARAM_DVLO_OFFSET + \ 28 | DOLBY_ENDDEP_PARAM_DVLO_LENGTH) 29 | #define DOLBY_ENDDEP_PARAM_DVLI_LENGTH 1 30 | #define DOLBY_ENDDEP_PARAM_VMB_OFFSET (DOLBY_ENDDEP_PARAM_DVLI_OFFSET + \ 31 | DOLBY_ENDDEP_PARAM_DVLI_LENGTH) 32 | #define DOLBY_ENDDEP_PARAM_VMB_LENGTH 1 33 | #define DOLBY_ENDDEP_PARAM_LENGTH (DOLBY_ENDDEP_PARAM_DVLO_LENGTH + \ 34 | DOLBY_ENDDEP_PARAM_DVLI_LENGTH + DOLBY_ENDDEP_PARAM_VMB_LENGTH) 35 | 36 | #define MAX_DOLBY_PARAMS 47 37 | #define MAX_DOLBY_CTRL_PARAMS 5 38 | #define ALL_DOLBY_PARAMS (MAX_DOLBY_PARAMS + \ 39 | MAX_DOLBY_CTRL_PARAMS) 40 | #define DOLBY_COMMIT_ALL_IDX MAX_DOLBY_PARAMS 41 | #define DOLBY_COMMIT_IDX (MAX_DOLBY_PARAMS+1) 42 | #define DOLBY_USE_CACHE_IDX (MAX_DOLBY_PARAMS+2) 43 | #define DOLBY_AUTO_ENDP_IDX (MAX_DOLBY_PARAMS+3) 44 | #define DOLBY_AUTO_ENDDEP_IDX (MAX_DOLBY_PARAMS+4) 45 | 46 | /* DOLBY device definitions */ 47 | enum { 48 | DOLBY_ENDP_INT_SPEAKERS = 0, 49 | DOLBY_ENDP_EXT_SPEAKERS, 50 | DOLBY_ENDP_HEADPHONES, 51 | DOLBY_ENDP_HDMI, 52 | DOLBY_ENDP_SPDIF, 53 | DOLBY_ENDP_DLNA, 54 | DOLBY_ENDP_ANALOG, 55 | }; 56 | 57 | /* DOLBY device definitions end */ 58 | 59 | struct dolby_dap_params { 60 | uint32_t value[TOTAL_LENGTH_DOLBY_PARAM + MAX_DOLBY_PARAMS]; 61 | } __packed; 62 | 63 | int msm_dolby_dap_init(int port_id, int copp_idx, int channels, 64 | bool is_custom_stereo_on); 65 | void msm_dolby_dap_deinit(int port_id); 66 | void msm_dolby_dap_add_controls(struct snd_soc_platform *platform); 67 | int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx, 68 | bool is_custom_stereo_enabled); 69 | /* Dolby DOLBY end */ 70 | #else 71 | int msm_dolby_dap_init(int port_id, int copp_idx, int channels, 72 | bool is_custom_stereo_on) 73 | { 74 | return 0; 75 | } 76 | void msm_dolby_dap_deinit(int port_id) { } 77 | void msm_dolby_dap_add_controls(struct snd_soc_platform *platform) { } 78 | int dolby_dap_set_custom_stereo_onoff(int port_id, int copp_idx, 79 | bool is_custom_stereo_enabled) 80 | { 81 | return 0; 82 | } 83 | #endif 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /asoc/msm-ds2-dap-config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved. 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 17 | #include "msm-dolby-common.h" 18 | #include 19 | #include 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 124 | -------------------------------------------------------------------------------- /asoc/msm-pcm-afe-v2.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012,2015-2016 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 _MSM_PCM_AFE_H 13 | #define _MSM_PCM_AFE_H 14 | #include 15 | #include 16 | 17 | 18 | struct pcm_afe_info { 19 | unsigned long dma_addr; 20 | struct snd_pcm_substream *substream; 21 | unsigned int pcm_irq_pos; /* IRQ position */ 22 | struct mutex lock; 23 | spinlock_t dsp_lock; 24 | uint32_t samp_rate; 25 | uint32_t channel_mode; 26 | uint8_t start; 27 | uint32_t dsp_cnt; 28 | uint32_t buf_phys; 29 | int32_t mmap_flag; 30 | int prepared; 31 | struct hrtimer hrt; 32 | int poll_time; 33 | struct afe_audio_client *audio_client; 34 | wait_queue_head_t read_wait; 35 | atomic_t rec_bytes_avail; 36 | bool reset_event; 37 | }; 38 | 39 | 40 | #define MSM_EXT(xname, fp_info, fp_get, fp_put, addr) \ 41 | {.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 42 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 43 | .name = xname, \ 44 | .info = fp_info,\ 45 | .get = fp_get, .put = fp_put, \ 46 | .private_value = addr, \ 47 | } 48 | 49 | #endif /*_MSM_PCM_AFE_H*/ 50 | -------------------------------------------------------------------------------- /asoc/msm-pcm-hostless.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011-2014, 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 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | static int msm_pcm_hostless_prepare(struct snd_pcm_substream *substream) 23 | { 24 | if (!substream) { 25 | pr_err("%s: invalid params\n", __func__); 26 | return -EINVAL; 27 | } 28 | pm_qos_remove_request(&substream->latency_pm_qos_req); 29 | return 0; 30 | } 31 | 32 | static const struct snd_pcm_ops msm_pcm_hostless_ops = { 33 | .prepare = msm_pcm_hostless_prepare 34 | }; 35 | 36 | static struct snd_soc_platform_driver msm_soc_hostless_platform = { 37 | .ops = &msm_pcm_hostless_ops, 38 | }; 39 | 40 | static int msm_pcm_hostless_probe(struct platform_device *pdev) 41 | { 42 | 43 | pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev)); 44 | return snd_soc_register_platform(&pdev->dev, 45 | &msm_soc_hostless_platform); 46 | } 47 | 48 | static int msm_pcm_hostless_remove(struct platform_device *pdev) 49 | { 50 | snd_soc_unregister_platform(&pdev->dev); 51 | return 0; 52 | } 53 | 54 | static const struct of_device_id msm_pcm_hostless_dt_match[] = { 55 | {.compatible = "qcom,msm-pcm-hostless"}, 56 | {} 57 | }; 58 | 59 | static struct platform_driver msm_pcm_hostless_driver = { 60 | .driver = { 61 | .name = "msm-pcm-hostless", 62 | .owner = THIS_MODULE, 63 | .of_match_table = msm_pcm_hostless_dt_match, 64 | }, 65 | .probe = msm_pcm_hostless_probe, 66 | .remove = msm_pcm_hostless_remove, 67 | }; 68 | 69 | static int __init msm_soc_platform_init(void) 70 | { 71 | return platform_driver_register(&msm_pcm_hostless_driver); 72 | } 73 | module_init(msm_soc_platform_init); 74 | 75 | static void __exit msm_soc_platform_exit(void) 76 | { 77 | platform_driver_unregister(&msm_pcm_hostless_driver); 78 | } 79 | module_exit(msm_soc_platform_exit); 80 | 81 | MODULE_DESCRIPTION("Hostless platform driver"); 82 | MODULE_LICENSE("GPL v2"); 83 | -------------------------------------------------------------------------------- /asoc/msm-pcm-q6-v2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Google, Inc. 3 | * Copyright (C) 2008 HTC Corporation 4 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. 5 | * 6 | * This software is licensed under the terms of the GNU General Public 7 | * License version 2, as published by the Free Software Foundation, and 8 | * may be copied, distributed, and modified under those terms. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 | * 14 | * See the GNU General Public License for more details. 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, you can find it at http://www.fsf.org. 17 | */ 18 | 19 | #ifndef _MSM_PCM_H 20 | #define _MSM_PCM_H 21 | #include 22 | #include 23 | 24 | 25 | 26 | /* Support unconventional sample rates 12000, 24000 as well */ 27 | #define USE_RATE \ 28 | (SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_KNOT) 29 | 30 | extern int copy_count; 31 | 32 | struct buffer { 33 | void *data; 34 | unsigned int size; 35 | unsigned int used; 36 | unsigned int addr; 37 | }; 38 | 39 | struct buffer_rec { 40 | void *data; 41 | unsigned int size; 42 | unsigned int read; 43 | unsigned int addr; 44 | }; 45 | 46 | struct audio_locks { 47 | spinlock_t event_lock; 48 | wait_queue_head_t read_wait; 49 | wait_queue_head_t write_wait; 50 | wait_queue_head_t eos_wait; 51 | wait_queue_head_t enable_wait; 52 | wait_queue_head_t flush_wait; 53 | }; 54 | 55 | struct msm_audio_in_frame_info { 56 | uint32_t size; 57 | uint32_t offset; 58 | }; 59 | 60 | #define PLAYBACK_MIN_NUM_PERIODS 2 61 | #define PLAYBACK_MAX_NUM_PERIODS 8 62 | #define PLAYBACK_MAX_PERIOD_SIZE 122880 63 | #define PLAYBACK_MIN_PERIOD_SIZE 128 64 | #define CAPTURE_MIN_NUM_PERIODS 2 65 | #define CAPTURE_MAX_NUM_PERIODS 8 66 | #define CAPTURE_MAX_PERIOD_SIZE 122880 67 | #define CAPTURE_MIN_PERIOD_SIZE 320 68 | 69 | struct msm_audio { 70 | struct snd_pcm_substream *substream; 71 | unsigned int pcm_size; 72 | unsigned int pcm_count; 73 | unsigned int pcm_irq_pos; /* IRQ position */ 74 | uint16_t source; /* Encoding source bit mask */ 75 | 76 | struct audio_client *audio_client; 77 | 78 | uint16_t session_id; 79 | 80 | uint32_t samp_rate; 81 | uint32_t channel_mode; 82 | uint32_t dsp_cnt; 83 | 84 | int abort; /* set when error, like sample rate mismatch */ 85 | 86 | bool reset_event; 87 | int enabled; 88 | int close_ack; 89 | int cmd_ack; 90 | /* 91 | * cmd_ack doesn't tell if paticular command has been sent so can't 92 | * determine if it needs to wait for completion. 93 | * Use cmd_pending instead when checking whether a command is been 94 | * sent or not. 95 | */ 96 | unsigned long cmd_pending; 97 | atomic_t start; 98 | atomic_t stop; 99 | atomic_t out_count; 100 | atomic_t in_count; 101 | atomic_t out_needed; 102 | atomic_t eos; 103 | int out_head; 104 | int periods; 105 | int mmap_flag; 106 | atomic_t pending_buffer; 107 | bool set_channel_map; 108 | char channel_map[8]; 109 | int cmd_interrupt; 110 | bool meta_data_mode; 111 | uint32_t volume; 112 | bool compress_enable; 113 | /* array of frame info */ 114 | struct msm_audio_in_frame_info in_frame_info[CAPTURE_MAX_NUM_PERIODS]; 115 | }; 116 | 117 | struct output_meta_data_st { 118 | uint32_t meta_data_length; 119 | uint32_t frame_size; 120 | uint32_t timestamp_lsw; 121 | uint32_t timestamp_msw; 122 | uint32_t reserved[12]; 123 | }; 124 | 125 | struct msm_plat_data { 126 | int perf_mode; 127 | struct snd_pcm *pcm; 128 | }; 129 | 130 | #endif /*_MSM_PCM_H*/ 131 | -------------------------------------------------------------------------------- /asoc/msm-pcm-routing-devdep.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 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 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "msm-pcm-routing-devdep.h" 20 | #include "msm-ds2-dap-config.h" 21 | 22 | #ifdef CONFIG_SND_HWDEP 23 | static int msm_pcm_routing_hwdep_open(struct snd_hwdep *hw, struct file *file) 24 | { 25 | pr_debug("%s\n", __func__); 26 | msm_ds2_dap_update_port_parameters(hw, file, true); 27 | return 0; 28 | } 29 | 30 | static int msm_pcm_routing_hwdep_release(struct snd_hwdep *hw, 31 | struct file *file) 32 | { 33 | pr_debug("%s\n", __func__); 34 | msm_ds2_dap_update_port_parameters(hw, file, false); 35 | return 0; 36 | } 37 | 38 | static int msm_pcm_routing_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, 39 | unsigned int cmd, unsigned long arg) 40 | { 41 | int ret = 0; 42 | void __user *argp = (void __user *)arg; 43 | 44 | pr_debug("%s:cmd %x\n", __func__, cmd); 45 | switch (cmd) { 46 | case SNDRV_DEVDEP_DAP_IOCTL_SET_PARAM: 47 | case SNDRV_DEVDEP_DAP_IOCTL_GET_PARAM: 48 | case SNDRV_DEVDEP_DAP_IOCTL_DAP_COMMAND: 49 | case SNDRV_DEVDEP_DAP_IOCTL_DAP_LICENSE: 50 | msm_pcm_routing_acquire_lock(); 51 | ret = msm_ds2_dap_ioctl(hw, file, cmd, argp); 52 | msm_pcm_routing_release_lock(); 53 | break; 54 | case SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER: 55 | ret = msm_ds2_dap_ioctl(hw, file, cmd, argp); 56 | break; 57 | default: 58 | pr_err("%s called with invalid control 0x%X\n", __func__, cmd); 59 | ret = -EINVAL; 60 | break; 61 | } 62 | return ret; 63 | } 64 | 65 | void msm_pcm_routing_hwdep_free(struct snd_pcm *pcm) 66 | { 67 | pr_debug("%s\n", __func__); 68 | } 69 | 70 | #ifdef CONFIG_COMPAT 71 | static int msm_pcm_routing_hwdep_compat_ioctl(struct snd_hwdep *hw, 72 | struct file *file, 73 | unsigned int cmd, 74 | unsigned long arg) 75 | { 76 | int ret = 0; 77 | void __user *argp = (void __user *)arg; 78 | 79 | pr_debug("%s:cmd %x\n", __func__, cmd); 80 | switch (cmd) { 81 | case SNDRV_DEVDEP_DAP_IOCTL_SET_PARAM32: 82 | case SNDRV_DEVDEP_DAP_IOCTL_GET_PARAM32: 83 | case SNDRV_DEVDEP_DAP_IOCTL_DAP_COMMAND32: 84 | case SNDRV_DEVDEP_DAP_IOCTL_DAP_LICENSE32: 85 | msm_pcm_routing_acquire_lock(); 86 | ret = msm_ds2_dap_compat_ioctl(hw, file, cmd, argp); 87 | msm_pcm_routing_release_lock(); 88 | break; 89 | case SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER32: 90 | ret = msm_ds2_dap_compat_ioctl(hw, file, cmd, argp); 91 | break; 92 | default: 93 | pr_err("%s called with invalid control 0x%X\n", __func__, cmd); 94 | ret = -EINVAL; 95 | break; 96 | } 97 | return ret; 98 | } 99 | #endif 100 | 101 | int msm_pcm_routing_hwdep_new(struct snd_soc_pcm_runtime *runtime, 102 | struct msm_pcm_routing_bdai_data *msm_bedais) 103 | { 104 | struct snd_hwdep *hwdep; 105 | struct snd_soc_dai_link *dai_link = runtime->dai_link; 106 | int rc; 107 | 108 | if (dai_link->id < 0 || 109 | dai_link->id >= MSM_BACKEND_DAI_MAX) { 110 | pr_err("%s:BE id %d invalid index\n", 111 | __func__, dai_link->id); 112 | return -EINVAL; 113 | } 114 | pr_debug("%s BE id %d\n", __func__, dai_link->id); 115 | rc = snd_hwdep_new(runtime->card->snd_card, 116 | msm_bedais[dai_link->id].name, 117 | dai_link->id, &hwdep); 118 | if (hwdep == NULL) { 119 | pr_err("%s: hwdep intf failed to create %s- hwdep NULL\n", 120 | __func__, msm_bedais[dai_link->id].name); 121 | return rc; 122 | } 123 | if (rc < 0) { 124 | pr_err("%s: hwdep intf failed to create %s rc %d\n", __func__, 125 | msm_bedais[dai_link->id].name, rc); 126 | return rc; 127 | } 128 | 129 | hwdep->iface = SNDRV_HWDEP_IFACE_AUDIO_BE; 130 | hwdep->private_data = &msm_bedais[dai_link->id]; 131 | hwdep->ops.open = msm_pcm_routing_hwdep_open; 132 | hwdep->ops.ioctl = msm_pcm_routing_hwdep_ioctl; 133 | hwdep->ops.release = msm_pcm_routing_hwdep_release; 134 | #ifdef CONFIG_COMPAT 135 | hwdep->ops.ioctl_compat = msm_pcm_routing_hwdep_compat_ioctl; 136 | #endif 137 | return rc; 138 | } 139 | #endif 140 | -------------------------------------------------------------------------------- /asoc/msm-pcm-routing-devdep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2015, 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 | 14 | #ifndef _MSM_PCM_ROUTING_DEVDEP_H_ 15 | #define _MSM_PCM_ROUTING_DEVDEP_H_ 16 | 17 | #include 18 | #include "msm-pcm-routing-v2.h" 19 | 20 | #ifdef CONFIG_SND_HWDEP 21 | int msm_pcm_routing_hwdep_new(struct snd_soc_pcm_runtime *runtime, 22 | struct msm_pcm_routing_bdai_data *msm_bedais); 23 | void msm_pcm_routing_hwdep_free(struct snd_pcm *pcm); 24 | #else 25 | static inline int msm_pcm_routing_hwdep_new(struct snd_soc_pcm_runtime *runtime, 26 | struct msm_pcm_routing_bdai_data *msm_bedais) 27 | { 28 | return 0; 29 | } 30 | 31 | static inline void msm_pcm_routing_hwdep_free(struct snd_pcm *pcm) 32 | { 33 | } 34 | #endif 35 | #endif 36 | -------------------------------------------------------------------------------- /asoc/msm-pcm-voice-v2.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2015, 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 _MSM_PCM_VOICE_H 13 | #define _MSM_PCM_VOICE_H 14 | #include 15 | 16 | enum { 17 | VOICE_SESSION_INDEX, 18 | VOLTE_SESSION_INDEX, 19 | VOICE2_SESSION_INDEX, 20 | QCHAT_SESSION_INDEX, 21 | VOWLAN_SESSION_INDEX, 22 | VOICEMMODE1_INDEX, 23 | VOICEMMODE2_INDEX, 24 | VOICE_SESSION_INDEX_MAX, 25 | }; 26 | 27 | struct msm_voice { 28 | struct snd_pcm_substream *playback_substream; 29 | struct snd_pcm_substream *capture_substream; 30 | 31 | int instance; 32 | 33 | struct mutex lock; 34 | 35 | uint32_t samp_rate; 36 | uint32_t channel_mode; 37 | 38 | int playback_start; 39 | int capture_start; 40 | }; 41 | 42 | #endif /*_MSM_PCM_VOICE_H*/ 43 | -------------------------------------------------------------------------------- /asoc/msm-qti-pp-config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. 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_QTI_PP_H_ 14 | #define _MSM_QTI_PP_H_ 15 | 16 | #include 17 | #define DSP_BIT_WIDTH_MIXER_CTL "ASM Bit Width" 18 | #ifdef CONFIG_QTI_PP 19 | int msm_adsp_inform_mixer_ctl(struct snd_soc_pcm_runtime *rtd, 20 | uint32_t *payload); 21 | int msm_adsp_init_mixer_ctl_pp_event_queue(struct snd_soc_pcm_runtime *rtd); 22 | int msm_adsp_clean_mixer_ctl_pp_event_queue(struct snd_soc_pcm_runtime *rtd); 23 | int msm_adsp_stream_cmd_info(struct snd_kcontrol *kcontrol, 24 | struct snd_ctl_elem_info *uinfo); 25 | int msm_adsp_stream_callback_get(struct snd_kcontrol *kcontrol, 26 | struct snd_ctl_elem_value *ucontrol); 27 | int msm_adsp_stream_callback_info(struct snd_kcontrol *kcontrol, 28 | struct snd_ctl_elem_info *uinfo); 29 | void msm_qti_pp_send_eq_values(int fedai_id); 30 | int msm_qti_pp_send_stereo_to_custom_stereo_cmd(int port_id, int copp_idx, 31 | unsigned int session_id, 32 | uint16_t op_FL_ip_FL_weight, 33 | uint16_t op_FL_ip_FR_weight, 34 | uint16_t op_FR_ip_FL_weight, 35 | uint16_t op_FR_ip_FR_weight); 36 | void msm_qti_pp_add_controls(struct snd_soc_platform *platform); 37 | #else /* CONFIG_QTI_PP */ 38 | static inline int msm_adsp_inform_mixer_ctl(struct snd_soc_pcm_runtime *rtd, 39 | uint32_t *payload) 40 | { 41 | return 0; 42 | } 43 | 44 | static inline int msm_adsp_init_mixer_ctl_pp_event_queue( 45 | struct snd_soc_pcm_runtime *rtd) 46 | { 47 | return 0; 48 | } 49 | 50 | static inline int msm_adsp_clean_mixer_ctl_pp_event_queue( 51 | struct snd_soc_pcm_runtime *rtd) 52 | { 53 | return 0; 54 | } 55 | 56 | static inline int msm_adsp_stream_cmd_info(struct snd_kcontrol *kcontrol, 57 | struct snd_ctl_elem_info *uinfo) 58 | { 59 | return 0; 60 | } 61 | 62 | static inline int msm_adsp_stream_callback_get(struct snd_kcontrol *kcontrol, 63 | struct snd_ctl_elem_value *ucontrol) 64 | { 65 | return 0; 66 | } 67 | 68 | static inline int msm_adsp_stream_callback_info(struct snd_kcontrol *kcontrol, 69 | struct snd_ctl_elem_info *uinfo) 70 | { 71 | return 0; 72 | } 73 | 74 | #define msm_qti_pp_send_eq_values(fedai_id) do {} while (0) 75 | #define msm_qti_pp_send_stereo_to_custom_stereo_cmd(port_id, copp_idx, \ 76 | session_id, op_FL_ip_FL_weight, op_FL_ip_FR_weight, \ 77 | op_FR_ip_FL_weight, op_FR_ip_FR_weight) (0) 78 | #define msm_qti_pp_add_controls(platform) do {} while (0) 79 | #endif /* CONFIG_QTI_PP */ 80 | 81 | 82 | #if defined(CONFIG_QTI_PP) && defined(CONFIG_QTI_PP_AUDIOSPHERE) 83 | int msm_qti_pp_asphere_init(int port_id, int copp_idx); 84 | void msm_qti_pp_asphere_deinit(int port_id); 85 | #else 86 | #define msm_qti_pp_asphere_init(port_id, copp_idx) (0) 87 | #define msm_qti_pp_asphere_deinit(port_id) do {} while (0) 88 | #endif 89 | 90 | #endif /* _MSM_QTI_PP_H_ */ 91 | -------------------------------------------------------------------------------- /asoc/msm-slim-dma.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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 | */ 14 | #ifndef _MSM_SLIMBUS_DMA_H 15 | #define _MSM_SLIMBUS_DMA_H 16 | 17 | #include 18 | 19 | /* 20 | * struct msm_slim_dma_data - DMA data for slimbus data transfer 21 | * 22 | * @sdev: Handle to the slim_device instance associated with the 23 | * data transfer. 24 | * @ph: Port handle for the slimbus ports. 25 | * @dai_channel_ctl: callback function into the CPU dai driver 26 | * to setup the data path. 27 | * 28 | * This structure is used to share the slimbus port handles and 29 | * other data path setup related handles with other drivers. 30 | */ 31 | struct msm_slim_dma_data { 32 | 33 | /* Handle to slimbus device */ 34 | struct slim_device *sdev; 35 | 36 | /* Port Handle */ 37 | u32 ph; 38 | 39 | /* Callback for data channel control */ 40 | int (*dai_channel_ctl)(struct msm_slim_dma_data *dma_data, 41 | struct snd_soc_dai *dai, bool enable); 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /asoc/sdm660-common.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-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 | 13 | #ifndef __MSM_COMMON 14 | #define __MSM_COMMON 15 | 16 | #include 17 | #include 18 | #include "codecs/wcd-mbhc-v2.h" 19 | 20 | #define DEFAULT_MCLK_RATE 9600000 21 | #define NATIVE_MCLK_RATE 11289600 22 | 23 | #define SAMPLING_RATE_8KHZ 8000 24 | #define SAMPLING_RATE_11P025KHZ 11025 25 | #define SAMPLING_RATE_16KHZ 16000 26 | #define SAMPLING_RATE_22P05KHZ 22050 27 | #define SAMPLING_RATE_32KHZ 32000 28 | #define SAMPLING_RATE_44P1KHZ 44100 29 | #define SAMPLING_RATE_48KHZ 48000 30 | #define SAMPLING_RATE_88P2KHZ 88200 31 | #define SAMPLING_RATE_96KHZ 96000 32 | #define SAMPLING_RATE_176P4KHZ 176400 33 | #define SAMPLING_RATE_192KHZ 192000 34 | #define SAMPLING_RATE_352P8KHZ 352800 35 | #define SAMPLING_RATE_384KHZ 384000 36 | 37 | #define TDM_CHANNEL_MAX 8 38 | #define TDM_SLOT_OFFSET_MAX 8 39 | 40 | enum { 41 | TDM_0 = 0, 42 | TDM_1, 43 | TDM_2, 44 | TDM_3, 45 | TDM_4, 46 | TDM_5, 47 | TDM_6, 48 | TDM_7, 49 | TDM_PORT_MAX, 50 | }; 51 | 52 | enum { 53 | TDM_PRI = 0, 54 | TDM_SEC, 55 | TDM_TERT, 56 | TDM_QUAT, 57 | TDM_QUIN, 58 | TDM_INTERFACE_MAX, 59 | }; 60 | 61 | struct tdm_port { 62 | u32 mode; 63 | u32 channel; 64 | }; 65 | 66 | enum { 67 | PRIM_MI2S = 0, 68 | SEC_MI2S, 69 | TERT_MI2S, 70 | QUAT_MI2S, 71 | QUIN_MI2S, 72 | MI2S_MAX, 73 | }; 74 | 75 | enum { 76 | DIG_CDC, 77 | ANA_CDC, 78 | CODECS_MAX, 79 | }; 80 | 81 | extern const struct snd_kcontrol_new msm_common_snd_controls[]; 82 | extern bool codec_reg_done; 83 | struct sdm660_codec { 84 | void* (*get_afe_config_fn)(struct snd_soc_codec *codec, 85 | enum afe_config_type config_type); 86 | }; 87 | 88 | enum { 89 | INT_SND_CARD, 90 | EXT_SND_CARD_TASHA, 91 | EXT_SND_CARD_TAVIL, 92 | }; 93 | 94 | struct msm_asoc_mach_data { 95 | int us_euro_gpio; /* used by gpio driver API */ 96 | int hph_en1_gpio; 97 | int hph_en0_gpio; 98 | struct device_node *us_euro_gpio_p; /* used by pinctrl API */ 99 | struct device_node *hph_en1_gpio_p; /* used by pinctrl API */ 100 | struct device_node *hph_en0_gpio_p; /* used by pinctrl API */ 101 | struct device_node *pdm_gpio_p; /* used by pinctrl API */ 102 | struct device_node *comp_gpio_p; /* used by pinctrl API */ 103 | struct device_node *dmic_gpio_p; /* used by pinctrl API */ 104 | struct device_node *ext_spk_gpio_p; /* used by pinctrl API */ 105 | struct device_node *mi2s_gpio_p[MI2S_MAX]; /* used by pinctrl API */ 106 | struct snd_soc_codec *codec; 107 | struct sdm660_codec sdm660_codec_fn; 108 | struct snd_info_entry *codec_root; 109 | int spk_ext_pa_gpio; 110 | int mclk_freq; 111 | bool native_clk_set; 112 | int lb_mode; 113 | int snd_card_val; 114 | u8 micbias1_cap_mode; 115 | u8 micbias2_cap_mode; 116 | atomic_t int_mclk0_rsc_ref; 117 | atomic_t int_mclk0_enabled; 118 | struct mutex cdc_int_mclk0_mutex; 119 | struct delayed_work disable_int_mclk0_work; 120 | struct afe_clk_set digital_cdc_core_clk; 121 | }; 122 | 123 | int msm_common_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, 124 | struct snd_pcm_hw_params *params); 125 | int msm_aux_pcm_snd_startup(struct snd_pcm_substream *substream); 126 | void msm_aux_pcm_snd_shutdown(struct snd_pcm_substream *substream); 127 | int msm_mi2s_snd_startup(struct snd_pcm_substream *substream); 128 | void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream); 129 | int msm_common_snd_controls_size(void); 130 | void msm_set_codec_reg_done(bool done); 131 | #endif 132 | -------------------------------------------------------------------------------- /asoc/sdm660-external.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-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 | 13 | #ifndef __SDM660_EXTERNAL 14 | #define __SDM660_EXTERNAL 15 | 16 | int msm_snd_hw_params(struct snd_pcm_substream *substream, 17 | struct snd_pcm_hw_params *params); 18 | int msm_ext_slimbus_2_hw_params(struct snd_pcm_substream *substream, 19 | struct snd_pcm_hw_params *params); 20 | int msm_btsco_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, 21 | struct snd_pcm_hw_params *params); 22 | int msm_proxy_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, 23 | struct snd_pcm_hw_params *params); 24 | int msm_proxy_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, 25 | struct snd_pcm_hw_params *params); 26 | int msm_audrx_init(struct snd_soc_pcm_runtime *rtd); 27 | int msm_snd_cpe_hw_params(struct snd_pcm_substream *substream, 28 | struct snd_pcm_hw_params *params); 29 | struct snd_soc_card *populate_snd_card_dailinks(struct device *dev, 30 | int snd_card_val); 31 | int msm_ext_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, 32 | struct snd_pcm_hw_params *params); 33 | int msm_snd_card_tavil_late_probe(struct snd_soc_card *card); 34 | int msm_snd_card_tasha_late_probe(struct snd_soc_card *card); 35 | #if IS_ENABLED(CONFIG_SND_SOC_EXT_CODEC) 36 | int msm_ext_cdc_init(struct platform_device *, struct msm_asoc_mach_data *, 37 | struct snd_soc_card **, struct wcd_mbhc_config *); 38 | void msm_ext_register_audio_notifier(struct platform_device *pdev); 39 | #else 40 | inline int msm_ext_cdc_init(struct platform_device *pdev, 41 | struct msm_asoc_mach_data *pdata, 42 | struct snd_soc_card **card, 43 | struct wcd_mbhc_config *wcd_mbhc_cfg_ptr1) 44 | { 45 | return 0; 46 | } 47 | 48 | inline void msm_ext_register_audio_notifier(struct platform_device *pdev) 49 | { 50 | } 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /asoc/sdm660-internal.h: -------------------------------------------------------------------------------- 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 | 13 | #ifndef __SDM660_INTERNAL 14 | #define __SDM660_INTERNAL 15 | 16 | #include 17 | 18 | #if IS_ENABLED(CONFIG_SND_SOC_INT_CODEC) 19 | int msm_int_cdc_init(struct platform_device *pdev, 20 | struct msm_asoc_mach_data *pdata, 21 | struct snd_soc_card **card, 22 | struct wcd_mbhc_config *mbhc_cfg); 23 | #else 24 | int msm_int_cdc_init(struct platform_device *pdev, 25 | struct msm_asoc_mach_data *pdata, 26 | struct snd_soc_card **card, 27 | struct wcd_mbhc_config *mbhc_cfg) 28 | { 29 | return 0; 30 | } 31 | #endif 32 | #endif 33 | -------------------------------------------------------------------------------- /config/sdm670auto.conf: -------------------------------------------------------------------------------- 1 | CONFIG_PINCTRL_LPI=y 2 | CONFIG_PINCTRL_WCD=y 3 | CONFIG_AUDIO_EXT_CLK=y 4 | CONFIG_SND_SOC_WCD9XXX_V2=y 5 | CONFIG_SND_SOC_WCD_MBHC=y 6 | CONFIG_SND_SOC_WSA881X=y 7 | CONFIG_SND_SOC_WCD_DSP_MGR=y 8 | CONFIG_SND_SOC_WCD_SPI=y 9 | CONFIG_SND_SOC_WCD_CPE=y 10 | CONFIG_SND_SOC_WCD9335=y 11 | CONFIG_SND_SOC_WCD934X=y 12 | CONFIG_SND_SOC_WCD934X_MBHC=y 13 | CONFIG_SND_SOC_WCD934X_DSD=y 14 | CONFIG_MSM_QDSP6V2_CODECS=y 15 | CONFIG_MSM_ULTRASOUND=y 16 | CONFIG_MSM_QDSP6_APRV2_GLINK=y 17 | CONFIG_MSM_ADSP_LOADER=y 18 | CONFIG_REGMAP_SWR=y 19 | CONFIG_MSM_QDSP6_SSR=y 20 | CONFIG_MSM_QDSP6_PDR=y 21 | CONFIG_MSM_QDSP6_NOTIFIER=y 22 | CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y 23 | CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y 24 | CONFIG_SND_SOC_SDM670=y 25 | CONFIG_MSM_GLINK_SPI_XPRT=y 26 | CONFIG_SOUNDWIRE=y 27 | CONFIG_SOUNDWIRE_WCD_CTRL=y 28 | CONFIG_SND_SOC_QDSP6V2=y 29 | CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y 30 | CONFIG_WCD9XXX_CODEC_CORE=y 31 | CONFIG_MSM_CDC_PINCTRL=y 32 | CONFIG_SND_SOC_WCD_MBHC_ADC=y 33 | CONFIG_SND_SOC_WCD_MBHC_LEGACY=y 34 | CONFIG_QTI_PP=y 35 | CONFIG_SND_HWDEP=y 36 | CONFIG_DTS_EAGLE=y 37 | CONFIG_DOLBY_DS2=y 38 | CONFIG_DOLBY_LICENSE=y 39 | CONFIG_DTS_SRS_TM=y 40 | CONFIG_SND_SOC_EXT_CODEC=y 41 | CONFIG_SND_SOC_INT_CODEC=y 42 | CONFIG_SND_SOC_MSM_STUB=y 43 | CONFIG_WCD_DSP_GLINK=y 44 | CONFIG_MSM_AVTIMER=y 45 | CONFIG_SND_SOC_SDM660_CDC=y 46 | CONFIG_SND_SOC_ANALOG_CDC=y 47 | CONFIG_SND_SOC_DIGITAL_CDC=y 48 | CONFIG_SND_SOC_MSM_SDW=y 49 | CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=y 50 | -------------------------------------------------------------------------------- /config/sdm670autoconf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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 | 14 | #define CONFIG_PINCTRL_LPI 1 15 | #define CONFIG_PINCTRL_WCD 1 16 | #define CONFIG_AUDIO_EXT_CLK 1 17 | #define CONFIG_SND_SOC_WCD9XXX_V2 1 18 | #define CONFIG_SND_SOC_WCD_CPE 1 19 | #define CONFIG_SND_SOC_WCD_MBHC 1 20 | #define CONFIG_SND_SOC_WSA881X 1 21 | #define CONFIG_SND_SOC_WCD_DSP_MGR 1 22 | #define CONFIG_SND_SOC_WCD_SPI 1 23 | #define CONFIG_SND_SOC_WCD9335 1 24 | #define CONFIG_SND_SOC_WCD934X 1 25 | #define CONFIG_SND_SOC_WCD934X_MBHC 1 26 | #define CONFIG_SND_SOC_WCD934X_DSD 1 27 | #define CONFIG_MSM_QDSP6V2_CODECS 1 28 | #define CONFIG_MSM_ULTRASOUND 1 29 | #define CONFIG_MSM_QDSP6_APRV2_GLINK 1 30 | #define CONFIG_MSM_ADSP_LOADER 1 31 | #define CONFIG_REGMAP_SWR 1 32 | #define CONFIG_MSM_QDSP6_SSR 1 33 | #define CONFIG_MSM_QDSP6_PDR 1 34 | #define CONFIG_MSM_QDSP6_NOTIFIER 1 35 | #define CONFIG_SND_SOC_MSM_HOSTLESS_PCM 1 36 | #define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1 37 | #define CONFIG_SND_SOC_SDM670 1 38 | #define CONFIG_MSM_GLINK_SPI_XPRT 1 39 | #define CONFIG_SOUNDWIRE 1 40 | #define CONFIG_SOUNDWIRE_WCD_CTRL 1 41 | #define CONFIG_SND_SOC_WCD_MBHC_ADC 1 42 | #define CONFIG_SND_SOC_WCD_MBHC_LEGACY 1 43 | #define CONFIG_SND_SOC_QDSP6V2 1 44 | #define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1 45 | #define CONFIG_QTI_PP 1 46 | #define CONFIG_SND_HWDEP 1 47 | #define CONFIG_DTS_EAGLE 1 48 | #define CONFIG_DOLBY_DS2 1 49 | #define CONFIG_DOLBY_LICENSE 1 50 | #define CONFIG_DTS_SRS_TM 1 51 | #define CONFIG_WCD9XXX_CODEC_CORE 1 52 | #define CONFIG_MSM_CDC_PINCTRL 1 53 | #define CONFIG_SND_SOC_MSM_STUB 1 54 | #define CONFIG_WCD_DSP_GLINK 1 55 | #define CONFIG_MSM_AVTIMER 1 56 | #define CONFIG_SND_SOC_EXT_CODEC 1 57 | #define CONFIG_SND_SOC_INT_CODEC 1 58 | #define CONFIG_SND_SOC_SDM660_CDC 1 59 | #define CONFIG_SND_SOC_ANALOG_CDC 1 60 | #define CONFIG_SND_SOC_DIGITAL_CDC 1 61 | #define CONFIG_SND_SOC_MSM_SDW 1 62 | #define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1 63 | -------------------------------------------------------------------------------- /config/sdm845auto.conf: -------------------------------------------------------------------------------- 1 | CONFIG_PINCTRL_WCD=m 2 | CONFIG_SND_SOC_WCD9XXX_V2=m 3 | CONFIG_SND_SOC_WCD_MBHC=m 4 | CONFIG_SND_SOC_WSA881X=m 5 | CONFIG_SND_SOC_WCD_SPI=m 6 | CONFIG_SND_SOC_WCD934X=m 7 | CONFIG_SOUNDWIRE_WCD_CTRL=m 8 | CONFIG_WCD9XXX_CODEC_CORE=m 9 | CONFIG_MSM_CDC_PINCTRL=m 10 | CONFIG_SND_SOC_WCD934X_MBHC=m 11 | CONFIG_SND_SOC_WCD934X_DSD=m 12 | CONFIG_SND_SOC_MACHINE_SDM845=m 13 | CONFIG_WCD_DSP_GLINK=m 14 | CONFIG_MSM_QDSP6V2_CODECS=y 15 | CONFIG_MSM_ULTRASOUND=y 16 | CONFIG_MSM_QDSP6_APRV2_GLINK=y 17 | CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y 18 | CONFIG_MSM_ADSP_LOADER=y 19 | CONFIG_REGMAP_SWR=y 20 | CONFIG_MSM_QDSP6_SSR=y 21 | CONFIG_MSM_QDSP6_PDR=y 22 | CONFIG_MSM_QDSP6_NOTIFIER=y 23 | CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y 24 | CONFIG_SND_SOC_SDM845=y 25 | CONFIG_SND_SOC_MAX98927=y 26 | CONFIG_MSM_GLINK_SPI_XPRT=y 27 | CONFIG_SOUNDWIRE=y 28 | CONFIG_SND_SOC_QDSP6V2=y 29 | CONFIG_SND_SOC_WCD_MBHC_ADC=y 30 | CONFIG_QTI_PP=y 31 | CONFIG_SND_HWDEP=y 32 | CONFIG_DTS_EAGLE=y 33 | CONFIG_DOLBY_DS2=y 34 | CONFIG_DOLBY_LICENSE=y 35 | CONFIG_DTS_SRS_TM=y 36 | CONFIG_SND_SOC_MSM_STUB=y 37 | CONFIG_MSM_AVTIMER=y 38 | CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=y 39 | -------------------------------------------------------------------------------- /config/sdm845autoconf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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 | 14 | #define CONFIG_PINCTRL_WCD 1 15 | #define CONFIG_SND_SOC_WCD934X 1 16 | #define CONFIG_SND_SOC_WCD9XXX_V2 1 17 | #define CONFIG_SND_SOC_WCD_CPE 1 18 | #define CONFIG_SND_SOC_WCD_MBHC 1 19 | #define CONFIG_SND_SOC_WSA881X 1 20 | #define CONFIG_SND_SOC_WCD_SPI 1 21 | #define CONFIG_SND_SOC_WCD934X_MBHC 1 22 | #define CONFIG_SND_SOC_WCD934X_DSD 1 23 | #define CONFIG_MSM_QDSP6V2_CODECS 1 24 | #define CONFIG_MSM_ULTRASOUND 1 25 | #define CONFIG_MSM_QDSP6_APRV2_GLINK 1 26 | #define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1 27 | #define CONFIG_MSM_ADSP_LOADER 1 28 | #define CONFIG_REGMAP_SWR 1 29 | #define CONFIG_MSM_QDSP6_SSR 1 30 | #define CONFIG_MSM_QDSP6_PDR 1 31 | #define CONFIG_MSM_QDSP6_NOTIFIER 1 32 | #define CONFIG_SND_SOC_MSM_HOSTLESS_PCM 1 33 | #define CONFIG_SND_SOC_SDM845 1 34 | #define CONFIG_SND_SOC_MAX98927 1 35 | #define CONFIG_MSM_GLINK_SPI_XPRT 1 36 | #define CONFIG_SOUNDWIRE 1 37 | #define CONFIG_SOUNDWIRE_WCD_CTRL 1 38 | #define CONFIG_SND_SOC_WCD_MBHC_ADC 1 39 | #define CONFIG_SND_SOC_QDSP6V2 1 40 | #define CONFIG_MSM_CDC_PINCTRL 1 41 | #define CONFIG_QTI_PP 1 42 | #define CONFIG_SND_HWDEP 1 43 | #define CONFIG_DTS_EAGLE 1 44 | #define CONFIG_DOLBY_DS2 1 45 | #define CONFIG_DOLBY_LICENSE 1 46 | #define CONFIG_DTS_SRS_TM 1 47 | #define CONFIG_WCD9XXX_CODEC_CORE 1 48 | #define CONFIG_SND_SOC_MSM_STUB 1 49 | #define CONFIG_WCD_DSP_GLINK 1 50 | #define CONFIG_MSM_AVTIMER 1 51 | #define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1 52 | -------------------------------------------------------------------------------- /config/sdxpoorwillsauto.conf: -------------------------------------------------------------------------------- 1 | CONFIG_PINCTRL_WCD=y 2 | CONFIG_SND_SOC_WCD934X=y 3 | CONFIG_AUDIO_EXT_CLK=y 4 | CONFIG_SND_SOC_WCD9XXX_V2=y 5 | CONFIG_SND_SOC_WCD_MBHC=y 6 | CONFIG_SND_SOC_WSA881X=y 7 | CONFIG_SND_SOC_WCD_DSP_MGR=y 8 | CONFIG_SND_SOC_WCD934X=y 9 | CONFIG_SND_SOC_WCD934X_MBHC=y 10 | CONFIG_SND_SOC_WCD934X_DSD=y 11 | CONFIG_MSM_QDSP6V2_CODECS=y 12 | CONFIG_MSM_QDSP6_APRV3_GLINK=y 13 | CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y 14 | CONFIG_MSM_ADSP_LOADER=y 15 | CONFIG_REGMAP_SWR=y 16 | CONFIG_SND_SOC_MSM_HOSTLESS_PCM=y 17 | CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y 18 | CONFIG_SND_SOC_POORWILLS=y 19 | CONFIG_SOUNDWIRE=y 20 | CONFIG_SOUNDWIRE_WCD_CTRL=y 21 | CONFIG_SND_SOC_QDSP6V2=y 22 | CONFIG_SND_SOC_MSM_QDSP6V2_INTF=y 23 | CONFIG_MSM_CDC_PINCTRL=y 24 | CONFIG_WCD9XXX_CODEC_CORE=y 25 | CONFIG_SND_SOC_WCD_MBHC_ADC=y 26 | CONFIG_QTI_PP=y 27 | CONFIG_SND_HWDEP=y 28 | CONFIG_SND_SOC_MACHINE_SDXPOORWILLS=y 29 | CONFIG_SND_SOC_MSM_STUB=y 30 | -------------------------------------------------------------------------------- /config/sdxpoorwillsautoconf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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 | 14 | #define CONFIG_PINCTRL_WCD 1 15 | #define CONFIG_SND_SOC_WCD934X 1 16 | #define CONFIG_AUDIO_EXT_CLK 1 17 | #define CONFIG_SND_SOC_WCD9XXX_V2 1 18 | #define CONFIG_SND_SOC_WCD_MBHC 1 19 | #define CONFIG_SND_SOC_WSA881X 1 20 | #define CONFIG_SND_SOC_WCD_DSP_MGR 1 21 | #define CONFIG_SND_SOC_WCD934X 1 22 | #define CONFIG_SND_SOC_WCD934X_MBHC 1 23 | #define CONFIG_SND_SOC_WCD934X_DSD 1 24 | #define CONFIG_MSM_QDSP6V2_CODECS 1 25 | #define CONFIG_MSM_QDSP6_APRV3_GLINK 1 26 | #define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1 27 | #define CONFIG_MSM_ADSP_LOADER 1 28 | #define CONFIG_REGMAP_SWR 1 29 | #define CONFIG_SND_SOC_MSM_HOSTLESS_PCM 1 30 | #define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1 31 | #define CONFIG_SND_SOC_POORWILLS 1 32 | #define CONFIG_SOUNDWIRE 1 33 | #define CONFIG_SOUNDWIRE_WCD_CTRL 1 34 | #define CONFIG_SND_SOC_QDSP6V2 1 35 | #define CONFIG_SND_SOC_MSM_QDSP6V2_INTF 1 36 | #define CONFIG_MSM_CDC_PINCTRL 1 37 | #define CONFIG_WCD9XXX_CODEC_CORE 1 38 | #define CONFIG_SND_SOC_WCD_MBHC_ADC 1 39 | #define CONFIG_QTI_PP 1 40 | #define CONFIG_SND_HWDEP 1 41 | #define CONFIG_SND_SOC_MACHINE_SDXPOORWILLS 1 42 | #define CONFIG_SND_SOC_MSM_STUB 1 43 | -------------------------------------------------------------------------------- /dsp/Makefile: -------------------------------------------------------------------------------- 1 | obj-$(CONFIG_SND_SOC_MSM_QDSP6V2_INTF) += audio_calibration.o audio_cal_utils.o \ 2 | q6adm.o q6afe.o q6asm.o q6audio-v2.o q6voice.o q6core.o \ 3 | rtac.o q6lsm.o audio_slimslave.o adsp_err.o msm_audio_ion.o 4 | obj-$(CONFIG_MSM_ADSP_LOADER) += adsp-loader.o 5 | obj-$(CONFIG_MSM_QDSP6_SSR) += audio_ssr.o 6 | obj-$(CONFIG_MSM_QDSP6_PDR) += audio_pdr.o 7 | obj-$(CONFIG_MSM_QDSP6_NOTIFIER) += audio_notifier.o 8 | obj-$(CONFIG_MSM_ULTRASOUND) += usf.o usfcdev.o q6usm.o 9 | obj-$(CONFIG_MSM_AVTIMER) += avtimer.o 10 | obj-$(CONFIG_MSM_QDSP6V2_CODECS) += codecs/ 11 | -------------------------------------------------------------------------------- /dsp/adsp_err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016, 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 | 14 | #ifndef __ADSP_ERR__ 15 | #define __ADSP_ERR__ 16 | 17 | int adsp_err_get_lnx_err_code(u32 adsp_error); 18 | 19 | char *adsp_err_get_err_str(u32 adsp_error); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /dsp/audio_pdr.h: -------------------------------------------------------------------------------- 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 | */ 13 | 14 | #ifndef __AUDIO_PDR_H_ 15 | #define __AUDIO_PDR_H_ 16 | 17 | enum { 18 | AUDIO_PDR_DOMAIN_ADSP, 19 | AUDIO_PDR_DOMAIN_MAX 20 | }; 21 | 22 | enum { 23 | AUDIO_PDR_FRAMEWORK_DOWN, 24 | AUDIO_PDR_FRAMEWORK_UP 25 | }; 26 | 27 | #ifdef CONFIG_MSM_QDSP6_PDR 28 | 29 | /* 30 | * Use audio_pdr_register to register with the PDR subsystem this 31 | * should be done before module late init otherwise notification 32 | * of the AUDIO_PDR_FRAMEWORK_UP cannot be guaranteed. 33 | * 34 | * *nb - Pointer to a notifier block. Provide a callback function 35 | * to be notified once the PDR framework has been initialized. 36 | * Callback will receive either the AUDIO_PDR_FRAMEWORK_DOWN 37 | * or AUDIO_PDR_FRAMEWORK_UP ioctl depending on the state of 38 | * the PDR framework. 39 | * 40 | * Returns: Success: 0 41 | * Failure: Error code 42 | */ 43 | int audio_pdr_register(struct notifier_block *nb); 44 | 45 | /* 46 | * Use audio_pdr_service_register to register with a PDR service 47 | * Function should be called after nb callback registered with 48 | * audio_pdr_register has been called back with the 49 | * AUDIO_PDR_FRAMEWORK_UP ioctl. 50 | * 51 | * domain_id - Domain to use, example: AUDIO_PDR_ADSP 52 | * *nb - Pointer to a notifier block. Provide a callback function 53 | * that will be notified of the state of the domain 54 | * requested. The ioctls received by the callback are 55 | * defined in service-notifier.h. 56 | * 57 | * Returns: Success: Client handle 58 | * Failure: Pointer error code 59 | */ 60 | void *audio_pdr_service_register(int domain_id, 61 | struct notifier_block *nb, int *curr_state); 62 | 63 | /* 64 | * Use audio_pdr_service_deregister to deregister with a PDR 65 | * service that was registered using the audio_pdr_service_register 66 | * API. 67 | * 68 | * *service_handle - Service handle returned by audio_pdr_service_register 69 | * *nb - Pointer to the notifier block. Used in the call to 70 | * audio_pdr_service_register. 71 | * 72 | * Returns: Success: Client handle 73 | * Failure: Error code 74 | */ 75 | int audio_pdr_service_deregister(void *service_handle, 76 | struct notifier_block *nb); 77 | 78 | #else 79 | 80 | static inline int audio_pdr_register(struct notifier_block *nb) 81 | { 82 | return -ENODEV; 83 | } 84 | 85 | 86 | static inline void *audio_pdr_service_register(int domain_id, 87 | struct notifier_block *nb, 88 | int *curr_state) 89 | { 90 | return NULL; 91 | } 92 | 93 | static inline int audio_pdr_service_deregister(void *service_handle, 94 | struct notifier_block *nb) 95 | { 96 | return 0; 97 | } 98 | 99 | #endif /* CONFIG_MSM_QDSP6_PDR */ 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /dsp/audio_ssr.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016, 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 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include "audio_ssr.h" 18 | 19 | #define SCM_Q6_NMI_CMD 0x1 20 | 21 | static char *audio_ssr_domains[] = { 22 | "adsp", 23 | "modem" 24 | }; 25 | 26 | void *audio_ssr_register(int domain_id, struct notifier_block *nb) 27 | { 28 | if ((domain_id < 0) || 29 | (domain_id >= AUDIO_SSR_DOMAIN_MAX)) { 30 | pr_err("%s: Invalid service ID %d\n", __func__, domain_id); 31 | return ERR_PTR(-EINVAL); 32 | } 33 | 34 | return subsys_notif_register_notifier( 35 | audio_ssr_domains[domain_id], nb); 36 | } 37 | EXPORT_SYMBOL(audio_ssr_register); 38 | 39 | int audio_ssr_deregister(void *handle, struct notifier_block *nb) 40 | { 41 | return subsys_notif_unregister_notifier(handle, nb); 42 | } 43 | EXPORT_SYMBOL(audio_ssr_deregister); 44 | 45 | void audio_ssr_send_nmi(void *ssr_cb_data) 46 | { 47 | struct notif_data *data = (struct notif_data *)ssr_cb_data; 48 | struct scm_desc desc; 49 | 50 | if (data && data->crashed) { 51 | /* Send NMI to QDSP6 via an SCM call. */ 52 | if (!is_scm_armv8()) { 53 | scm_call_atomic1(SCM_SVC_UTIL, 54 | SCM_Q6_NMI_CMD, 0x1); 55 | } else { 56 | desc.args[0] = 0x1; 57 | desc.arginfo = SCM_ARGS(1); 58 | scm_call2_atomic(SCM_SIP_FNID(SCM_SVC_UTIL, 59 | SCM_Q6_NMI_CMD), &desc); 60 | } 61 | /* The write should go through before q6 is shutdown */ 62 | mb(); 63 | pr_debug("%s: Q6 NMI was sent.\n", __func__); 64 | } 65 | } 66 | EXPORT_SYMBOL(audio_ssr_send_nmi); 67 | -------------------------------------------------------------------------------- /dsp/audio_ssr.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016, 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 | */ 13 | 14 | #ifndef __AUDIO_SSR_H_ 15 | #define __AUDIO_SSR_H_ 16 | 17 | enum { 18 | AUDIO_SSR_DOMAIN_ADSP, 19 | AUDIO_SSR_DOMAIN_MODEM, 20 | AUDIO_SSR_DOMAIN_MAX 21 | }; 22 | 23 | #ifdef CONFIG_MSM_QDSP6_SSR 24 | 25 | /* 26 | * Use audio_ssr_register to register with the SSR subsystem 27 | * 28 | * domain_id - Service to use, example: AUDIO_SSR_DOMAIN_ADSP 29 | * *nb - Pointer to a notifier block. Provide a callback function 30 | * to be notified of an event for that service. The ioctls 31 | * used by the callback are defined in subsystem_notif.h. 32 | * 33 | * Returns: Success: Client handle 34 | * Failure: Pointer error code 35 | */ 36 | void *audio_ssr_register(int domain_id, struct notifier_block *nb); 37 | 38 | /* 39 | * Use audio_ssr_deregister to register with the SSR subsystem 40 | * 41 | * handle - Handle received from audio_ssr_register 42 | * *nb - Pointer to a notifier block. Callback function 43 | * Used from audio_ssr_register. 44 | * 45 | * Returns: Success: 0 46 | * Failure: Error code 47 | */ 48 | int audio_ssr_deregister(void *handle, struct notifier_block *nb); 49 | 50 | 51 | /* 52 | * Use audio_ssr_send_nmi to force a RAM dump on ADSP 53 | * down event. 54 | * 55 | * *ssr_cb_data - *data received from notifier callback 56 | */ 57 | void audio_ssr_send_nmi(void *ssr_cb_data); 58 | 59 | #else 60 | 61 | static inline void *audio_ssr_register(int domain_id, 62 | struct notifier_block *nb) 63 | { 64 | return NULL; 65 | } 66 | 67 | static inline int audio_ssr_deregister(void *handle, struct notifier_block *nb) 68 | { 69 | return 0; 70 | } 71 | 72 | static inline void audio_ssr_send_nmi(void *ssr_cb_data) 73 | { 74 | } 75 | 76 | #endif /* CONFIG_MSM_QDSP6_SSR */ 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /dsp/codecs/Makefile: -------------------------------------------------------------------------------- 1 | obj-$(CONFIG_MSM_QDSP6V2_CODECS) += aac_in.o qcelp_in.o evrc_in.o amrnb_in.o g711mlaw_in.o g711alaw_in.o audio_utils.o 2 | obj-$(CONFIG_MSM_QDSP6V2_CODECS) += audio_wma.o audio_wmapro.o audio_aac.o audio_multi_aac.o audio_alac.o audio_ape.o audio_utils_aio.o 3 | obj-$(CONFIG_MSM_QDSP6V2_CODECS) += q6audio_v2.o q6audio_v2_aio.o 4 | obj-$(CONFIG_MSM_QDSP6V2_CODECS) += audio_g711mlaw.o audio_g711alaw.o 5 | obj-$(CONFIG_MSM_QDSP6V2_CODECS) += audio_mp3.o audio_amrnb.o audio_amrwb.o audio_amrwbplus.o audio_evrc.o audio_qcelp.o amrwb_in.o audio_hwacc_effects.o 6 | -------------------------------------------------------------------------------- /dsp/codecs/audio_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010-2015, 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 | */ 13 | #include 14 | #include 15 | #include "q6audio_common.h" 16 | 17 | #define FRAME_NUM (8) 18 | 19 | #define PCM_BUF_COUNT (2) 20 | 21 | #define AUD_EOS_SET 0x01 22 | #define TUNNEL_MODE 0x0000 23 | #define NON_TUNNEL_MODE 0x0001 24 | 25 | #define NO_BUF_ALLOC 0x00 26 | #define BUF_ALLOC_IN 0x01 27 | #define BUF_ALLOC_OUT 0x02 28 | #define BUF_ALLOC_INOUT 0x03 29 | #define ALIGN_BUF_SIZE(size) ((size + 4095) & (~4095)) 30 | 31 | struct timestamp { 32 | u32 lowpart; 33 | u32 highpart; 34 | } __packed; 35 | 36 | struct meta_in { 37 | unsigned short offset; 38 | struct timestamp ntimestamp; 39 | unsigned int nflags; 40 | } __packed; 41 | 42 | struct meta_out_dsp { 43 | u32 offset_to_frame; 44 | u32 frame_size; 45 | u32 encoded_pcm_samples; 46 | u32 msw_ts; 47 | u32 lsw_ts; 48 | u32 nflags; 49 | } __packed; 50 | 51 | struct meta_out { 52 | unsigned char num_of_frames; 53 | struct meta_out_dsp meta_out_dsp[]; 54 | } __packed; 55 | 56 | struct q6audio_in { 57 | spinlock_t dsp_lock; 58 | atomic_t in_bytes; 59 | atomic_t in_samples; 60 | 61 | struct mutex lock; 62 | struct mutex read_lock; 63 | struct mutex write_lock; 64 | wait_queue_head_t read_wait; 65 | wait_queue_head_t write_wait; 66 | 67 | struct audio_client *ac; 68 | struct msm_audio_stream_config str_cfg; 69 | void *enc_cfg; 70 | struct msm_audio_buf_cfg buf_cfg; 71 | struct msm_audio_config pcm_cfg; 72 | void *codec_cfg; 73 | 74 | /* number of buffers available to read/write */ 75 | atomic_t in_count; 76 | atomic_t out_count; 77 | 78 | /* first idx: num of frames per buf, second idx: offset to frame */ 79 | uint32_t out_frame_info[FRAME_NUM][2]; 80 | int eos_rsp; 81 | int opened; 82 | int enabled; 83 | int stopped; 84 | int event_abort; 85 | int feedback; /* Flag indicates whether used 86 | * in Non Tunnel mode 87 | */ 88 | int rflush; 89 | int wflush; 90 | int buf_alloc; 91 | uint16_t min_frame_size; 92 | uint16_t max_frames_per_buf; 93 | bool reset_event; 94 | long (*enc_ioctl)(struct file *, unsigned int, unsigned long); 95 | long (*enc_compat_ioctl)(struct file *, unsigned int, unsigned long); 96 | }; 97 | 98 | int audio_in_enable(struct q6audio_in *audio); 99 | int audio_in_disable(struct q6audio_in *audio); 100 | int audio_in_buf_alloc(struct q6audio_in *audio); 101 | long audio_in_ioctl(struct file *file, 102 | unsigned int cmd, unsigned long arg); 103 | #ifdef CONFIG_COMPAT 104 | long audio_in_compat_ioctl(struct file *file, 105 | unsigned int cmd, unsigned long arg); 106 | #else 107 | #define audio_in_compat_ioctl NULL 108 | #endif 109 | ssize_t audio_in_read(struct file *file, char __user *buf, 110 | size_t count, loff_t *pos); 111 | ssize_t audio_in_write(struct file *file, const char __user *buf, 112 | size_t count, loff_t *pos); 113 | int audio_in_release(struct inode *inode, struct file *file); 114 | int audio_in_set_config(struct file *file, struct msm_audio_config *cfg); 115 | -------------------------------------------------------------------------------- /dsp/codecs/q6audio_common.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2014, 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 | */ 13 | 14 | 15 | /* For Decoders */ 16 | #ifndef __Q6_AUDIO_COMMON_H__ 17 | #define __Q6_AUDIO_COMMON_H__ 18 | 19 | #include 20 | #include 21 | 22 | 23 | void q6_audio_cb(uint32_t opcode, uint32_t token, 24 | uint32_t *payload, void *priv); 25 | 26 | void audio_aio_cb(uint32_t opcode, uint32_t token, 27 | uint32_t *payload, void *audio); 28 | 29 | 30 | /* For Encoders */ 31 | void q6asm_in_cb(uint32_t opcode, uint32_t token, 32 | uint32_t *payload, void *priv); 33 | 34 | void audio_in_get_dsp_frames(void *audio, 35 | uint32_t token, uint32_t *payload); 36 | 37 | #endif /*__Q6_AUDIO_COMMON_H__*/ 38 | -------------------------------------------------------------------------------- /dsp/codecs/q6audio_v2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2013, 2015-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 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "audio_utils.h" 25 | 26 | void q6asm_in_cb(uint32_t opcode, uint32_t token, 27 | uint32_t *payload, void *priv) 28 | { 29 | struct q6audio_in *audio = (struct q6audio_in *)priv; 30 | unsigned long flags; 31 | 32 | pr_debug("%s:session id %d: opcode[0x%x]\n", __func__, 33 | audio->ac->session, opcode); 34 | 35 | spin_lock_irqsave(&audio->dsp_lock, flags); 36 | switch (opcode) { 37 | case ASM_DATA_EVENT_READ_DONE_V2: 38 | audio_in_get_dsp_frames(audio, token, payload); 39 | break; 40 | case ASM_DATA_EVENT_WRITE_DONE_V2: 41 | atomic_inc(&audio->in_count); 42 | wake_up(&audio->write_wait); 43 | break; 44 | case ASM_DATA_EVENT_RENDERED_EOS: 45 | audio->eos_rsp = 1; 46 | wake_up(&audio->read_wait); 47 | break; 48 | case ASM_STREAM_CMDRSP_GET_PP_PARAMS_V2: 49 | break; 50 | case ASM_SESSION_EVENTX_OVERFLOW: 51 | pr_err("%s:session id %d: ASM_SESSION_EVENT_TX_OVERFLOW\n", 52 | __func__, audio->ac->session); 53 | break; 54 | case RESET_EVENTS: 55 | pr_debug("%s:received RESET EVENTS\n", __func__); 56 | audio->enabled = 0; 57 | audio->stopped = 1; 58 | audio->event_abort = 1; 59 | audio->reset_event = true; 60 | wake_up(&audio->read_wait); 61 | wake_up(&audio->write_wait); 62 | break; 63 | default: 64 | pr_debug("%s:session id %d: Ignore opcode[0x%x]\n", __func__, 65 | audio->ac->session, opcode); 66 | break; 67 | } 68 | spin_unlock_irqrestore(&audio->dsp_lock, flags); 69 | } 70 | 71 | void audio_in_get_dsp_frames(void *priv, 72 | uint32_t token, uint32_t *payload) 73 | { 74 | struct q6audio_in *audio = (struct q6audio_in *)priv; 75 | uint32_t index; 76 | 77 | index = q6asm_get_buf_index_from_token(token); 78 | pr_debug("%s:session id %d: index=%d nr frames=%d offset[%d]\n", 79 | __func__, audio->ac->session, token, payload[9], 80 | payload[5]); 81 | pr_debug("%s:session id %d: timemsw=%d lsw=%d\n", __func__, 82 | audio->ac->session, payload[7], payload[6]); 83 | pr_debug("%s:session id %d: uflags=0x%8x uid=0x%8x\n", __func__, 84 | audio->ac->session, payload[8], payload[10]); 85 | pr_debug("%s:session id %d: enc_framesotal_size=0x%8x\n", __func__, 86 | audio->ac->session, payload[4]); 87 | 88 | /* Ensure the index is within max array size: FRAME_NUM */ 89 | if (index >= FRAME_NUM) { 90 | pr_err("%s: Invalid index %d\n", 91 | __func__, index); 92 | return; 93 | } 94 | 95 | audio->out_frame_info[index][0] = payload[9]; 96 | audio->out_frame_info[index][1] = payload[5]; 97 | 98 | /* statistics of read */ 99 | atomic_add(payload[4], &audio->in_bytes); 100 | atomic_add(payload[9], &audio->in_samples); 101 | 102 | if (atomic_read(&audio->out_count) <= audio->str_cfg.buffer_count) { 103 | atomic_inc(&audio->out_count); 104 | wake_up(&audio->read_wait); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /dsp/usfcdev.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, 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 | */ 13 | #ifndef __USFCDEV_H__ 14 | #define __USFCDEV_H__ 15 | 16 | #include 17 | 18 | /* TSC event type index in the containers of the handlers & handles */ 19 | #define TSC_EVENT_TYPE_IND 0 20 | /* Number of supported event types to be filtered */ 21 | #define MAX_EVENT_TYPE_NUM 1 22 | 23 | bool usfcdev_register( 24 | uint16_t event_type_ind, 25 | bool (*match_cb)(uint16_t, struct input_dev *dev)); 26 | void usfcdev_unregister(uint16_t event_type_ind); 27 | bool usfcdev_set_filter(uint16_t event_type_ind, bool filter); 28 | #endif /* __USFCDEV_H__ */ 29 | -------------------------------------------------------------------------------- /include/Kbuild: -------------------------------------------------------------------------------- 1 | # Top-level Makefile calls into asm-$(ARCH) 2 | # List only non-arch directories below 3 | -------------------------------------------------------------------------------- /include/asoc/msm-dts-srs-tm-config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2014, 2017 The Linux Foundation. All rights reserved. 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_DTS_SRS_TM_CONFIG_H_ 14 | #define _MSM_DTS_SRS_TM_CONFIG_H_ 15 | 16 | #include 17 | #include 18 | 19 | struct param_outband; 20 | 21 | #ifdef CONFIG_DTS_SRS_TM 22 | 23 | union srs_trumedia_params_u { 24 | struct srs_trumedia_params srs_params; 25 | __u16 raw_params[1]; 26 | }; 27 | 28 | void msm_dts_srs_tm_ion_memmap(struct param_outband *po_); 29 | void msm_dts_srs_tm_init(int port_id, int copp_idx); 30 | void msm_dts_srs_tm_deinit(int port_id); 31 | void msm_dts_srs_tm_add_controls(struct snd_soc_platform *platform); 32 | #else 33 | static inline void msm_dts_srs_tm_ion_memmap(struct param_outband *po_) { } 34 | static inline void msm_dts_srs_tm_init(int port_id, int copp_idx) { } 35 | static inline void msm_dts_srs_tm_deinit(int port_id) { } 36 | static inline void msm_dts_srs_tm_add_controls( 37 | struct snd_soc_platform *platform) { } 38 | 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/dsp/audio_cal_utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 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 | */ 13 | #ifndef _AUDIO_CAL_UTILS_H 14 | #define _AUDIO_CAL_UTILS_H 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | struct cal_data { 22 | size_t size; 23 | void *kvaddr; 24 | phys_addr_t paddr; 25 | }; 26 | 27 | struct mem_map_data { 28 | size_t map_size; 29 | int32_t q6map_handle; 30 | int32_t ion_map_handle; 31 | struct ion_client *ion_client; 32 | struct ion_handle *ion_handle; 33 | }; 34 | 35 | struct cal_block_data { 36 | size_t client_info_size; 37 | void *client_info; 38 | void *cal_info; 39 | struct list_head list; 40 | struct cal_data cal_data; 41 | struct mem_map_data map_data; 42 | int32_t buffer_number; 43 | }; 44 | 45 | struct cal_util_callbacks { 46 | int (*map_cal) 47 | (int32_t cal_type, struct cal_block_data *cal_block); 48 | int (*unmap_cal) 49 | (int32_t cal_type, struct cal_block_data *cal_block); 50 | bool (*match_block) 51 | (struct cal_block_data *cal_block, void *user_data); 52 | }; 53 | 54 | struct cal_type_info { 55 | struct audio_cal_reg reg; 56 | struct cal_util_callbacks cal_util_callbacks; 57 | }; 58 | 59 | struct cal_type_data { 60 | struct cal_type_info info; 61 | struct mutex lock; 62 | struct list_head cal_blocks; 63 | }; 64 | 65 | 66 | /* to register & degregister with cal util driver */ 67 | int cal_utils_create_cal_types(int num_cal_types, 68 | struct cal_type_data **cal_type, 69 | struct cal_type_info *info); 70 | void cal_utils_destroy_cal_types(int num_cal_types, 71 | struct cal_type_data **cal_type); 72 | 73 | /* common functions for callbacks */ 74 | int cal_utils_alloc_cal(size_t data_size, void *data, 75 | struct cal_type_data *cal_type, 76 | size_t client_info_size, void *client_info); 77 | int cal_utils_dealloc_cal(size_t data_size, void *data, 78 | struct cal_type_data *cal_type); 79 | int cal_utils_set_cal(size_t data_size, void *data, 80 | struct cal_type_data *cal_type, 81 | size_t client_info_size, void *client_info); 82 | 83 | /* use for SSR */ 84 | void cal_utils_clear_cal_block_q6maps(int num_cal_types, 85 | struct cal_type_data **cal_type); 86 | 87 | 88 | /* common matching functions used to add blocks */ 89 | bool cal_utils_match_buf_num(struct cal_block_data *cal_block, 90 | void *user_data); 91 | 92 | /* common matching functions to find cal blocks */ 93 | struct cal_block_data *cal_utils_get_only_cal_block( 94 | struct cal_type_data *cal_type); 95 | 96 | /* Size of calibration specific data */ 97 | size_t get_cal_info_size(int32_t cal_type); 98 | size_t get_user_cal_type_size(int32_t cal_type); 99 | 100 | /* Version of the cal type*/ 101 | int32_t cal_utils_get_cal_type_version(void *cal_type_data); 102 | #endif 103 | -------------------------------------------------------------------------------- /include/dsp/audio_calibration.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 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 | */ 13 | #ifndef _AUDIO_CALIBRATION_H 14 | #define _AUDIO_CALIBRATION_H 15 | 16 | #include 17 | 18 | /* Used by driver in buffer_number field to notify client 19 | * To update all blocks, for example: freeing all memory 20 | */ 21 | #define ALL_CAL_BLOCKS -1 22 | 23 | 24 | struct audio_cal_callbacks { 25 | int (*alloc)(int32_t cal_type, size_t data_size, void *data); 26 | int (*dealloc)(int32_t cal_type, size_t data_size, void *data); 27 | int (*pre_cal)(int32_t cal_type, size_t data_size, void *data); 28 | int (*set_cal)(int32_t cal_type, size_t data_size, void *data); 29 | int (*get_cal)(int32_t cal_type, size_t data_size, void *data); 30 | int (*post_cal)(int32_t cal_type, size_t data_size, void *data); 31 | }; 32 | 33 | struct audio_cal_reg { 34 | int32_t cal_type; 35 | struct audio_cal_callbacks callbacks; 36 | }; 37 | 38 | int audio_cal_register(int num_cal_types, struct audio_cal_reg *reg_data); 39 | int audio_cal_deregister(int num_cal_types, struct audio_cal_reg *reg_data); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/dsp/audio_notifier.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2016, 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 | */ 13 | 14 | #ifndef __AUDIO_NOTIFIER_H_ 15 | #define __AUDIO_NOTIFIER_H_ 16 | 17 | /* State of the notifier domain */ 18 | enum { 19 | AUDIO_NOTIFIER_SERVICE_DOWN, 20 | AUDIO_NOTIFIER_SERVICE_UP 21 | }; 22 | 23 | /* Service order determines connection priority 24 | * Highest number connected first 25 | */ 26 | enum { 27 | AUDIO_NOTIFIER_SSR_SERVICE, 28 | AUDIO_NOTIFIER_PDR_SERVICE, 29 | AUDIO_NOTIFIER_MAX_SERVICES 30 | }; 31 | 32 | enum { 33 | AUDIO_NOTIFIER_ADSP_DOMAIN, 34 | AUDIO_NOTIFIER_MODEM_DOMAIN, 35 | AUDIO_NOTIFIER_MAX_DOMAINS 36 | }; 37 | 38 | /* Structure populated in void *data of nb function 39 | * callback used for audio_notifier_register 40 | */ 41 | struct audio_notifier_cb_data { 42 | int service; 43 | int domain; 44 | }; 45 | 46 | #ifdef CONFIG_MSM_QDSP6_NOTIFIER 47 | 48 | /* 49 | * Use audio_notifier_register to register any audio 50 | * clients who need to be notified of a remote process. 51 | * This API will determine and register the client with 52 | * the best available subsystem (SSR or PDR) for that 53 | * domain (Adsp or Modem). When an event is sent from that 54 | * domain the notifier block callback function will be called. 55 | * 56 | * client_name - A unique user name defined by the client. 57 | * If the same name is used for multiple calls each will 58 | * be tracked & called back separately and a single call 59 | * to deregister will delete them all. 60 | * domain - Domain the client wants to get events from. 61 | * AUDIO_NOTIFIER_ADSP_DOMAIN 62 | * AUDIO_NOTIFIER_MODEM_DOMAIN 63 | * *nb - Pointer to a notifier block. Provide a callback function 64 | * to be notified of an even on that domain. 65 | * 66 | * nb_func(struct notifier_block *this, unsigned long opcode, void *data) 67 | * this - pointer to own nb 68 | * opcode - event from registered domain 69 | * AUDIO_NOTIFIER_SERVICE_DOWN 70 | * AUDIO_NOTIFIER_SERVICE_UP 71 | * *data - pointer to struct audio_notifier_cb_data 72 | * 73 | * Returns: Success: 0 74 | * Error: -# 75 | */ 76 | int audio_notifier_register(char *client_name, int domain, 77 | struct notifier_block *nb); 78 | 79 | /* 80 | * Use audio_notifier_deregister to deregister the clients from 81 | * all domains registered using audio_notifier_register that 82 | * match the client name. 83 | * 84 | * client_name - Unique user name used in audio_notifier_register. 85 | * Returns: Success: 0 86 | * Error: -# 87 | */ 88 | int audio_notifier_deregister(char *client_name); 89 | 90 | #else 91 | 92 | static inline int audio_notifier_register(char *client_name, int domain, 93 | struct notifier_block *nb) 94 | { 95 | return -ENODEV; 96 | } 97 | 98 | static inline int audio_notifier_deregister(char *client_name) 99 | { 100 | return 0; 101 | } 102 | 103 | #endif /* CONFIG_MSM_QDSP6_PDR */ 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /include/dsp/msm-audio-effects-q6-v2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016, 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 | 14 | #ifndef _MSM_AUDIO_EFFECTS_H 15 | #define _MSM_AUDIO_EFFECTS_H 16 | 17 | #include 18 | 19 | #define MAX_PP_PARAMS_SZ 128 20 | 21 | bool msm_audio_effects_is_effmodule_supp_in_top(int effect_module, 22 | int topology); 23 | 24 | int msm_audio_effects_enable_extn(struct audio_client *ac, 25 | struct msm_nt_eff_all_config *effects, 26 | bool flag); 27 | 28 | int msm_audio_effects_reverb_handler(struct audio_client *ac, 29 | struct reverb_params *reverb, 30 | long *values); 31 | 32 | int msm_audio_effects_bass_boost_handler(struct audio_client *ac, 33 | struct bass_boost_params *bass_boost, 34 | long *values); 35 | 36 | int msm_audio_effects_pbe_handler(struct audio_client *ac, 37 | struct pbe_params *pbe, 38 | long *values); 39 | 40 | int msm_audio_effects_virtualizer_handler(struct audio_client *ac, 41 | struct virtualizer_params *virtualizer, 42 | long *values); 43 | 44 | int msm_audio_effects_popless_eq_handler(struct audio_client *ac, 45 | struct eq_params *eq, 46 | long *values); 47 | 48 | int msm_audio_effects_volume_handler(struct audio_client *ac, 49 | struct soft_volume_params *vol, 50 | long *values); 51 | 52 | int msm_audio_effects_volume_handler_v2(struct audio_client *ac, 53 | struct soft_volume_params *vol, 54 | long *values, int instance); 55 | #endif /*_MSM_AUDIO_EFFECTS_H*/ 56 | -------------------------------------------------------------------------------- /include/dsp/msm_audio_ion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2015, 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 | 14 | #ifndef _LINUX_MSM_AUDIO_ION_H 15 | #define _LINUX_MSM_AUDIO_ION_H 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | int msm_audio_ion_alloc(const char *name, struct ion_client **client, 22 | struct ion_handle **handle, size_t bufsz, 23 | ion_phys_addr_t *paddr, size_t *pa_len, void **vaddr); 24 | 25 | int msm_audio_ion_import(const char *name, struct ion_client **client, 26 | struct ion_handle **handle, int fd, 27 | unsigned long *ionflag, size_t bufsz, 28 | ion_phys_addr_t *paddr, size_t *pa_len, void **vaddr); 29 | int msm_audio_ion_free(struct ion_client *client, struct ion_handle *handle); 30 | int msm_audio_ion_mmap(struct audio_buffer *substream, 31 | struct vm_area_struct *vma); 32 | 33 | bool msm_audio_ion_is_smmu_available(void); 34 | int msm_audio_ion_cache_operations(struct audio_buffer *abuff, int cache_op); 35 | 36 | struct ion_client *msm_audio_ion_client_create(const char *name); 37 | void msm_audio_ion_client_destroy(struct ion_client *client); 38 | int msm_audio_ion_import_legacy(const char *name, struct ion_client *client, 39 | struct ion_handle **handle, int fd, 40 | unsigned long *ionflag, size_t bufsz, 41 | ion_phys_addr_t *paddr, size_t *pa_len, void **vaddr); 42 | int msm_audio_ion_free_legacy(struct ion_client *client, 43 | struct ion_handle *handle); 44 | u32 msm_audio_populate_upper_32_bits(ion_phys_addr_t pa); 45 | #endif /* _LINUX_MSM_AUDIO_ION_H */ 46 | -------------------------------------------------------------------------------- /include/dsp/q6audio-v2.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012-2013, 2015 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 | 13 | #ifndef _Q6_AUDIO_H_ 14 | #define _Q6_AUDIO_H_ 15 | 16 | #include 17 | 18 | enum { 19 | LEGACY_PCM_MODE = 0, 20 | LOW_LATENCY_PCM_MODE, 21 | ULTRA_LOW_LATENCY_PCM_MODE, 22 | ULL_POST_PROCESSING_PCM_MODE, 23 | }; 24 | 25 | 26 | int q6audio_get_port_index(u16 port_id); 27 | 28 | int q6audio_convert_virtual_to_portid(u16 port_id); 29 | 30 | int q6audio_validate_port(u16 port_id); 31 | 32 | int q6audio_is_digital_pcm_interface(u16 port_id); 33 | 34 | int q6audio_get_port_id(u16 port_id); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /include/dsp/rtac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, 2013-2015, 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 | */ 14 | 15 | #ifndef __RTAC_H__ 16 | #define __RTAC_H__ 17 | 18 | #include 19 | 20 | /* Voice Modes */ 21 | #define RTAC_CVP 0 22 | #define RTAC_CVS 1 23 | #define RTAC_VOICE_MODES 2 24 | 25 | #define RTAC_MAX_ACTIVE_DEVICES 4 26 | #define RTAC_MAX_ACTIVE_POPP 8 27 | 28 | #define DEFAULT_APP_TYPE 0x00011130 29 | 30 | enum { 31 | ADM_RTAC_CAL, 32 | ASM_RTAC_CAL, 33 | VOICE_RTAC_CAL, 34 | AFE_RTAC_CAL, 35 | MAX_RTAC_BLOCKS 36 | }; 37 | 38 | struct rtac_cal_mem_map_data { 39 | uint32_t map_size; 40 | uint32_t map_handle; 41 | struct ion_client *ion_client; 42 | struct ion_handle *ion_handle; 43 | }; 44 | 45 | struct rtac_cal_data { 46 | size_t size; 47 | void *kvaddr; 48 | phys_addr_t paddr; 49 | }; 50 | 51 | struct rtac_cal_block_data { 52 | struct rtac_cal_mem_map_data map_data; 53 | struct rtac_cal_data cal_data; 54 | }; 55 | 56 | struct rtac_popp_data { 57 | uint32_t popp; 58 | uint32_t popp_topology; 59 | uint32_t app_type; 60 | }; 61 | 62 | struct rtac_adm_data { 63 | uint32_t topology_id; 64 | uint32_t afe_topology; 65 | uint32_t afe_port; 66 | uint32_t copp; 67 | uint32_t num_of_popp; 68 | uint32_t app_type; 69 | uint32_t acdb_dev_id; 70 | struct rtac_popp_data popp[RTAC_MAX_ACTIVE_POPP]; 71 | }; 72 | 73 | struct rtac_adm { 74 | uint32_t num_of_dev; 75 | struct rtac_adm_data device[RTAC_MAX_ACTIVE_DEVICES]; 76 | }; 77 | 78 | void rtac_add_adm_device(u32 port_id, u32 copp_id, u32 path_id, u32 popp_id, 79 | u32 app_type, u32 acdb_dev_id); 80 | void rtac_remove_adm_device(u32 port_id, u32 copp_id); 81 | void rtac_remove_popp_from_adm_devices(u32 popp_id); 82 | void rtac_add_voice(u32 cvs_handle, u32 cvp_handle, u32 rx_afe_port, 83 | u32 tx_afe_port, u32 rx_acdb_id, u32 tx_acdb_id, u32 session_id); 84 | void rtac_remove_voice(u32 cvs_handle); 85 | void rtac_set_adm_handle(void *handle); 86 | bool rtac_make_adm_callback(uint32_t *payload, u32 payload_size); 87 | void rtac_copy_adm_payload_to_user(void *payload, u32 payload_size); 88 | void rtac_set_asm_handle(u32 session_id, void *handle); 89 | bool rtac_make_asm_callback(u32 session_id, uint32_t *payload, 90 | u32 payload_size); 91 | void rtac_copy_asm_payload_to_user(void *payload, u32 payload_size); 92 | void rtac_set_voice_handle(u32 mode, void *handle); 93 | bool rtac_make_voice_callback(u32 mode, uint32_t *payload, u32 payload_size); 94 | void rtac_copy_voice_payload_to_user(void *payload, u32 payload_size); 95 | int rtac_clear_mapping(uint32_t cal_type); 96 | bool rtac_make_afe_callback(uint32_t *payload, u32 payload_size); 97 | void rtac_set_afe_handle(void *handle); 98 | void get_rtac_adm_data(struct rtac_adm *adm_data); 99 | void rtac_update_afe_topology(u32 port_id); 100 | #endif 101 | -------------------------------------------------------------------------------- /include/ipc/apr_tal.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2010-2011, 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 | */ 13 | #ifndef __APR_TAL_H_ 14 | #define __APR_TAL_H_ 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | /* APR Client IDs */ 21 | #define APR_CLIENT_AUDIO 0x0 22 | #define APR_CLIENT_VOICE 0x1 23 | #define APR_CLIENT_MAX 0x2 24 | 25 | #define APR_DL_SMD 0 26 | #define APR_DL_MAX 1 27 | 28 | #define APR_DEST_MODEM 0 29 | #define APR_DEST_QDSP6 1 30 | #define APR_DEST_MAX 2 31 | 32 | #if defined(CONFIG_MSM_QDSP6_APRV2_GLINK) || \ 33 | defined(CONFIG_MSM_QDSP6_APRV3_GLINK) 34 | #define APR_MAX_BUF 512 35 | #else 36 | #define APR_MAX_BUF 8092 37 | #endif 38 | 39 | #define APR_DEFAULT_NUM_OF_INTENTS 20 40 | 41 | #define APR_OPEN_TIMEOUT_MS 5000 42 | 43 | enum { 44 | /* If client sets the pkt_owner to APR_PKT_OWNER_DRIVER, APR 45 | * driver will allocate a buffer, where the user packet is 46 | * copied into, for each and every single Tx transmission. 47 | * The buffer is thereafter passed to underlying link layer 48 | * and freed upon the notification received from the link layer 49 | * that the packet has been consumed. 50 | */ 51 | APR_PKT_OWNER_DRIVER, 52 | /* If client sets the pkt_owner to APR_PKT_OWNER_CLIENT, APR 53 | * will pass the user packet memory address directly to underlying 54 | * link layer. In this case it is the client's responsibility to 55 | * make sure the packet is intact until being notified that the 56 | * packet has been consumed. 57 | */ 58 | APR_PKT_OWNER_CLIENT, 59 | }; 60 | 61 | struct apr_pkt_priv { 62 | /* This property is only applicable for APR over Glink. 63 | * It is ignored in APR over SMD cases. 64 | */ 65 | uint8_t pkt_owner; 66 | }; 67 | 68 | typedef void (*apr_svc_cb_fn)(void *buf, int len, void *priv); 69 | struct apr_svc_ch_dev *apr_tal_open(uint32_t svc, uint32_t dest, 70 | uint32_t dl, apr_svc_cb_fn func, void *priv); 71 | int apr_tal_write(struct apr_svc_ch_dev *apr_ch, void *data, 72 | struct apr_pkt_priv *pkt_priv, int len); 73 | int apr_tal_close(struct apr_svc_ch_dev *apr_ch); 74 | int apr_tal_rx_intents_config(struct apr_svc_ch_dev *apr_ch, 75 | int num_of_intents, uint32_t size); 76 | int apr_tal_start_rx_rt(struct apr_svc_ch_dev *apr_ch); 77 | int apr_tal_end_rx_rt(struct apr_svc_ch_dev *apr_ch); 78 | 79 | struct apr_svc_ch_dev { 80 | void *handle; 81 | spinlock_t w_lock; 82 | spinlock_t r_lock; 83 | struct mutex m_lock; 84 | apr_svc_cb_fn func; 85 | wait_queue_head_t wait; 86 | void *priv; 87 | unsigned int channel_state; 88 | bool if_remote_intent_ready; 89 | }; 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /include/soc/internal.h: -------------------------------------------------------------------------------- 1 | ../../../../drivers/base/regmap/internal.h -------------------------------------------------------------------------------- /include/soc/swr-wcd.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, 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 | 13 | #ifndef _LINUX_SWR_WCD_H 14 | #define _LINUX_SWR_WCD_H 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | enum { 21 | SWR_CH_MAP, 22 | SWR_DEVICE_DOWN, 23 | SWR_DEVICE_UP, 24 | SWR_SUBSYS_RESTART, 25 | SWR_SET_NUM_RX_CH, 26 | }; 27 | 28 | struct swr_mstr_port { 29 | int num_port; 30 | u8 *port; 31 | }; 32 | 33 | #if IS_ENABLED(CONFIG_SOUNDWIRE_WCD_CTRL) 34 | extern int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data); 35 | #else /* CONFIG_SOUNDWIRE_WCD_CTRL */ 36 | static inline int swrm_wcd_notify(struct platform_device *pdev, u32 id, 37 | void *data) 38 | { 39 | return 0; 40 | } 41 | #endif /* CONFIG_SOUNDWIRE_WCD_CTRL */ 42 | #endif /* _LINUX_SWR_WCD_H */ 43 | -------------------------------------------------------------------------------- /include/uapi/Kbuild: -------------------------------------------------------------------------------- 1 | # UAPI Header export list 2 | # Top-level Makefile calls into asm-$(ARCH) 3 | # List only non-arch directories below 4 | 5 | header-y += linux/ 6 | header-y += sound/ 7 | -------------------------------------------------------------------------------- /include/uapi/linux/Kbuild: -------------------------------------------------------------------------------- 1 | # UAPI Header export list 2 | header-y += avtimer.h 3 | header-y += msm_audio.h 4 | header-y += msm_audio_aac.h 5 | header-y += msm_audio_ac3.h 6 | header-y += msm_audio_amrnb.h 7 | header-y += msm_audio_amrwb.h 8 | header-y += msm_audio_amrwbplus.h 9 | header-y += msm_audio_calibration.h 10 | header-y += msm_audio_mvs.h 11 | header-y += msm_audio_qcp.h 12 | header-y += msm_audio_sbc.h 13 | header-y += msm_audio_voicememo.h 14 | header-y += msm_audio_wma.h 15 | header-y += msm_audio_wmapro.h 16 | header-y += msm_audio_alac.h 17 | header-y += msm_audio_ape.h 18 | header-y += msm_audio_g711.h 19 | header-y += msm_audio_g711_dec.h 20 | -------------------------------------------------------------------------------- /include/uapi/linux/avtimer.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_AVTIMER_H 2 | #define _UAPI_AVTIMER_H 3 | 4 | #include 5 | 6 | #define MAJOR_NUM 100 7 | 8 | #define IOCTL_GET_AVTIMER_TICK _IOR(MAJOR_NUM, 0, uint64_t) 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_aac.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_AAC_H 2 | #define _UAPI_MSM_AUDIO_AAC_H 3 | 4 | #include 5 | 6 | #define AUDIO_SET_AAC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), struct msm_audio_aac_config) 8 | #define AUDIO_GET_AAC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 9 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), struct msm_audio_aac_config) 10 | 11 | #define AUDIO_SET_AAC_ENC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 12 | (AUDIO_MAX_COMMON_IOCTL_NUM+3), struct msm_audio_aac_enc_config) 13 | 14 | #define AUDIO_GET_AAC_ENC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 15 | (AUDIO_MAX_COMMON_IOCTL_NUM+4), struct msm_audio_aac_enc_config) 16 | 17 | #define AUDIO_SET_AAC_MIX_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 18 | (AUDIO_MAX_COMMON_IOCTL_NUM+5), uint32_t) 19 | 20 | #define AUDIO_AAC_FORMAT_ADTS -1 21 | #define AUDIO_AAC_FORMAT_RAW 0x0000 22 | #define AUDIO_AAC_FORMAT_PSUEDO_RAW 0x0001 23 | #define AUDIO_AAC_FORMAT_LOAS 0x0002 24 | #define AUDIO_AAC_FORMAT_ADIF 0x0003 25 | 26 | #define AUDIO_AAC_OBJECT_LC 0x0002 27 | #define AUDIO_AAC_OBJECT_LTP 0x0004 28 | #define AUDIO_AAC_OBJECT_ERLC 0x0011 29 | #define AUDIO_AAC_OBJECT_BSAC 0x0016 30 | 31 | #define AUDIO_AAC_SEC_DATA_RES_ON 0x0001 32 | #define AUDIO_AAC_SEC_DATA_RES_OFF 0x0000 33 | 34 | #define AUDIO_AAC_SCA_DATA_RES_ON 0x0001 35 | #define AUDIO_AAC_SCA_DATA_RES_OFF 0x0000 36 | 37 | #define AUDIO_AAC_SPEC_DATA_RES_ON 0x0001 38 | #define AUDIO_AAC_SPEC_DATA_RES_OFF 0x0000 39 | 40 | #define AUDIO_AAC_SBR_ON_FLAG_ON 0x0001 41 | #define AUDIO_AAC_SBR_ON_FLAG_OFF 0x0000 42 | 43 | #define AUDIO_AAC_SBR_PS_ON_FLAG_ON 0x0001 44 | #define AUDIO_AAC_SBR_PS_ON_FLAG_OFF 0x0000 45 | 46 | /* Primary channel on both left and right channels */ 47 | #define AUDIO_AAC_DUAL_MONO_PL_PR 0 48 | /* Secondary channel on both left and right channels */ 49 | #define AUDIO_AAC_DUAL_MONO_SL_SR 1 50 | /* Primary channel on right channel and 2nd on left channel */ 51 | #define AUDIO_AAC_DUAL_MONO_SL_PR 2 52 | /* 2nd channel on right channel and primary on left channel */ 53 | #define AUDIO_AAC_DUAL_MONO_PL_SR 3 54 | 55 | struct msm_audio_aac_config { 56 | signed short format; 57 | unsigned short audio_object; 58 | unsigned short ep_config; /* 0 ~ 3 useful only obj = ERLC */ 59 | unsigned short aac_section_data_resilience_flag; 60 | unsigned short aac_scalefactor_data_resilience_flag; 61 | unsigned short aac_spectral_data_resilience_flag; 62 | unsigned short sbr_on_flag; 63 | unsigned short sbr_ps_on_flag; 64 | unsigned short dual_mono_mode; 65 | unsigned short channel_configuration; 66 | unsigned short sample_rate; 67 | }; 68 | 69 | struct msm_audio_aac_enc_config { 70 | uint32_t channels; 71 | uint32_t sample_rate; 72 | uint32_t bit_rate; 73 | uint32_t stream_format; 74 | }; 75 | 76 | #endif /* _UAPI_MSM_AUDIO_AAC_H */ 77 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_ac3.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_AC3_H 2 | #define _UAPI_MSM_AUDIO_AC3_H 3 | 4 | #include 5 | 6 | #define AUDIO_SET_AC3_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned int) 8 | #define AUDIO_GET_AC3_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 9 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned int) 10 | 11 | #define AUDAC3_DEF_WORDSIZE 0 12 | #define AUDAC3_DEF_USER_DOWNMIX_FLAG 0x0 13 | #define AUDAC3_DEF_USER_KARAOKE_FLAG 0x0 14 | #define AUDAC3_DEF_ERROR_CONCEALMENT 0 15 | #define AUDAC3_DEF_MAX_REPEAT_COUNT 0 16 | 17 | struct msm_audio_ac3_config { 18 | unsigned short numChans; 19 | unsigned short wordSize; 20 | unsigned short kCapableMode; 21 | unsigned short compMode; 22 | unsigned short outLfeOn; 23 | unsigned short outputMode; 24 | unsigned short stereoMode; 25 | unsigned short dualMonoMode; 26 | unsigned short fsCod; 27 | unsigned short pcmScaleFac; 28 | unsigned short dynRngScaleHi; 29 | unsigned short dynRngScaleLow; 30 | unsigned short user_downmix_flag; 31 | unsigned short user_karaoke_flag; 32 | unsigned short dm_address_high; 33 | unsigned short dm_address_low; 34 | unsigned short ko_address_high; 35 | unsigned short ko_address_low; 36 | unsigned short error_concealment; 37 | unsigned short max_rep_count; 38 | unsigned short channel_routing_mode[6]; 39 | }; 40 | 41 | #endif /* _UAPI_MSM_AUDIO_AC3_H */ 42 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_alac.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_ALAC_H 2 | #define _UAPI_MSM_AUDIO_ALAC_H 3 | 4 | #define AUDIO_GET_ALAC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 5 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), struct msm_audio_alac_config) 6 | #define AUDIO_SET_ALAC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), struct msm_audio_alac_config) 8 | 9 | struct msm_audio_alac_config { 10 | uint32_t frameLength; 11 | uint8_t compatVersion; 12 | uint8_t bitDepth; 13 | uint8_t pb; /* currently unused */ 14 | uint8_t mb; /* currently unused */ 15 | uint8_t kb; /* currently unused */ 16 | uint8_t channelCount; 17 | uint16_t maxRun; /* currently unused */ 18 | uint32_t maxSize; 19 | uint32_t averageBitRate; 20 | uint32_t sampleRate; 21 | uint32_t channelLayout; 22 | }; 23 | 24 | #endif /* _UAPI_MSM_AUDIO_ALAC_H */ 25 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_amrnb.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_AMRNB_H 2 | #define _UAPI_MSM_AUDIO_AMRNB_H 3 | 4 | #include 5 | 6 | #define AUDIO_GET_AMRNB_ENC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned int) 8 | #define AUDIO_SET_AMRNB_ENC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 9 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned int) 10 | #define AUDIO_GET_AMRNB_ENC_CONFIG_V2 _IOW(AUDIO_IOCTL_MAGIC, \ 11 | (AUDIO_MAX_COMMON_IOCTL_NUM+2), \ 12 | struct msm_audio_amrnb_enc_config_v2) 13 | #define AUDIO_SET_AMRNB_ENC_CONFIG_V2 _IOR(AUDIO_IOCTL_MAGIC, \ 14 | (AUDIO_MAX_COMMON_IOCTL_NUM+3), \ 15 | struct msm_audio_amrnb_enc_config_v2) 16 | 17 | struct msm_audio_amrnb_enc_config { 18 | unsigned short voicememoencweight1; 19 | unsigned short voicememoencweight2; 20 | unsigned short voicememoencweight3; 21 | unsigned short voicememoencweight4; 22 | unsigned short dtx_mode_enable; /* 0xFFFF - enable, 0- disable */ 23 | unsigned short test_mode_enable; /* 0xFFFF - enable, 0- disable */ 24 | unsigned short enc_mode; /* 0-MR475,1-MR515,2-MR59,3-MR67,4-MR74 25 | * 5-MR795, 6- MR102, 7- MR122(default) 26 | */ 27 | }; 28 | 29 | struct msm_audio_amrnb_enc_config_v2 { 30 | uint32_t band_mode; 31 | uint32_t dtx_enable; 32 | uint32_t frame_format; 33 | }; 34 | #endif /* _UAPI_MSM_AUDIO_AMRNB_H */ 35 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_amrwb.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_AMRWB_H 2 | #define _UAPI_MSM_AUDIO_AMRWB_H 3 | 4 | #include 5 | 6 | #define AUDIO_GET_AMRWB_ENC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), \ 8 | struct msm_audio_amrwb_enc_config) 9 | #define AUDIO_SET_AMRWB_ENC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 10 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), \ 11 | struct msm_audio_amrwb_enc_config) 12 | 13 | struct msm_audio_amrwb_enc_config { 14 | uint32_t band_mode; 15 | uint32_t dtx_enable; 16 | uint32_t frame_format; 17 | }; 18 | #endif /* _UAPI_MSM_AUDIO_AMRWB_H */ 19 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_amrwbplus.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_AMR_WB_PLUS_H 2 | #define _UAPI_MSM_AUDIO_AMR_WB_PLUS_H 3 | 4 | #define AUDIO_GET_AMRWBPLUS_CONFIG_V2 _IOR(AUDIO_IOCTL_MAGIC, \ 5 | (AUDIO_MAX_COMMON_IOCTL_NUM+2), struct msm_audio_amrwbplus_config_v2) 6 | #define AUDIO_SET_AMRWBPLUS_CONFIG_V2 _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+3), struct msm_audio_amrwbplus_config_v2) 8 | 9 | struct msm_audio_amrwbplus_config_v2 { 10 | unsigned int size_bytes; 11 | unsigned int version; 12 | unsigned int num_channels; 13 | unsigned int amr_band_mode; 14 | unsigned int amr_dtx_mode; 15 | unsigned int amr_frame_fmt; 16 | unsigned int amr_lsf_idx; 17 | }; 18 | #endif /* _UAPI_MSM_AUDIO_AMR_WB_PLUS_H */ 19 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_ape.h: -------------------------------------------------------------------------------- 1 | /* The following structure has been taken 2 | * from Monkey's Audio SDK with permission 3 | */ 4 | 5 | #ifndef _UAPI_MSM_AUDIO_APE_H 6 | #define _UAPI_MSM_AUDIO_APE_H 7 | 8 | #define AUDIO_GET_APE_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 9 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), struct msm_audio_ape_config) 10 | #define AUDIO_SET_APE_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 11 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), struct msm_audio_ape_config) 12 | 13 | struct msm_audio_ape_config { 14 | uint16_t compatibleVersion; 15 | uint16_t compressionLevel; 16 | uint32_t formatFlags; 17 | uint32_t blocksPerFrame; 18 | uint32_t finalFrameBlocks; 19 | uint32_t totalFrames; 20 | uint16_t bitsPerSample; 21 | uint16_t numChannels; 22 | uint32_t sampleRate; 23 | uint32_t seekTablePresent; 24 | }; 25 | 26 | #endif /* _UAPI_MSM_AUDIO_APE_H */ 27 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_g711.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_G711_H 2 | #define _UAPI_MSM_AUDIO_G711_H 3 | 4 | #include 5 | 6 | struct msm_audio_g711_enc_config { 7 | uint32_t sample_rate; 8 | }; 9 | 10 | #define AUDIO_SET_G711_ENC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 11 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), struct msm_audio_g711_enc_config) 12 | 13 | #define AUDIO_GET_G711_ENC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 14 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), struct msm_audio_g711_enc_config) 15 | 16 | 17 | #endif /* _UAPI_MSM_AUDIO_G711_H */ 18 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_g711_dec.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_G711_H 2 | #define _UAPI_MSM_AUDIO_G711_H 3 | 4 | #include 5 | 6 | struct msm_audio_g711_dec_config { 7 | uint32_t sample_rate; 8 | }; 9 | 10 | #define AUDIO_SET_G711_DEC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 11 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), struct msm_audio_g711_dec_config) 12 | 13 | #define AUDIO_GET_G711_DEC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 14 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), struct msm_audio_g711_dec_config) 15 | 16 | #endif /* _UAPI_MSM_AUDIO_G711_H */ 17 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_mvs.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_MVS_H 2 | #define _UAPI_MSM_AUDIO_MVS_H 3 | 4 | #include 5 | 6 | #define AUDIO_GET_MVS_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM + 0), unsigned int) 8 | #define AUDIO_SET_MVS_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 9 | (AUDIO_MAX_COMMON_IOCTL_NUM + 1), unsigned int) 10 | 11 | /* MVS modes */ 12 | #define MVS_MODE_IS733 0x1 /*QCELP 13K*/ 13 | #define MVS_MODE_IS127 0x2 /*EVRC-8k*/ 14 | #define MVS_MODE_4GV_NB 0x3 /*EVRC-B*/ 15 | #define MVS_MODE_4GV_WB 0x4 /*EVRC-WB*/ 16 | #define MVS_MODE_AMR 0x5 17 | #define MVS_MODE_EFR 0x6 18 | #define MVS_MODE_FR 0x7 19 | #define MVS_MODE_HR 0x8 20 | #define MVS_MODE_LINEAR_PCM 0x9 21 | #define MVS_MODE_G711 0xA 22 | #define MVS_MODE_PCM 0xC 23 | #define MVS_MODE_AMR_WB 0xD 24 | #define MVS_MODE_G729A 0xE 25 | #define MVS_MODE_G711A 0xF 26 | #define MVS_MODE_G722 0x10 27 | #define MVS_MODE_PCM_WB 0x12 28 | 29 | enum msm_audio_amr_mode { 30 | MVS_AMR_MODE_0475, /* AMR 4.75 kbps */ 31 | MVS_AMR_MODE_0515, /* AMR 5.15 kbps */ 32 | MVS_AMR_MODE_0590, /* AMR 5.90 kbps */ 33 | MVS_AMR_MODE_0670, /* AMR 6.70 kbps */ 34 | MVS_AMR_MODE_0740, /* AMR 7.40 kbps */ 35 | MVS_AMR_MODE_0795, /* AMR 7.95 kbps */ 36 | MVS_AMR_MODE_1020, /* AMR 10.20 kbps */ 37 | MVS_AMR_MODE_1220, /* AMR 12.20 kbps */ 38 | MVS_AMR_MODE_0660, /* AMR-WB 6.60 kbps */ 39 | MVS_AMR_MODE_0885, /* AMR-WB 8.85 kbps */ 40 | MVS_AMR_MODE_1265, /* AMR-WB 12.65 kbps */ 41 | MVS_AMR_MODE_1425, /* AMR-WB 14.25 kbps */ 42 | MVS_AMR_MODE_1585, /* AMR-WB 15.85 kbps */ 43 | MVS_AMR_MODE_1825, /* AMR-WB 18.25 kbps */ 44 | MVS_AMR_MODE_1985, /* AMR-WB 19.85 kbps */ 45 | MVS_AMR_MODE_2305, /* AMR-WB 23.05 kbps */ 46 | MVS_AMR_MODE_2385, /* AMR-WB 23.85 kbps */ 47 | MVS_AMR_MODE_UNDEF 48 | }; 49 | 50 | /* The MVS VOC rate type is used to identify the rate of QCELP 13K(IS733), 51 | * EVRC(IS127), 4GV, or 4GV-WB frame. 52 | */ 53 | enum msm_audio_voc_rate { 54 | MVS_VOC_0_RATE, /* Blank frame */ 55 | MVS_VOC_8_RATE, /* 1/8 rate */ 56 | MVS_VOC_4_RATE, /* 1/4 rate */ 57 | MVS_VOC_2_RATE, /* 1/2 rate */ 58 | MVS_VOC_1_RATE, /* Full rate */ 59 | MVS_VOC_ERASURE, /* erasure frame */ 60 | MVS_VOC_RATE_MAX, 61 | MVS_VOC_RATE_UNDEF = MVS_VOC_RATE_MAX 62 | }; 63 | 64 | enum msm_audio_amr_frame_type { 65 | MVS_AMR_SPEECH_GOOD, /* Good speech frame */ 66 | MVS_AMR_SPEECH_DEGRADED, /* Speech degraded */ 67 | MVS_AMR_ONSET, /* Onset */ 68 | MVS_AMR_SPEECH_BAD, /* Corrupt speech frame (bad CRC) */ 69 | MVS_AMR_SID_FIRST, /* First silence descriptor */ 70 | MVS_AMR_SID_UPDATE, /* Comfort noise frame */ 71 | MVS_AMR_SID_BAD, /* Corrupt SID frame (bad CRC) */ 72 | MVS_AMR_NO_DATA, /* Nothing to transmit */ 73 | MVS_AMR_SPEECH_LOST /* Downlink speech lost */ 74 | }; 75 | 76 | enum msm_audio_g711a_mode { 77 | MVS_G711A_MODE_MULAW, 78 | MVS_G711A_MODE_ALAW 79 | }; 80 | 81 | enum msm_audio_g711_mode { 82 | MVS_G711_MODE_MULAW, 83 | MVS_G711_MODE_ALAW 84 | }; 85 | 86 | enum mvs_g722_mode_type { 87 | MVS_G722_MODE_01, 88 | MVS_G722_MODE_02, 89 | MVS_G722_MODE_03, 90 | MVS_G722_MODE_MAX, 91 | MVS_G722_MODE_UNDEF 92 | }; 93 | 94 | enum msm_audio_g711a_frame_type { 95 | MVS_G711A_SPEECH_GOOD, 96 | MVS_G711A_SID, 97 | MVS_G711A_NO_DATA, 98 | MVS_G711A_ERASURE 99 | }; 100 | 101 | enum msm_audio_g729a_frame_type { 102 | MVS_G729A_NO_DATA, 103 | MVS_G729A_SPEECH_GOOD, 104 | MVS_G729A_SID, 105 | MVS_G729A_ERASURE 106 | }; 107 | 108 | struct min_max_rate { 109 | uint32_t min_rate; 110 | uint32_t max_rate; 111 | }; 112 | 113 | struct msm_audio_mvs_config { 114 | uint32_t mvs_mode; 115 | uint32_t rate_type; 116 | struct min_max_rate min_max_rate; 117 | uint32_t dtx_mode; 118 | }; 119 | 120 | #define MVS_MAX_VOC_PKT_SIZE 640 121 | 122 | struct gsm_header { 123 | uint8_t bfi; 124 | uint8_t sid; 125 | uint8_t taf; 126 | uint8_t ufi; 127 | }; 128 | 129 | struct q6_msm_audio_mvs_frame { 130 | union { 131 | uint32_t frame_type; 132 | uint32_t packet_rate; 133 | struct gsm_header gsm_frame_type; 134 | } header; 135 | uint32_t len; 136 | uint8_t voc_pkt[MVS_MAX_VOC_PKT_SIZE]; 137 | 138 | }; 139 | 140 | struct msm_audio_mvs_frame { 141 | uint32_t frame_type; 142 | uint32_t len; 143 | uint8_t voc_pkt[MVS_MAX_VOC_PKT_SIZE]; 144 | 145 | }; 146 | 147 | #define Q5V2_MVS_MAX_VOC_PKT_SIZE 320 148 | 149 | struct q5v2_msm_audio_mvs_frame { 150 | uint32_t frame_type; 151 | uint32_t len; 152 | uint8_t voc_pkt[Q5V2_MVS_MAX_VOC_PKT_SIZE]; 153 | 154 | }; 155 | #endif /* _UAPI_MSM_AUDIO_MVS_H */ 156 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_qcp.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_QCP_H 2 | #define _UAPI_MSM_AUDIO_QCP_H 3 | 4 | #include 5 | 6 | #define AUDIO_SET_QCELP_ENC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | 0, struct msm_audio_qcelp_enc_config) 8 | 9 | #define AUDIO_GET_QCELP_ENC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 10 | 1, struct msm_audio_qcelp_enc_config) 11 | 12 | #define AUDIO_SET_EVRC_ENC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 13 | 2, struct msm_audio_evrc_enc_config) 14 | 15 | #define AUDIO_GET_EVRC_ENC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 16 | 3, struct msm_audio_evrc_enc_config) 17 | 18 | #define CDMA_RATE_BLANK 0x00 19 | #define CDMA_RATE_EIGHTH 0x01 20 | #define CDMA_RATE_QUARTER 0x02 21 | #define CDMA_RATE_HALF 0x03 22 | #define CDMA_RATE_FULL 0x04 23 | #define CDMA_RATE_ERASURE 0x05 24 | 25 | struct msm_audio_qcelp_enc_config { 26 | uint32_t cdma_rate; 27 | uint32_t min_bit_rate; 28 | uint32_t max_bit_rate; 29 | }; 30 | 31 | struct msm_audio_evrc_enc_config { 32 | uint32_t cdma_rate; 33 | uint32_t min_bit_rate; 34 | uint32_t max_bit_rate; 35 | }; 36 | 37 | #endif /* _UAPI_MSM_AUDIO_QCP_H */ 38 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_sbc.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_SBC_H 2 | #define _UAPI_MSM_AUDIO_SBC_H 3 | 4 | #include 5 | 6 | #define AUDIO_SET_SBC_ENC_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), struct msm_audio_sbc_enc_config) 8 | 9 | #define AUDIO_GET_SBC_ENC_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 10 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), struct msm_audio_sbc_enc_config) 11 | 12 | #define AUDIO_SBC_BA_LOUDNESS 0x0 13 | #define AUDIO_SBC_BA_SNR 0x1 14 | 15 | #define AUDIO_SBC_MODE_MONO 0x0 16 | #define AUDIO_SBC_MODE_DUAL 0x1 17 | #define AUDIO_SBC_MODE_STEREO 0x2 18 | #define AUDIO_SBC_MODE_JSTEREO 0x3 19 | 20 | #define AUDIO_SBC_BANDS_8 0x1 21 | 22 | #define AUDIO_SBC_BLOCKS_4 0x0 23 | #define AUDIO_SBC_BLOCKS_8 0x1 24 | #define AUDIO_SBC_BLOCKS_12 0x2 25 | #define AUDIO_SBC_BLOCKS_16 0x3 26 | 27 | struct msm_audio_sbc_enc_config { 28 | uint32_t channels; 29 | uint32_t sample_rate; 30 | uint32_t bit_allocation; 31 | uint32_t number_of_subbands; 32 | uint32_t number_of_blocks; 33 | uint32_t bit_rate; 34 | uint32_t mode; 35 | }; 36 | #endif /* _UAPI_MSM_AUDIO_SBC_H */ 37 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_voicememo.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_VOICEMEMO_H 2 | #define _UAPI_MSM_AUDIO_VOICEMEMO_H 3 | 4 | #include 5 | 6 | #define AUDIO_GET_VOICEMEMO_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned int) 8 | #define AUDIO_SET_VOICEMEMO_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 9 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned int) 10 | 11 | /* rec_type */ 12 | enum rpc_voc_rec_dir_type { 13 | RPC_VOC_REC_NONE, 14 | RPC_VOC_REC_FORWARD, 15 | RPC_VOC_REC_REVERSE, 16 | RPC_VOC_REC_BOTH, 17 | RPC_VOC_MAX_REC_TYPE 18 | }; 19 | 20 | /* capability */ 21 | enum rpc_voc_capability_type { 22 | RPC_VOC_CAP_IS733 = 4, 23 | RPC_VOC_CAP_IS127 = 8, 24 | RPC_VOC_CAP_AMR = 64, 25 | RPC_VOC_CAP_32BIT_DUMMY = 2147483647 26 | }; 27 | 28 | /* Rate */ 29 | enum rpc_voc_rate_type { 30 | RPC_VOC_0_RATE = 0, 31 | RPC_VOC_8_RATE, 32 | RPC_VOC_4_RATE, 33 | RPC_VOC_2_RATE, 34 | RPC_VOC_1_RATE, 35 | RPC_VOC_ERASURE, 36 | RPC_VOC_ERR_RATE, 37 | RPC_VOC_AMR_RATE_475 = 0, 38 | RPC_VOC_AMR_RATE_515 = 1, 39 | RPC_VOC_AMR_RATE_590 = 2, 40 | RPC_VOC_AMR_RATE_670 = 3, 41 | RPC_VOC_AMR_RATE_740 = 4, 42 | RPC_VOC_AMR_RATE_795 = 5, 43 | RPC_VOC_AMR_RATE_1020 = 6, 44 | RPC_VOC_AMR_RATE_1220 = 7, 45 | }; 46 | 47 | /* frame_format */ 48 | enum rpc_voc_pb_len_rate_var_type { 49 | RPC_VOC_PB_NATIVE_QCP = 3, 50 | RPC_VOC_PB_AMR, 51 | RPC_VOC_PB_EVB 52 | }; 53 | 54 | struct msm_audio_voicememo_config { 55 | uint32_t rec_type; 56 | uint32_t rec_interval_ms; 57 | uint32_t auto_stop_ms; 58 | uint32_t capability; 59 | uint32_t max_rate; 60 | uint32_t min_rate; 61 | uint32_t frame_format; 62 | uint32_t dtx_enable; 63 | uint32_t data_req_ms; 64 | }; 65 | 66 | #endif /* _UAPI_MSM_AUDIO_VOICEMEMO_H */ 67 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_wma.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_WMA_H 2 | #define _UAPI_MSM_AUDIO_WMA_H 3 | 4 | #define AUDIO_GET_WMA_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 5 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), unsigned int) 6 | #define AUDIO_SET_WMA_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), unsigned int) 8 | 9 | #define AUDIO_GET_WMA_CONFIG_V2 _IOR(AUDIO_IOCTL_MAGIC, \ 10 | (AUDIO_MAX_COMMON_IOCTL_NUM+2), struct msm_audio_wma_config_v2) 11 | #define AUDIO_SET_WMA_CONFIG_V2 _IOW(AUDIO_IOCTL_MAGIC, \ 12 | (AUDIO_MAX_COMMON_IOCTL_NUM+3), struct msm_audio_wma_config_v2) 13 | 14 | struct msm_audio_wma_config { 15 | unsigned short armdatareqthr; 16 | unsigned short channelsdecoded; 17 | unsigned short wmabytespersec; 18 | unsigned short wmasamplingfreq; 19 | unsigned short wmaencoderopts; 20 | }; 21 | 22 | struct msm_audio_wma_config_v2 { 23 | unsigned short format_tag; 24 | unsigned short numchannels; 25 | uint32_t samplingrate; 26 | uint32_t avgbytespersecond; 27 | unsigned short block_align; 28 | unsigned short validbitspersample; 29 | uint32_t channelmask; 30 | unsigned short encodeopt; 31 | }; 32 | 33 | #endif /* _UAPI_MSM_AUDIO_WMA_H */ 34 | -------------------------------------------------------------------------------- /include/uapi/linux/msm_audio_wmapro.h: -------------------------------------------------------------------------------- 1 | #ifndef _UAPI_MSM_AUDIO_WMAPRO_H 2 | #define _UAPI_MSM_AUDIO_WMAPRO_H 3 | 4 | #define AUDIO_GET_WMAPRO_CONFIG _IOR(AUDIO_IOCTL_MAGIC, \ 5 | (AUDIO_MAX_COMMON_IOCTL_NUM+0), struct msm_audio_wmapro_config) 6 | #define AUDIO_SET_WMAPRO_CONFIG _IOW(AUDIO_IOCTL_MAGIC, \ 7 | (AUDIO_MAX_COMMON_IOCTL_NUM+1), struct msm_audio_wmapro_config) 8 | 9 | struct msm_audio_wmapro_config { 10 | unsigned short armdatareqthr; 11 | uint8_t validbitspersample; 12 | uint8_t numchannels; 13 | unsigned short formattag; 14 | uint32_t samplingrate; 15 | uint32_t avgbytespersecond; 16 | unsigned short asfpacketlength; 17 | uint32_t channelmask; 18 | unsigned short encodeopt; 19 | unsigned short advancedencodeopt; 20 | uint32_t advancedencodeopt2; 21 | }; 22 | #endif /* _UAPI_MSM_AUDIO_WMAPRO_H */ 23 | -------------------------------------------------------------------------------- /include/uapi/sound/Kbuild: -------------------------------------------------------------------------------- 1 | # UAPI Header export list 2 | header-y += lsm_params.h 3 | header-y += audio_slimslave.h 4 | header-y += audio_effects.h 5 | header-y += devdep_params.h 6 | header-y += msmcal-hwdep.h 7 | header-y += wcd-dsp-glink.h 8 | header-y += voice_params.h 9 | -------------------------------------------------------------------------------- /include/uapi/sound/audio_slimslave.h: -------------------------------------------------------------------------------- 1 | #ifndef __AUDIO_SLIMSLAVE_H__ 2 | #define __AUDIO_SLIMSLAVE_H__ 3 | 4 | #include 5 | #include 6 | 7 | #define AUDIO_SLIMSLAVE_IOCTL_NAME "audio_slimslave" 8 | #define AUDIO_SLIMSLAVE_MAGIC 'S' 9 | 10 | #define AUDIO_SLIMSLAVE_IOCTL_UNVOTE _IO(AUDIO_SLIMSLAVE_MAGIC, 0x00) 11 | #define AUDIO_SLIMSLAVE_IOCTL_VOTE _IO(AUDIO_SLIMSLAVE_MAGIC, 0x01) 12 | 13 | enum { 14 | AUDIO_SLIMSLAVE_UNVOTE, 15 | AUDIO_SLIMSLAVE_VOTE 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /include/uapi/sound/devdep_params.h: -------------------------------------------------------------------------------- 1 | #ifndef _DEV_DEP_H 2 | #define _DEV_DEP_H 3 | 4 | struct dolby_param_data { 5 | int32_t version; 6 | int32_t device_id; 7 | int32_t be_id; 8 | int32_t param_id; 9 | int32_t length; 10 | int32_t __user *data; 11 | }; 12 | 13 | struct dolby_param_license { 14 | int32_t dmid; 15 | int32_t license_key; 16 | }; 17 | 18 | #define SNDRV_DEVDEP_DAP_IOCTL_SET_PARAM\ 19 | _IOWR('U', 0x10, struct dolby_param_data) 20 | #define SNDRV_DEVDEP_DAP_IOCTL_GET_PARAM\ 21 | _IOR('U', 0x11, struct dolby_param_data) 22 | #define SNDRV_DEVDEP_DAP_IOCTL_DAP_COMMAND\ 23 | _IOWR('U', 0x13, struct dolby_param_data) 24 | #define SNDRV_DEVDEP_DAP_IOCTL_DAP_LICENSE\ 25 | _IOWR('U', 0x14, struct dolby_param_license) 26 | #define SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER\ 27 | _IOR('U', 0x15, struct dolby_param_data) 28 | 29 | #define DTS_EAGLE_MODULE 0x00005000 30 | #define DTS_EAGLE_MODULE_ENABLE 0x00005001 31 | #define EAGLE_DRIVER_ID 0xF2 32 | #define DTS_EAGLE_IOCTL_GET_CACHE_SIZE _IOR(EAGLE_DRIVER_ID, 0, int) 33 | #define DTS_EAGLE_IOCTL_SET_CACHE_SIZE _IOW(EAGLE_DRIVER_ID, 1, int) 34 | #define DTS_EAGLE_IOCTL_GET_PARAM _IOR(EAGLE_DRIVER_ID, 2, void*) 35 | #define DTS_EAGLE_IOCTL_SET_PARAM _IOW(EAGLE_DRIVER_ID, 3, void*) 36 | #define DTS_EAGLE_IOCTL_SET_CACHE_BLOCK _IOW(EAGLE_DRIVER_ID, 4, void*) 37 | #define DTS_EAGLE_IOCTL_SET_ACTIVE_DEVICE _IOW(EAGLE_DRIVER_ID, 5, void*) 38 | #define DTS_EAGLE_IOCTL_GET_LICENSE _IOR(EAGLE_DRIVER_ID, 6, void*) 39 | #define DTS_EAGLE_IOCTL_SET_LICENSE _IOW(EAGLE_DRIVER_ID, 7, void*) 40 | #define DTS_EAGLE_IOCTL_SEND_LICENSE _IOW(EAGLE_DRIVER_ID, 8, int) 41 | #define DTS_EAGLE_IOCTL_SET_VOLUME_COMMANDS _IOW(EAGLE_DRIVER_ID, 9, void*) 42 | #define DTS_EAGLE_FLAG_IOCTL_PRE (1<<30) 43 | #define DTS_EAGLE_FLAG_IOCTL_JUSTSETCACHE (1<<31) 44 | #define DTS_EAGLE_FLAG_IOCTL_GETFROMCORE DTS_EAGLE_FLAG_IOCTL_JUSTSETCACHE 45 | #define DTS_EAGLE_FLAG_IOCTL_MASK (~(DTS_EAGLE_FLAG_IOCTL_PRE | \ 46 | DTS_EAGLE_FLAG_IOCTL_JUSTSETCACHE)) 47 | #define DTS_EAGLE_FLAG_ALSA_GET (1<<31) 48 | 49 | struct dts_eagle_param_desc { 50 | uint32_t id; 51 | uint32_t size; 52 | int32_t offset; 53 | uint32_t device; 54 | } __packed; 55 | 56 | #define HWDEP_FE_BASE 3000 /*unique base for FE hw dep nodes*/ 57 | struct snd_pcm_mmap_fd { 58 | int32_t dir; 59 | int32_t fd; 60 | int32_t size; 61 | int32_t actual_size; 62 | }; 63 | 64 | #define SNDRV_PCM_IOCTL_MMAP_DATA_FD _IOWR('U', 0xd2, struct snd_pcm_mmap_fd) 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /include/uapi/sound/msmcal-hwdep.h: -------------------------------------------------------------------------------- 1 | #ifndef _CALIB_HWDEP_H 2 | #define _CALIB_HWDEP_H 3 | 4 | #define WCD9XXX_CODEC_HWDEP_NODE 1000 5 | enum wcd_cal_type { 6 | WCD9XXX_MIN_CAL, 7 | WCD9XXX_ANC_CAL = WCD9XXX_MIN_CAL, 8 | WCD9XXX_MAD_CAL, 9 | WCD9XXX_MBHC_CAL, 10 | WCD9XXX_VBAT_CAL, 11 | WCD9XXX_MAX_CAL, 12 | }; 13 | 14 | struct wcdcal_ioctl_buffer { 15 | __u32 size; 16 | __u8 __user *buffer; 17 | enum wcd_cal_type cal_type; 18 | }; 19 | 20 | #define SNDRV_CTL_IOCTL_HWDEP_CAL_TYPE \ 21 | _IOW('U', 0x1, struct wcdcal_ioctl_buffer) 22 | 23 | #endif /*_CALIB_HWDEP_H*/ 24 | -------------------------------------------------------------------------------- /include/uapi/sound/voice_params.h: -------------------------------------------------------------------------------- 1 | #ifndef __VOICE_PARAMS_H__ 2 | #define __VOICE_PARAMS_H__ 3 | 4 | #include 5 | #include 6 | 7 | enum voice_lch_mode { 8 | VOICE_LCH_START = 1, 9 | VOICE_LCH_STOP 10 | }; 11 | 12 | #define SNDRV_VOICE_IOCTL_LCH _IOW('U', 0x00, enum voice_lch_mode) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /include/uapi/sound/wcd-dsp-glink.h: -------------------------------------------------------------------------------- 1 | #ifndef _WCD_DSP_GLINK_H 2 | #define _WCD_DSP_GLINK_H 3 | 4 | #include 5 | 6 | #define WDSP_CH_NAME_MAX_LEN 50 7 | 8 | enum { 9 | WDSP_REG_PKT = 1, 10 | WDSP_CMD_PKT, 11 | WDSP_READY_PKT, 12 | }; 13 | #define WDSP_READY_PKT WDSP_READY_PKT 14 | 15 | /* 16 | * struct wdsp_reg_pkt - Glink channel information structure format 17 | * @no_of_channels: Number of glink channels to open 18 | * @payload[0]: Dynamic array contains all the glink channels information 19 | */ 20 | struct wdsp_reg_pkt { 21 | __u8 no_of_channels; 22 | __u8 payload[0]; 23 | }; 24 | 25 | /* 26 | * struct wdsp_cmd_pkt - WDSP command packet format 27 | * @ch_name: Name of the glink channel 28 | * @payload_size: Size of the payload 29 | * @payload[0]: Actual data payload 30 | */ 31 | struct wdsp_cmd_pkt { 32 | char ch_name[WDSP_CH_NAME_MAX_LEN]; 33 | __u32 payload_size; 34 | __u8 payload[0]; 35 | }; 36 | 37 | /* 38 | * struct wdsp_write_pkt - Format that userspace send the data to driver. 39 | * @pkt_type: Type of the packet(REG or CMD PKT) 40 | * @payload[0]: Payload is either cmd or reg pkt structure based on pkt type 41 | */ 42 | struct wdsp_write_pkt { 43 | __u8 pkt_type; 44 | __u8 payload[0]; 45 | }; 46 | 47 | /* 48 | * struct wdsp_glink_ch_cfg - Defines the glink channel configuration. 49 | * @ch_name: Name of the glink channel 50 | * @latency_in_us: Latency specified in micro seconds for QOS 51 | * @no_of_intents: Number of intents prequeued 52 | * @intents_size[0]: Dynamic array to specify size of each intent 53 | */ 54 | struct wdsp_glink_ch_cfg { 55 | char name[WDSP_CH_NAME_MAX_LEN]; 56 | __u32 latency_in_us; 57 | __u32 no_of_intents; 58 | __u32 intents_size[0]; 59 | }; 60 | #endif /* _WCD_DSP_GLINK_H */ 61 | -------------------------------------------------------------------------------- /ipc/Makefile: -------------------------------------------------------------------------------- 1 | obj-$(CONFIG_MSM_QDSP6_APRV2_GLINK) += apr.o apr_v2.o apr_tal_glink.o 2 | obj-$(CONFIG_MSM_QDSP6_APRV3_GLINK) += apr.o apr_v3.o apr_tal_glink.o 3 | obj-$(CONFIG_WCD_DSP_GLINK) += wcd-dsp-glink.o 4 | -------------------------------------------------------------------------------- /ipc/apr_v2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-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 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | /** 23 | * apr_get_subsys_state - get Q6 subsys status 24 | * 25 | * Returns apr_subsys_state 26 | */ 27 | enum apr_subsys_state apr_get_subsys_state(void) 28 | { 29 | return apr_get_q6_state(); 30 | } 31 | EXPORT_SYMBOL(apr_get_subsys_state); 32 | 33 | void apr_set_subsys_state(void) 34 | { 35 | apr_set_q6_state(APR_SUBSYS_DOWN); 36 | apr_set_modem_state(APR_SUBSYS_UP); 37 | } 38 | 39 | uint16_t apr_get_data_src(struct apr_hdr *hdr) 40 | { 41 | if (hdr->src_domain == APR_DOMAIN_MODEM) 42 | return APR_DEST_MODEM; 43 | else if (hdr->src_domain == APR_DOMAIN_ADSP) 44 | return APR_DEST_QDSP6; 45 | 46 | pr_err("APR: Pkt from wrong source: %d\n", hdr->src_domain); 47 | return APR_DEST_MAX; /*RETURN INVALID VALUE*/ 48 | } 49 | 50 | int apr_get_dest_id(char *dest) 51 | { 52 | if (!strcmp(dest, "ADSP")) 53 | return APR_DEST_QDSP6; 54 | else 55 | return APR_DEST_MODEM; 56 | } 57 | 58 | void subsys_notif_register(char *client_name, int domain, 59 | struct notifier_block *nb) 60 | { 61 | int ret; 62 | 63 | ret = audio_notifier_register(client_name, domain, nb); 64 | if (ret < 0) 65 | pr_err("%s: Audio notifier register failed for domain %d ret = %d\n", 66 | __func__, domain, ret); 67 | } 68 | 69 | uint16_t apr_get_reset_domain(uint16_t proc) 70 | { 71 | return proc; 72 | } 73 | -------------------------------------------------------------------------------- /ipc/apr_v3.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016, 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 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #define DEST_ID APR_DEST_MODEM 23 | 24 | enum apr_subsys_state apr_get_subsys_state(void) 25 | { 26 | return apr_get_modem_state(); 27 | } 28 | 29 | void apr_set_subsys_state(void) 30 | { 31 | apr_set_modem_state(APR_SUBSYS_DOWN); 32 | } 33 | 34 | uint16_t apr_get_data_src(struct apr_hdr *hdr) 35 | { 36 | return DEST_ID; 37 | } 38 | 39 | int apr_get_dest_id(char *dest) 40 | { 41 | return DEST_ID; 42 | } 43 | 44 | void subsys_notif_register(char *client_name, int domain, 45 | struct notifier_block *nb) 46 | { 47 | int ret; 48 | 49 | if (domain != AUDIO_NOTIFIER_MODEM_DOMAIN) { 50 | pr_debug("%s: Unused domain %d not registering with notifier\n", 51 | __func__, domain); 52 | return; 53 | } 54 | 55 | ret = audio_notifier_register(client_name, domain, nb); 56 | if (ret < 0) 57 | pr_err("%s: Audio notifier register failed for domain %d ret = %d\n", 58 | __func__, domain, ret); 59 | } 60 | 61 | uint16_t apr_get_reset_domain(uint16_t proc) 62 | { 63 | return APR_DEST_QDSP6; 64 | } 65 | -------------------------------------------------------------------------------- /soc/Makefile: -------------------------------------------------------------------------------- 1 | 2 | obj-$(CONFIG_REGMAP_SWR) += regmap-swr.o 3 | obj-$(CONFIG_PINCTRL_WCD) += pinctrl-wcd.o 4 | obj-$(CONFIG_PINCTRL_LPI) += pinctrl-lpi.o 5 | obj-$(CONFIG_SOUNDWIRE) += soundwire.o 6 | obj-$(CONFIG_SOUNDWIRE_WCD_CTRL) += swr-wcd-ctrl.o 7 | -------------------------------------------------------------------------------- /soc/core.h: -------------------------------------------------------------------------------- 1 | ../../../drivers/pinctrl/core.h -------------------------------------------------------------------------------- /soc/pinctrl-utils.h: -------------------------------------------------------------------------------- 1 | ../../../drivers/pinctrl/pinctrl-utils.h -------------------------------------------------------------------------------- /soc/swr-wcd-ctrl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015-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 | 13 | #ifndef _SWR_WCD_CTRL_H 14 | #define _SWR_WCD_CTRL_H 15 | #include 16 | #include 17 | 18 | #define SWR_MAX_ROW 0 /* Rows = 48 */ 19 | #define SWR_MAX_COL 7 /* Cols = 16 */ 20 | #define SWR_MIN_COL 0 /* Cols = 2 */ 21 | 22 | #define SWR_WCD_NAME "swr-wcd" 23 | 24 | #define SWR_MSTR_PORT_LEN 8 /* Number of master ports */ 25 | 26 | #define SWRM_VERSION_1_0 0x01010000 27 | #define SWRM_VERSION_1_2 0x01030000 28 | #define SWRM_VERSION_1_3 0x01040000 29 | 30 | enum { 31 | SWR_MSTR_PAUSE, 32 | SWR_MSTR_RESUME, 33 | SWR_MSTR_UP, 34 | SWR_MSTR_DOWN, 35 | }; 36 | 37 | enum { 38 | SWR_IRQ_FREE, 39 | SWR_IRQ_REGISTER, 40 | }; 41 | 42 | enum { 43 | SWR_DAC_PORT, 44 | SWR_COMP_PORT, 45 | SWR_BOOST_PORT, 46 | SWR_VISENSE_PORT, 47 | }; 48 | 49 | struct usecase { 50 | u8 num_port; 51 | u8 num_ch; 52 | u32 chrate; 53 | }; 54 | 55 | struct port_params { 56 | u8 si; 57 | u8 off1; 58 | u8 off2; 59 | }; 60 | 61 | struct swrm_mports { 62 | struct list_head list; 63 | u8 id; 64 | }; 65 | 66 | struct swr_ctrl_platform_data { 67 | void *handle; /* holds priv data */ 68 | int (*read)(void *handle, int reg); 69 | int (*write)(void *handle, int reg, int val); 70 | int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len); 71 | int (*clk)(void *handle, bool enable); 72 | int (*reg_irq)(void *handle, irqreturn_t(*irq_handler)(int irq, 73 | void *data), void *swr_handle, int type); 74 | }; 75 | 76 | struct swr_mstr_ctrl { 77 | struct swr_master master; 78 | struct device *dev; 79 | struct resource *supplies; 80 | struct clk *mclk; 81 | int clk_ref_count; 82 | struct completion reset; 83 | struct completion broadcast; 84 | struct mutex mlock; 85 | struct mutex reslock; 86 | u8 rcmd_id; 87 | u8 wcmd_id; 88 | void *handle; /* SWR Master handle from client for read and writes */ 89 | int (*read)(void *handle, int reg); 90 | int (*write)(void *handle, int reg, int val); 91 | int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len); 92 | int (*clk)(void *handle, bool enable); 93 | int (*reg_irq)(void *handle, irqreturn_t(*irq_handler)(int irq, 94 | void *data), void *swr_handle, int type); 95 | int irq; 96 | int version; 97 | int num_enum_slaves; 98 | int slave_status; 99 | struct swr_mstr_port *mstr_port; 100 | struct list_head mport_list; 101 | int state; 102 | struct platform_device *pdev; 103 | int num_rx_chs; 104 | u8 num_cfg_devs; 105 | }; 106 | 107 | #endif /* _SWR_WCD_CTRL_H */ 108 | --------------------------------------------------------------------------------