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

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

Merge "wcd_dsp_mgr: Add the WCD DSP manager driver"

parents c3a74e4b 64317399
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -2142,3 +2142,35 @@ Example:
		asoc-codec-names = "msm-stub-codec.1";
		qcom,wsa-max-devs = <0>;
	};

* WCD DSP manager driver

Required properties:
- compatible : "qcom,wcd-dsp-mgr"
- qcom,wdsp-components : This is phandle list containing the references to the
			 components of the manager driver. Manager driver will
			 register to component framework with these phandles.
- qcom,img-filename : String property to provide the dsp image file name that is
		     to be read from file system and downloaded to dsp memory
Optional properties:
- qcom,wdsp-cmpnt-dev-name : Property that manager driver will parse, but defined
			     in the child's DT entry that is given to manager driver
			     with phandle. This property will be used by the manager
			     driver in case the manager driver cannot match child's
			     of_node pointer to registered phandle.

Example:

	qcom,wcd-dsp-mgr {
		compatible = "qcom,wcd-dsp-mgr";
		qcom,wdsp-components = <&wcd934x_cdc 0>,
				       <&wcd_spi_0 1>,
				       <&glink_spi 2>;
		qcom,img-filename = "cpe_9340";
	};

Example of child node that would have qcom,wdsp-cmpnt-dev-name property

	wcd934x_cdc: tavil_codec {
		qcom,wdsp-cmpnt-dev-name = "tavil_codec";
	};
+9 −0
Original line number Diff line number Diff line
@@ -1848,6 +1848,15 @@ static bool wcd934x_is_volatile_register(struct device *dev, unsigned int reg)
	if (reg_tbl && reg_tbl[reg_offset] == WCD934X_READ)
		return true;

	/*
	 * Need to mark volatile for registers that are writable but
	 * only few bits are read-only
	 */
	switch (reg) {
	case WCD934X_CPE_SS_SOC_SW_COLLAPSE_CTL:
		return true;
	}

	return false;
}

+118 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016, 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
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __WCD_DSP_MGR_H__
#define __WCD_DSP_MGR_H__

#include <linux/types.h>

/*
 * These enums correspond to the component types
 * that wcd-dsp-manager driver will use. The order
 * of the enums specifies the order in which the
 * manager driver will perform the sequencing.
 * Changing this will cause the sequencing order
 * to be changed as well.
 */
enum wdsp_cmpnt_type {
	/* Component to control the DSP */
	WDSP_CMPNT_CONTROL = 0,
	/* Component to perform data transfer to/from DSP */
	WDSP_CMPNT_TRANSPORT,
	/* Component that performs high level IPC */
	WDSP_CMPNT_IPC,

	WDSP_CMPNT_TYPE_MAX,
};

enum wdsp_event_type {
	/* Image download related */
	WDSP_EVENT_PRE_DLOAD_CODE,
	WDSP_EVENT_DLOAD_SECTION,
	WDSP_EVENT_POST_DLOAD_CODE,
	WDSP_EVENT_PRE_DLOAD_DATA,
	WDSP_EVENT_POST_DLOAD_DATA,
	WDSP_EVENT_DLOAD_FAILED,

	/* DSP boot related */
	WDSP_EVENT_PRE_BOOTUP,
	WDSP_EVENT_DO_BOOT,
	WDSP_EVENT_POST_BOOTUP,
	WDSP_EVENT_PRE_SHUTDOWN,
	WDSP_EVENT_DO_SHUTDOWN,
	WDSP_EVENT_POST_SHUTDOWN,

	/* IRQ handling related */
	WDSP_EVENT_IPC1_INTR,

	/* Suspend/Resume related */
	WDSP_EVENT_SUSPEND,
	WDSP_EVENT_RESUME,
};

enum wdsp_intr {
	WDSP_IPC1_INTR,
};

