Loading asoc/msm-pcm-routing-v2.c +6 −0 Original line number Diff line number Diff line Loading @@ -3033,6 +3033,7 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol, struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int mux = ucontrol->value.enumerated.item[0]; int lsm_port = AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_TX; int lsm_port_idx = 0; u8 fe_idx = 0; if (mux >= e->items) { Loading @@ -3042,6 +3043,7 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol, pr_debug("%s: LSM enable %ld\n", __func__, ucontrol->value.integer.value[0]); lsm_port_idx = ucontrol->value.integer.value[0]; switch (ucontrol->value.integer.value[0]) { case 1: lsm_port = AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_TX; Loading Loading @@ -3098,6 +3100,10 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol, set_lsm_port(lsm_port); msm_routing_get_lsm_fe_idx(kcontrol, &fe_idx); lsm_port_index[fe_idx] = ucontrol->value.integer.value[0]; /* Set the default AFE LSM Port to 0xffff */ if(lsm_port_idx <= 0 || lsm_port_idx >= ARRAY_SIZE(lsm_port_text)) lsm_port = 0xffff; afe_set_lsm_afe_port_id(fe_idx, lsm_port); return 0; } dsp/msm_audio_ion.c +9 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. */ #include <linux/init.h> Loading Loading @@ -67,7 +67,7 @@ static int msm_audio_dma_buf_map(struct dma_buf *dma_buf, dma_addr_t *addr, size_t *len) { struct msm_audio_alloc_data *alloc_data; struct msm_audio_alloc_data *alloc_data = NULL; struct device *cb_dev; unsigned long ionflag = 0; int rc = 0; Loading Loading @@ -133,6 +133,7 @@ static int msm_audio_dma_buf_map(struct dma_buf *dma_buf, alloc_data->attach); free_alloc_data: kfree(alloc_data); alloc_data = NULL; return rc; } Loading Loading @@ -170,6 +171,7 @@ static int msm_audio_dma_buf_unmap(struct dma_buf *dma_buf) list_del(&(alloc_data->list)); kfree(alloc_data); alloc_data = NULL; break; } } Loading Loading @@ -312,6 +314,11 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr, { int rc = 0; if (!dma_buf || !paddr || !vaddr || !plen) { pr_err("%s: Invalid params\n", __func__); return -EINVAL; } rc = msm_audio_ion_get_phys(dma_buf, paddr, plen); if (rc) { pr_err("%s: ION Get Physical for AUDIO failed, rc = %d\n", Loading dsp/msm_audio_ion_vm.c +9 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ static int msm_audio_ion_dma_buf_map(struct dma_buf *dma_buf, dma_addr_t *addr, size_t *len) { struct msm_audio_alloc_data *alloc_data; struct msm_audio_alloc_data *alloc_data = NULL; struct device *cb_dev; unsigned long ionflag = 0; int rc = 0; Loading Loading @@ -189,6 +189,7 @@ static int msm_audio_ion_dma_buf_map(struct dma_buf *dma_buf, dma_buf_detach(dma_buf, alloc_data->attach); free_alloc_data: kfree(alloc_data); alloc_data = NULL; return rc; } Loading Loading @@ -262,6 +263,7 @@ static int msm_audio_dma_buf_unmap(void *handle) list_del(&(alloc_data->list)); kfree(alloc_data); alloc_data = NULL; break; } } else { Loading @@ -278,6 +280,7 @@ static int msm_audio_dma_buf_unmap(void *handle) list_del(&(alloc_data->list)); kfree(alloc_data); alloc_data = NULL; break; } } Loading Loading @@ -541,6 +544,11 @@ static int msm_audio_ion_map_buf(void *handle, dma_addr_t *paddr, { int rc = 0; if (!handle || !paddr || !vaddr || !plen) { pr_err("%s: Invalid params\n", __func__); return -EINVAL; } rc = msm_audio_ion_get_phys((struct dma_buf*) handle, paddr, plen); if (rc) { pr_err("%s: ION Get Physical for AUDIO failed, rc = %d\n", Loading dsp/q6afe.c +35 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #define AFE_CLK_TOKEN 1024 #define SP_V4_NUM_MAX_SPKRS SP_V2_NUM_MAX_SPKRS #define MAX_LSM_SESSIONS 8 struct afe_avcs_payload_port_mapping { u16 port_id; Loading Loading @@ -249,6 +250,7 @@ struct afe_ctl { uint32_t num_spkrs; uint32_t cps_ch_mask; struct afe_cps_hw_intf_cfg *cps_config; int lsm_afe_ports[MAX_LSM_SESSIONS]; }; struct afe_clkinfo_per_port { Loading Loading @@ -303,6 +305,8 @@ bool afe_close_done[2] = {true, true}; #define SIZEOF_CFG_CMD(y) \ (sizeof(struct apr_hdr) + sizeof(u16) + (sizeof(struct y))) static bool q6afe_is_afe_lsm_port(int port_id); static void q6afe_unload_avcs_modules(u16 port_id, int index) { int ret = 0; Loading Loading @@ -3011,7 +3015,7 @@ static int afe_send_port_topology_id(u16 port_id) } ret = afe_get_cal_topology_id(port_id, &topology_id, AFE_TOPOLOGY_CAL); if (ret < 0) { if (ret < 0 && q6afe_is_afe_lsm_port(port_id)) { pr_debug("%s: Check for LSM topology\n", __func__); ret = afe_get_cal_topology_id(port_id, &topology_id, AFE_LSM_TOPOLOGY_CAL); Loading Loading @@ -3384,7 +3388,7 @@ void afe_send_cal(u16 port_id) if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_TX) { afe_send_cal_spkr_prot_tx(port_id); ret = send_afe_cal_type(AFE_COMMON_TX_CAL, port_id); if (ret < 0) if (ret < 0 && q6afe_is_afe_lsm_port(port_id)) send_afe_cal_type(AFE_LSM_TX_CAL, port_id); } else if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_RX) { send_afe_cal_type(AFE_COMMON_RX_CAL, port_id); Loading Loading @@ -10675,6 +10679,8 @@ int __init afe_init(void) init_waitqueue_head(&this_afe.wait_wakeup); init_waitqueue_head(&this_afe.lpass_core_hw_wait); init_waitqueue_head(&this_afe.clk_wait); for (i = 0; i < MAX_LSM_SESSIONS; i++) this_afe.lsm_afe_ports[i] = 0xffff; ret = afe_init_cal_data(); if (ret) pr_err("%s: could not init cal data! %d\n", __func__, ret); Loading Loading @@ -10913,3 +10919,30 @@ void afe_set_cps_config(int src_port, this_afe.cps_config = cps_config; } EXPORT_SYMBOL(afe_set_cps_config); static bool q6afe_is_afe_lsm_port(int port_id) { int i = 0; for (i = 0; i < MAX_LSM_SESSIONS; i++) { if (port_id == this_afe.lsm_afe_ports[i]) return true; } return false; } /** * afe_set_lsm_afe_port_id - * Update LSM AFE port * idx: LSM port index * lsm_port: LSM port id */ void afe_set_lsm_afe_port_id(int idx, int lsm_port) { if (idx < 0 || idx >= MAX_LSM_SESSIONS) { pr_err("%s: %d Invalid lsm port index\n", __func__, idx); return; } this_afe.lsm_afe_ports[idx] = lsm_port; } EXPORT_SYMBOL(afe_set_lsm_afe_port_id); dsp/q6asm.c +6 −0 Original line number Diff line number Diff line Loading @@ -8486,6 +8486,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, if (mmap_region_cmd == NULL) { rc = -EINVAL; kfree(buffer_node); buffer_node = NULL; return rc; } mmap_regions = (struct avs_cmd_shared_mem_map_regions *) Loading Loading @@ -8522,6 +8523,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, mmap_regions->hdr.opcode, rc); rc = -EINVAL; kfree(buffer_node); buffer_node = NULL; goto fail_cmd; } Loading @@ -8533,6 +8535,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, pr_err("%s: timeout. waited for memory_map\n", __func__); rc = -ETIMEDOUT; kfree(buffer_node); buffer_node = NULL; goto fail_cmd; } if (atomic_read(&ac->mem_state) > 0) { Loading @@ -8542,6 +8545,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, rc = adsp_err_get_lnx_err_code( atomic_read(&ac->mem_state)); kfree(buffer_node); buffer_node = NULL; goto fail_cmd; } mutex_lock(&ac->cmd_lock); Loading @@ -8561,6 +8565,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, rc = 0; fail_cmd: kfree(mmap_region_cmd); mmap_region_cmd = NULL; return rc; } EXPORT_SYMBOL(q6asm_memory_map_regions); Loading Loading @@ -8656,6 +8661,7 @@ static int q6asm_memory_unmap_regions(struct audio_client *ac, int dir) if (buf_node->buf_phys_addr == buf_add) { list_del(&buf_node->list); kfree(buf_node); buf_node = NULL; break; } } Loading Loading
asoc/msm-pcm-routing-v2.c +6 −0 Original line number Diff line number Diff line Loading @@ -3033,6 +3033,7 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol, struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int mux = ucontrol->value.enumerated.item[0]; int lsm_port = AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_TX; int lsm_port_idx = 0; u8 fe_idx = 0; if (mux >= e->items) { Loading @@ -3042,6 +3043,7 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol, pr_debug("%s: LSM enable %ld\n", __func__, ucontrol->value.integer.value[0]); lsm_port_idx = ucontrol->value.integer.value[0]; switch (ucontrol->value.integer.value[0]) { case 1: lsm_port = AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_TX; Loading Loading @@ -3098,6 +3100,10 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol, set_lsm_port(lsm_port); msm_routing_get_lsm_fe_idx(kcontrol, &fe_idx); lsm_port_index[fe_idx] = ucontrol->value.integer.value[0]; /* Set the default AFE LSM Port to 0xffff */ if(lsm_port_idx <= 0 || lsm_port_idx >= ARRAY_SIZE(lsm_port_text)) lsm_port = 0xffff; afe_set_lsm_afe_port_id(fe_idx, lsm_port); return 0; }
dsp/msm_audio_ion.c +9 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. */ #include <linux/init.h> Loading Loading @@ -67,7 +67,7 @@ static int msm_audio_dma_buf_map(struct dma_buf *dma_buf, dma_addr_t *addr, size_t *len) { struct msm_audio_alloc_data *alloc_data; struct msm_audio_alloc_data *alloc_data = NULL; struct device *cb_dev; unsigned long ionflag = 0; int rc = 0; Loading Loading @@ -133,6 +133,7 @@ static int msm_audio_dma_buf_map(struct dma_buf *dma_buf, alloc_data->attach); free_alloc_data: kfree(alloc_data); alloc_data = NULL; return rc; } Loading Loading @@ -170,6 +171,7 @@ static int msm_audio_dma_buf_unmap(struct dma_buf *dma_buf) list_del(&(alloc_data->list)); kfree(alloc_data); alloc_data = NULL; break; } } Loading Loading @@ -312,6 +314,11 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr, { int rc = 0; if (!dma_buf || !paddr || !vaddr || !plen) { pr_err("%s: Invalid params\n", __func__); return -EINVAL; } rc = msm_audio_ion_get_phys(dma_buf, paddr, plen); if (rc) { pr_err("%s: ION Get Physical for AUDIO failed, rc = %d\n", Loading
dsp/msm_audio_ion_vm.c +9 −1 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ static int msm_audio_ion_dma_buf_map(struct dma_buf *dma_buf, dma_addr_t *addr, size_t *len) { struct msm_audio_alloc_data *alloc_data; struct msm_audio_alloc_data *alloc_data = NULL; struct device *cb_dev; unsigned long ionflag = 0; int rc = 0; Loading Loading @@ -189,6 +189,7 @@ static int msm_audio_ion_dma_buf_map(struct dma_buf *dma_buf, dma_buf_detach(dma_buf, alloc_data->attach); free_alloc_data: kfree(alloc_data); alloc_data = NULL; return rc; } Loading Loading @@ -262,6 +263,7 @@ static int msm_audio_dma_buf_unmap(void *handle) list_del(&(alloc_data->list)); kfree(alloc_data); alloc_data = NULL; break; } } else { Loading @@ -278,6 +280,7 @@ static int msm_audio_dma_buf_unmap(void *handle) list_del(&(alloc_data->list)); kfree(alloc_data); alloc_data = NULL; break; } } Loading Loading @@ -541,6 +544,11 @@ static int msm_audio_ion_map_buf(void *handle, dma_addr_t *paddr, { int rc = 0; if (!handle || !paddr || !vaddr || !plen) { pr_err("%s: Invalid params\n", __func__); return -EINVAL; } rc = msm_audio_ion_get_phys((struct dma_buf*) handle, paddr, plen); if (rc) { pr_err("%s: ION Get Physical for AUDIO failed, rc = %d\n", Loading
dsp/q6afe.c +35 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #define AFE_CLK_TOKEN 1024 #define SP_V4_NUM_MAX_SPKRS SP_V2_NUM_MAX_SPKRS #define MAX_LSM_SESSIONS 8 struct afe_avcs_payload_port_mapping { u16 port_id; Loading Loading @@ -249,6 +250,7 @@ struct afe_ctl { uint32_t num_spkrs; uint32_t cps_ch_mask; struct afe_cps_hw_intf_cfg *cps_config; int lsm_afe_ports[MAX_LSM_SESSIONS]; }; struct afe_clkinfo_per_port { Loading Loading @@ -303,6 +305,8 @@ bool afe_close_done[2] = {true, true}; #define SIZEOF_CFG_CMD(y) \ (sizeof(struct apr_hdr) + sizeof(u16) + (sizeof(struct y))) static bool q6afe_is_afe_lsm_port(int port_id); static void q6afe_unload_avcs_modules(u16 port_id, int index) { int ret = 0; Loading Loading @@ -3011,7 +3015,7 @@ static int afe_send_port_topology_id(u16 port_id) } ret = afe_get_cal_topology_id(port_id, &topology_id, AFE_TOPOLOGY_CAL); if (ret < 0) { if (ret < 0 && q6afe_is_afe_lsm_port(port_id)) { pr_debug("%s: Check for LSM topology\n", __func__); ret = afe_get_cal_topology_id(port_id, &topology_id, AFE_LSM_TOPOLOGY_CAL); Loading Loading @@ -3384,7 +3388,7 @@ void afe_send_cal(u16 port_id) if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_TX) { afe_send_cal_spkr_prot_tx(port_id); ret = send_afe_cal_type(AFE_COMMON_TX_CAL, port_id); if (ret < 0) if (ret < 0 && q6afe_is_afe_lsm_port(port_id)) send_afe_cal_type(AFE_LSM_TX_CAL, port_id); } else if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_RX) { send_afe_cal_type(AFE_COMMON_RX_CAL, port_id); Loading Loading @@ -10675,6 +10679,8 @@ int __init afe_init(void) init_waitqueue_head(&this_afe.wait_wakeup); init_waitqueue_head(&this_afe.lpass_core_hw_wait); init_waitqueue_head(&this_afe.clk_wait); for (i = 0; i < MAX_LSM_SESSIONS; i++) this_afe.lsm_afe_ports[i] = 0xffff; ret = afe_init_cal_data(); if (ret) pr_err("%s: could not init cal data! %d\n", __func__, ret); Loading Loading @@ -10913,3 +10919,30 @@ void afe_set_cps_config(int src_port, this_afe.cps_config = cps_config; } EXPORT_SYMBOL(afe_set_cps_config); static bool q6afe_is_afe_lsm_port(int port_id) { int i = 0; for (i = 0; i < MAX_LSM_SESSIONS; i++) { if (port_id == this_afe.lsm_afe_ports[i]) return true; } return false; } /** * afe_set_lsm_afe_port_id - * Update LSM AFE port * idx: LSM port index * lsm_port: LSM port id */ void afe_set_lsm_afe_port_id(int idx, int lsm_port) { if (idx < 0 || idx >= MAX_LSM_SESSIONS) { pr_err("%s: %d Invalid lsm port index\n", __func__, idx); return; } this_afe.lsm_afe_ports[idx] = lsm_port; } EXPORT_SYMBOL(afe_set_lsm_afe_port_id);
dsp/q6asm.c +6 −0 Original line number Diff line number Diff line Loading @@ -8486,6 +8486,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, if (mmap_region_cmd == NULL) { rc = -EINVAL; kfree(buffer_node); buffer_node = NULL; return rc; } mmap_regions = (struct avs_cmd_shared_mem_map_regions *) Loading Loading @@ -8522,6 +8523,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, mmap_regions->hdr.opcode, rc); rc = -EINVAL; kfree(buffer_node); buffer_node = NULL; goto fail_cmd; } Loading @@ -8533,6 +8535,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, pr_err("%s: timeout. waited for memory_map\n", __func__); rc = -ETIMEDOUT; kfree(buffer_node); buffer_node = NULL; goto fail_cmd; } if (atomic_read(&ac->mem_state) > 0) { Loading @@ -8542,6 +8545,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, rc = adsp_err_get_lnx_err_code( atomic_read(&ac->mem_state)); kfree(buffer_node); buffer_node = NULL; goto fail_cmd; } mutex_lock(&ac->cmd_lock); Loading @@ -8561,6 +8565,7 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir, rc = 0; fail_cmd: kfree(mmap_region_cmd); mmap_region_cmd = NULL; return rc; } EXPORT_SYMBOL(q6asm_memory_map_regions); Loading Loading @@ -8656,6 +8661,7 @@ static int q6asm_memory_unmap_regions(struct audio_client *ac, int dir) if (buf_node->buf_phys_addr == buf_add) { list_del(&buf_node->list); kfree(buf_node); buf_node = NULL; break; } } Loading