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

Commit 604b44ae authored by Maheshwar Ajja's avatar Maheshwar Ajja
Browse files

msm: vidc: Allocate HFI CDSP queues from adsp heap



CDSP needs the memory to be allocated from adsp heap
memory. So allocate HFI CDSP queue buffer from adsp
memory device and map the buffer to video hardware
context bank for video hardware to access the buffer.

Change-Id: I3c4f68db651c69f44719f804f41b5d2eca4ab5e3
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
parent 8ecd48cc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -138,6 +138,13 @@ Optional properties:
  this tag will be used to pick the appropriate bus as per the session profile
  as shown below in example.

Memory Heaps
============
Required properties:
- compatible : one of:
	- "qcom,msm-vidc,mem-adsp"
- memory-region : phandle to the memory heap/region.

Example:

	qcom,vidc@fdc00000 {
+9 −0
Original line number Diff line number Diff line
@@ -488,6 +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"},
	{}
};

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

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

static int msm_vidc_probe_context_bank(struct platform_device *pdev)
{
	return read_context_bank_resources_from_dt(pdev);
@@ -704,6 +710,9 @@ static int msm_vidc_probe(struct platform_device *pdev)
	} else if (of_device_is_compatible(pdev->dev.of_node,
		"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);
	}

	/* How did we end up here? */
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ struct msm_smem {
	void *dma_buf;
	void *kvaddr;
	u32 device_addr;
	dma_addr_t dma_handle;
	unsigned int offset;
	unsigned int size;
	unsigned long flags;
+31 −0
Original line number Diff line number Diff line
@@ -377,6 +377,14 @@ static int msm_vidc_load_allowed_clocks_table(
	return 0;
}

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

	return 0;
}

static int msm_vidc_populate_bus(struct device *dev,
		struct msm_vidc_platform_resources *res)
{
@@ -1277,3 +1285,26 @@ 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)
{
	struct msm_vidc_core *core;

	if (!pdev) {
		dprintk(VIDC_ERR, "%s: invalid platform device\n", __func__);
		return -EINVAL;
	} else if (!pdev->dev.parent) {
		dprintk(VIDC_ERR, "Failed to find a parent for %s\n",
				dev_name(&pdev->dev));
		return -ENODEV;
	}

	core = dev_get_drvdata(pdev->dev.parent);
	if (!core) {
		dprintk(VIDC_ERR, "Failed to find cookie in parent device %s",
				dev_name(pdev->dev.parent));
		return -EINVAL;
	}

	return msm_vidc_populate_mem_adsp(&pdev->dev, &core->resources);
}
+2 −1
Original line number Diff line number Diff line

/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 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
@@ -30,6 +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 msm_vidc_load_u32_table(struct platform_device *pdev,
		struct device_node *of_node, char *table_name, int struct_size,
Loading