162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  Driver for the Conexant CX25821 PCIe bridge
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright (C) 2009 Conexant Systems Inc.
662306a36Sopenharmony_ci *  Authors  <shu.lin@conexant.com>, <hiep.huynh@conexant.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __CX25821_AUDIO_H__
1062306a36Sopenharmony_ci#define __CX25821_AUDIO_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#define USE_RISC_NOOP		1
1362306a36Sopenharmony_ci#define LINES_PER_BUFFER	15
1462306a36Sopenharmony_ci#define AUDIO_LINE_SIZE		128
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* Number of buffer programs to use at once. */
1762306a36Sopenharmony_ci#define NUMBER_OF_PROGRAMS	8
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/*
2062306a36Sopenharmony_ci * Max size of the RISC program for a buffer. - worst case is 2 writes per line
2162306a36Sopenharmony_ci * Space is also added for the 4 no-op instructions added on the end.
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci#ifndef USE_RISC_NOOP
2462306a36Sopenharmony_ci#define MAX_BUFFER_PROGRAM_SIZE						\
2562306a36Sopenharmony_ci	(2 * LINES_PER_BUFFER * RISC_WRITE_INSTRUCTION_SIZE +		\
2662306a36Sopenharmony_ci	 RISC_WRITECR_INSTRUCTION_SIZE * 4)
2762306a36Sopenharmony_ci#endif
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* MAE 12 July 2005 Try to use NOOP RISC instruction instead */
3062306a36Sopenharmony_ci#ifdef USE_RISC_NOOP
3162306a36Sopenharmony_ci#define MAX_BUFFER_PROGRAM_SIZE						\
3262306a36Sopenharmony_ci	(2 * LINES_PER_BUFFER * RISC_WRITE_INSTRUCTION_SIZE +		\
3362306a36Sopenharmony_ci	 RISC_NOOP_INSTRUCTION_SIZE * 4)
3462306a36Sopenharmony_ci#endif
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/* Sizes of various instructions in bytes.  Used when adding instructions. */
3762306a36Sopenharmony_ci#define RISC_WRITE_INSTRUCTION_SIZE	12
3862306a36Sopenharmony_ci#define RISC_JUMP_INSTRUCTION_SIZE	12
3962306a36Sopenharmony_ci#define RISC_SKIP_INSTRUCTION_SIZE	4
4062306a36Sopenharmony_ci#define RISC_SYNC_INSTRUCTION_SIZE	4
4162306a36Sopenharmony_ci#define RISC_WRITECR_INSTRUCTION_SIZE	16
4262306a36Sopenharmony_ci#define RISC_NOOP_INSTRUCTION_SIZE	4
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define MAX_AUDIO_DMA_BUFFER_SIZE					\
4562306a36Sopenharmony_ci	(MAX_BUFFER_PROGRAM_SIZE * NUMBER_OF_PROGRAMS +			\
4662306a36Sopenharmony_ci	 RISC_SYNC_INSTRUCTION_SIZE)
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#endif
49