From 3a1b20f595f30ea57edced76c38cee4a6fb38e84 Mon Sep 17 00:00:00 2001 From: Weiyin Jiang Date: Mon, 19 Sep 2016 17:56:12 +0800 Subject: [PATCH] ASoC: msm: limit audiosphere driver logics to legacy soc Since GEF was introduced, effect control function is moved to user land and driver related logics are not needed anymore. Adding a config to limit audiosphere related functions to legacy platforms only. CRs-Fixed: 1067706 Change-Id: I1d860a1ecf930e09988fa116add8518bfb3abc25 Signed-off-by: Weiyin Jiang --- sound/soc/msm/Kconfig | 10 ++++++ sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c | 32 ++++++++++++------- sound/soc/msm/qdsp6v2/msm-qti-pp-config.c | 6 ++++ sound/soc/msm/qdsp6v2/msm-qti-pp-config.h | 37 ++++++++-------------- 4 files changed, 49 insertions(+), 36 deletions(-) diff --git a/sound/soc/msm/Kconfig b/sound/soc/msm/Kconfig index e740a24704b7..a58f1f36ac70 100644 --- a/sound/soc/msm/Kconfig +++ b/sound/soc/msm/Kconfig @@ -79,6 +79,15 @@ config QTI_PP tuning parameters of various modules such as equalizer, customized mixing. +config QTI_PP_AUDIOSPHERE + bool "Enable QTI AUDIOSPHERE PP" + depends on SND_SOC_MSM_QDSP6V2_INTF + help + To add support for QTI audio sphere post processing. + This support is to configure the post processing + parameters to DSP. The configuration includes sending + tuning parameters of audio sphere module. + config SND_SOC_CPE tristate "CPE drivers" depends on SND_SOC_WCD_CPE @@ -104,6 +113,7 @@ config SND_SOC_MSM8996 select SND_SOC_MSM_HDMI_CODEC_RX select DTS_SRS_TM select QTI_PP + select QTI_PP_AUDIOSPHERE select SND_SOC_CPE select MSM_ULTRASOUND select DOLBY_DS2 diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c index aea60f1fa044..7e8b46595dfd 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c @@ -177,7 +177,10 @@ static void msm_pcm_routing_cfg_pp(int port_id, int copp_idx, int topology, break; case ADM_CMD_COPP_OPEN_TOPOLOGY_ID_AUDIOSPHERE: pr_debug("%s: TOPOLOGY_ID_AUDIOSPHERE\n", __func__); - msm_qti_pp_asphere_init(port_id, copp_idx); + rc = msm_qti_pp_asphere_init(port_id, copp_idx); + if (rc < 0) + pr_err("%s: topo_id 0x%x, port %d, copp %d, rc %d\n", + __func__, topology, port_id, copp_idx, rc); break; default: /* custom topology specific feature param handlers */ @@ -223,22 +226,27 @@ static void msm_pcm_routing_deinit_pp(int port_id, int topology) static void msm_pcm_routng_cfg_matrix_map_pp(struct route_payload payload, int path_type, int perf_mode) { - int itr = 0; + int itr = 0, rc = 0; if ((path_type == ADM_PATH_PLAYBACK) && (perf_mode == LEGACY_PCM_MODE) && is_custom_stereo_on) { for (itr = 0; itr < payload.num_copps; itr++) { - if ((payload.port_id[itr] == SLIMBUS_0_RX) || - (payload.port_id[itr] == RT_PROXY_PORT_001_RX)) { - msm_qti_pp_send_stereo_to_custom_stereo_cmd( - payload.port_id[itr], - payload.copp_idx[itr], - payload.session_id, - Q14_GAIN_ZERO_POINT_FIVE, - Q14_GAIN_ZERO_POINT_FIVE, - Q14_GAIN_ZERO_POINT_FIVE, - Q14_GAIN_ZERO_POINT_FIVE); + if ((payload.port_id[itr] != SLIMBUS_0_RX) && + (payload.port_id[itr] != RT_PROXY_PORT_001_RX)) { + continue; } + + rc = msm_qti_pp_send_stereo_to_custom_stereo_cmd( + payload.port_id[itr], + payload.copp_idx[itr], + payload.session_id, + Q14_GAIN_ZERO_POINT_FIVE, + Q14_GAIN_ZERO_POINT_FIVE, + Q14_GAIN_ZERO_POINT_FIVE, + Q14_GAIN_ZERO_POINT_FIVE); + if (rc < 0) + pr_err("%s: err setting custom stereo\n", + __func__); } } } diff --git a/sound/soc/msm/qdsp6v2/msm-qti-pp-config.c b/sound/soc/msm/qdsp6v2/msm-qti-pp-config.c index d4d22d3587ba..7c8af09a8793 100644 --- a/sound/soc/msm/qdsp6v2/msm-qti-pp-config.c +++ b/sound/soc/msm/qdsp6v2/msm-qti-pp-config.c @@ -241,6 +241,7 @@ static int msm_qti_pp_put_eq_band_audio_mixer(struct snd_kcontrol *kcontrol, return 0; } +#ifdef CONFIG_QTI_PP void msm_qti_pp_send_eq_values(int fedai_id) { if (eq_data[fedai_id].enable) @@ -325,6 +326,7 @@ skip_send_cmd: kfree(params_value); return -ENOMEM; } +#endif /* CONFIG_QTI_PP */ /* RMS */ static int msm_qti_pp_get_rms_value_control(struct snd_kcontrol *kcontrol, @@ -682,6 +684,7 @@ static int msm_qti_pp_asphere_send_params(int port_id, int copp_idx, bool force) return 0; } +#if defined(CONFIG_QTI_PP) && defined(CONFIG_QTI_PP_AUDIOSPHERE) int msm_qti_pp_asphere_init(int port_id, int copp_idx) { int index = adm_validate_and_get_port_index(port_id); @@ -719,6 +722,7 @@ void msm_qti_pp_asphere_deinit(int port_id) asphere_state.copp_idx[index] = -1; } } +#endif static int msm_qti_pp_asphere_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -976,6 +980,7 @@ static const struct snd_kcontrol_new asphere_mixer_controls[] = { 0xFFFFFFFF, 0, 2, msm_qti_pp_asphere_get, msm_qti_pp_asphere_set), }; +#ifdef CONFIG_QTI_PP void msm_qti_pp_add_controls(struct snd_soc_platform *platform) { snd_soc_add_platform_controls(platform, int_fm_vol_mixer_controls, @@ -1023,3 +1028,4 @@ void msm_qti_pp_add_controls(struct snd_soc_platform *platform) snd_soc_add_platform_controls(platform, asphere_mixer_controls, ARRAY_SIZE(asphere_mixer_controls)); } +#endif /* CONFIG_QTI_PP */ diff --git a/sound/soc/msm/qdsp6v2/msm-qti-pp-config.h b/sound/soc/msm/qdsp6v2/msm-qti-pp-config.h index 5c600f0ae866..f8a1da5e7702 100644 --- a/sound/soc/msm/qdsp6v2/msm-qti-pp-config.h +++ b/sound/soc/msm/qdsp6v2/msm-qti-pp-config.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. @@ -15,7 +15,6 @@ #include #ifdef CONFIG_QTI_PP - void msm_qti_pp_send_eq_values(int fedai_id); int msm_qti_pp_send_stereo_to_custom_stereo_cmd(int port_id, int copp_idx, unsigned int session_id, @@ -24,32 +23,22 @@ int msm_qti_pp_send_stereo_to_custom_stereo_cmd(int port_id, int copp_idx, uint16_t op_FR_ip_FL_weight, uint16_t op_FR_ip_FR_weight); void msm_qti_pp_add_controls(struct snd_soc_platform *platform); +#else /* CONFIG_QTI_PP */ +#define msm_qti_pp_send_eq_values(fedai_id) do {} while (0) +#define msm_qti_pp_send_stereo_to_custom_stereo_cmd(port_id, copp_idx, \ + session_id, op_FL_ip_FL_weight, op_FL_ip_FR_weight, \ + op_FR_ip_FL_weight, op_FR_ip_FR_weight) (0) +#define msm_qti_pp_add_controls(platform) do {} while (0) +#endif /* CONFIG_QTI_PP */ + +#if defined(CONFIG_QTI_PP) && defined(CONFIG_QTI_PP_AUDIOSPHERE) int msm_qti_pp_asphere_init(int port_id, int copp_idx); void msm_qti_pp_asphere_deinit(int port_id); - #else - -void msm_qti_pp_send_eq_values(int fedai_id) { } -int msm_qti_pp_send_stereo_to_custom_stereo_cmd(int port_id, int copp_idx, - unsigned int session_id, - uint16_t op_FL_ip_FL_weight, - uint16_t op_FL_ip_FR_weight, - uint16_t op_FR_ip_FL_weight, - uint16_t op_FR_ip_FR_weight) -{ - return 0; -} - -void msm_qti_pp_add_controls(struct snd_soc_platform *platform) { } - -int msm_qti_pp_asphere_init(int port_id, int copp_idx) -{ - return 0; -} -void msm_qti_pp_asphere_deinit(int port_id) { } - +#define msm_qti_pp_asphere_init(port_id, copp_idx) (0) +#define msm_qti_pp_asphere_deinit(port_id) do {} while (0) #endif -#endif +#endif /* _MSM_QTI_PP_H_ */