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

Commit 2d6f6830 authored by Jeff Hugo's avatar Jeff Hugo
Browse files

msm: smd: separate pil attributes from subsystem name



All remote subsystems have a name, but not all remote subsystems are
loadable by PIL.  Storing a single value to be used as both the name and to
indicate a subsystem can be loaded by PIL is limiting in cases where a
subsystem cannot be loaded by PIL.  In such cases, workarounds are
necessary, or useful functionality is broken.

In addition to listing a name for a subsystem, indicate if it can be loaded
by PIL which eliminates limitations when loading by PILL may not apply.

Change-Id: Id7b6ee028ac6b1ecdc12a4fd4aeebf51cb45a1a0
Signed-off-by: default avatarJeffrey Hugo <jhugo@codeaurora.org>
parent 1f4dd82d
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -24,10 +24,11 @@ Required properties:
	interrupts
-qcom,smd-irq-bitmask : the sending irq bitmask
-interrupts : the receiving interrupt line
-label : the name of the remote subsystem for this edge

Optional properties:
-qcom,pil-string : the name to use when loading this edge
-qcom,irq-no-suspend: configure the incoming irq line as active during suspend
-qcom,not-loadable : indicates this processor cannot be loaded by PIL

qcom,smsm
Required properties:
@@ -53,8 +54,8 @@ Example:
			qcom,smd-edge = <0>;
			qcom,smd-irq-offset = <0x8>;
			qcom,smd-irq-bitmask = <0x1000>;
			qcom,pil-string = "modem";
			interrupts = <0 25 1>;
			label = "modem";
		};

		qcom,smsm-modem {
@@ -70,8 +71,8 @@ Example:
			qcom,smd-edge = <1>;
			qcom,smd-irq-offset = <0x8>;
			qcom,smd-irq-bitmask = <0x100>;
			qcom,pil-string = "adsp";
			interrupts = <0 156 1>;
			label = "adsp";
		};

		qcom,smsm-adsp {
@@ -87,8 +88,8 @@ Example:
			qcom,smd-edge = <6>;
			qcom,smd-irq-offset = <0x8>;
			qcom,smd-irq-bitmask = <0x20000>;
			qcom,pil-string = "wcnss";
			interrupts = <0 142 1>;
			label = "wcnss";
		};

		qcom,smsm-wcnss {
@@ -105,7 +106,9 @@ Example:
			qcom,smd-irq-offset = <0x8>;
			qcom,smd-irq-bitmask = <0x1>;
			interrupts = <0 168 1>;
			label = "rpm";
			qcom,irq-no-syspend;
			qcom,not-loadable;
		};
	};
+15 −0
Original line number Diff line number Diff line
@@ -325,6 +325,16 @@ int __init msm_smd_init(void);
 */
int smd_remote_ss_to_edge(const char *name);

/**
 * smd_edge_to_pil_str - Returns the PIL string used to load the remote side of
 *			the indicated edge.
 *
 * @type - Edge definition
 * @returns - The PIL string to load the remove side of @type or NULL if the
 *		PIL string does not exist.
 */
const char *smd_edge_to_pil_str(uint32_t type);

#else

