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

Commit d3e2442b authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'qcom-soc-for-4.7-2' of...

Merge tag 'qcom-soc-for-4.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux into next/drivers

Merge "Qualcomm ARM Based SoC Updates for v4.7 part 2" from Andy Gross:

* Change SMD callback parameters
* Use writecombine mapping for SMEM

* tag 'qcom-soc-for-4.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux:
  soc: qcom: smd: Make callback pass channel reference
  soc: qcom: smem: Use write-combine remap for SMEM
parents c6ba3f69 b853cb96
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
 */
struct qcom_smd_rpm {
	struct qcom_smd_channel *rpm_channel;
	struct device *dev;

	struct completion ack;
	struct mutex lock;
@@ -149,14 +150,14 @@ int qcom_rpm_smd_write(struct qcom_smd_rpm *rpm,
}
EXPORT_SYMBOL(qcom_rpm_smd_write);

static int qcom_smd_rpm_callback(struct qcom_smd_device *qsdev,
static int qcom_smd_rpm_callback(struct qcom_smd_channel *channel,
				 const void *data,
				 size_t count)
{
	const struct qcom_rpm_header *hdr = data;
	size_t hdr_length = le32_to_cpu(hdr->length);
	const struct qcom_rpm_message *msg;
	struct qcom_smd_rpm *rpm = dev_get_drvdata(&qsdev->dev);
	struct qcom_smd_rpm *rpm = qcom_smd_get_drvdata(channel);
	const u8 *buf = data + sizeof(struct qcom_rpm_header);
	const u8 *end = buf + hdr_length;
	char msgbuf[32];
@@ -165,7 +166,7 @@ static int qcom_smd_rpm_callback(struct qcom_smd_device *qsdev,

	if (le32_to_cpu(hdr->service_type) != RPM_SERVICE_TYPE_REQUEST ||
	    hdr_length < sizeof(struct qcom_rpm_message)) {
		dev_err(&qsdev->dev, "invalid request\n");
		dev_err(rpm->dev, "invalid request\n");
		return 0;
	}

@@ -206,7 +207,9 @@ static int qcom_smd_rpm_probe(struct qcom_smd_device *sdev)
	mutex_init(&rpm->lock);
	init_completion(&rpm->ack);

	rpm->dev = &sdev->dev;
	rpm->rpm_channel = sdev->channel;
	qcom_smd_set_drvdata(sdev->channel, rpm);

	dev_set_drvdata(&sdev->dev, rpm);

+18 −4
Original line number Diff line number Diff line
@@ -194,6 +194,8 @@ struct qcom_smd_channel {

	int pkt_size;

	void *drvdata;

	struct list_head list;
	struct list_head dev_list;
};
@@ -513,7 +515,6 @@ static void qcom_smd_channel_advance(struct qcom_smd_channel *channel,
 */
static int qcom_smd_channel_recv_single(struct qcom_smd_channel *channel)
{
	struct qcom_smd_device *qsdev = channel->qsdev;
	unsigned tail;
	size_t len;
	void *ptr;
@@ -533,7 +534,7 @@ static int qcom_smd_channel_recv_single(struct qcom_smd_channel *channel)
		len = channel->pkt_size;
	}

	ret = channel->cb(qsdev, ptr, len);
	ret = channel->cb(channel, ptr, len);
	if (ret < 0)
		return ret;

@@ -1034,6 +1035,18 @@ int qcom_smd_driver_register(struct qcom_smd_driver *qsdrv)
}
EXPORT_SYMBOL(qcom_smd_driver_register);

void *qcom_smd_get_drvdata(struct qcom_smd_channel *channel)
{
	return channel->drvdata;
}
EXPORT_SYMBOL(qcom_smd_get_drvdata);

void qcom_smd_set_drvdata(struct qcom_smd_channel *channel, void *data)
{
	channel->drvdata = data;
}
EXPORT_SYMBOL(qcom_smd_set_drvdata);

/**
 * qcom_smd_driver_unregister - unregister a smd driver
 * @qsdrv:	qcom_smd_driver struct
@@ -1079,12 +1092,13 @@ qcom_smd_find_channel(struct qcom_smd_edge *edge, const char *name)
 * Returns a channel handle on success, or -EPROBE_DEFER if the channel isn't
 * ready.
 */
struct qcom_smd_channel *qcom_smd_open_channel(struct qcom_smd_device *sdev,
struct qcom_smd_channel *qcom_smd_open_channel(struct qcom_smd_channel *parent,
					       const char *name,
					       qcom_smd_cb_t cb)
{
	struct qcom_smd_channel *channel;
	struct qcom_smd_edge *edge = sdev->channel->edge;
	struct qcom_smd_device *sdev = parent->qsdev;
	struct qcom_smd_edge *edge = parent->edge;
	int ret;

	/* Wait up to HZ for the channel to appear */
+1 −2
Original line number Diff line number Diff line
@@ -684,8 +684,7 @@ static int qcom_smem_map_memory(struct qcom_smem *smem, struct device *dev,

	smem->regions[i].aux_base = (u32)r.start;
	smem->regions[i].size = resource_size(&r);
	smem->regions[i].virt_base = devm_ioremap_nocache(dev, r.start,
							  resource_size(&r));
	smem->regions[i].virt_base = devm_ioremap_wc(dev, r.start, resource_size(&r));
	if (!smem->regions[i].virt_base)
		return -ENOMEM;

+4 −4
Original line number Diff line number Diff line
@@ -100,17 +100,17 @@ struct wcnss_download_nv_resp {

/**
 * wcnss_ctrl_smd_callback() - handler from SMD responses
 * @qsdev:	smd device handle
 * @channel:	smd channel handle
 * @data:	pointer to the incoming data packet
 * @count:	size of the incoming data packet
 *
 * Handles any incoming packets from the remote WCNSS_CTRL service.
 */
static int wcnss_ctrl_smd_callback(struct qcom_smd_device *qsdev,
static int wcnss_ctrl_smd_callback(struct qcom_smd_channel *channel,
				   const void *data,
				   size_t count)
{
	struct wcnss_ctrl *wcnss = dev_get_drvdata(&qsdev->dev);
	struct wcnss_ctrl *wcnss = qcom_smd_get_drvdata(channel);
	const struct wcnss_download_nv_resp *nvresp;
	const struct wcnss_version_resp *version;
	const struct wcnss_msg_hdr *hdr = data;
@@ -246,7 +246,7 @@ static int wcnss_ctrl_probe(struct qcom_smd_device *sdev)
	init_completion(&wcnss->ack);
	INIT_WORK(&wcnss->download_nv_work, wcnss_download_nv);

	dev_set_drvdata(&sdev->dev, wcnss);
	qcom_smd_set_drvdata(sdev->channel, wcnss);

	return wcnss_request_version(wcnss);
}
+5 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ struct qcom_smd_device {
	struct qcom_smd_channel *channel;
};

typedef int (*qcom_smd_cb_t)(struct qcom_smd_device *, const void *, size_t);
typedef int (*qcom_smd_cb_t)(struct qcom_smd_channel *, const void *, size_t);

/**
 * struct qcom_smd_driver - smd driver struct
@@ -50,13 +50,16 @@ struct qcom_smd_driver {
int qcom_smd_driver_register(struct qcom_smd_driver *drv);
void qcom_smd_driver_unregister(struct qcom_smd_driver *drv);

void *qcom_smd_get_drvdata(struct qcom_smd_channel *channel);
void qcom_smd_set_drvdata(struct qcom_smd_channel *channel, void *data);

#define module_qcom_smd_driver(__smd_driver) \
	module_driver(__smd_driver, qcom_smd_driver_register, \
		      qcom_smd_driver_unregister)

int qcom_smd_send(struct qcom_smd_channel *channel, const void *data, int len);

struct qcom_smd_channel *qcom_smd_open_channel(struct qcom_smd_device *sdev,
struct qcom_smd_channel *qcom_smd_open_channel(struct qcom_smd_channel *channel,
					       const char *name,
					       qcom_smd_cb_t cb);