xref: /openbmc/linux/sound/soc/sof/intel/byt.c (revision ddcccd54)
1e149ca29SPierre-Louis Bossart // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
29e42c5caSLiam Girdwood //
39e42c5caSLiam Girdwood // This file is provided under a dual BSD/GPLv2 license.  When using or
49e42c5caSLiam Girdwood // redistributing this file, you may do so under either license.
59e42c5caSLiam Girdwood //
69e42c5caSLiam Girdwood // Copyright(c) 2018 Intel Corporation. All rights reserved.
79e42c5caSLiam Girdwood //
89e42c5caSLiam Girdwood // Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
99e42c5caSLiam Girdwood //
109e42c5caSLiam Girdwood 
119e42c5caSLiam Girdwood /*
129e42c5caSLiam Girdwood  * Hardware interface for audio DSP on Baytrail, Braswell and Cherrytrail.
139e42c5caSLiam Girdwood  */
149e42c5caSLiam Girdwood 
159e42c5caSLiam Girdwood #include <linux/module.h>
169e42c5caSLiam Girdwood #include <sound/sof.h>
179e42c5caSLiam Girdwood #include <sound/sof/xtensa.h>
189e42c5caSLiam Girdwood #include "../ops.h"
199e42c5caSLiam Girdwood #include "shim.h"
20285880a2SDaniel Baluta #include "../sof-audio.h"
212aae447aSPierre-Louis Bossart #include "../../intel/common/soc-intel-quirks.h"
229e42c5caSLiam Girdwood 
239e42c5caSLiam Girdwood /* DSP memories */
249e42c5caSLiam Girdwood #define IRAM_OFFSET		0x0C0000
259e42c5caSLiam Girdwood #define IRAM_SIZE		(80 * 1024)
269e42c5caSLiam Girdwood #define DRAM_OFFSET		0x100000
279e42c5caSLiam Girdwood #define DRAM_SIZE		(160 * 1024)
289e42c5caSLiam Girdwood #define SHIM_OFFSET		0x140000
29f84337c3SCurtis Malainey #define SHIM_SIZE_BYT		0x100
30f84337c3SCurtis Malainey #define SHIM_SIZE_CHT		0x118
319e42c5caSLiam Girdwood #define MBOX_OFFSET		0x144000
329e42c5caSLiam Girdwood #define MBOX_SIZE		0x1000
339e42c5caSLiam Girdwood #define EXCEPT_OFFSET		0x800
34ff2be865SLiam Girdwood #define EXCEPT_MAX_HDR_SIZE	0x400
359e42c5caSLiam Girdwood 
369e42c5caSLiam Girdwood /* DSP peripherals */
379e42c5caSLiam Girdwood #define DMAC0_OFFSET		0x098000
389e42c5caSLiam Girdwood #define DMAC1_OFFSET		0x09c000
399e42c5caSLiam Girdwood #define DMAC2_OFFSET		0x094000
409e42c5caSLiam Girdwood #define DMAC_SIZE		0x420
419e42c5caSLiam Girdwood #define SSP0_OFFSET		0x0a0000
429e42c5caSLiam Girdwood #define SSP1_OFFSET		0x0a1000
439e42c5caSLiam Girdwood #define SSP2_OFFSET		0x0a2000
449e42c5caSLiam Girdwood #define SSP3_OFFSET		0x0a4000
459e42c5caSLiam Girdwood #define SSP4_OFFSET		0x0a5000
469e42c5caSLiam Girdwood #define SSP5_OFFSET		0x0a6000
479e42c5caSLiam Girdwood #define SSP_SIZE		0x100
489e42c5caSLiam Girdwood 
499e42c5caSLiam Girdwood #define BYT_STACK_DUMP_SIZE	32
509e42c5caSLiam Girdwood 
519e42c5caSLiam Girdwood #define BYT_PCI_BAR_SIZE	0x200000
529e42c5caSLiam Girdwood 
539e42c5caSLiam Girdwood #define BYT_PANIC_OFFSET(x)	(((x) & GENMASK_ULL(47, 32)) >> 32)
549e42c5caSLiam Girdwood 
559e42c5caSLiam Girdwood /*
569e42c5caSLiam Girdwood  * Debug
579e42c5caSLiam Girdwood  */
589e42c5caSLiam Girdwood 
599e42c5caSLiam Girdwood #define MBOX_DUMP_SIZE	0x30
609e42c5caSLiam Girdwood 
619e42c5caSLiam Girdwood /* BARs */
629e42c5caSLiam Girdwood #define BYT_DSP_BAR		0
639e42c5caSLiam Girdwood #define BYT_PCI_BAR		1
649e42c5caSLiam Girdwood #define BYT_IMR_BAR		2
659e42c5caSLiam Girdwood 
669e42c5caSLiam Girdwood static const struct snd_sof_debugfs_map byt_debugfs[] = {
679e42c5caSLiam Girdwood 	{"dmac0", BYT_DSP_BAR, DMAC0_OFFSET, DMAC_SIZE,
689e42c5caSLiam Girdwood 	 SOF_DEBUGFS_ACCESS_ALWAYS},
699e42c5caSLiam Girdwood 	{"dmac1", BYT_DSP_BAR,  DMAC1_OFFSET, DMAC_SIZE,
709e42c5caSLiam Girdwood 	 SOF_DEBUGFS_ACCESS_ALWAYS},
719e42c5caSLiam Girdwood 	{"ssp0",  BYT_DSP_BAR, SSP0_OFFSET, SSP_SIZE,
729e42c5caSLiam Girdwood 	 SOF_DEBUGFS_ACCESS_ALWAYS},
739e42c5caSLiam Girdwood 	{"ssp1", BYT_DSP_BAR, SSP1_OFFSET, SSP_SIZE,
749e42c5caSLiam Girdwood 	 SOF_DEBUGFS_ACCESS_ALWAYS},
759e42c5caSLiam Girdwood 	{"ssp2", BYT_DSP_BAR, SSP2_OFFSET, SSP_SIZE,
769e42c5caSLiam Girdwood 	 SOF_DEBUGFS_ACCESS_ALWAYS},
779e42c5caSLiam Girdwood 	{"iram", BYT_DSP_BAR, IRAM_OFFSET, IRAM_SIZE,
789e42c5caSLiam Girdwood 	 SOF_DEBUGFS_ACCESS_D0_ONLY},
799e42c5caSLiam Girdwood 	{"dram", BYT_DSP_BAR, DRAM_OFFSET, DRAM_SIZE,
809e42c5caSLiam Girdwood 	 SOF_DEBUGFS_ACCESS_D0_ONLY},
81f84337c3SCurtis Malainey 	{"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE_BYT,
829e42c5caSLiam Girdwood 	 SOF_DEBUGFS_ACCESS_ALWAYS},
839e42c5caSLiam Girdwood };
849e42c5caSLiam Girdwood 
859e42c5caSLiam Girdwood static void byt_host_done(struct snd_sof_dev *sdev);
869e42c5caSLiam Girdwood static void byt_dsp_done(struct snd_sof_dev *sdev);
879e42c5caSLiam Girdwood static void byt_get_reply(struct snd_sof_dev *sdev);
889e42c5caSLiam Girdwood 
899e42c5caSLiam Girdwood /*
909e42c5caSLiam Girdwood  * Debug
919e42c5caSLiam Girdwood  */
929e42c5caSLiam Girdwood 
939e42c5caSLiam Girdwood static void byt_get_registers(struct snd_sof_dev *sdev,
949e42c5caSLiam Girdwood 			      struct sof_ipc_dsp_oops_xtensa *xoops,
959e42c5caSLiam Girdwood 			      struct sof_ipc_panic_info *panic_info,
969e42c5caSLiam Girdwood 			      u32 *stack, size_t stack_words)
979e42c5caSLiam Girdwood {
9814104eb6SKai Vehmanen 	u32 offset = sdev->dsp_oops_offset;
9914104eb6SKai Vehmanen 
1009e42c5caSLiam Girdwood 	/* first read regsisters */
10114104eb6SKai Vehmanen 	sof_mailbox_read(sdev, offset, xoops, sizeof(*xoops));
10214104eb6SKai Vehmanen 
10314104eb6SKai Vehmanen 	/* note: variable AR register array is not read */
1049e42c5caSLiam Girdwood 
1059e42c5caSLiam Girdwood 	/* then get panic info */
106ff2be865SLiam Girdwood 	if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) {
107ff2be865SLiam Girdwood 		dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n",
108ff2be865SLiam Girdwood 			xoops->arch_hdr.totalsize);
109ff2be865SLiam Girdwood 		return;
110ff2be865SLiam Girdwood 	}
11114104eb6SKai Vehmanen 	offset += xoops->arch_hdr.totalsize;
11214104eb6SKai Vehmanen 	sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
1139e42c5caSLiam Girdwood 
1149e42c5caSLiam Girdwood 	/* then get the stack */
11514104eb6SKai Vehmanen 	offset += sizeof(*panic_info);
11614104eb6SKai Vehmanen 	sof_mailbox_read(sdev, offset, stack, stack_words * sizeof(u32));
1179e42c5caSLiam Girdwood }
1189e42c5caSLiam Girdwood 
1199e42c5caSLiam Girdwood static void byt_dump(struct snd_sof_dev *sdev, u32 flags)
1209e42c5caSLiam Girdwood {
1219e42c5caSLiam Girdwood 	struct sof_ipc_dsp_oops_xtensa xoops;
1229e42c5caSLiam Girdwood 	struct sof_ipc_panic_info panic_info;
1239e42c5caSLiam Girdwood 	u32 stack[BYT_STACK_DUMP_SIZE];
124b81eb73bSKeyon Jie 	u64 status, panic, imrd, imrx;
1259e42c5caSLiam Girdwood 
1269e42c5caSLiam Girdwood 	/* now try generic SOF status messages */
127b81eb73bSKeyon Jie 	status = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IPCD);
128b81eb73bSKeyon Jie 	panic = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IPCX);
1299e42c5caSLiam Girdwood 	byt_get_registers(sdev, &xoops, &panic_info, stack,
1309e42c5caSLiam Girdwood 			  BYT_STACK_DUMP_SIZE);
1319e42c5caSLiam Girdwood 	snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, stack,
1329e42c5caSLiam Girdwood 			   BYT_STACK_DUMP_SIZE);
1333a9e204dSLiam Girdwood 
1343a9e204dSLiam Girdwood 	/* provide some context for firmware debug */
135b81eb73bSKeyon Jie 	imrx = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IMRX);
136b81eb73bSKeyon Jie 	imrd = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IMRD);
1373a9e204dSLiam Girdwood 	dev_err(sdev->dev,
138b81eb73bSKeyon Jie 		"error: ipc host -> DSP: pending %s complete %s raw 0x%llx\n",
139f9f618e7SPierre-Louis Bossart 		(panic & SHIM_IPCX_BUSY) ? "yes" : "no",
140f9f618e7SPierre-Louis Bossart 		(panic & SHIM_IPCX_DONE) ? "yes" : "no", panic);
1413a9e204dSLiam Girdwood 	dev_err(sdev->dev,
142b81eb73bSKeyon Jie 		"error: mask host: pending %s complete %s raw 0x%llx\n",
143f9f618e7SPierre-Louis Bossart 		(imrx & SHIM_IMRX_BUSY) ? "yes" : "no",
144f9f618e7SPierre-Louis Bossart 		(imrx & SHIM_IMRX_DONE) ? "yes" : "no", imrx);
1453a9e204dSLiam Girdwood 	dev_err(sdev->dev,
146b81eb73bSKeyon Jie 		"error: ipc DSP -> host: pending %s complete %s raw 0x%llx\n",
147f9f618e7SPierre-Louis Bossart 		(status & SHIM_IPCD_BUSY) ? "yes" : "no",
148f9f618e7SPierre-Louis Bossart 		(status & SHIM_IPCD_DONE) ? "yes" : "no", status);
1493a9e204dSLiam Girdwood 	dev_err(sdev->dev,
150b81eb73bSKeyon Jie 		"error: mask DSP: pending %s complete %s raw 0x%llx\n",
151f9f618e7SPierre-Louis Bossart 		(imrd & SHIM_IMRD_BUSY) ? "yes" : "no",
152f9f618e7SPierre-Louis Bossart 		(imrd & SHIM_IMRD_DONE) ? "yes" : "no", imrd);
1533a9e204dSLiam Girdwood 
1549e42c5caSLiam Girdwood }
1559e42c5caSLiam Girdwood 
1569e42c5caSLiam Girdwood /*
1579e42c5caSLiam Girdwood  * IPC Doorbell IRQ handler and thread.
1589e42c5caSLiam Girdwood  */
1599e42c5caSLiam Girdwood 
1609e42c5caSLiam Girdwood static irqreturn_t byt_irq_handler(int irq, void *context)
1619e42c5caSLiam Girdwood {
1629e42c5caSLiam Girdwood 	struct snd_sof_dev *sdev = context;
1639e42c5caSLiam Girdwood 	u64 isr;
1649e42c5caSLiam Girdwood 	int ret = IRQ_NONE;
1659e42c5caSLiam Girdwood 
1669e42c5caSLiam Girdwood 	/* Interrupt arrived, check src */
1679e42c5caSLiam Girdwood 	isr = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_ISRX);
1689e42c5caSLiam Girdwood 	if (isr & (SHIM_ISRX_DONE | SHIM_ISRX_BUSY))
1699e42c5caSLiam Girdwood 		ret = IRQ_WAKE_THREAD;
1709e42c5caSLiam Girdwood 
1719e42c5caSLiam Girdwood 	return ret;
1729e42c5caSLiam Girdwood }
1739e42c5caSLiam Girdwood 
1749e42c5caSLiam Girdwood static irqreturn_t byt_irq_thread(int irq, void *context)
1759e42c5caSLiam Girdwood {
1769e42c5caSLiam Girdwood 	struct snd_sof_dev *sdev = context;
1779e42c5caSLiam Girdwood 	u64 ipcx, ipcd;
1789e42c5caSLiam Girdwood 	u64 imrx;
1799e42c5caSLiam Girdwood 
1809e42c5caSLiam Girdwood 	imrx = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IMRX);
1819e42c5caSLiam Girdwood 	ipcx = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IPCX);
1829e42c5caSLiam Girdwood 
1839e42c5caSLiam Girdwood 	/* reply message from DSP */
1849e42c5caSLiam Girdwood 	if (ipcx & SHIM_BYT_IPCX_DONE &&
1859e42c5caSLiam Girdwood 	    !(imrx & SHIM_IMRX_DONE)) {
1869e42c5caSLiam Girdwood 		/* Mask Done interrupt before first */
1879e42c5caSLiam Girdwood 		snd_sof_dsp_update_bits64_unlocked(sdev, BYT_DSP_BAR,
1889e42c5caSLiam Girdwood 						   SHIM_IMRX,
1899e42c5caSLiam Girdwood 						   SHIM_IMRX_DONE,
1909e42c5caSLiam Girdwood 						   SHIM_IMRX_DONE);
1911183e9a6SGuennadi Liakhovetski 
1921183e9a6SGuennadi Liakhovetski 		spin_lock_irq(&sdev->ipc_lock);
1931183e9a6SGuennadi Liakhovetski 
1949e42c5caSLiam Girdwood 		/*
1959e42c5caSLiam Girdwood 		 * handle immediate reply from DSP core. If the msg is
1969e42c5caSLiam Girdwood 		 * found, set done bit in cmd_done which is called at the
1979e42c5caSLiam Girdwood 		 * end of message processing function, else set it here
1989e42c5caSLiam Girdwood 		 * because the done bit can't be set in cmd_done function
1999e42c5caSLiam Girdwood 		 * which is triggered by msg
2009e42c5caSLiam Girdwood 		 */
2019e42c5caSLiam Girdwood 		byt_get_reply(sdev);
2029e42c5caSLiam Girdwood 		snd_sof_ipc_reply(sdev, ipcx);
2039e42c5caSLiam Girdwood 
2049e42c5caSLiam Girdwood 		byt_dsp_done(sdev);
2051183e9a6SGuennadi Liakhovetski 
2061183e9a6SGuennadi Liakhovetski 		spin_unlock_irq(&sdev->ipc_lock);
2079e42c5caSLiam Girdwood 	}
2089e42c5caSLiam Girdwood 
2099e42c5caSLiam Girdwood 	/* new message from DSP */
2109e42c5caSLiam Girdwood 	ipcd = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IPCD);
2119e42c5caSLiam Girdwood 	if (ipcd & SHIM_BYT_IPCD_BUSY &&
2129e42c5caSLiam Girdwood 	    !(imrx & SHIM_IMRX_BUSY)) {
2139e42c5caSLiam Girdwood 		/* Mask Busy interrupt before return */
2149e42c5caSLiam Girdwood 		snd_sof_dsp_update_bits64_unlocked(sdev, BYT_DSP_BAR,
2159e42c5caSLiam Girdwood 						   SHIM_IMRX,
2169e42c5caSLiam Girdwood 						   SHIM_IMRX_BUSY,
2179e42c5caSLiam Girdwood 						   SHIM_IMRX_BUSY);
2189e42c5caSLiam Girdwood 
2199e42c5caSLiam Girdwood 		/* Handle messages from DSP Core */
2209e42c5caSLiam Girdwood 		if ((ipcd & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) {
2219e42c5caSLiam Girdwood 			snd_sof_dsp_panic(sdev, BYT_PANIC_OFFSET(ipcd) +
2229e42c5caSLiam Girdwood 					  MBOX_OFFSET);
2239e42c5caSLiam Girdwood 		} else {
2249e42c5caSLiam Girdwood 			snd_sof_ipc_msgs_rx(sdev);
2259e42c5caSLiam Girdwood 		}
2269e42c5caSLiam Girdwood 
2279e42c5caSLiam Girdwood 		byt_host_done(sdev);
2289e42c5caSLiam Girdwood 	}
2299e42c5caSLiam Girdwood 
2309e42c5caSLiam Girdwood 	return IRQ_HANDLED;
2319e42c5caSLiam Girdwood }
2329e42c5caSLiam Girdwood 
2339e42c5caSLiam Girdwood static int byt_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
2349e42c5caSLiam Girdwood {
2359e42c5caSLiam Girdwood 	/* send the message */
2369e42c5caSLiam Girdwood 	sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data,
2379e42c5caSLiam Girdwood 			  msg->msg_size);
2386fbbc18eSDaniel Baluta 	snd_sof_dsp_write64(sdev, BYT_DSP_BAR, SHIM_IPCX, SHIM_BYT_IPCX_BUSY);
2399e42c5caSLiam Girdwood 
2409e42c5caSLiam Girdwood 	return 0;
2419e42c5caSLiam Girdwood }
2429e42c5caSLiam Girdwood 
2439e42c5caSLiam Girdwood static void byt_get_reply(struct snd_sof_dev *sdev)
2449e42c5caSLiam Girdwood {
2459e42c5caSLiam Girdwood 	struct snd_sof_ipc_msg *msg = sdev->msg;
2469e42c5caSLiam Girdwood 	struct sof_ipc_reply reply;
2479e42c5caSLiam Girdwood 	int ret = 0;
2489e42c5caSLiam Girdwood 
2499e42c5caSLiam Girdwood 	/*
2509e42c5caSLiam Girdwood 	 * Sometimes, there is unexpected reply ipc arriving. The reply
2519e42c5caSLiam Girdwood 	 * ipc belongs to none of the ipcs sent from driver.
2529e42c5caSLiam Girdwood 	 * In this case, the driver must ignore the ipc.
2539e42c5caSLiam Girdwood 	 */
2549e42c5caSLiam Girdwood 	if (!msg) {
2559e42c5caSLiam Girdwood 		dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n");
2569e42c5caSLiam Girdwood 		return;
2579e42c5caSLiam Girdwood 	}
2589e42c5caSLiam Girdwood 
2599e42c5caSLiam Girdwood 	/* get reply */
2609e42c5caSLiam Girdwood 	sof_mailbox_read(sdev, sdev->host_box.offset, &reply, sizeof(reply));
2619e42c5caSLiam Girdwood 
2629e42c5caSLiam Girdwood 	if (reply.error < 0) {
2639e42c5caSLiam Girdwood 		memcpy(msg->reply_data, &reply, sizeof(reply));
2649e42c5caSLiam Girdwood 		ret = reply.error;
2659e42c5caSLiam Girdwood 	} else {
2669e42c5caSLiam Girdwood 		/* reply correct size ? */
2679e42c5caSLiam Girdwood 		if (reply.hdr.size != msg->reply_size) {
2689e42c5caSLiam Girdwood 			dev_err(sdev->dev, "error: reply expected %zu got %u bytes\n",
2699e42c5caSLiam Girdwood 				msg->reply_size, reply.hdr.size);
2709e42c5caSLiam Girdwood 			ret = -EINVAL;
2719e42c5caSLiam Girdwood 		}
2729e42c5caSLiam Girdwood 
2739e42c5caSLiam Girdwood 		/* read the message */
2749e42c5caSLiam Girdwood 		if (msg->reply_size > 0)
2759e42c5caSLiam Girdwood 			sof_mailbox_read(sdev, sdev->host_box.offset,
2769e42c5caSLiam Girdwood 					 msg->reply_data, msg->reply_size);
2779e42c5caSLiam Girdwood 	}
2789e42c5caSLiam Girdwood 
2799e42c5caSLiam Girdwood 	msg->reply_error = ret;
2809e42c5caSLiam Girdwood }
2819e42c5caSLiam Girdwood 
28283ee7ab1SDaniel Baluta static int byt_get_mailbox_offset(struct snd_sof_dev *sdev)
28383ee7ab1SDaniel Baluta {
28483ee7ab1SDaniel Baluta 	return MBOX_OFFSET;
28583ee7ab1SDaniel Baluta }
28683ee7ab1SDaniel Baluta 
28783ee7ab1SDaniel Baluta static int byt_get_window_offset(struct snd_sof_dev *sdev, u32 id)
28883ee7ab1SDaniel Baluta {
28983ee7ab1SDaniel Baluta 	return MBOX_OFFSET;
29083ee7ab1SDaniel Baluta }
29183ee7ab1SDaniel Baluta 
2929e42c5caSLiam Girdwood static void byt_host_done(struct snd_sof_dev *sdev)
2939e42c5caSLiam Girdwood {
2949e42c5caSLiam Girdwood 	/* clear BUSY bit and set DONE bit - accept new messages */
2959e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64_unlocked(sdev, BYT_DSP_BAR, SHIM_IPCD,
2969e42c5caSLiam Girdwood 					   SHIM_BYT_IPCD_BUSY |
2979e42c5caSLiam Girdwood 					   SHIM_BYT_IPCD_DONE,
2989e42c5caSLiam Girdwood 					   SHIM_BYT_IPCD_DONE);
2999e42c5caSLiam Girdwood 
3009e42c5caSLiam Girdwood 	/* unmask busy interrupt */
3019e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64_unlocked(sdev, BYT_DSP_BAR, SHIM_IMRX,
3029e42c5caSLiam Girdwood 					   SHIM_IMRX_BUSY, 0);
3039e42c5caSLiam Girdwood }
3049e42c5caSLiam Girdwood 
3059e42c5caSLiam Girdwood static void byt_dsp_done(struct snd_sof_dev *sdev)
3069e42c5caSLiam Girdwood {
3079e42c5caSLiam Girdwood 	/* clear DONE bit - tell DSP we have completed */
3089e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64_unlocked(sdev, BYT_DSP_BAR, SHIM_IPCX,
3099e42c5caSLiam Girdwood 					   SHIM_BYT_IPCX_DONE, 0);
3109e42c5caSLiam Girdwood 
3119e42c5caSLiam Girdwood 	/* unmask Done interrupt */
3129e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64_unlocked(sdev, BYT_DSP_BAR, SHIM_IMRX,
3139e42c5caSLiam Girdwood 					   SHIM_IMRX_DONE, 0);
3149e42c5caSLiam Girdwood }
3159e42c5caSLiam Girdwood 
3169e42c5caSLiam Girdwood /*
3179e42c5caSLiam Girdwood  * DSP control.
3189e42c5caSLiam Girdwood  */
3199e42c5caSLiam Girdwood 
3209e42c5caSLiam Girdwood static int byt_run(struct snd_sof_dev *sdev)
3219e42c5caSLiam Girdwood {
3229e42c5caSLiam Girdwood 	int tries = 10;
3239e42c5caSLiam Girdwood 
3249e42c5caSLiam Girdwood 	/* release stall and wait to unstall */
3259e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_CSR,
3269e42c5caSLiam Girdwood 				  SHIM_BYT_CSR_STALL, 0x0);
3279e42c5caSLiam Girdwood 	while (tries--) {
3289e42c5caSLiam Girdwood 		if (!(snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_CSR) &
3299e42c5caSLiam Girdwood 		      SHIM_BYT_CSR_PWAITMODE))
3309e42c5caSLiam Girdwood 			break;
3319e42c5caSLiam Girdwood 		msleep(100);
3329e42c5caSLiam Girdwood 	}
3339e42c5caSLiam Girdwood 	if (tries < 0) {
3349e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error:  unable to run DSP firmware\n");
3359e42c5caSLiam Girdwood 		byt_dump(sdev, SOF_DBG_REGS | SOF_DBG_MBOX);
3369e42c5caSLiam Girdwood 		return -ENODEV;
3379e42c5caSLiam Girdwood 	}
3389e42c5caSLiam Girdwood 
3399e42c5caSLiam Girdwood 	/* return init core mask */
3409e42c5caSLiam Girdwood 	return 1;
3419e42c5caSLiam Girdwood }
3429e42c5caSLiam Girdwood 
3439e42c5caSLiam Girdwood static int byt_reset(struct snd_sof_dev *sdev)
3449e42c5caSLiam Girdwood {
3459e42c5caSLiam Girdwood 	/* put DSP into reset, set reset vector and stall */
3469e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_CSR,
3479e42c5caSLiam Girdwood 				  SHIM_BYT_CSR_RST | SHIM_BYT_CSR_VECTOR_SEL |
3489e42c5caSLiam Girdwood 				  SHIM_BYT_CSR_STALL,
3499e42c5caSLiam Girdwood 				  SHIM_BYT_CSR_RST | SHIM_BYT_CSR_VECTOR_SEL |
3509e42c5caSLiam Girdwood 				  SHIM_BYT_CSR_STALL);
3519e42c5caSLiam Girdwood 
3529e42c5caSLiam Girdwood 	usleep_range(10, 15);
3539e42c5caSLiam Girdwood 
3549e42c5caSLiam Girdwood 	/* take DSP out of reset and keep stalled for FW loading */
3559e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_CSR,
3569e42c5caSLiam Girdwood 				  SHIM_BYT_CSR_RST, 0);
3579e42c5caSLiam Girdwood 
3589e42c5caSLiam Girdwood 	return 0;
3599e42c5caSLiam Girdwood }
3609e42c5caSLiam Girdwood 
3612aae447aSPierre-Louis Bossart static const char *fixup_tplg_name(struct snd_sof_dev *sdev,
3622aae447aSPierre-Louis Bossart 				   const char *sof_tplg_filename,
3632aae447aSPierre-Louis Bossart 				   const char *ssp_str)
3642aae447aSPierre-Louis Bossart {
3652aae447aSPierre-Louis Bossart 	const char *tplg_filename = NULL;
3662aae447aSPierre-Louis Bossart 	char *filename;
3672aae447aSPierre-Louis Bossart 	char *split_ext;
3682aae447aSPierre-Louis Bossart 
3692aae447aSPierre-Louis Bossart 	filename = devm_kstrdup(sdev->dev, sof_tplg_filename, GFP_KERNEL);
3702aae447aSPierre-Louis Bossart 	if (!filename)
3712aae447aSPierre-Louis Bossart 		return NULL;
3722aae447aSPierre-Louis Bossart 
3732aae447aSPierre-Louis Bossart 	/* this assumes a .tplg extension */
3742aae447aSPierre-Louis Bossart 	split_ext = strsep(&filename, ".");
3752aae447aSPierre-Louis Bossart 	if (split_ext) {
3762aae447aSPierre-Louis Bossart 		tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL,
3772aae447aSPierre-Louis Bossart 					       "%s-%s.tplg",
3782aae447aSPierre-Louis Bossart 					       split_ext, ssp_str);
3792aae447aSPierre-Louis Bossart 		if (!tplg_filename)
3802aae447aSPierre-Louis Bossart 			return NULL;
3812aae447aSPierre-Louis Bossart 	}
3822aae447aSPierre-Louis Bossart 	return tplg_filename;
3832aae447aSPierre-Louis Bossart }
3842aae447aSPierre-Louis Bossart 
385285880a2SDaniel Baluta static void byt_machine_select(struct snd_sof_dev *sdev)
386285880a2SDaniel Baluta {
387285880a2SDaniel Baluta 	struct snd_sof_pdata *sof_pdata = sdev->pdata;
388285880a2SDaniel Baluta 	const struct sof_dev_desc *desc = sof_pdata->desc;
389285880a2SDaniel Baluta 	struct snd_soc_acpi_mach *mach;
3902aae447aSPierre-Louis Bossart 	struct platform_device *pdev;
3912aae447aSPierre-Louis Bossart 	const char *tplg_filename;
392285880a2SDaniel Baluta 
393285880a2SDaniel Baluta 	mach = snd_soc_acpi_find_machine(desc->machines);
394285880a2SDaniel Baluta 	if (!mach) {
395285880a2SDaniel Baluta 		dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n");
396285880a2SDaniel Baluta 		return;
397285880a2SDaniel Baluta 	}
398285880a2SDaniel Baluta 
3992aae447aSPierre-Louis Bossart 	pdev = to_platform_device(sdev->dev);
4002aae447aSPierre-Louis Bossart 	if (soc_intel_is_byt_cr(pdev)) {
4012aae447aSPierre-Louis Bossart 		dev_dbg(sdev->dev,
4022aae447aSPierre-Louis Bossart 			"BYT-CR detected, SSP0 used instead of SSP2\n");
4032aae447aSPierre-Louis Bossart 
4042aae447aSPierre-Louis Bossart 		tplg_filename = fixup_tplg_name(sdev,
4052aae447aSPierre-Louis Bossart 						mach->sof_tplg_filename,
4062aae447aSPierre-Louis Bossart 						"ssp0");
4072aae447aSPierre-Louis Bossart 	} else {
4082aae447aSPierre-Louis Bossart 		tplg_filename = mach->sof_tplg_filename;
4092aae447aSPierre-Louis Bossart 	}
4102aae447aSPierre-Louis Bossart 
4112aae447aSPierre-Louis Bossart 	if (!tplg_filename) {
4122aae447aSPierre-Louis Bossart 		dev_dbg(sdev->dev,
4132aae447aSPierre-Louis Bossart 			"error: no topology filename\n");
4142aae447aSPierre-Louis Bossart 		return;
4152aae447aSPierre-Louis Bossart 	}
4162aae447aSPierre-Louis Bossart 
4172aae447aSPierre-Louis Bossart 	sof_pdata->tplg_filename = tplg_filename;
418285880a2SDaniel Baluta 	mach->mach_params.acpi_ipc_irq_index = desc->irqindex_host_ipc;
419285880a2SDaniel Baluta 	sof_pdata->machine = mach;
420285880a2SDaniel Baluta }
421285880a2SDaniel Baluta 
422285880a2SDaniel Baluta static void byt_set_mach_params(const struct snd_soc_acpi_mach *mach,
423285880a2SDaniel Baluta 				struct device *dev)
424285880a2SDaniel Baluta {
425285880a2SDaniel Baluta 	struct snd_soc_acpi_mach_params *mach_params;
426285880a2SDaniel Baluta 
427285880a2SDaniel Baluta 	mach_params = (struct snd_soc_acpi_mach_params *)&mach->mach_params;
428285880a2SDaniel Baluta 	mach_params->platform = dev_name(dev);
429285880a2SDaniel Baluta }
430285880a2SDaniel Baluta 
431ddcccd54SRanjani Sridharan static void byt_reset_dsp_disable_int(struct snd_sof_dev *sdev)
432ddcccd54SRanjani Sridharan {
433ddcccd54SRanjani Sridharan 	/* Disable Interrupt from both sides */
434ddcccd54SRanjani Sridharan 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRX, 0x3, 0x3);
435ddcccd54SRanjani Sridharan 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRD, 0x3, 0x3);
436ddcccd54SRanjani Sridharan 
437ddcccd54SRanjani Sridharan 	/* Put DSP into reset, set reset vector */
438ddcccd54SRanjani Sridharan 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_CSR,
439ddcccd54SRanjani Sridharan 				  SHIM_BYT_CSR_RST | SHIM_BYT_CSR_VECTOR_SEL,
440ddcccd54SRanjani Sridharan 				  SHIM_BYT_CSR_RST | SHIM_BYT_CSR_VECTOR_SEL);
441ddcccd54SRanjani Sridharan }
442ddcccd54SRanjani Sridharan 
443ddcccd54SRanjani Sridharan static int byt_suspend(struct snd_sof_dev *sdev, u32 target_state)
444ddcccd54SRanjani Sridharan {
445ddcccd54SRanjani Sridharan 	byt_reset_dsp_disable_int(sdev);
446ddcccd54SRanjani Sridharan 
447ddcccd54SRanjani Sridharan 	return 0;
448ddcccd54SRanjani Sridharan }
449ddcccd54SRanjani Sridharan 
450ddcccd54SRanjani Sridharan static int byt_resume(struct snd_sof_dev *sdev)
451ddcccd54SRanjani Sridharan {
452ddcccd54SRanjani Sridharan 	/* Enable Interrupt from both sides */
453ddcccd54SRanjani Sridharan 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRX, 0x3, 0x0);
454ddcccd54SRanjani Sridharan 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRD, 0x3, 0x0);
455ddcccd54SRanjani Sridharan 
456ddcccd54SRanjani Sridharan 	return 0;
457ddcccd54SRanjani Sridharan }
458ddcccd54SRanjani Sridharan 
4599e42c5caSLiam Girdwood /* Baytrail DAIs */
4609e42c5caSLiam Girdwood static struct snd_soc_dai_driver byt_dai[] = {
4619e42c5caSLiam Girdwood {
4629e42c5caSLiam Girdwood 	.name = "ssp0-port",
4638c05246cSPierre-Louis Bossart 	.playback = {
4648c05246cSPierre-Louis Bossart 		.channels_min = 1,
4658c05246cSPierre-Louis Bossart 		.channels_max = 8,
4668c05246cSPierre-Louis Bossart 	},
4678c05246cSPierre-Louis Bossart 	.capture = {
4688c05246cSPierre-Louis Bossart 		.channels_min = 1,
4698c05246cSPierre-Louis Bossart 		.channels_max = 8,
4708c05246cSPierre-Louis Bossart 	},
4719e42c5caSLiam Girdwood },
4729e42c5caSLiam Girdwood {
4739e42c5caSLiam Girdwood 	.name = "ssp1-port",
4748c05246cSPierre-Louis Bossart 	.playback = {
4758c05246cSPierre-Louis Bossart 		.channels_min = 1,
4768c05246cSPierre-Louis Bossart 		.channels_max = 8,
4778c05246cSPierre-Louis Bossart 	},
4788c05246cSPierre-Louis Bossart 	.capture = {
4798c05246cSPierre-Louis Bossart 		.channels_min = 1,
4808c05246cSPierre-Louis Bossart 		.channels_max = 8,
4818c05246cSPierre-Louis Bossart 	},
4829e42c5caSLiam Girdwood },
4839e42c5caSLiam Girdwood {
4849e42c5caSLiam Girdwood 	.name = "ssp2-port",
4858c05246cSPierre-Louis Bossart 	.playback = {
4868c05246cSPierre-Louis Bossart 		.channels_min = 1,
4878c05246cSPierre-Louis Bossart 		.channels_max = 8,
4888c05246cSPierre-Louis Bossart 	},
4898c05246cSPierre-Louis Bossart 	.capture = {
4908c05246cSPierre-Louis Bossart 		.channels_min = 1,
4918c05246cSPierre-Louis Bossart 		.channels_max = 8,
4928c05246cSPierre-Louis Bossart 	}
4939e42c5caSLiam Girdwood },
4949e42c5caSLiam Girdwood {
4959e42c5caSLiam Girdwood 	.name = "ssp3-port",
4968c05246cSPierre-Louis Bossart 	.playback = {
4978c05246cSPierre-Louis Bossart 		.channels_min = 1,
4988c05246cSPierre-Louis Bossart 		.channels_max = 8,
4998c05246cSPierre-Louis Bossart 	},
5008c05246cSPierre-Louis Bossart 	.capture = {
5018c05246cSPierre-Louis Bossart 		.channels_min = 1,
5028c05246cSPierre-Louis Bossart 		.channels_max = 8,
5038c05246cSPierre-Louis Bossart 	},
5049e42c5caSLiam Girdwood },
5059e42c5caSLiam Girdwood {
5069e42c5caSLiam Girdwood 	.name = "ssp4-port",
5078c05246cSPierre-Louis Bossart 	.playback = {
5088c05246cSPierre-Louis Bossart 		.channels_min = 1,
5098c05246cSPierre-Louis Bossart 		.channels_max = 8,
5108c05246cSPierre-Louis Bossart 	},
5118c05246cSPierre-Louis Bossart 	.capture = {
5128c05246cSPierre-Louis Bossart 		.channels_min = 1,
5138c05246cSPierre-Louis Bossart 		.channels_max = 8,
5148c05246cSPierre-Louis Bossart 	},
5159e42c5caSLiam Girdwood },
5169e42c5caSLiam Girdwood {
5179e42c5caSLiam Girdwood 	.name = "ssp5-port",
5188c05246cSPierre-Louis Bossart 	.playback = {
5198c05246cSPierre-Louis Bossart 		.channels_min = 1,
5208c05246cSPierre-Louis Bossart 		.channels_max = 8,
5218c05246cSPierre-Louis Bossart 	},
5228c05246cSPierre-Louis Bossart 	.capture = {
5238c05246cSPierre-Louis Bossart 		.channels_min = 1,
5248c05246cSPierre-Louis Bossart 		.channels_max = 8,
5258c05246cSPierre-Louis Bossart 	},
5269e42c5caSLiam Girdwood },
5279e42c5caSLiam Girdwood };
5289e42c5caSLiam Girdwood 
5299e42c5caSLiam Girdwood /*
5309e42c5caSLiam Girdwood  * Probe and remove.
5319e42c5caSLiam Girdwood  */
5329e42c5caSLiam Girdwood 
5339e42c5caSLiam Girdwood #if IS_ENABLED(CONFIG_SND_SOC_SOF_MERRIFIELD)
5349e42c5caSLiam Girdwood 
5359e42c5caSLiam Girdwood static int tangier_pci_probe(struct snd_sof_dev *sdev)
5369e42c5caSLiam Girdwood {
5379e42c5caSLiam Girdwood 	struct snd_sof_pdata *pdata = sdev->pdata;
5389e42c5caSLiam Girdwood 	const struct sof_dev_desc *desc = pdata->desc;
5399e42c5caSLiam Girdwood 	struct pci_dev *pci = to_pci_dev(sdev->dev);
5409e42c5caSLiam Girdwood 	u32 base, size;
5419e42c5caSLiam Girdwood 	int ret;
5429e42c5caSLiam Girdwood 
5439e42c5caSLiam Girdwood 	/* DSP DMA can only access low 31 bits of host memory */
5449e42c5caSLiam Girdwood 	ret = dma_coerce_mask_and_coherent(&pci->dev, DMA_BIT_MASK(31));
5459e42c5caSLiam Girdwood 	if (ret < 0) {
5469e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to set DMA mask %d\n", ret);
5479e42c5caSLiam Girdwood 		return ret;
5489e42c5caSLiam Girdwood 	}
5499e42c5caSLiam Girdwood 
5509e42c5caSLiam Girdwood 	/* LPE base */
5519e42c5caSLiam Girdwood 	base = pci_resource_start(pci, desc->resindex_lpe_base) - IRAM_OFFSET;
5529e42c5caSLiam Girdwood 	size = BYT_PCI_BAR_SIZE;
5539e42c5caSLiam Girdwood 
5549e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size);
5559e42c5caSLiam Girdwood 	sdev->bar[BYT_DSP_BAR] = devm_ioremap(sdev->dev, base, size);
5569e42c5caSLiam Girdwood 	if (!sdev->bar[BYT_DSP_BAR]) {
5579e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to ioremap LPE base 0x%x size 0x%x\n",
5589e42c5caSLiam Girdwood 			base, size);
5599e42c5caSLiam Girdwood 		return -ENODEV;
5609e42c5caSLiam Girdwood 	}
5619e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "LPE VADDR %p\n", sdev->bar[BYT_DSP_BAR]);
5629e42c5caSLiam Girdwood 
5639e42c5caSLiam Girdwood 	/* IMR base - optional */
5649e42c5caSLiam Girdwood 	if (desc->resindex_imr_base == -1)
5659e42c5caSLiam Girdwood 		goto irq;
5669e42c5caSLiam Girdwood 
5679e42c5caSLiam Girdwood 	base = pci_resource_start(pci, desc->resindex_imr_base);
5689e42c5caSLiam Girdwood 	size = pci_resource_len(pci, desc->resindex_imr_base);
5699e42c5caSLiam Girdwood 
5709e42c5caSLiam Girdwood 	/* some BIOSes don't map IMR */
5719e42c5caSLiam Girdwood 	if (base == 0x55aa55aa || base == 0x0) {
5729e42c5caSLiam Girdwood 		dev_info(sdev->dev, "IMR not set by BIOS. Ignoring\n");
5739e42c5caSLiam Girdwood 		goto irq;
5749e42c5caSLiam Girdwood 	}
5759e42c5caSLiam Girdwood 
5769e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "IMR base at 0x%x size 0x%x", base, size);
5779e42c5caSLiam Girdwood 	sdev->bar[BYT_IMR_BAR] = devm_ioremap(sdev->dev, base, size);
5789e42c5caSLiam Girdwood 	if (!sdev->bar[BYT_IMR_BAR]) {
5799e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to ioremap IMR base 0x%x size 0x%x\n",
5809e42c5caSLiam Girdwood 			base, size);
5819e42c5caSLiam Girdwood 		return -ENODEV;
5829e42c5caSLiam Girdwood 	}
5839e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "IMR VADDR %p\n", sdev->bar[BYT_IMR_BAR]);
5849e42c5caSLiam Girdwood 
5859e42c5caSLiam Girdwood irq:
5869e42c5caSLiam Girdwood 	/* register our IRQ */
5879e42c5caSLiam Girdwood 	sdev->ipc_irq = pci->irq;
5889e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "using IRQ %d\n", sdev->ipc_irq);
5899e42c5caSLiam Girdwood 	ret = devm_request_threaded_irq(sdev->dev, sdev->ipc_irq,
5909e42c5caSLiam Girdwood 					byt_irq_handler, byt_irq_thread,
5919e42c5caSLiam Girdwood 					0, "AudioDSP", sdev);
5929e42c5caSLiam Girdwood 	if (ret < 0) {
5939e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to register IRQ %d\n",
5949e42c5caSLiam Girdwood 			sdev->ipc_irq);
5959e42c5caSLiam Girdwood 		return ret;
5969e42c5caSLiam Girdwood 	}
5979e42c5caSLiam Girdwood 
5989e42c5caSLiam Girdwood 	/* enable Interrupt from both sides */
5999e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRX, 0x3, 0x0);
6009e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRD, 0x3, 0x0);
6019e42c5caSLiam Girdwood 
6029e42c5caSLiam Girdwood 	/* set default mailbox offset for FW ready message */
6039e42c5caSLiam Girdwood 	sdev->dsp_box.offset = MBOX_OFFSET;
6049e42c5caSLiam Girdwood 
6059e42c5caSLiam Girdwood 	return ret;
6069e42c5caSLiam Girdwood }
6079e42c5caSLiam Girdwood 
6089e42c5caSLiam Girdwood const struct snd_sof_dsp_ops sof_tng_ops = {
6099e42c5caSLiam Girdwood 	/* device init */
6109e42c5caSLiam Girdwood 	.probe		= tangier_pci_probe,
6119e42c5caSLiam Girdwood 
6129e42c5caSLiam Girdwood 	/* DSP core boot / reset */
6139e42c5caSLiam Girdwood 	.run		= byt_run,
6149e42c5caSLiam Girdwood 	.reset		= byt_reset,
6159e42c5caSLiam Girdwood 
6169e42c5caSLiam Girdwood 	/* Register IO */
6179e42c5caSLiam Girdwood 	.write		= sof_io_write,
6189e42c5caSLiam Girdwood 	.read		= sof_io_read,
6199e42c5caSLiam Girdwood 	.write64	= sof_io_write64,
6209e42c5caSLiam Girdwood 	.read64		= sof_io_read64,
6219e42c5caSLiam Girdwood 
6229e42c5caSLiam Girdwood 	/* Block IO */
6239e42c5caSLiam Girdwood 	.block_read	= sof_block_read,
6249e42c5caSLiam Girdwood 	.block_write	= sof_block_write,
6259e42c5caSLiam Girdwood 
6269e42c5caSLiam Girdwood 	/* doorbell */
6279e42c5caSLiam Girdwood 	.irq_handler	= byt_irq_handler,
6289e42c5caSLiam Girdwood 	.irq_thread	= byt_irq_thread,
6299e42c5caSLiam Girdwood 
6309e42c5caSLiam Girdwood 	/* ipc */
6319e42c5caSLiam Girdwood 	.send_msg	= byt_send_msg,
63283ee7ab1SDaniel Baluta 	.fw_ready	= sof_fw_ready,
63383ee7ab1SDaniel Baluta 	.get_mailbox_offset = byt_get_mailbox_offset,
63483ee7ab1SDaniel Baluta 	.get_window_offset = byt_get_window_offset,
6359e42c5caSLiam Girdwood 
6369e42c5caSLiam Girdwood 	.ipc_msg_data	= intel_ipc_msg_data,
6379e42c5caSLiam Girdwood 	.ipc_pcm_params	= intel_ipc_pcm_params,
6389e42c5caSLiam Girdwood 
639285880a2SDaniel Baluta 	/* machine driver */
640285880a2SDaniel Baluta 	.machine_select = byt_machine_select,
641285880a2SDaniel Baluta 	.machine_register = sof_machine_register,
642285880a2SDaniel Baluta 	.machine_unregister = sof_machine_unregister,
643285880a2SDaniel Baluta 	.set_mach_params = byt_set_mach_params,
644285880a2SDaniel Baluta 
6459e42c5caSLiam Girdwood 	/* debug */
6469e42c5caSLiam Girdwood 	.debug_map	= byt_debugfs,
6479e42c5caSLiam Girdwood 	.debug_map_count	= ARRAY_SIZE(byt_debugfs),
6489e42c5caSLiam Girdwood 	.dbg_dump	= byt_dump,
6499e42c5caSLiam Girdwood 
6509e42c5caSLiam Girdwood 	/* stream callbacks */
6519e42c5caSLiam Girdwood 	.pcm_open	= intel_pcm_open,
6529e42c5caSLiam Girdwood 	.pcm_close	= intel_pcm_close,
6539e42c5caSLiam Girdwood 
6549e42c5caSLiam Girdwood 	/* module loading */
6559e42c5caSLiam Girdwood 	.load_module	= snd_sof_parse_module_memcpy,
6569e42c5caSLiam Girdwood 
6579e42c5caSLiam Girdwood 	/*Firmware loading */
6589e42c5caSLiam Girdwood 	.load_firmware	= snd_sof_load_firmware_memcpy,
6599e42c5caSLiam Girdwood 
6609e42c5caSLiam Girdwood 	/* DAI drivers */
6619e42c5caSLiam Girdwood 	.drv = byt_dai,
6629e42c5caSLiam Girdwood 	.num_drv = 3, /* we have only 3 SSPs on byt*/
66327e322faSPierre-Louis Bossart 
66427e322faSPierre-Louis Bossart 	/* ALSA HW info flags */
66527e322faSPierre-Louis Bossart 	.hw_info =	SNDRV_PCM_INFO_MMAP |
66627e322faSPierre-Louis Bossart 			SNDRV_PCM_INFO_MMAP_VALID |
66727e322faSPierre-Louis Bossart 			SNDRV_PCM_INFO_INTERLEAVED |
66827e322faSPierre-Louis Bossart 			SNDRV_PCM_INFO_PAUSE |
6694c02a7bdSPierre-Louis Bossart 			SNDRV_PCM_INFO_BATCH,
6700f501c7cSPierre-Louis Bossart 
6710f501c7cSPierre-Louis Bossart 	.arch_ops = &sof_xtensa_arch_ops,
6729e42c5caSLiam Girdwood };
673e42b1945SPierre-Louis Bossart EXPORT_SYMBOL_NS(sof_tng_ops, SND_SOC_SOF_MERRIFIELD);
6749e42c5caSLiam Girdwood 
6759e42c5caSLiam Girdwood const struct sof_intel_dsp_desc tng_chip_info = {
6769e42c5caSLiam Girdwood 	.cores_num = 1,
6779e42c5caSLiam Girdwood 	.cores_mask = 1,
6789e42c5caSLiam Girdwood };
679e42b1945SPierre-Louis Bossart EXPORT_SYMBOL_NS(tng_chip_info, SND_SOC_SOF_MERRIFIELD);
6809e42c5caSLiam Girdwood 
6819e42c5caSLiam Girdwood #endif /* CONFIG_SND_SOC_SOF_MERRIFIELD */
6829e42c5caSLiam Girdwood 
6839e42c5caSLiam Girdwood #if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
6849e42c5caSLiam Girdwood 
68528d4adc4SYueHaibing static const struct snd_sof_debugfs_map cht_debugfs[] = {
68628d4adc4SYueHaibing 	{"dmac0", BYT_DSP_BAR, DMAC0_OFFSET, DMAC_SIZE,
68728d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
68828d4adc4SYueHaibing 	{"dmac1", BYT_DSP_BAR,  DMAC1_OFFSET, DMAC_SIZE,
68928d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
69028d4adc4SYueHaibing 	{"dmac2", BYT_DSP_BAR,  DMAC2_OFFSET, DMAC_SIZE,
69128d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
69228d4adc4SYueHaibing 	{"ssp0",  BYT_DSP_BAR, SSP0_OFFSET, SSP_SIZE,
69328d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
69428d4adc4SYueHaibing 	{"ssp1", BYT_DSP_BAR, SSP1_OFFSET, SSP_SIZE,
69528d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
69628d4adc4SYueHaibing 	{"ssp2", BYT_DSP_BAR, SSP2_OFFSET, SSP_SIZE,
69728d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
69828d4adc4SYueHaibing 	{"ssp3", BYT_DSP_BAR, SSP3_OFFSET, SSP_SIZE,
69928d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
70028d4adc4SYueHaibing 	{"ssp4", BYT_DSP_BAR, SSP4_OFFSET, SSP_SIZE,
70128d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
70228d4adc4SYueHaibing 	{"ssp5", BYT_DSP_BAR, SSP5_OFFSET, SSP_SIZE,
70328d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
70428d4adc4SYueHaibing 	{"iram", BYT_DSP_BAR, IRAM_OFFSET, IRAM_SIZE,
70528d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_D0_ONLY},
70628d4adc4SYueHaibing 	{"dram", BYT_DSP_BAR, DRAM_OFFSET, DRAM_SIZE,
70728d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_D0_ONLY},
70828d4adc4SYueHaibing 	{"shim", BYT_DSP_BAR, SHIM_OFFSET, SHIM_SIZE_CHT,
70928d4adc4SYueHaibing 	 SOF_DEBUGFS_ACCESS_ALWAYS},
71028d4adc4SYueHaibing };
71128d4adc4SYueHaibing 
7129e42c5caSLiam Girdwood static int byt_acpi_probe(struct snd_sof_dev *sdev)
7139e42c5caSLiam Girdwood {
7149e42c5caSLiam Girdwood 	struct snd_sof_pdata *pdata = sdev->pdata;
7159e42c5caSLiam Girdwood 	const struct sof_dev_desc *desc = pdata->desc;
7169e42c5caSLiam Girdwood 	struct platform_device *pdev =
7179e42c5caSLiam Girdwood 		container_of(sdev->dev, struct platform_device, dev);
7189e42c5caSLiam Girdwood 	struct resource *mmio;
7199e42c5caSLiam Girdwood 	u32 base, size;
7209e42c5caSLiam Girdwood 	int ret;
7219e42c5caSLiam Girdwood 
7229e42c5caSLiam Girdwood 	/* DSP DMA can only access low 31 bits of host memory */
7239e42c5caSLiam Girdwood 	ret = dma_coerce_mask_and_coherent(sdev->dev, DMA_BIT_MASK(31));
7249e42c5caSLiam Girdwood 	if (ret < 0) {
7259e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to set DMA mask %d\n", ret);
7269e42c5caSLiam Girdwood 		return ret;
7279e42c5caSLiam Girdwood 	}
7289e42c5caSLiam Girdwood 
7299e42c5caSLiam Girdwood 	/* LPE base */
7309e42c5caSLiam Girdwood 	mmio = platform_get_resource(pdev, IORESOURCE_MEM,
7319e42c5caSLiam Girdwood 				     desc->resindex_lpe_base);
7329e42c5caSLiam Girdwood 	if (mmio) {
7339e42c5caSLiam Girdwood 		base = mmio->start;
7349e42c5caSLiam Girdwood 		size = resource_size(mmio);
7359e42c5caSLiam Girdwood 	} else {
7369e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to get LPE base at idx %d\n",
7379e42c5caSLiam Girdwood 			desc->resindex_lpe_base);
7389e42c5caSLiam Girdwood 		return -EINVAL;
7399e42c5caSLiam Girdwood 	}
7409e42c5caSLiam Girdwood 
7419e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size);
7429e42c5caSLiam Girdwood 	sdev->bar[BYT_DSP_BAR] = devm_ioremap(sdev->dev, base, size);
7439e42c5caSLiam Girdwood 	if (!sdev->bar[BYT_DSP_BAR]) {
7449e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to ioremap LPE base 0x%x size 0x%x\n",
7459e42c5caSLiam Girdwood 			base, size);
7469e42c5caSLiam Girdwood 		return -ENODEV;
7479e42c5caSLiam Girdwood 	}
7489e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "LPE VADDR %p\n", sdev->bar[BYT_DSP_BAR]);
7499e42c5caSLiam Girdwood 
7509e42c5caSLiam Girdwood 	/* TODO: add offsets */
7519e42c5caSLiam Girdwood 	sdev->mmio_bar = BYT_DSP_BAR;
7529e42c5caSLiam Girdwood 	sdev->mailbox_bar = BYT_DSP_BAR;
7539e42c5caSLiam Girdwood 
7549e42c5caSLiam Girdwood 	/* IMR base - optional */
7559e42c5caSLiam Girdwood 	if (desc->resindex_imr_base == -1)
7569e42c5caSLiam Girdwood 		goto irq;
7579e42c5caSLiam Girdwood 
7589e42c5caSLiam Girdwood 	mmio = platform_get_resource(pdev, IORESOURCE_MEM,
7599e42c5caSLiam Girdwood 				     desc->resindex_imr_base);
7609e42c5caSLiam Girdwood 	if (mmio) {
7619e42c5caSLiam Girdwood 		base = mmio->start;
7629e42c5caSLiam Girdwood 		size = resource_size(mmio);
7639e42c5caSLiam Girdwood 	} else {
7649e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to get IMR base at idx %d\n",
7659e42c5caSLiam Girdwood 			desc->resindex_imr_base);
7669e42c5caSLiam Girdwood 		return -ENODEV;
7679e42c5caSLiam Girdwood 	}
7689e42c5caSLiam Girdwood 
7699e42c5caSLiam Girdwood 	/* some BIOSes don't map IMR */
7709e42c5caSLiam Girdwood 	if (base == 0x55aa55aa || base == 0x0) {
7719e42c5caSLiam Girdwood 		dev_info(sdev->dev, "IMR not set by BIOS. Ignoring\n");
7729e42c5caSLiam Girdwood 		goto irq;
7739e42c5caSLiam Girdwood 	}
7749e42c5caSLiam Girdwood 
7759e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "IMR base at 0x%x size 0x%x", base, size);
7769e42c5caSLiam Girdwood 	sdev->bar[BYT_IMR_BAR] = devm_ioremap(sdev->dev, base, size);
7779e42c5caSLiam Girdwood 	if (!sdev->bar[BYT_IMR_BAR]) {
7789e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to ioremap IMR base 0x%x size 0x%x\n",
7799e42c5caSLiam Girdwood 			base, size);
7809e42c5caSLiam Girdwood 		return -ENODEV;
7819e42c5caSLiam Girdwood 	}
7829e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "IMR VADDR %p\n", sdev->bar[BYT_IMR_BAR]);
7839e42c5caSLiam Girdwood 
7849e42c5caSLiam Girdwood irq:
7859e42c5caSLiam Girdwood 	/* register our IRQ */
7869e42c5caSLiam Girdwood 	sdev->ipc_irq = platform_get_irq(pdev, desc->irqindex_host_ipc);
787cf9441adSStephen Boyd 	if (sdev->ipc_irq < 0)
7889e42c5caSLiam Girdwood 		return sdev->ipc_irq;
7899e42c5caSLiam Girdwood 
7909e42c5caSLiam Girdwood 	dev_dbg(sdev->dev, "using IRQ %d\n", sdev->ipc_irq);
7919e42c5caSLiam Girdwood 	ret = devm_request_threaded_irq(sdev->dev, sdev->ipc_irq,
7929e42c5caSLiam Girdwood 					byt_irq_handler, byt_irq_thread,
7939e42c5caSLiam Girdwood 					IRQF_SHARED, "AudioDSP", sdev);
7949e42c5caSLiam Girdwood 	if (ret < 0) {
7959e42c5caSLiam Girdwood 		dev_err(sdev->dev, "error: failed to register IRQ %d\n",
7969e42c5caSLiam Girdwood 			sdev->ipc_irq);
7979e42c5caSLiam Girdwood 		return ret;
7989e42c5caSLiam Girdwood 	}
7999e42c5caSLiam Girdwood 
8009e42c5caSLiam Girdwood 	/* enable Interrupt from both sides */
8019e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRX, 0x3, 0x0);
8029e42c5caSLiam Girdwood 	snd_sof_dsp_update_bits64(sdev, BYT_DSP_BAR, SHIM_IMRD, 0x3, 0x0);
8039e42c5caSLiam Girdwood 
8049e42c5caSLiam Girdwood 	/* set default mailbox offset for FW ready message */
8059e42c5caSLiam Girdwood 	sdev->dsp_box.offset = MBOX_OFFSET;
8069e42c5caSLiam Girdwood 
8079e42c5caSLiam Girdwood 	return ret;
8089e42c5caSLiam Girdwood }
8099e42c5caSLiam Girdwood 
8109e42c5caSLiam Girdwood /* baytrail ops */
8119e42c5caSLiam Girdwood const struct snd_sof_dsp_ops sof_byt_ops = {
8129e42c5caSLiam Girdwood 	/* device init */
8139e42c5caSLiam Girdwood 	.probe		= byt_acpi_probe,
8149e42c5caSLiam Girdwood 
8159e42c5caSLiam Girdwood 	/* DSP core boot / reset */
8169e42c5caSLiam Girdwood 	.run		= byt_run,
8179e42c5caSLiam Girdwood 	.reset		= byt_reset,
8189e42c5caSLiam Girdwood 
8199e42c5caSLiam Girdwood 	/* Register IO */
8209e42c5caSLiam Girdwood 	.write		= sof_io_write,
8219e42c5caSLiam Girdwood 	.read		= sof_io_read,
8229e42c5caSLiam Girdwood 	.write64	= sof_io_write64,
8239e42c5caSLiam Girdwood 	.read64		= sof_io_read64,
8249e42c5caSLiam Girdwood 
8259e42c5caSLiam Girdwood 	/* Block IO */
8269e42c5caSLiam Girdwood 	.block_read	= sof_block_read,
8279e42c5caSLiam Girdwood 	.block_write	= sof_block_write,
8289e42c5caSLiam Girdwood 
8299e42c5caSLiam Girdwood 	/* doorbell */
8309e42c5caSLiam Girdwood 	.irq_handler	= byt_irq_handler,
8319e42c5caSLiam Girdwood 	.irq_thread	= byt_irq_thread,
8329e42c5caSLiam Girdwood 
8339e42c5caSLiam Girdwood 	/* ipc */
8349e42c5caSLiam Girdwood 	.send_msg	= byt_send_msg,
83583ee7ab1SDaniel Baluta 	.fw_ready	= sof_fw_ready,
83683ee7ab1SDaniel Baluta 	.get_mailbox_offset = byt_get_mailbox_offset,
83783ee7ab1SDaniel Baluta 	.get_window_offset = byt_get_window_offset,
8389e42c5caSLiam Girdwood 
8399e42c5caSLiam Girdwood 	.ipc_msg_data	= intel_ipc_msg_data,
8409e42c5caSLiam Girdwood 	.ipc_pcm_params	= intel_ipc_pcm_params,
8419e42c5caSLiam Girdwood 
842285880a2SDaniel Baluta 	/* machine driver */
843285880a2SDaniel Baluta 	.machine_select = byt_machine_select,
844285880a2SDaniel Baluta 	.machine_register = sof_machine_register,
845285880a2SDaniel Baluta 	.machine_unregister = sof_machine_unregister,
846285880a2SDaniel Baluta 	.set_mach_params = byt_set_mach_params,
847285880a2SDaniel Baluta 
8489e42c5caSLiam Girdwood 	/* debug */
8499e42c5caSLiam Girdwood 	.debug_map	= byt_debugfs,
8509e42c5caSLiam Girdwood 	.debug_map_count	= ARRAY_SIZE(byt_debugfs),
8519e42c5caSLiam Girdwood 	.dbg_dump	= byt_dump,
8529e42c5caSLiam Girdwood 
8539e42c5caSLiam Girdwood 	/* stream callbacks */
8549e42c5caSLiam Girdwood 	.pcm_open	= intel_pcm_open,
8559e42c5caSLiam Girdwood 	.pcm_close	= intel_pcm_close,
8569e42c5caSLiam Girdwood 
8579e42c5caSLiam Girdwood 	/* module loading */
8589e42c5caSLiam Girdwood 	.load_module	= snd_sof_parse_module_memcpy,
8599e42c5caSLiam Girdwood 
8609e42c5caSLiam Girdwood 	/*Firmware loading */
8619e42c5caSLiam Girdwood 	.load_firmware	= snd_sof_load_firmware_memcpy,
8629e42c5caSLiam Girdwood 
863ddcccd54SRanjani Sridharan 	/* PM */
864ddcccd54SRanjani Sridharan 	.suspend = byt_suspend,
865ddcccd54SRanjani Sridharan 	.resume = byt_resume,
866ddcccd54SRanjani Sridharan 
8679e42c5caSLiam Girdwood 	/* DAI drivers */
8689e42c5caSLiam Girdwood 	.drv = byt_dai,
8699e42c5caSLiam Girdwood 	.num_drv = 3, /* we have only 3 SSPs on byt*/
87027e322faSPierre-Louis Bossart 
87127e322faSPierre-Louis Bossart 	/* ALSA HW info flags */
87227e322faSPierre-Louis Bossart 	.hw_info =	SNDRV_PCM_INFO_MMAP |
87327e322faSPierre-Louis Bossart 			SNDRV_PCM_INFO_MMAP_VALID |
87427e322faSPierre-Louis Bossart 			SNDRV_PCM_INFO_INTERLEAVED |
87527e322faSPierre-Louis Bossart 			SNDRV_PCM_INFO_PAUSE |
8764c02a7bdSPierre-Louis Bossart 			SNDRV_PCM_INFO_BATCH,
8770f501c7cSPierre-Louis Bossart 
8780f501c7cSPierre-Louis Bossart 	.arch_ops = &sof_xtensa_arch_ops,
8799e42c5caSLiam Girdwood };
880e42b1945SPierre-Louis Bossart EXPORT_SYMBOL_NS(sof_byt_ops, SND_SOC_SOF_BAYTRAIL);
8819e42c5caSLiam Girdwood 
8829e42c5caSLiam Girdwood const struct sof_intel_dsp_desc byt_chip_info = {
8839e42c5caSLiam Girdwood 	.cores_num = 1,
8849e42c5caSLiam Girdwood 	.cores_mask = 1,
8859e42c5caSLiam Girdwood };
886e42b1945SPierre-Louis Bossart EXPORT_SYMBOL_NS(byt_chip_info, SND_SOC_SOF_BAYTRAIL);
8879e42c5caSLiam Girdwood 
8889e42c5caSLiam Girdwood /* cherrytrail and braswell ops */
8899e42c5caSLiam Girdwood const struct snd_sof_dsp_ops sof_cht_ops = {
8909e42c5caSLiam Girdwood 	/* device init */
8919e42c5caSLiam Girdwood 	.probe		= byt_acpi_probe,
8929e42c5caSLiam Girdwood 
8939e42c5caSLiam Girdwood 	/* DSP core boot / reset */
8949e42c5caSLiam Girdwood 	.run		= byt_run,
8959e42c5caSLiam Girdwood 	.reset		= byt_reset,
8969e42c5caSLiam Girdwood 
8979e42c5caSLiam Girdwood 	/* Register IO */
8989e42c5caSLiam Girdwood 	.write		= sof_io_write,
8999e42c5caSLiam Girdwood 	.read		= sof_io_read,
9009e42c5caSLiam Girdwood 	.write64	= sof_io_write64,
9019e42c5caSLiam Girdwood 	.read64		= sof_io_read64,
9029e42c5caSLiam Girdwood 
9039e42c5caSLiam Girdwood 	/* Block IO */
9049e42c5caSLiam Girdwood 	.block_read	= sof_block_read,
9059e42c5caSLiam Girdwood 	.block_write	= sof_block_write,
9069e42c5caSLiam Girdwood 
9079e42c5caSLiam Girdwood 	/* doorbell */
9089e42c5caSLiam Girdwood 	.irq_handler	= byt_irq_handler,
9099e42c5caSLiam Girdwood 	.irq_thread	= byt_irq_thread,
9109e42c5caSLiam Girdwood 
9119e42c5caSLiam Girdwood 	/* ipc */
9129e42c5caSLiam Girdwood 	.send_msg	= byt_send_msg,
91383ee7ab1SDaniel Baluta 	.fw_ready	= sof_fw_ready,
91483ee7ab1SDaniel Baluta 	.get_mailbox_offset = byt_get_mailbox_offset,
91583ee7ab1SDaniel Baluta 	.get_window_offset = byt_get_window_offset,
9169e42c5caSLiam Girdwood 
9179e42c5caSLiam Girdwood 	.ipc_msg_data	= intel_ipc_msg_data,
9189e42c5caSLiam Girdwood 	.ipc_pcm_params	= intel_ipc_pcm_params,
9199e42c5caSLiam Girdwood 
920285880a2SDaniel Baluta 	/* machine driver */
921285880a2SDaniel Baluta 	.machine_select = byt_machine_select,
922285880a2SDaniel Baluta 	.machine_register = sof_machine_register,
923285880a2SDaniel Baluta 	.machine_unregister = sof_machine_unregister,
924285880a2SDaniel Baluta 	.set_mach_params = byt_set_mach_params,
925285880a2SDaniel Baluta 
9269e42c5caSLiam Girdwood 	/* debug */
9279e42c5caSLiam Girdwood 	.debug_map	= cht_debugfs,
9289e42c5caSLiam Girdwood 	.debug_map_count	= ARRAY_SIZE(cht_debugfs),
9299e42c5caSLiam Girdwood 	.dbg_dump	= byt_dump,
9309e42c5caSLiam Girdwood 
9319e42c5caSLiam Girdwood 	/* stream callbacks */
9329e42c5caSLiam Girdwood 	.pcm_open	= intel_pcm_open,
9339e42c5caSLiam Girdwood 	.pcm_close	= intel_pcm_close,
9349e42c5caSLiam Girdwood 
9359e42c5caSLiam Girdwood 	/* module loading */
9369e42c5caSLiam Girdwood 	.load_module	= snd_sof_parse_module_memcpy,
9379e42c5caSLiam Girdwood 
9389e42c5caSLiam Girdwood 	/*Firmware loading */
9399e42c5caSLiam Girdwood 	.load_firmware	= snd_sof_load_firmware_memcpy,
9409e42c5caSLiam Girdwood 
941ddcccd54SRanjani Sridharan 	/* PM */
942ddcccd54SRanjani Sridharan 	.suspend = byt_suspend,
943ddcccd54SRanjani Sridharan 	.resume = byt_resume,
944ddcccd54SRanjani Sridharan 
9459e42c5caSLiam Girdwood 	/* DAI drivers */
9469e42c5caSLiam Girdwood 	.drv = byt_dai,
9479e42c5caSLiam Girdwood 	/* all 6 SSPs may be available for cherrytrail */
9489e42c5caSLiam Girdwood 	.num_drv = ARRAY_SIZE(byt_dai),
94927e322faSPierre-Louis Bossart 
95027e322faSPierre-Louis Bossart 	/* ALSA HW info flags */
95127e322faSPierre-Louis Bossart 	.hw_info =	SNDRV_PCM_INFO_MMAP |
95227e322faSPierre-Louis Bossart 			SNDRV_PCM_INFO_MMAP_VALID |
95327e322faSPierre-Louis Bossart 			SNDRV_PCM_INFO_INTERLEAVED |
95427e322faSPierre-Louis Bossart 			SNDRV_PCM_INFO_PAUSE |
9554c02a7bdSPierre-Louis Bossart 			SNDRV_PCM_INFO_BATCH,
9560f501c7cSPierre-Louis Bossart 
9570f501c7cSPierre-Louis Bossart 	.arch_ops = &sof_xtensa_arch_ops,
9589e42c5caSLiam Girdwood };
959e42b1945SPierre-Louis Bossart EXPORT_SYMBOL_NS(sof_cht_ops, SND_SOC_SOF_BAYTRAIL);
9609e42c5caSLiam Girdwood 
9619e42c5caSLiam Girdwood const struct sof_intel_dsp_desc cht_chip_info = {
9629e42c5caSLiam Girdwood 	.cores_num = 1,
9639e42c5caSLiam Girdwood 	.cores_mask = 1,
9649e42c5caSLiam Girdwood };
965e42b1945SPierre-Louis Bossart EXPORT_SYMBOL_NS(cht_chip_info, SND_SOC_SOF_BAYTRAIL);
9669e42c5caSLiam Girdwood 
9679e42c5caSLiam Girdwood #endif /* CONFIG_SND_SOC_SOF_BAYTRAIL */
9689e42c5caSLiam Girdwood 
9699e42c5caSLiam Girdwood MODULE_LICENSE("Dual BSD/GPL");
970f4483a0fSPierre-Louis Bossart MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HIFI_EP_IPC);
971068ac0dbSPierre-Louis Bossart MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA);
972