Loading drivers/soc/qcom/qdsp6v2/msm_audio_ion.c +2 −77 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include <linux/of_device.h> #include <linux/msm_audio_ion.h> #include <linux/export.h> #include <linux/qcom_iommu.h> #include <asm/dma-iommu.h> #define MSM_AUDIO_ION_PROBED (1 << 0) Loading @@ -40,16 +39,6 @@ #define MSM_AUDIO_SMMU_SID_OFFSET 32 struct addr_range { dma_addr_t start; size_t size; }; struct context_bank_info { const char *name; struct addr_range addr_range; }; struct msm_audio_ion_private { bool smmu_enabled; bool audioheap_enabled; Loading Loading @@ -676,74 +665,12 @@ static int msm_audio_ion_get_phys(struct ion_client *client, return rc; } static int msm_audio_smmu_init_legacy(struct device *dev) { struct dma_iommu_mapping *mapping; struct device_node *ctx_node = NULL; struct context_bank_info *cb; int ret; u32 read_val[2]; cb = devm_kzalloc(dev, sizeof(struct context_bank_info), GFP_KERNEL); if (!cb) return -ENOMEM; ctx_node = of_parse_phandle(dev->of_node, "iommus", 0); if (!ctx_node) { dev_err(dev, "%s Could not find any iommus for audio\n", __func__); return -EINVAL; } ret = of_property_read_string(ctx_node, "label", &(cb->name)); if (ret) { dev_err(dev, "%s Could not find label\n", __func__); return -EINVAL; } pr_debug("label found : %s\n", cb->name); ret = of_property_read_u32_array(ctx_node, "qcom,virtual-addr-pool", read_val, 2); if (ret) { dev_err(dev, "%s Could not read addr pool for group : (%d)\n", __func__, ret); return -EINVAL; } msm_audio_ion_data.cb_dev = msm_iommu_get_ctx(cb->name); cb->addr_range.start = (dma_addr_t) read_val[0]; cb->addr_range.size = (size_t) read_val[1]; dev_dbg(dev, "%s Legacy iommu usage\n", __func__); mapping = arm_iommu_create_mapping( msm_iommu_get_bus(msm_audio_ion_data.cb_dev), cb->addr_range.start, cb->addr_range.size); if (IS_ERR(mapping)) return PTR_ERR(mapping); ret = arm_iommu_attach_device(msm_audio_ion_data.cb_dev, mapping); if (ret) { dev_err(dev, "%s: Attach failed, err = %d\n", __func__, ret); goto fail_attach; } msm_audio_ion_data.mapping = mapping; INIT_LIST_HEAD(&msm_audio_ion_data.alloc_list); mutex_init(&(msm_audio_ion_data.list_mutex)); return 0; fail_attach: arm_iommu_release_mapping(mapping); return ret; } static int msm_audio_smmu_init(struct device *dev) { struct dma_iommu_mapping *mapping; int ret; mapping = arm_iommu_create_mapping( msm_iommu_get_bus(dev), mapping = arm_iommu_create_mapping(&platform_bus_type, MSM_AUDIO_ION_VA_START, MSM_AUDIO_ION_VA_LEN); if (IS_ERR(mapping)) Loading Loading @@ -853,9 +780,7 @@ static int msm_audio_ion_probe(struct platform_device *pdev) msm_audio_ion_data.smmu_sid_bits = smmu_sid << MSM_AUDIO_SMMU_SID_OFFSET; if (msm_audio_ion_data.smmu_version == 0x1) { rc = msm_audio_smmu_init_legacy(dev); } else if (msm_audio_ion_data.smmu_version == 0x2) { if (msm_audio_ion_data.smmu_version == 0x2) { rc = msm_audio_smmu_init(dev); } else { dev_err(dev, "%s: smmu version invalid %d\n", Loading Loading
drivers/soc/qcom/qdsp6v2/msm_audio_ion.c +2 −77 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ #include <linux/of_device.h> #include <linux/msm_audio_ion.h> #include <linux/export.h> #include <linux/qcom_iommu.h> #include <asm/dma-iommu.h> #define MSM_AUDIO_ION_PROBED (1 << 0) Loading @@ -40,16 +39,6 @@ #define MSM_AUDIO_SMMU_SID_OFFSET 32 struct addr_range { dma_addr_t start; size_t size; }; struct context_bank_info { const char *name; struct addr_range addr_range; }; struct msm_audio_ion_private { bool smmu_enabled; bool audioheap_enabled; Loading Loading @@ -676,74 +665,12 @@ static int msm_audio_ion_get_phys(struct ion_client *client, return rc; } static int msm_audio_smmu_init_legacy(struct device *dev) { struct dma_iommu_mapping *mapping; struct device_node *ctx_node = NULL; struct context_bank_info *cb; int ret; u32 read_val[2]; cb = devm_kzalloc(dev, sizeof(struct context_bank_info), GFP_KERNEL); if (!cb) return -ENOMEM; ctx_node = of_parse_phandle(dev->of_node, "iommus", 0); if (!ctx_node) { dev_err(dev, "%s Could not find any iommus for audio\n", __func__); return -EINVAL; } ret = of_property_read_string(ctx_node, "label", &(cb->name)); if (ret) { dev_err(dev, "%s Could not find label\n", __func__); return -EINVAL; } pr_debug("label found : %s\n", cb->name); ret = of_property_read_u32_array(ctx_node, "qcom,virtual-addr-pool", read_val, 2); if (ret) { dev_err(dev, "%s Could not read addr pool for group : (%d)\n", __func__, ret); return -EINVAL; } msm_audio_ion_data.cb_dev = msm_iommu_get_ctx(cb->name); cb->addr_range.start = (dma_addr_t) read_val[0]; cb->addr_range.size = (size_t) read_val[1]; dev_dbg(dev, "%s Legacy iommu usage\n", __func__); mapping = arm_iommu_create_mapping( msm_iommu_get_bus(msm_audio_ion_data.cb_dev), cb->addr_range.start, cb->addr_range.size); if (IS_ERR(mapping)) return PTR_ERR(mapping); ret = arm_iommu_attach_device(msm_audio_ion_data.cb_dev, mapping); if (ret) { dev_err(dev, "%s: Attach failed, err = %d\n", __func__, ret); goto fail_attach; } msm_audio_ion_data.mapping = mapping; INIT_LIST_HEAD(&msm_audio_ion_data.alloc_list); mutex_init(&(msm_audio_ion_data.list_mutex)); return 0; fail_attach: arm_iommu_release_mapping(mapping); return ret; } static int msm_audio_smmu_init(struct device *dev) { struct dma_iommu_mapping *mapping; int ret; mapping = arm_iommu_create_mapping( msm_iommu_get_bus(dev), mapping = arm_iommu_create_mapping(&platform_bus_type, MSM_AUDIO_ION_VA_START, MSM_AUDIO_ION_VA_LEN); if (IS_ERR(mapping)) Loading Loading @@ -853,9 +780,7 @@ static int msm_audio_ion_probe(struct platform_device *pdev) msm_audio_ion_data.smmu_sid_bits = smmu_sid << MSM_AUDIO_SMMU_SID_OFFSET; if (msm_audio_ion_data.smmu_version == 0x1) { rc = msm_audio_smmu_init_legacy(dev); } else if (msm_audio_ion_data.smmu_version == 0x2) { if (msm_audio_ion_data.smmu_version == 0x2) { rc = msm_audio_smmu_init(dev); } else { dev_err(dev, "%s: smmu version invalid %d\n", Loading