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

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

Merge "soc: qcom: Enable wcd glink driver for BG"

parents 6ac722a8 a6104efd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -411,6 +411,9 @@ Required properties:
Required properties:

 - compatible :                            "qcom,wcd-dsp-glink"
 - qcom,msm-codec-glink-edge:              Name of the glink edge which is used
					    for IPC.
					    If no name is set, it defaults to "wdsp"

Example:

@@ -689,6 +692,7 @@ Example:

	wcd_dsp_glink {
		compatible = "qcom,wcd-dsp-glink";
		qcom,msm-codec-glink-edge = "bg";
	};


+1 −1
Original line number Diff line number Diff line
@@ -932,7 +932,7 @@ config MSM_BG_GLINK
config WCD_DSP_GLINK
	tristate "WCD DSP GLINK Driver"
	depends on MSM_GLINK
	default y if SND_SOC_WCD934X=y
	default y if (SND_SOC_WCD934X=y || MSM_BG_GLINK=y)
	help
	   This option enables driver which provides communication interface
	   between MSM and WCD DSP over glink transport protocol. This driver
+22 −5
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <linux/cdev.h>
#include <linux/platform_device.h>
#include <linux/vmalloc.h>
#include <linux/of_device.h>
#include <soc/qcom/glink.h>
#include "sound/wcd-dsp-glink.h"

@@ -40,12 +41,14 @@
#define RESP_QUEUE_SIZE 3
#define QOS_PKT_SIZE 1024
#define TIMEOUT_MS 1000
#define GLINK_EDGE_MAX 16

struct wdsp_glink_dev {
	struct class *cls;
	struct device *dev;
	struct cdev cdev;
	dev_t dev_num;
	char glink_edge[GLINK_EDGE_MAX];
};

struct wdsp_glink_rsp_que {
@@ -115,6 +118,7 @@ struct wdsp_glink_priv {
	u8 no_of_channels;
	struct work_struct ch_open_cls_wrk;
	struct workqueue_struct *work_queue;
	const char *glink_edge;

	wait_queue_head_t link_state_wait;

@@ -401,7 +405,7 @@ static int wdsp_glink_open_ch(struct wdsp_glink_ch *ch)
	if (!ch->handle) {
		memset(&open_cfg, 0, sizeof(open_cfg));
		open_cfg.options = GLINK_OPT_INITIAL_XPORT;
		open_cfg.edge = WDSP_EDGE;
		open_cfg.edge = wpriv->glink_edge;
		open_cfg.notify_rx = wdsp_glink_notify_rx;
		open_cfg.notify_tx_done = wdsp_glink_notify_tx_done;
		open_cfg.notify_tx_abort = wdsp_glink_notify_tx_abort;
@@ -511,10 +515,8 @@ static void wdsp_glink_link_state_cb(struct glink_link_state_cb_info *cb_info,

	wpriv = (struct wdsp_glink_priv *)priv;

	mutex_lock(&wpriv->glink_mutex);
	wpriv->glink_state.link_state = cb_info->link_state;
	wake_up(&wpriv->link_state_wait);
	mutex_unlock(&wpriv->glink_mutex);

	queue_work(wpriv->work_queue, &wpriv->ch_open_cls_wrk);
}
@@ -631,7 +633,7 @@ static int wdsp_glink_ch_info_init(struct wdsp_glink_priv *wpriv,
	/* Register glink link_state notification */
	link_info.glink_link_state_notif_cb = wdsp_glink_link_state_cb;
	link_info.transport = NULL;
	link_info.edge = WDSP_EDGE;
	link_info.edge = wpriv->glink_edge;

	wpriv->glink_state.link_state = GLINK_LINK_STATE_DOWN;
	wpriv->glink_state.handle = glink_register_link_state_cb(&link_info,
@@ -971,7 +973,7 @@ static int wdsp_glink_open(struct inode *inode, struct file *file)
		ret = -EINVAL;
		goto err_wq;
	}

	wpriv->glink_edge = wdev->glink_edge;
	wpriv->glink_state.link_state = GLINK_LINK_STATE_DOWN;
	init_completion(&wpriv->rsp_complete);
	init_waitqueue_head(&wpriv->link_state_wait);
@@ -1087,6 +1089,7 @@ static int wdsp_glink_probe(struct platform_device *pdev)
{
	int ret;
	struct wdsp_glink_dev *wdev;
	const char *str = NULL;

	wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
	if (!wdev) {
@@ -1126,6 +1129,20 @@ static int wdsp_glink_probe(struct platform_device *pdev)
			__func__, ret);
		goto err_cdev_add;
	}
	ret = of_property_read_string(pdev->dev.of_node,
				"qcom,msm-codec-glink-edge", &str);
	if (ret < 0) {
		strlcpy(wdev->glink_edge, WDSP_EDGE, GLINK_EDGE_MAX);
		dev_info(&pdev->dev,
			"%s: qcom,msm-codec-glink-edge not set use default %s\n",
			__func__, wdev->glink_edge);
		ret = 0;
	} else {
		strlcpy(wdev->glink_edge, str, GLINK_EDGE_MAX);
		dev_info(&pdev->dev, "%s: glink edge is %s\n", __func__,
					wdev->glink_edge);
	}

	platform_set_drvdata(pdev, wdev);
	goto done;