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

Commit 87405a22 authored by Banajit Goswami's avatar Banajit Goswami
Browse files

soc: msm_audio_ion: add mask for Stream ID



SMMU SID may contain multiple identifiers for hardware to properly
identify the Context Bank in the SMMU. However, only the Stream ID
part of the overall SMMU SID needs to be appended to IOVA address
of shared audio buffers, and sent to ADSP.
Add a mask for identify the Stream ID part in SMMU SID.

Change-Id: I99b8c5e379730bc06f8f90eff3958f0f5438f6e8
Signed-off-by: default avatarBanajit Goswami <bgoswami@codeaurora.org>
parent a7654c6b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1067,6 +1067,9 @@ Optional properties:
	used in chipset. If ARM SMMU HW - use id value as 1,
	If QSMMU HW - use id value as 2.

 - qcom,smmu-sid-mask:
	Mask for the Stream ID part of SMMU SID.

 - qcom,smmu-enabled:
        It is possible that some MSM have SMMU in ADSP.  While other MSM use
	no SMMU. Audio lib introduce wrapper for ION APIs. The wrapper needs
+12 −1
Original line number Diff line number Diff line
@@ -723,6 +723,7 @@ static int msm_audio_ion_probe(struct platform_device *pdev)
	int rc = 0;
	const char *msm_audio_ion_dt = "qcom,smmu-enabled";
	const char *msm_audio_ion_smmu = "qcom,smmu-version";
	const char *msm_audio_ion_smmu_sid_mask = "qcom,smmu-sid-mask";
	bool smmu_enabled;
	enum apr_subsys_state q6_state;
	struct device *dev = &pdev->dev;
@@ -766,16 +767,26 @@ static int msm_audio_ion_probe(struct platform_device *pdev)

	if (smmu_enabled) {
		u64 smmu_sid = 0;
		u64 smmu_sid_mask = 0;
		struct of_phandle_args iommuspec;

		/* Get SMMU SID information from Devicetree */
		rc = of_property_read_u64(dev->of_node,
					  msm_audio_ion_smmu_sid_mask,
					  &smmu_sid_mask);
		if (rc) {
			dev_err(dev,
				"%s: qcom,smmu-sid-mask missing in DT node, using default\n",
				__func__);
			smmu_sid_mask = 0xFFFFFFFFFFFFFFFF;
		}
		rc = of_parse_phandle_with_args(dev->of_node, "iommus",
						"#iommu-cells", 0, &iommuspec);
		if (rc)
			dev_err(dev, "%s: could not get smmu SID, ret = %d\n",
				__func__, rc);
		else
			smmu_sid = iommuspec.args[0];
			smmu_sid = (iommuspec.args[0] & smmu_sid_mask);

		msm_audio_ion_data.smmu_sid_bits =
			smmu_sid << MSM_AUDIO_SMMU_SID_OFFSET;