static inline int smd_open(const char *name, smd_channel_t **ch, void *priv,
@@ -461,6 +471,11 @@ static inline int smd_remote_ss_to_edge(const char *name)
{
	return -EINVAL;
}

static inline const char *smd_edge_to_pil_str(uint32_t type)
{
	return NULL;
}
#endif

#endif
+2 −2
Original line number Diff line number Diff line
@@ -446,7 +446,7 @@ static void *msm_ipc_load_subsystem(uint32_t edge)
	void *pil = NULL;
	const char *peripheral;

	peripheral = smd_edge_to_subsystem(edge);
	peripheral = smd_edge_to_pil_str(edge);
	if (peripheral) {
		pil = subsystem_get(peripheral);
		if (IS_ERR(pil)) {
@@ -548,7 +548,7 @@ void *msm_ipc_load_default_node(void)
	void *pil = NULL;
	const char *peripheral;

	peripheral = smd_edge_to_subsystem(SMD_APPS_MODEM);
	peripheral = smd_edge_to_pil_str(SMD_APPS_MODEM);
	if (peripheral && !strncmp(peripheral, "modem", 6)) {
		pil = subsystem_get(peripheral);
		if (IS_ERR(pil)) {
+47 −5
Original line number Diff line number Diff line
@@ -650,6 +650,7 @@ struct remote_proc_info {
	struct list_head ch_list;
	/* 2 total supported tables of channels */
	unsigned char ch_allocated[SMEM_NUM_SMD_STREAM_CHANNELS * 2];
	bool skip_pil;
};

static struct remote_proc_info remote_info[NUM_SMD_SUBSYSTEMS];
@@ -823,6 +824,29 @@ int smd_remote_ss_to_edge(const char *name)
}
EXPORT_SYMBOL(smd_remote_ss_to_edge);

/**
 * smd_edge_to_pil_str - Returns the PIL string used to load the remote side of
 *			 the indicated edge.
 *
 * @type -	Edge definition
 * @returns -	The PIL string to load the remove side of @type or NULL if the
 *		PIL string does not exist.
 */
const char *smd_edge_to_pil_str(uint32_t type)
{
	const char *pil_str = NULL;

	if (type < ARRAY_SIZE(edge_to_pids)) {
		if (!remote_info[smd_edge_to_remote_pid(type)].skip_pil) {
			pil_str = edge_to_pids[type].subsys_name;
			if (pil_str[0] == 0x0)
				pil_str = NULL;
		}
	}
	return pil_str;
}
EXPORT_SYMBOL(smd_edge_to_pil_str);

/*
 * Returns a pointer to the subsystem name or NULL if no
 * subsystem name is available.
@@ -3329,26 +3353,44 @@ int smd_edge_to_local_pid(uint32_t edge)
	return edge_to_pids[edge].local_pid;
}

/**
 * smd_proc_set_skip_pil() - Mark if the indicated processor is be loaded by PIL
 * @pid:		the processor id to mark
 * @skip_pil:		true if @pid cannot by loaded by PIL
 */
void smd_proc_set_skip_pil(unsigned pid, bool skip_pil)
{
	if (pid >= NUM_SMD_SUBSYSTEMS) {
		pr_err("%s: invalid pid:%d\n", __func__, pid);
		return;
	}
	remote_info[pid].skip_pil = skip_pil;
}

/**
 * smd_set_edge_subsys_name() - Set the subsystem name
 * @edge:		edge type identifies local and remote processor
 * @sussys_name:	pointer to subsystem name
 * @subsys_name:	pointer to subsystem name
 *
 * This function is used to set the subsystem name for given edge type.
 */
void smd_set_edge_subsys_name(uint32_t edge, const char *subsys_name)
{
	if (edge < ARRAY_SIZE(edge_to_pids))
		if (subsys_name)
			strlcpy(edge_to_pids[edge].subsys_name,
				subsys_name, SMD_MAX_CH_NAME_LEN);
		else
			strlcpy(edge_to_pids[edge].subsys_name,
				"", SMD_MAX_CH_NAME_LEN);
	else
		pr_err("%s: Invalid edge type[%d]\n", __func__, edge);
}

/**
 * smd_reset_all_edge_subsys_name() - Reset the PIL string
 * smd_reset_all_edge_subsys_name() - Reset the subsystem name
 *
 * This function is used to reset the PIL string of all edges in
 * This function is used to reset the subsystem name of all edges in
 * targets where configuration information is available through
 * device tree.
 */
+25 −7
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ static int msm_smd_probe(struct platform_device *pdev)
	uint32_t irq_bitmask;
	uint32_t irq_line;
	unsigned long irq_flags = IRQF_TRIGGER_RISING;
	const char *pilstr;
	const char *subsys_name;
	struct interrupt_config_item *private_irq;
	struct device_node *node;
	void *irq_out_base;
@@ -173,6 +173,7 @@ static int msm_smd_probe(struct platform_device *pdev)
	struct resource *r;
	struct interrupt_config *private_intr_config;
	uint32_t remote_pid;
	bool skip_pil;

	node = pdev->dev.of_node;

@@ -227,10 +228,27 @@ static int msm_smd_probe(struct platform_device *pdev)
		goto missing_key;
	SMD_DBG("%s: %s = %d", __func__, key, irq_line);

	key = "label";
	subsys_name = of_get_property(node, key, NULL);
	SMD_DBG("%s: %s = %s", __func__, key, subsys_name);
	/*
	 * Backwards compatibility.  Although label is required, some DTs may
	 * still list the legacy pil-string.  Sanely handle pil-string.
	 */
	if (!subsys_name) {
		pr_warn("Missing required property - label.  Using legacy parsing\n");
		key = "qcom,pil-string";
	pilstr = of_get_property(node, key, NULL);
	if (pilstr)
		SMD_DBG("%s: %s = %s", __func__, key, pilstr);
		subsys_name = of_get_property(node, key, NULL);
		SMD_DBG("%s: %s = %s", __func__, key, subsys_name);
		if (subsys_name)
			skip_pil = false;
		else
			skip_pil = true;
	} else {
		key = "qcom,not-loadable";
		skip_pil = of_property_read_bool(node, key);
		SMD_DBG("%s: %s = %d\n", __func__, key, skip_pil);
	}

	key = "qcom,irq-no-suspend";
	ret = of_property_read_bool(node, key);
@@ -265,8 +283,8 @@ static int msm_smd_probe(struct platform_device *pdev)
					irq_line);
	}

	if (pilstr)
		smd_set_edge_subsys_name(edge, pilstr);
	smd_set_edge_subsys_name(edge, subsys_name);
	smd_proc_set_skip_pil(smd_edge_to_remote_pid(edge), skip_pil);

	smd_set_edge_initialized(edge);
	smd_post_init(0, remote_pid);
Loading