18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Driver for the Conexant CX25821 PCIe bridge
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 2009 Conexant Systems Inc.
68c2ecf20Sopenharmony_ci *  Authors  <shu.lin@conexant.com>, <hiep.huynh@conexant.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __CX25821_AUDIO_H__
108c2ecf20Sopenharmony_ci#define __CX25821_AUDIO_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define USE_RISC_NOOP		1
138c2ecf20Sopenharmony_ci#define LINES_PER_BUFFER	15
148c2ecf20Sopenharmony_ci#define AUDIO_LINE_SIZE		128
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* Number of buffer programs to use at once. */
178c2ecf20Sopenharmony_ci#define NUMBER_OF_PROGRAMS	8
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/*
208c2ecf20Sopenharmony_ci * Max size of the RISC program for a buffer. - worst case is 2 writes per line
218c2ecf20Sopenharmony_ci * Space is also added for the 4 no-op instructions added on the end.
228c2ecf20Sopenharmony_ci */
238c2ecf20Sopenharmony_ci#ifndef USE_RISC_NOOP
248c2ecf20Sopenharmony_ci#define MAX_BUFFER_PROGRAM_SIZE						\
258c2ecf20Sopenharmony_ci	(2 * LINES_PER_BUFFER * RISC_WRITE_INSTRUCTION_SIZE +		\
268c2ecf20Sopenharmony_ci	 RISC_WRITECR_INSTRUCTION_SIZE * 4)
278c2ecf20Sopenharmony_ci#endif
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* MAE 12 July 2005 Try to use NOOP RISC instruction instead */
308c2ecf20Sopenharmony_ci#ifdef USE_RISC_NOOP
318c2ecf20Sopenharmony_ci#define MAX_BUFFER_PROGRAM_SIZE						\
328c2ecf20Sopenharmony_ci	(2 * LINES_PER_BUFFER * RISC_WRITE_INSTRUCTION_SIZE +		\
338c2ecf20Sopenharmony_ci	 RISC_NOOP_INSTRUCTION_SIZE * 4)
348c2ecf20Sopenharmony_ci#endif
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* Sizes of various instructions in bytes.  Used when adding instructions. */
378c2ecf20Sopenharmony_ci#define RISC_WRITE_INSTRUCTION_SIZE	12
388c2ecf20Sopenharmony_ci#define RISC_JUMP_INSTRUCTION_SIZE	12
398c2ecf20Sopenharmony_ci#define RISC_SKIP_INSTRUCTION_SIZE	4
408c2ecf20Sopenharmony_ci#define RISC_SYNC_INSTRUCTION_SIZE	4
418c2ecf20Sopenharmony_ci#define RISC_WRITECR_INSTRUCTION_SIZE	16
428c2ecf20Sopenharmony_ci#define RISC_NOOP_INSTRUCTION_SIZE	4
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define MAX_AUDIO_DMA_BUFFER_SIZE					\
458c2ecf20Sopenharmony_ci	(MAX_BUFFER_PROGRAM_SIZE * NUMBER_OF_PROGRAMS +			\
468c2ecf20Sopenharmony_ci	 RISC_SYNC_INSTRUCTION_SIZE)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#endif
49