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

Commit 6c1fed3a authored by Bhalchandra Gajare's avatar Bhalchandra Gajare Committed by Phani Kumar Uppalapati
Browse files

ASoC: wcd-dsp-mgr: add support to get ops from components



Add support in the wcd dsp manager driver to provide interface
to components to get operations from other components. This can
be used when components need to communicate amongst themselves
without intervention from manager driver.

Change-Id: Idddb60f0c8d6179046879bc358c840936c61299f
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent 80e2ccd6
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2017, 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
@@ -63,6 +63,9 @@ enum wdsp_event_type {
	/* Suspend/Resume related */
	WDSP_EVENT_SUSPEND,
	WDSP_EVENT_RESUME,

	/* Misc */
	WDSP_EVENT_GET_DEVOPS
};

enum wdsp_signal {
@@ -109,6 +112,8 @@ struct wdsp_err_signal_arg {
 *			their own ops to manager driver
 * @get_dev_for_cmpnt: components can use this to get handle
 *		       to struct device * of any other component
 * @get_devops_for_cmpnt: components can use this to get ops
 *			  from other related components.
 * @signal_handler: callback to notify manager driver that signal
 *		    has occurred. Cannot be called from interrupt
 *		    context as this can sleep
@@ -126,6 +131,8 @@ struct wdsp_mgr_ops {
				  struct wdsp_cmpnt_ops *ops);
	struct device *(*get_dev_for_cmpnt)(struct device *wdsp_dev,
					    enum wdsp_cmpnt_type type);
	int (*get_devops_for_cmpnt)(struct device *wdsp_dev,
				    enum wdsp_cmpnt_type type, void *data);
	int (*signal_handler)(struct device *wdsp_dev,
			      enum wdsp_signal signal, void *arg);
	int (*vote_for_dsp)(struct device *wdsp_dev, bool vote);
+20 −0
Original line number Diff line number Diff line
@@ -610,6 +610,25 @@ static struct device *wdsp_get_dev_for_cmpnt(struct device *wdsp_dev,
	return cmpnt->cdev;
}

static int wdsp_get_devops_for_cmpnt(struct device *wdsp_dev,
				     enum wdsp_cmpnt_type type,
				     void *data)
{
	struct wdsp_mgr_priv *wdsp;
	int ret = 0;

	if (!wdsp_dev || type >= WDSP_CMPNT_TYPE_MAX)
		return -EINVAL;

	wdsp = dev_get_drvdata(wdsp_dev);
	ret = wdsp_unicast_event(wdsp, type,
				 WDSP_EVENT_GET_DEVOPS, data);
	if (ret)
		WDSP_ERR(wdsp, "get_dev_ops failed for cmpnt type %d",
			 type);
	return ret;
}

static void wdsp_collect_ramdumps(struct wdsp_mgr_priv *wdsp)
{
	struct wdsp_img_section img_section;
@@ -941,6 +960,7 @@ static int wdsp_resume(struct device *wdsp_dev)
static struct wdsp_mgr_ops wdsp_ops = {
	.register_cmpnt_ops = wdsp_register_cmpnt_ops,
	.get_dev_for_cmpnt = wdsp_get_dev_for_cmpnt,
	.get_devops_for_cmpnt = wdsp_get_devops_for_cmpnt,
	.signal_handler = wdsp_signal_handler,
	.vote_for_dsp = wdsp_vote_for_dsp,
	.suspend = wdsp_suspend,