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

Commit 027cf3c1 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "rpmsg: Add snapshot of RPMSG drivers for lahaina"

parents edb7abf4 f1d8e56e
Loading
Loading
Loading
Loading
+473 −56

File changed.

Preview size limit exceeded, changes collapsed.

+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ struct qcom_glink_pipe {
	void (*write)(struct qcom_glink_pipe *glink_pipe,
		      const void *hdr, size_t hlen,
		      const void *data, size_t dlen);

	void (*reset)(struct qcom_glink_pipe *glink_pipe);
};

struct qcom_glink;
+2 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2016, 2019 Linaro Ltd
 * Copyright (c) 2018-2019, The Linux Foundation, All rights reserved.
 */

#include <linux/io.h>
@@ -114,7 +115,7 @@ static void glink_smem_rx_advance(struct qcom_glink_pipe *np,
	tail = le32_to_cpu(*pipe->tail);

	tail += count;
	if (tail > pipe->native.length)
	if (tail >= pipe->native.length)
		tail %= pipe->native.length;

	*pipe->tail = cpu_to_le32(tail);
+42 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
 *
 * Copyright (C) 2011 Texas Instruments, Inc.
 * Copyright (C) 2011 Google, Inc.
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 *
 * Ohad Ben-Cohen <ohad@wizery.com>
 * Brian Swetland <swetland@google.com>
@@ -81,7 +82,7 @@ EXPORT_SYMBOL(rpmsg_create_ept);
 */
void rpmsg_destroy_ept(struct rpmsg_endpoint *ept)
{
	if (ept)
	if (ept && ept->ops)
		ept->ops->destroy_ept(ept);
}
EXPORT_SYMBOL(rpmsg_destroy_ept);
@@ -283,6 +284,42 @@ int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst,
}
EXPORT_SYMBOL(rpmsg_trysend_offchannel);

/**
 * rpmsg_get_sigs() - get the signals for this endpoint
 * @ept:	the rpmsg endpoint
 * @sigs:	serial signals bitmask
 *
 * Returns 0 on success and an appropriate error value on failure.
 */
int rpmsg_get_sigs(struct rpmsg_endpoint *ept, u32 *lsigs, u32 *rsigs)
{
	if (WARN_ON(!ept))
		return -EINVAL;
	if (!ept->ops->get_sigs)
		return -ENXIO;

	return ept->ops->get_sigs(ept, lsigs, rsigs);
}
EXPORT_SYMBOL(rpmsg_get_sigs);

/**
 * rpmsg_set_sigs() - set the remote signals for this endpoint
 * @ept:	the rpmsg endpoint
 * @sigs:	serial signals bitmask
 *
 * Returns 0 on success and an appropriate error value on failure.
 */
int rpmsg_set_sigs(struct rpmsg_endpoint *ept, u32 sigs)
{
	if (WARN_ON(!ept))
		return -EINVAL;
	if (!ept->ops->set_sigs)
		return -ENXIO;

	return ept->ops->set_sigs(ept, sigs);
}
EXPORT_SYMBOL(rpmsg_set_sigs);

/*
 * match an rpmsg channel with a channel info struct.
 * this is used to make sure we're not creating rpmsg devices for channels
@@ -468,6 +505,10 @@ static int rpmsg_dev_probe(struct device *dev)

		rpdev->ept = ept;
		rpdev->src = ept->addr;

		if (rpdrv->signals)
			ept->sig_cb = rpdrv->signals;

	}

	err = rpdrv->probe(rpdev);
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
 *
 * Copyright (C) 2011 Texas Instruments, Inc.
 * Copyright (C) 2011 Google, Inc.
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 *
 * Ohad Ben-Cohen <ohad@wizery.com>
 * Brian Swetland <swetland@google.com>
@@ -46,6 +47,8 @@ struct rpmsg_device_ops {
 * @trysend:		see @rpmsg_trysend(), required
 * @trysendto:		see @rpmsg_trysendto(), optional
 * @trysend_offchannel:	see @rpmsg_trysend_offchannel(), optional
 * @get_sigs:		see @rpmsg_get_sigs(), optional
 * @set_sigs:		see @rpmsg_set_sigs(), optional
 *
 * Indirection table for the operations that a rpmsg backend should implement.
 * In addition to @destroy_ept, the backend must at least implement @send and
@@ -65,6 +68,8 @@ struct rpmsg_endpoint_ops {
			     void *data, int len);
	__poll_t (*poll)(struct rpmsg_endpoint *ept, struct file *filp,
			     poll_table *wait);
	int (*get_sigs)(struct rpmsg_endpoint *ept, u32 *lsigs, u32 *rsigs);
	int (*set_sigs)(struct rpmsg_endpoint *ept, u32 sigs);
};

int rpmsg_register_device(struct rpmsg_device *rpdev);
Loading