Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8b35d91 authored by Maheshwar Ajja's avatar Maheshwar Ajja Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Allocate dsp hfi queues from cdsp memory



Use cdsp memory device instead of adsp memory device
to allocate dsp hfi queues.

Change-Id: Ie3df9fd736b146177f34e1739b1e1f688ade0859
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
parent 06c98d1f
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -488,7 +488,7 @@ static const struct of_device_id msm_vidc_dt_match[] = {
	{.compatible = "qcom,msm-vidc"},
	{.compatible = "qcom,msm-vidc,context-bank"},
	{.compatible = "qcom,msm-vidc,bus"},
	{.compatible = "qcom,msm-vidc,mem-adsp"},
	{.compatible = "qcom,msm-vidc,mem-cdsp"},
	{}
};

@@ -680,9 +680,9 @@ static int msm_vidc_probe_vidc_device(struct platform_device *pdev)
	return rc;
}

static int msm_vidc_probe_mem_adsp(struct platform_device *pdev)
static int msm_vidc_probe_mem_cdsp(struct platform_device *pdev)
{
	return read_mem_adsp_resources_from_dt(pdev);
	return read_mem_cdsp_resources_from_dt(pdev);
}

static int msm_vidc_probe_context_bank(struct platform_device *pdev)
@@ -711,8 +711,8 @@ static int msm_vidc_probe(struct platform_device *pdev)
		"qcom,msm-vidc,context-bank")) {
		return msm_vidc_probe_context_bank(pdev);
	} else if (of_device_is_compatible(pdev->dev.of_node,
		"qcom,msm-vidc,mem-adsp")) {
		return msm_vidc_probe_mem_adsp(pdev);
		"qcom,msm-vidc,mem-cdsp")) {
		return msm_vidc_probe_mem_cdsp(pdev);
	}

	/* How did we end up here? */
+4 −4
Original line number Diff line number Diff line
@@ -377,10 +377,10 @@ static int msm_vidc_load_allowed_clocks_table(
	return 0;
}

static int msm_vidc_populate_mem_adsp(struct device *dev,
static int msm_vidc_populate_mem_cdsp(struct device *dev,
		struct msm_vidc_platform_resources *res)
{
	res->mem_adsp.dev = dev;
	res->mem_cdsp.dev = dev;

	return 0;
}
@@ -1288,7 +1288,7 @@ int read_bus_resources_from_dt(struct platform_device *pdev)
	return msm_vidc_populate_bus(&pdev->dev, &core->resources);
}

int read_mem_adsp_resources_from_dt(struct platform_device *pdev)
int read_mem_cdsp_resources_from_dt(struct platform_device *pdev)
{
	struct msm_vidc_core *core;

@@ -1308,5 +1308,5 @@ int read_mem_adsp_resources_from_dt(struct platform_device *pdev)
		return -EINVAL;
	}

	return msm_vidc_populate_mem_adsp(&pdev->dev, &core->resources);
	return msm_vidc_populate_mem_cdsp(&pdev->dev, &core->resources);
}
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ int read_platform_resources_from_dt(
int read_context_bank_resources_from_dt(struct platform_device *pdev);

int read_bus_resources_from_dt(struct platform_device *pdev);
int read_mem_adsp_resources_from_dt(struct platform_device *pdev);
int read_mem_cdsp_resources_from_dt(struct platform_device *pdev);

int msm_vidc_load_u32_table(struct platform_device *pdev,
		struct device_node *of_node, char *table_name, int struct_size,
+2 −2
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ struct subcache_set {
	u32 count;
};

struct msm_vidc_mem_adsp {
struct msm_vidc_mem_cdsp {
	struct device *dev;
};

@@ -196,7 +196,7 @@ struct msm_vidc_platform_resources {
	struct msm_vidc_codec_data *codec_data;
	int codec_data_count;
	struct msm_vidc_csc_coeff *csc_coeff_data;
	struct msm_vidc_mem_adsp mem_adsp;
	struct msm_vidc_mem_cdsp mem_cdsp;
};

static inline bool is_iommu_present(struct msm_vidc_platform_resources *res)
+3 −3
Original line number Diff line number Diff line
@@ -1611,7 +1611,7 @@ static void __interface_dsp_queues_release(struct venus_hfi_device *device)

	dma_unmap_single_attrs(cb->dev, mem_data->device_addr,
		mem_data->size, DMA_BIDIRECTIONAL, 0);
	dma_free_coherent(device->res->mem_adsp.dev, mem_data->size,
	dma_free_coherent(device->res->mem_cdsp.dev, mem_data->size,
		mem_data->kvaddr, mem_data->dma_handle);

	for (i = 0; i < VIDC_IFACEQ_NUMQ; i++) {
@@ -1643,7 +1643,7 @@ static int __interface_dsp_queues_init(struct venus_hfi_device *dev)
	mem_data = &dev->dsp_iface_q_table.mem_data;

	/* Allocate dsp queues from ADSP device memory */
	kvaddr = dma_alloc_coherent(dev->res->mem_adsp.dev, q_size,
	kvaddr = dma_alloc_coherent(dev->res->mem_cdsp.dev, q_size,
				&dma_handle, GFP_KERNEL);
	if (IS_ERR_OR_NULL(kvaddr)) {
		dprintk(VIDC_ERR, "%s: failed dma allocation\n", __func__);
@@ -1726,7 +1726,7 @@ static int __interface_dsp_queues_init(struct venus_hfi_device *dev)
	return rc;

fail_dma_map:
	dma_free_coherent(dev->res->mem_adsp.dev, q_size, kvaddr, dma_handle);
	dma_free_coherent(dev->res->mem_cdsp.dev, q_size, kvaddr, dma_handle);
fail_dma_alloc:
	return -ENOMEM;
}