/*
 * wdsp_cmpnt_ops: ops/function callbacks for components
 * @init: called by manager driver, component is expected
 *	  to initialize itself in this callback
 * @deinit: called by manager driver, component should
 *	    de-initialize itself in this callback
 * @event_handler: Event handler for each component, called
 *		   by the manager as per sequence
 */
struct wdsp_cmpnt_ops {
	int (*init)(struct device *, void *priv_data);
	int (*deinit)(struct device *, void *priv_data);
	int (*event_handler)(struct device *, void *priv_data,
			     enum wdsp_event_type, void *data);
};

struct wdsp_img_section {
	u32 addr;
	size_t size;
	u8 *data;
};

/*
 * wdsp_ops: ops/function callbacks for manager driver
 * @register_cmpnt_ops: components will use this to register
 *			their own ops to manager driver
 * @get_dev_for_cmpnt: components can use this to get handle
 *		       to struct device * of any other component
 * @intr_handler: callback to notify manager driver that interrupt
 *		  has occurred.
 * @vote_for_dsp: notifies manager that dsp should be booted up
 * @suspend: notifies manager that one component wants to suspend.
 *	     Manager will make sure to suspend all components in order
 * @resume: notifies manager that one component wants to resume.
 *	    Manager will make sure to resume all components in order
 */

struct wdsp_mgr_ops {
	int (*register_cmpnt_ops)(struct device *wdsp_dev,
				  struct device *cdev,
				  void *priv_data,
				  struct wdsp_cmpnt_ops *ops);
	struct device *(*get_dev_for_cmpnt)(struct device *wdsp_dev,
					    enum wdsp_cmpnt_type type);
	int (*intr_handler)(struct device *wdsp_dev,
			      enum wdsp_intr intr);
	int (*vote_for_dsp)(struct device *wdsp_dev, bool vote);
	int (*suspend)(struct device *wdsp_dev);
	int (*resume)(struct device *wdsp_dev);
};

#endif /* end of __WCD_DSP_MGR_H__ */
+3 −0
Original line number Diff line number Diff line
@@ -762,6 +762,9 @@ config SND_SOC_WCD_MBHC
	tristate
	default y if (SND_SOC_MSM8909_WCD=y || SND_SOC_MSM8X16_WCD=y || SND_SOC_WCD9335=y) && SND_SOC_MDMCALIFORNIUM!=y

config SND_SOC_WCD_DSP_MGR
	tristate

config SND_SOC_WL1273
	tristate

+3 −0
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ snd-soc-wcd-mbhc-objs := wcd-mbhc-v2.o
snd-soc-msm8952-wcd-objs := msm8x16-wcd.o msm8x16-wcd-tables.o
snd-soc-wsa881x-analog-objs := wsa881x-analog.o wsa881x-tables-analog.o
snd-soc-wsa881x-analog-objs += wsa881x-regmap-analog.o wsa881x-irq.o
snd-soc-wcd-dsp-utils-objs := wcd-dsp-utils.o
snd-soc-wcd-dsp-mgr-objs := wcd-dsp-mgr.o
snd-soc-wl1273-objs := wl1273.o
snd-soc-wm-adsp-objs := wm_adsp.o
snd-soc-wm0010-objs := wm0010.o
@@ -351,6 +353,7 @@ obj-$(CONFIG_SND_SOC_WCD_MBHC) += snd-soc-wcd-mbhc.o
obj-$(CONFIG_SND_SOC_WSA881X)	+= snd-soc-wsa881x.o
obj-$(CONFIG_SND_SOC_WSA881X_ANALOG)	+= snd-soc-wsa881x-analog.o
obj-$(CONFIG_SND_SOC_WL1273)	+= snd-soc-wl1273.o
obj-$(CONFIG_SND_SOC_WCD_DSP_MGR)	+= snd-soc-wcd-dsp-mgr.o snd-soc-wcd-dsp-utils.o
obj-$(CONFIG_SND_SOC_WM0010)	+= snd-soc-wm0010.o
obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o
obj-$(CONFIG_SND_SOC_WM2000)	+= snd-soc-wm2000.o
Loading