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

Commit ff2b0399 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: sps: add the option to distinguish BAM types"

parents 45594076 6beb18e8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ Peripheral-to-Memory (a.k.a. BAM-System) mode. SPS includes BAM (Bus
Access Module) hardware block, BAM DMA peripheral, and pipe memory.

Required property:
  - compatible: should be "qcom,msm_sps"
  - compatible: should be "qcom,msm_sps" or "qcom,msm_sps_4k"

Optional properties:
  - reg: offset and size for the memory mapping, including maps for
+1 −1
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@
	};

	qcom,sps {
		compatible = "qcom,msm_sps";
		compatible = "qcom,msm_sps_4k";
		qcom,device-type = <3>;
		qcom,pipe-attr-ee;
	};
+26 −7
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, 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
@@ -27,6 +27,7 @@
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#include <linux/of.h>
#include <linux/of_device.h>

#include "sps_bam.h"
#include "spsi.h"
@@ -81,6 +82,8 @@ static struct sps_drv *sps;
u32 d_type;
bool enhd_pipe;
bool imem;
enum sps_bam_type bam_type;
enum sps_bam_type bam_types[] = {SPS_BAM_LEGACY, SPS_BAM_NDP, SPS_BAM_NDP_4K};

static void sps_device_de_init(void);

@@ -2497,6 +2500,16 @@ static int get_device_tree_data(struct platform_device *pdev)
	return 0;
}

static struct of_device_id msm_sps_match[] = {
	{	.compatible = "qcom,msm_sps",
		.data = &bam_types[SPS_BAM_NDP]
	},
	{	.compatible = "qcom,msm_sps_4k",
		.data = &bam_types[SPS_BAM_NDP_4K]
	},
	{}
};

static int msm_sps_probe(struct platform_device *pdev)
{
	int ret = -ENODEV;
@@ -2504,11 +2517,22 @@ static int msm_sps_probe(struct platform_device *pdev)
	SPS_DBG2("sps:%s.", __func__);

	if (pdev->dev.of_node) {
		const struct of_device_id *match;

		if (get_device_tree_data(pdev)) {
			SPS_ERR("sps:Fail to get data from device tree.");
			return -ENODEV;
		} else
			SPS_DBG("sps:get data from device tree.");

		match = of_match_device(msm_sps_match, &pdev->dev);
		if (match) {
			bam_type = *((enum sps_bam_type *)(match->data));
			SPS_DBG("sps:BAM type is:%d\n", bam_type);
		} else {
			bam_type = SPS_BAM_NDP;
			SPS_DBG("sps:use default BAM type:%d\n", bam_type);
		}
	} else {
		d_type = 0;
		if (get_platform_data(pdev)) {
@@ -2516,6 +2540,7 @@ static int msm_sps_probe(struct platform_device *pdev)
			return -ENODEV;
		} else
			SPS_DBG("sps:get platform data.");
		bam_type = SPS_BAM_LEGACY;
	}

	/* Create Device */
@@ -2652,12 +2677,6 @@ static int msm_sps_remove(struct platform_device *pdev)
	return 0;
}

static struct of_device_id msm_sps_match[] = {
	{	.compatible = "qcom,msm_sps",
	},
	{}
};

static struct platform_driver msm_sps_driver = {
	.probe          = msm_sps_probe,
	.driver		= {
+8 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, 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
@@ -53,6 +53,7 @@
extern u32 d_type;
extern bool enhd_pipe;
extern bool imem;
extern enum sps_bam_type bam_type;

#ifdef CONFIG_DEBUG_FS
extern u8 debugfs_record_enabled;
@@ -196,6 +197,12 @@ struct sps_mem_stats {
	u32 max_bytes_used;
};

enum sps_bam_type {
	SPS_BAM_LEGACY,
	SPS_BAM_NDP,
	SPS_BAM_NDP_4K
};

#ifdef CONFIG_DEBUG_FS
/* record debug info for debugfs */
void sps_debugfs_record(const char *);