162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2019 NXP 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef _FSL_EASRC_H 762306a36Sopenharmony_ci#define _FSL_EASRC_H 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <sound/asound.h> 1062306a36Sopenharmony_ci#include <linux/dma/imx-dma.h> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include "fsl_asrc_common.h" 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci/* EASRC Register Map */ 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* ASRC Input Write FIFO */ 1762306a36Sopenharmony_ci#define REG_EASRC_WRFIFO(ctx) (0x000 + 4 * (ctx)) 1862306a36Sopenharmony_ci/* ASRC Output Read FIFO */ 1962306a36Sopenharmony_ci#define REG_EASRC_RDFIFO(ctx) (0x010 + 4 * (ctx)) 2062306a36Sopenharmony_ci/* ASRC Context Control */ 2162306a36Sopenharmony_ci#define REG_EASRC_CC(ctx) (0x020 + 4 * (ctx)) 2262306a36Sopenharmony_ci/* ASRC Context Control Extended 1 */ 2362306a36Sopenharmony_ci#define REG_EASRC_CCE1(ctx) (0x030 + 4 * (ctx)) 2462306a36Sopenharmony_ci/* ASRC Context Control Extended 2 */ 2562306a36Sopenharmony_ci#define REG_EASRC_CCE2(ctx) (0x040 + 4 * (ctx)) 2662306a36Sopenharmony_ci/* ASRC Control Input Access */ 2762306a36Sopenharmony_ci#define REG_EASRC_CIA(ctx) (0x050 + 4 * (ctx)) 2862306a36Sopenharmony_ci/* ASRC Datapath Processor Control Slot0 */ 2962306a36Sopenharmony_ci#define REG_EASRC_DPCS0R0(ctx) (0x060 + 4 * (ctx)) 3062306a36Sopenharmony_ci#define REG_EASRC_DPCS0R1(ctx) (0x070 + 4 * (ctx)) 3162306a36Sopenharmony_ci#define REG_EASRC_DPCS0R2(ctx) (0x080 + 4 * (ctx)) 3262306a36Sopenharmony_ci#define REG_EASRC_DPCS0R3(ctx) (0x090 + 4 * (ctx)) 3362306a36Sopenharmony_ci/* ASRC Datapath Processor Control Slot1 */ 3462306a36Sopenharmony_ci#define REG_EASRC_DPCS1R0(ctx) (0x0A0 + 4 * (ctx)) 3562306a36Sopenharmony_ci#define REG_EASRC_DPCS1R1(ctx) (0x0B0 + 4 * (ctx)) 3662306a36Sopenharmony_ci#define REG_EASRC_DPCS1R2(ctx) (0x0C0 + 4 * (ctx)) 3762306a36Sopenharmony_ci#define REG_EASRC_DPCS1R3(ctx) (0x0D0 + 4 * (ctx)) 3862306a36Sopenharmony_ci/* ASRC Context Output Control */ 3962306a36Sopenharmony_ci#define REG_EASRC_COC(ctx) (0x0E0 + 4 * (ctx)) 4062306a36Sopenharmony_ci/* ASRC Control Output Access */ 4162306a36Sopenharmony_ci#define REG_EASRC_COA(ctx) (0x0F0 + 4 * (ctx)) 4262306a36Sopenharmony_ci/* ASRC Sample FIFO Status */ 4362306a36Sopenharmony_ci#define REG_EASRC_SFS(ctx) (0x100 + 4 * (ctx)) 4462306a36Sopenharmony_ci/* ASRC Resampling Ratio Low */ 4562306a36Sopenharmony_ci#define REG_EASRC_RRL(ctx) (0x110 + 8 * (ctx)) 4662306a36Sopenharmony_ci/* ASRC Resampling Ratio High */ 4762306a36Sopenharmony_ci#define REG_EASRC_RRH(ctx) (0x114 + 8 * (ctx)) 4862306a36Sopenharmony_ci/* ASRC Resampling Ratio Update Control */ 4962306a36Sopenharmony_ci#define REG_EASRC_RUC(ctx) (0x130 + 4 * (ctx)) 5062306a36Sopenharmony_ci/* ASRC Resampling Ratio Update Rate */ 5162306a36Sopenharmony_ci#define REG_EASRC_RUR(ctx) (0x140 + 4 * (ctx)) 5262306a36Sopenharmony_ci/* ASRC Resampling Center Tap Coefficient Low */ 5362306a36Sopenharmony_ci#define REG_EASRC_RCTCL (0x150) 5462306a36Sopenharmony_ci/* ASRC Resampling Center Tap Coefficient High */ 5562306a36Sopenharmony_ci#define REG_EASRC_RCTCH (0x154) 5662306a36Sopenharmony_ci/* ASRC Prefilter Coefficient FIFO */ 5762306a36Sopenharmony_ci#define REG_EASRC_PCF(ctx) (0x160 + 4 * (ctx)) 5862306a36Sopenharmony_ci/* ASRC Context Resampling Coefficient Memory */ 5962306a36Sopenharmony_ci#define REG_EASRC_CRCM 0x170 6062306a36Sopenharmony_ci/* ASRC Context Resampling Coefficient Control*/ 6162306a36Sopenharmony_ci#define REG_EASRC_CRCC 0x174 6262306a36Sopenharmony_ci/* ASRC Interrupt Control */ 6362306a36Sopenharmony_ci#define REG_EASRC_IRQC 0x178 6462306a36Sopenharmony_ci/* ASRC Interrupt Status Flags */ 6562306a36Sopenharmony_ci#define REG_EASRC_IRQF 0x17C 6662306a36Sopenharmony_ci/* ASRC Channel Status 0 */ 6762306a36Sopenharmony_ci#define REG_EASRC_CS0(ctx) (0x180 + 4 * (ctx)) 6862306a36Sopenharmony_ci/* ASRC Channel Status 1 */ 6962306a36Sopenharmony_ci#define REG_EASRC_CS1(ctx) (0x190 + 4 * (ctx)) 7062306a36Sopenharmony_ci/* ASRC Channel Status 2 */ 7162306a36Sopenharmony_ci#define REG_EASRC_CS2(ctx) (0x1A0 + 4 * (ctx)) 7262306a36Sopenharmony_ci/* ASRC Channel Status 3 */ 7362306a36Sopenharmony_ci#define REG_EASRC_CS3(ctx) (0x1B0 + 4 * (ctx)) 7462306a36Sopenharmony_ci/* ASRC Channel Status 4 */ 7562306a36Sopenharmony_ci#define REG_EASRC_CS4(ctx) (0x1C0 + 4 * (ctx)) 7662306a36Sopenharmony_ci/* ASRC Channel Status 5 */ 7762306a36Sopenharmony_ci#define REG_EASRC_CS5(ctx) (0x1D0 + 4 * (ctx)) 7862306a36Sopenharmony_ci/* ASRC Debug Control Register */ 7962306a36Sopenharmony_ci#define REG_EASRC_DBGC 0x1E0 8062306a36Sopenharmony_ci/* ASRC Debug Status Register */ 8162306a36Sopenharmony_ci#define REG_EASRC_DBGS 0x1E4 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci#define REG_EASRC_FIFO(x, ctx) (x == IN ? REG_EASRC_WRFIFO(ctx) \ 8462306a36Sopenharmony_ci : REG_EASRC_RDFIFO(ctx)) 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci/* ASRC Context Control (CC) */ 8762306a36Sopenharmony_ci#define EASRC_CC_EN_SHIFT 31 8862306a36Sopenharmony_ci#define EASRC_CC_EN_MASK BIT(EASRC_CC_EN_SHIFT) 8962306a36Sopenharmony_ci#define EASRC_CC_EN BIT(EASRC_CC_EN_SHIFT) 9062306a36Sopenharmony_ci#define EASRC_CC_STOP_SHIFT 29 9162306a36Sopenharmony_ci#define EASRC_CC_STOP_MASK BIT(EASRC_CC_STOP_SHIFT) 9262306a36Sopenharmony_ci#define EASRC_CC_STOP BIT(EASRC_CC_STOP_SHIFT) 9362306a36Sopenharmony_ci#define EASRC_CC_FWMDE_SHIFT 28 9462306a36Sopenharmony_ci#define EASRC_CC_FWMDE_MASK BIT(EASRC_CC_FWMDE_SHIFT) 9562306a36Sopenharmony_ci#define EASRC_CC_FWMDE BIT(EASRC_CC_FWMDE_SHIFT) 9662306a36Sopenharmony_ci#define EASRC_CC_FIFO_WTMK_SHIFT 16 9762306a36Sopenharmony_ci#define EASRC_CC_FIFO_WTMK_WIDTH 7 9862306a36Sopenharmony_ci#define EASRC_CC_FIFO_WTMK_MASK ((BIT(EASRC_CC_FIFO_WTMK_WIDTH) - 1) \ 9962306a36Sopenharmony_ci << EASRC_CC_FIFO_WTMK_SHIFT) 10062306a36Sopenharmony_ci#define EASRC_CC_FIFO_WTMK(v) (((v) << EASRC_CC_FIFO_WTMK_SHIFT) \ 10162306a36Sopenharmony_ci & EASRC_CC_FIFO_WTMK_MASK) 10262306a36Sopenharmony_ci#define EASRC_CC_SAMPLE_POS_SHIFT 11 10362306a36Sopenharmony_ci#define EASRC_CC_SAMPLE_POS_WIDTH 5 10462306a36Sopenharmony_ci#define EASRC_CC_SAMPLE_POS_MASK ((BIT(EASRC_CC_SAMPLE_POS_WIDTH) - 1) \ 10562306a36Sopenharmony_ci << EASRC_CC_SAMPLE_POS_SHIFT) 10662306a36Sopenharmony_ci#define EASRC_CC_SAMPLE_POS(v) (((v) << EASRC_CC_SAMPLE_POS_SHIFT) \ 10762306a36Sopenharmony_ci & EASRC_CC_SAMPLE_POS_MASK) 10862306a36Sopenharmony_ci#define EASRC_CC_ENDIANNESS_SHIFT 10 10962306a36Sopenharmony_ci#define EASRC_CC_ENDIANNESS_MASK BIT(EASRC_CC_ENDIANNESS_SHIFT) 11062306a36Sopenharmony_ci#define EASRC_CC_ENDIANNESS BIT(EASRC_CC_ENDIANNESS_SHIFT) 11162306a36Sopenharmony_ci#define EASRC_CC_BPS_SHIFT 8 11262306a36Sopenharmony_ci#define EASRC_CC_BPS_WIDTH 2 11362306a36Sopenharmony_ci#define EASRC_CC_BPS_MASK ((BIT(EASRC_CC_BPS_WIDTH) - 1) \ 11462306a36Sopenharmony_ci << EASRC_CC_BPS_SHIFT) 11562306a36Sopenharmony_ci#define EASRC_CC_BPS(v) (((v) << EASRC_CC_BPS_SHIFT) \ 11662306a36Sopenharmony_ci & EASRC_CC_BPS_MASK) 11762306a36Sopenharmony_ci#define EASRC_CC_FMT_SHIFT 7 11862306a36Sopenharmony_ci#define EASRC_CC_FMT_MASK BIT(EASRC_CC_FMT_SHIFT) 11962306a36Sopenharmony_ci#define EASRC_CC_FMT BIT(EASRC_CC_FMT_SHIFT) 12062306a36Sopenharmony_ci#define EASRC_CC_INSIGN_SHIFT 6 12162306a36Sopenharmony_ci#define EASRC_CC_INSIGN_MASK BIT(EASRC_CC_INSIGN_SHIFT) 12262306a36Sopenharmony_ci#define EASRC_CC_INSIGN BIT(EASRC_CC_INSIGN_SHIFT) 12362306a36Sopenharmony_ci#define EASRC_CC_CHEN_SHIFT 0 12462306a36Sopenharmony_ci#define EASRC_CC_CHEN_WIDTH 5 12562306a36Sopenharmony_ci#define EASRC_CC_CHEN_MASK ((BIT(EASRC_CC_CHEN_WIDTH) - 1) \ 12662306a36Sopenharmony_ci << EASRC_CC_CHEN_SHIFT) 12762306a36Sopenharmony_ci#define EASRC_CC_CHEN(v) (((v) << EASRC_CC_CHEN_SHIFT) \ 12862306a36Sopenharmony_ci & EASRC_CC_CHEN_MASK) 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci/* ASRC Context Control Extended 1 (CCE1) */ 13162306a36Sopenharmony_ci#define EASRC_CCE1_COEF_WS_SHIFT 25 13262306a36Sopenharmony_ci#define EASRC_CCE1_COEF_WS_MASK BIT(EASRC_CCE1_COEF_WS_SHIFT) 13362306a36Sopenharmony_ci#define EASRC_CCE1_COEF_WS BIT(EASRC_CCE1_COEF_WS_SHIFT) 13462306a36Sopenharmony_ci#define EASRC_CCE1_COEF_MEM_RST_SHIFT 24 13562306a36Sopenharmony_ci#define EASRC_CCE1_COEF_MEM_RST_MASK BIT(EASRC_CCE1_COEF_MEM_RST_SHIFT) 13662306a36Sopenharmony_ci#define EASRC_CCE1_COEF_MEM_RST BIT(EASRC_CCE1_COEF_MEM_RST_SHIFT) 13762306a36Sopenharmony_ci#define EASRC_CCE1_PF_EXP_SHIFT 16 13862306a36Sopenharmony_ci#define EASRC_CCE1_PF_EXP_WIDTH 8 13962306a36Sopenharmony_ci#define EASRC_CCE1_PF_EXP_MASK ((BIT(EASRC_CCE1_PF_EXP_WIDTH) - 1) \ 14062306a36Sopenharmony_ci << EASRC_CCE1_PF_EXP_SHIFT) 14162306a36Sopenharmony_ci#define EASRC_CCE1_PF_EXP(v) (((v) << EASRC_CCE1_PF_EXP_SHIFT) \ 14262306a36Sopenharmony_ci & EASRC_CCE1_PF_EXP_MASK) 14362306a36Sopenharmony_ci#define EASRC_CCE1_PF_ST1_WBFP_SHIFT 9 14462306a36Sopenharmony_ci#define EASRC_CCE1_PF_ST1_WBFP_MASK BIT(EASRC_CCE1_PF_ST1_WBFP_SHIFT) 14562306a36Sopenharmony_ci#define EASRC_CCE1_PF_ST1_WBFP BIT(EASRC_CCE1_PF_ST1_WBFP_SHIFT) 14662306a36Sopenharmony_ci#define EASRC_CCE1_PF_TSEN_SHIFT 8 14762306a36Sopenharmony_ci#define EASRC_CCE1_PF_TSEN_MASK BIT(EASRC_CCE1_PF_TSEN_SHIFT) 14862306a36Sopenharmony_ci#define EASRC_CCE1_PF_TSEN BIT(EASRC_CCE1_PF_TSEN_SHIFT) 14962306a36Sopenharmony_ci#define EASRC_CCE1_RS_BYPASS_SHIFT 7 15062306a36Sopenharmony_ci#define EASRC_CCE1_RS_BYPASS_MASK BIT(EASRC_CCE1_RS_BYPASS_SHIFT) 15162306a36Sopenharmony_ci#define EASRC_CCE1_RS_BYPASS BIT(EASRC_CCE1_RS_BYPASS_SHIFT) 15262306a36Sopenharmony_ci#define EASRC_CCE1_PF_BYPASS_SHIFT 6 15362306a36Sopenharmony_ci#define EASRC_CCE1_PF_BYPASS_MASK BIT(EASRC_CCE1_PF_BYPASS_SHIFT) 15462306a36Sopenharmony_ci#define EASRC_CCE1_PF_BYPASS BIT(EASRC_CCE1_PF_BYPASS_SHIFT) 15562306a36Sopenharmony_ci#define EASRC_CCE1_RS_STOP_SHIFT 5 15662306a36Sopenharmony_ci#define EASRC_CCE1_RS_STOP_MASK BIT(EASRC_CCE1_RS_STOP_SHIFT) 15762306a36Sopenharmony_ci#define EASRC_CCE1_RS_STOP BIT(EASRC_CCE1_RS_STOP_SHIFT) 15862306a36Sopenharmony_ci#define EASRC_CCE1_PF_STOP_SHIFT 4 15962306a36Sopenharmony_ci#define EASRC_CCE1_PF_STOP_MASK BIT(EASRC_CCE1_PF_STOP_SHIFT) 16062306a36Sopenharmony_ci#define EASRC_CCE1_PF_STOP BIT(EASRC_CCE1_PF_STOP_SHIFT) 16162306a36Sopenharmony_ci#define EASRC_CCE1_RS_INIT_SHIFT 2 16262306a36Sopenharmony_ci#define EASRC_CCE1_RS_INIT_WIDTH 2 16362306a36Sopenharmony_ci#define EASRC_CCE1_RS_INIT_MASK ((BIT(EASRC_CCE1_RS_INIT_WIDTH) - 1) \ 16462306a36Sopenharmony_ci << EASRC_CCE1_RS_INIT_SHIFT) 16562306a36Sopenharmony_ci#define EASRC_CCE1_RS_INIT(v) (((v) << EASRC_CCE1_RS_INIT_SHIFT) \ 16662306a36Sopenharmony_ci & EASRC_CCE1_RS_INIT_MASK) 16762306a36Sopenharmony_ci#define EASRC_CCE1_PF_INIT_SHIFT 0 16862306a36Sopenharmony_ci#define EASRC_CCE1_PF_INIT_WIDTH 2 16962306a36Sopenharmony_ci#define EASRC_CCE1_PF_INIT_MASK ((BIT(EASRC_CCE1_PF_INIT_WIDTH) - 1) \ 17062306a36Sopenharmony_ci << EASRC_CCE1_PF_INIT_SHIFT) 17162306a36Sopenharmony_ci#define EASRC_CCE1_PF_INIT(v) (((v) << EASRC_CCE1_PF_INIT_SHIFT) \ 17262306a36Sopenharmony_ci & EASRC_CCE1_PF_INIT_MASK) 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci/* ASRC Context Control Extended 2 (CCE2) */ 17562306a36Sopenharmony_ci#define EASRC_CCE2_ST2_TAPS_SHIFT 16 17662306a36Sopenharmony_ci#define EASRC_CCE2_ST2_TAPS_WIDTH 9 17762306a36Sopenharmony_ci#define EASRC_CCE2_ST2_TAPS_MASK ((BIT(EASRC_CCE2_ST2_TAPS_WIDTH) - 1) \ 17862306a36Sopenharmony_ci << EASRC_CCE2_ST2_TAPS_SHIFT) 17962306a36Sopenharmony_ci#define EASRC_CCE2_ST2_TAPS(v) (((v) << EASRC_CCE2_ST2_TAPS_SHIFT) \ 18062306a36Sopenharmony_ci & EASRC_CCE2_ST2_TAPS_MASK) 18162306a36Sopenharmony_ci#define EASRC_CCE2_ST1_TAPS_SHIFT 0 18262306a36Sopenharmony_ci#define EASRC_CCE2_ST1_TAPS_WIDTH 9 18362306a36Sopenharmony_ci#define EASRC_CCE2_ST1_TAPS_MASK ((BIT(EASRC_CCE2_ST1_TAPS_WIDTH) - 1) \ 18462306a36Sopenharmony_ci << EASRC_CCE2_ST1_TAPS_SHIFT) 18562306a36Sopenharmony_ci#define EASRC_CCE2_ST1_TAPS(v) (((v) << EASRC_CCE2_ST1_TAPS_SHIFT) \ 18662306a36Sopenharmony_ci & EASRC_CCE2_ST1_TAPS_MASK) 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci/* ASRC Control Input Access (CIA) */ 18962306a36Sopenharmony_ci#define EASRC_CIA_ITER_SHIFT 16 19062306a36Sopenharmony_ci#define EASRC_CIA_ITER_WIDTH 6 19162306a36Sopenharmony_ci#define EASRC_CIA_ITER_MASK ((BIT(EASRC_CIA_ITER_WIDTH) - 1) \ 19262306a36Sopenharmony_ci << EASRC_CIA_ITER_SHIFT) 19362306a36Sopenharmony_ci#define EASRC_CIA_ITER(v) (((v) << EASRC_CIA_ITER_SHIFT) \ 19462306a36Sopenharmony_ci & EASRC_CIA_ITER_MASK) 19562306a36Sopenharmony_ci#define EASRC_CIA_GRLEN_SHIFT 8 19662306a36Sopenharmony_ci#define EASRC_CIA_GRLEN_WIDTH 6 19762306a36Sopenharmony_ci#define EASRC_CIA_GRLEN_MASK ((BIT(EASRC_CIA_GRLEN_WIDTH) - 1) \ 19862306a36Sopenharmony_ci << EASRC_CIA_GRLEN_SHIFT) 19962306a36Sopenharmony_ci#define EASRC_CIA_GRLEN(v) (((v) << EASRC_CIA_GRLEN_SHIFT) \ 20062306a36Sopenharmony_ci & EASRC_CIA_GRLEN_MASK) 20162306a36Sopenharmony_ci#define EASRC_CIA_ACCLEN_SHIFT 0 20262306a36Sopenharmony_ci#define EASRC_CIA_ACCLEN_WIDTH 6 20362306a36Sopenharmony_ci#define EASRC_CIA_ACCLEN_MASK ((BIT(EASRC_CIA_ACCLEN_WIDTH) - 1) \ 20462306a36Sopenharmony_ci << EASRC_CIA_ACCLEN_SHIFT) 20562306a36Sopenharmony_ci#define EASRC_CIA_ACCLEN(v) (((v) << EASRC_CIA_ACCLEN_SHIFT) \ 20662306a36Sopenharmony_ci & EASRC_CIA_ACCLEN_MASK) 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_ci/* ASRC Datapath Processor Control Slot0 Register0 (DPCS0R0) */ 20962306a36Sopenharmony_ci#define EASRC_DPCS0R0_MAXCH_SHIFT 24 21062306a36Sopenharmony_ci#define EASRC_DPCS0R0_MAXCH_WIDTH 5 21162306a36Sopenharmony_ci#define EASRC_DPCS0R0_MAXCH_MASK ((BIT(EASRC_DPCS0R0_MAXCH_WIDTH) - 1) \ 21262306a36Sopenharmony_ci << EASRC_DPCS0R0_MAXCH_SHIFT) 21362306a36Sopenharmony_ci#define EASRC_DPCS0R0_MAXCH(v) (((v) << EASRC_DPCS0R0_MAXCH_SHIFT) \ 21462306a36Sopenharmony_ci & EASRC_DPCS0R0_MAXCH_MASK) 21562306a36Sopenharmony_ci#define EASRC_DPCS0R0_MINCH_SHIFT 16 21662306a36Sopenharmony_ci#define EASRC_DPCS0R0_MINCH_WIDTH 5 21762306a36Sopenharmony_ci#define EASRC_DPCS0R0_MINCH_MASK ((BIT(EASRC_DPCS0R0_MINCH_WIDTH) - 1) \ 21862306a36Sopenharmony_ci << EASRC_DPCS0R0_MINCH_SHIFT) 21962306a36Sopenharmony_ci#define EASRC_DPCS0R0_MINCH(v) (((v) << EASRC_DPCS0R0_MINCH_SHIFT) \ 22062306a36Sopenharmony_ci & EASRC_DPCS0R0_MINCH_MASK) 22162306a36Sopenharmony_ci#define EASRC_DPCS0R0_NUMCH_SHIFT 8 22262306a36Sopenharmony_ci#define EASRC_DPCS0R0_NUMCH_WIDTH 5 22362306a36Sopenharmony_ci#define EASRC_DPCS0R0_NUMCH_MASK ((BIT(EASRC_DPCS0R0_NUMCH_WIDTH) - 1) \ 22462306a36Sopenharmony_ci << EASRC_DPCS0R0_NUMCH_SHIFT) 22562306a36Sopenharmony_ci#define EASRC_DPCS0R0_NUMCH(v) (((v) << EASRC_DPCS0R0_NUMCH_SHIFT) \ 22662306a36Sopenharmony_ci & EASRC_DPCS0R0_NUMCH_MASK) 22762306a36Sopenharmony_ci#define EASRC_DPCS0R0_CTXNUM_SHIFT 1 22862306a36Sopenharmony_ci#define EASRC_DPCS0R0_CTXNUM_WIDTH 2 22962306a36Sopenharmony_ci#define EASRC_DPCS0R0_CTXNUM_MASK ((BIT(EASRC_DPCS0R0_CTXNUM_WIDTH) - 1) \ 23062306a36Sopenharmony_ci << EASRC_DPCS0R0_CTXNUM_SHIFT) 23162306a36Sopenharmony_ci#define EASRC_DPCS0R0_CTXNUM(v) (((v) << EASRC_DPCS0R0_CTXNUM_SHIFT) \ 23262306a36Sopenharmony_ci & EASRC_DPCS0R0_CTXNUM_MASK) 23362306a36Sopenharmony_ci#define EASRC_DPCS0R0_EN_SHIFT 0 23462306a36Sopenharmony_ci#define EASRC_DPCS0R0_EN_MASK BIT(EASRC_DPCS0R0_EN_SHIFT) 23562306a36Sopenharmony_ci#define EASRC_DPCS0R0_EN BIT(EASRC_DPCS0R0_EN_SHIFT) 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ci/* ASRC Datapath Processor Control Slot0 Register1 (DPCS0R1) */ 23862306a36Sopenharmony_ci#define EASRC_DPCS0R1_ST1_EXP_SHIFT 0 23962306a36Sopenharmony_ci#define EASRC_DPCS0R1_ST1_EXP_WIDTH 13 24062306a36Sopenharmony_ci#define EASRC_DPCS0R1_ST1_EXP_MASK ((BIT(EASRC_DPCS0R1_ST1_EXP_WIDTH) - 1) \ 24162306a36Sopenharmony_ci << EASRC_DPCS0R1_ST1_EXP_SHIFT) 24262306a36Sopenharmony_ci#define EASRC_DPCS0R1_ST1_EXP(v) (((v) << EASRC_DPCS0R1_ST1_EXP_SHIFT) \ 24362306a36Sopenharmony_ci & EASRC_DPCS0R1_ST1_EXP_MASK) 24462306a36Sopenharmony_ci 24562306a36Sopenharmony_ci/* ASRC Datapath Processor Control Slot0 Register2 (DPCS0R2) */ 24662306a36Sopenharmony_ci#define EASRC_DPCS0R2_ST1_MA_SHIFT 16 24762306a36Sopenharmony_ci#define EASRC_DPCS0R2_ST1_MA_WIDTH 13 24862306a36Sopenharmony_ci#define EASRC_DPCS0R2_ST1_MA_MASK ((BIT(EASRC_DPCS0R2_ST1_MA_WIDTH) - 1) \ 24962306a36Sopenharmony_ci << EASRC_DPCS0R2_ST1_MA_SHIFT) 25062306a36Sopenharmony_ci#define EASRC_DPCS0R2_ST1_MA(v) (((v) << EASRC_DPCS0R2_ST1_MA_SHIFT) \ 25162306a36Sopenharmony_ci & EASRC_DPCS0R2_ST1_MA_MASK) 25262306a36Sopenharmony_ci#define EASRC_DPCS0R2_ST1_SA_SHIFT 0 25362306a36Sopenharmony_ci#define EASRC_DPCS0R2_ST1_SA_WIDTH 13 25462306a36Sopenharmony_ci#define EASRC_DPCS0R2_ST1_SA_MASK ((BIT(EASRC_DPCS0R2_ST1_SA_WIDTH) - 1) \ 25562306a36Sopenharmony_ci << EASRC_DPCS0R2_ST1_SA_SHIFT) 25662306a36Sopenharmony_ci#define EASRC_DPCS0R2_ST1_SA(v) (((v) << EASRC_DPCS0R2_ST1_SA_SHIFT) \ 25762306a36Sopenharmony_ci & EASRC_DPCS0R2_ST1_SA_MASK) 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci/* ASRC Datapath Processor Control Slot0 Register3 (DPCS0R3) */ 26062306a36Sopenharmony_ci#define EASRC_DPCS0R3_ST2_MA_SHIFT 16 26162306a36Sopenharmony_ci#define EASRC_DPCS0R3_ST2_MA_WIDTH 13 26262306a36Sopenharmony_ci#define EASRC_DPCS0R3_ST2_MA_MASK ((BIT(EASRC_DPCS0R3_ST2_MA_WIDTH) - 1) \ 26362306a36Sopenharmony_ci << EASRC_DPCS0R3_ST2_MA_SHIFT) 26462306a36Sopenharmony_ci#define EASRC_DPCS0R3_ST2_MA(v) (((v) << EASRC_DPCS0R3_ST2_MA_SHIFT) \ 26562306a36Sopenharmony_ci & EASRC_DPCS0R3_ST2_MA_MASK) 26662306a36Sopenharmony_ci#define EASRC_DPCS0R3_ST2_SA_SHIFT 0 26762306a36Sopenharmony_ci#define EASRC_DPCS0R3_ST2_SA_WIDTH 13 26862306a36Sopenharmony_ci#define EASRC_DPCS0R3_ST2_SA_MASK ((BIT(EASRC_DPCS0R3_ST2_SA_WIDTH) - 1) \ 26962306a36Sopenharmony_ci << EASRC_DPCS0R3_ST2_SA_SHIFT) 27062306a36Sopenharmony_ci#define EASRC_DPCS0R3_ST2_SA(v) (((v) << EASRC_DPCS0R3_ST2_SA_SHIFT) \ 27162306a36Sopenharmony_ci & EASRC_DPCS0R3_ST2_SA_MASK) 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci/* ASRC Context Output Control (COC) */ 27462306a36Sopenharmony_ci#define EASRC_COC_FWMDE_SHIFT 28 27562306a36Sopenharmony_ci#define EASRC_COC_FWMDE_MASK BIT(EASRC_COC_FWMDE_SHIFT) 27662306a36Sopenharmony_ci#define EASRC_COC_FWMDE BIT(EASRC_COC_FWMDE_SHIFT) 27762306a36Sopenharmony_ci#define EASRC_COC_FIFO_WTMK_SHIFT 16 27862306a36Sopenharmony_ci#define EASRC_COC_FIFO_WTMK_WIDTH 7 27962306a36Sopenharmony_ci#define EASRC_COC_FIFO_WTMK_MASK ((BIT(EASRC_COC_FIFO_WTMK_WIDTH) - 1) \ 28062306a36Sopenharmony_ci << EASRC_COC_FIFO_WTMK_SHIFT) 28162306a36Sopenharmony_ci#define EASRC_COC_FIFO_WTMK(v) (((v) << EASRC_COC_FIFO_WTMK_SHIFT) \ 28262306a36Sopenharmony_ci & EASRC_COC_FIFO_WTMK_MASK) 28362306a36Sopenharmony_ci#define EASRC_COC_SAMPLE_POS_SHIFT 11 28462306a36Sopenharmony_ci#define EASRC_COC_SAMPLE_POS_WIDTH 5 28562306a36Sopenharmony_ci#define EASRC_COC_SAMPLE_POS_MASK ((BIT(EASRC_COC_SAMPLE_POS_WIDTH) - 1) \ 28662306a36Sopenharmony_ci << EASRC_COC_SAMPLE_POS_SHIFT) 28762306a36Sopenharmony_ci#define EASRC_COC_SAMPLE_POS(v) (((v) << EASRC_COC_SAMPLE_POS_SHIFT) \ 28862306a36Sopenharmony_ci & EASRC_COC_SAMPLE_POS_MASK) 28962306a36Sopenharmony_ci#define EASRC_COC_ENDIANNESS_SHIFT 10 29062306a36Sopenharmony_ci#define EASRC_COC_ENDIANNESS_MASK BIT(EASRC_COC_ENDIANNESS_SHIFT) 29162306a36Sopenharmony_ci#define EASRC_COC_ENDIANNESS BIT(EASRC_COC_ENDIANNESS_SHIFT) 29262306a36Sopenharmony_ci#define EASRC_COC_BPS_SHIFT 8 29362306a36Sopenharmony_ci#define EASRC_COC_BPS_WIDTH 2 29462306a36Sopenharmony_ci#define EASRC_COC_BPS_MASK ((BIT(EASRC_COC_BPS_WIDTH) - 1) \ 29562306a36Sopenharmony_ci << EASRC_COC_BPS_SHIFT) 29662306a36Sopenharmony_ci#define EASRC_COC_BPS(v) (((v) << EASRC_COC_BPS_SHIFT) \ 29762306a36Sopenharmony_ci & EASRC_COC_BPS_MASK) 29862306a36Sopenharmony_ci#define EASRC_COC_FMT_SHIFT 7 29962306a36Sopenharmony_ci#define EASRC_COC_FMT_MASK BIT(EASRC_COC_FMT_SHIFT) 30062306a36Sopenharmony_ci#define EASRC_COC_FMT BIT(EASRC_COC_FMT_SHIFT) 30162306a36Sopenharmony_ci#define EASRC_COC_OUTSIGN_SHIFT 6 30262306a36Sopenharmony_ci#define EASRC_COC_OUTSIGN_MASK BIT(EASRC_COC_OUTSIGN_SHIFT) 30362306a36Sopenharmony_ci#define EASRC_COC_OUTSIGN_OUT BIT(EASRC_COC_OUTSIGN_SHIFT) 30462306a36Sopenharmony_ci#define EASRC_COC_IEC_VDATA_SHIFT 2 30562306a36Sopenharmony_ci#define EASRC_COC_IEC_VDATA_MASK BIT(EASRC_COC_IEC_VDATA_SHIFT) 30662306a36Sopenharmony_ci#define EASRC_COC_IEC_VDATA BIT(EASRC_COC_IEC_VDATA_SHIFT) 30762306a36Sopenharmony_ci#define EASRC_COC_IEC_EN_SHIFT 1 30862306a36Sopenharmony_ci#define EASRC_COC_IEC_EN_MASK BIT(EASRC_COC_IEC_EN_SHIFT) 30962306a36Sopenharmony_ci#define EASRC_COC_IEC_EN BIT(EASRC_COC_IEC_EN_SHIFT) 31062306a36Sopenharmony_ci#define EASRC_COC_DITHER_EN_SHIFT 0 31162306a36Sopenharmony_ci#define EASRC_COC_DITHER_EN_MASK BIT(EASRC_COC_DITHER_EN_SHIFT) 31262306a36Sopenharmony_ci#define EASRC_COC_DITHER_EN BIT(EASRC_COC_DITHER_EN_SHIFT) 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_ci/* ASRC Control Output Access (COA) */ 31562306a36Sopenharmony_ci#define EASRC_COA_ITER_SHIFT 16 31662306a36Sopenharmony_ci#define EASRC_COA_ITER_WIDTH 6 31762306a36Sopenharmony_ci#define EASRC_COA_ITER_MASK ((BIT(EASRC_COA_ITER_WIDTH) - 1) \ 31862306a36Sopenharmony_ci << EASRC_COA_ITER_SHIFT) 31962306a36Sopenharmony_ci#define EASRC_COA_ITER(v) (((v) << EASRC_COA_ITER_SHIFT) \ 32062306a36Sopenharmony_ci & EASRC_COA_ITER_MASK) 32162306a36Sopenharmony_ci#define EASRC_COA_GRLEN_SHIFT 8 32262306a36Sopenharmony_ci#define EASRC_COA_GRLEN_WIDTH 6 32362306a36Sopenharmony_ci#define EASRC_COA_GRLEN_MASK ((BIT(EASRC_COA_GRLEN_WIDTH) - 1) \ 32462306a36Sopenharmony_ci << EASRC_COA_GRLEN_SHIFT) 32562306a36Sopenharmony_ci#define EASRC_COA_GRLEN(v) (((v) << EASRC_COA_GRLEN_SHIFT) \ 32662306a36Sopenharmony_ci & EASRC_COA_GRLEN_MASK) 32762306a36Sopenharmony_ci#define EASRC_COA_ACCLEN_SHIFT 0 32862306a36Sopenharmony_ci#define EASRC_COA_ACCLEN_WIDTH 6 32962306a36Sopenharmony_ci#define EASRC_COA_ACCLEN_MASK ((BIT(EASRC_COA_ACCLEN_WIDTH) - 1) \ 33062306a36Sopenharmony_ci << EASRC_COA_ACCLEN_SHIFT) 33162306a36Sopenharmony_ci#define EASRC_COA_ACCLEN(v) (((v) << EASRC_COA_ACCLEN_SHIFT) \ 33262306a36Sopenharmony_ci & EASRC_COA_ACCLEN_MASK) 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ci/* ASRC Sample FIFO Status (SFS) */ 33562306a36Sopenharmony_ci#define EASRC_SFS_IWTMK_SHIFT 23 33662306a36Sopenharmony_ci#define EASRC_SFS_IWTMK_MASK BIT(EASRC_SFS_IWTMK_SHIFT) 33762306a36Sopenharmony_ci#define EASRC_SFS_IWTMK BIT(EASRC_SFS_IWTMK_SHIFT) 33862306a36Sopenharmony_ci#define EASRC_SFS_NSGI_SHIFT 16 33962306a36Sopenharmony_ci#define EASRC_SFS_NSGI_WIDTH 7 34062306a36Sopenharmony_ci#define EASRC_SFS_NSGI_MASK ((BIT(EASRC_SFS_NSGI_WIDTH) - 1) \ 34162306a36Sopenharmony_ci << EASRC_SFS_NSGI_SHIFT) 34262306a36Sopenharmony_ci#define EASRC_SFS_NSGI(v) (((v) << EASRC_SFS_NSGI_SHIFT) \ 34362306a36Sopenharmony_ci & EASRC_SFS_NSGI_MASK) 34462306a36Sopenharmony_ci#define EASRC_SFS_OWTMK_SHIFT 7 34562306a36Sopenharmony_ci#define EASRC_SFS_OWTMK_MASK BIT(EASRC_SFS_OWTMK_SHIFT) 34662306a36Sopenharmony_ci#define EASRC_SFS_OWTMK BIT(EASRC_SFS_OWTMK_SHIFT) 34762306a36Sopenharmony_ci#define EASRC_SFS_NSGO_SHIFT 0 34862306a36Sopenharmony_ci#define EASRC_SFS_NSGO_WIDTH 7 34962306a36Sopenharmony_ci#define EASRC_SFS_NSGO_MASK ((BIT(EASRC_SFS_NSGO_WIDTH) - 1) \ 35062306a36Sopenharmony_ci << EASRC_SFS_NSGO_SHIFT) 35162306a36Sopenharmony_ci#define EASRC_SFS_NSGO(v) (((v) << EASRC_SFS_NSGO_SHIFT) \ 35262306a36Sopenharmony_ci & EASRC_SFS_NSGO_MASK) 35362306a36Sopenharmony_ci 35462306a36Sopenharmony_ci/* ASRC Resampling Ratio Low (RRL) */ 35562306a36Sopenharmony_ci#define EASRC_RRL_RS_RL_SHIFT 0 35662306a36Sopenharmony_ci#define EASRC_RRL_RS_RL_WIDTH 32 35762306a36Sopenharmony_ci#define EASRC_RRL_RS_RL(v) ((v) << EASRC_RRL_RS_RL_SHIFT) 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ci/* ASRC Resampling Ratio High (RRH) */ 36062306a36Sopenharmony_ci#define EASRC_RRH_RS_VLD_SHIFT 31 36162306a36Sopenharmony_ci#define EASRC_RRH_RS_VLD_MASK BIT(EASRC_RRH_RS_VLD_SHIFT) 36262306a36Sopenharmony_ci#define EASRC_RRH_RS_VLD BIT(EASRC_RRH_RS_VLD_SHIFT) 36362306a36Sopenharmony_ci#define EASRC_RRH_RS_RH_SHIFT 0 36462306a36Sopenharmony_ci#define EASRC_RRH_RS_RH_WIDTH 12 36562306a36Sopenharmony_ci#define EASRC_RRH_RS_RH_MASK ((BIT(EASRC_RRH_RS_RH_WIDTH) - 1) \ 36662306a36Sopenharmony_ci << EASRC_RRH_RS_RH_SHIFT) 36762306a36Sopenharmony_ci#define EASRC_RRH_RS_RH(v) (((v) << EASRC_RRH_RS_RH_SHIFT) \ 36862306a36Sopenharmony_ci & EASRC_RRH_RS_RH_MASK) 36962306a36Sopenharmony_ci 37062306a36Sopenharmony_ci/* ASRC Resampling Ratio Update Control (RSUC) */ 37162306a36Sopenharmony_ci#define EASRC_RSUC_RS_RM_SHIFT 0 37262306a36Sopenharmony_ci#define EASRC_RSUC_RS_RM_WIDTH 32 37362306a36Sopenharmony_ci#define EASRC_RSUC_RS_RM(v) ((v) << EASRC_RSUC_RS_RM_SHIFT) 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci/* ASRC Resampling Ratio Update Rate (RRUR) */ 37662306a36Sopenharmony_ci#define EASRC_RRUR_RRR_SHIFT 0 37762306a36Sopenharmony_ci#define EASRC_RRUR_RRR_WIDTH 31 37862306a36Sopenharmony_ci#define EASRC_RRUR_RRR_MASK ((BIT(EASRC_RRUR_RRR_WIDTH) - 1) \ 37962306a36Sopenharmony_ci << EASRC_RRUR_RRR_SHIFT) 38062306a36Sopenharmony_ci#define EASRC_RRUR_RRR(v) (((v) << EASRC_RRUR_RRR_SHIFT) \ 38162306a36Sopenharmony_ci & EASRC_RRUR_RRR_MASK) 38262306a36Sopenharmony_ci 38362306a36Sopenharmony_ci/* ASRC Resampling Center Tap Coefficient Low (RCTCL) */ 38462306a36Sopenharmony_ci#define EASRC_RCTCL_RS_CL_SHIFT 0 38562306a36Sopenharmony_ci#define EASRC_RCTCL_RS_CL_WIDTH 32 38662306a36Sopenharmony_ci#define EASRC_RCTCL_RS_CL(v) ((v) << EASRC_RCTCL_RS_CL_SHIFT) 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_ci/* ASRC Resampling Center Tap Coefficient High (RCTCH) */ 38962306a36Sopenharmony_ci#define EASRC_RCTCH_RS_CH_SHIFT 0 39062306a36Sopenharmony_ci#define EASRC_RCTCH_RS_CH_WIDTH 32 39162306a36Sopenharmony_ci#define EASRC_RCTCH_RS_CH(v) ((v) << EASRC_RCTCH_RS_CH_SHIFT) 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci/* ASRC Prefilter Coefficient FIFO (PCF) */ 39462306a36Sopenharmony_ci#define EASRC_PCF_CD_SHIFT 0 39562306a36Sopenharmony_ci#define EASRC_PCF_CD_WIDTH 32 39662306a36Sopenharmony_ci#define EASRC_PCF_CD(v) ((v) << EASRC_PCF_CD_SHIFT) 39762306a36Sopenharmony_ci 39862306a36Sopenharmony_ci/* ASRC Context Resampling Coefficient Memory (CRCM) */ 39962306a36Sopenharmony_ci#define EASRC_CRCM_RS_CWD_SHIFT 0 40062306a36Sopenharmony_ci#define EASRC_CRCM_RS_CWD_WIDTH 32 40162306a36Sopenharmony_ci#define EASRC_CRCM_RS_CWD(v) ((v) << EASRC_CRCM_RS_CWD_SHIFT) 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_ci/* ASRC Context Resampling Coefficient Control (CRCC) */ 40462306a36Sopenharmony_ci#define EASRC_CRCC_RS_CA_SHIFT 16 40562306a36Sopenharmony_ci#define EASRC_CRCC_RS_CA_WIDTH 11 40662306a36Sopenharmony_ci#define EASRC_CRCC_RS_CA_MASK ((BIT(EASRC_CRCC_RS_CA_WIDTH) - 1) \ 40762306a36Sopenharmony_ci << EASRC_CRCC_RS_CA_SHIFT) 40862306a36Sopenharmony_ci#define EASRC_CRCC_RS_CA(v) (((v) << EASRC_CRCC_RS_CA_SHIFT) \ 40962306a36Sopenharmony_ci & EASRC_CRCC_RS_CA_MASK) 41062306a36Sopenharmony_ci#define EASRC_CRCC_RS_TAPS_SHIFT 1 41162306a36Sopenharmony_ci#define EASRC_CRCC_RS_TAPS_WIDTH 2 41262306a36Sopenharmony_ci#define EASRC_CRCC_RS_TAPS_MASK ((BIT(EASRC_CRCC_RS_TAPS_WIDTH) - 1) \ 41362306a36Sopenharmony_ci << EASRC_CRCC_RS_TAPS_SHIFT) 41462306a36Sopenharmony_ci#define EASRC_CRCC_RS_TAPS(v) (((v) << EASRC_CRCC_RS_TAPS_SHIFT) \ 41562306a36Sopenharmony_ci & EASRC_CRCC_RS_TAPS_MASK) 41662306a36Sopenharmony_ci#define EASRC_CRCC_RS_CPR_SHIFT 0 41762306a36Sopenharmony_ci#define EASRC_CRCC_RS_CPR_MASK BIT(EASRC_CRCC_RS_CPR_SHIFT) 41862306a36Sopenharmony_ci#define EASRC_CRCC_RS_CPR BIT(EASRC_CRCC_RS_CPR_SHIFT) 41962306a36Sopenharmony_ci 42062306a36Sopenharmony_ci/* ASRC Interrupt_Control (IC) */ 42162306a36Sopenharmony_ci#define EASRC_IRQC_RSDM_SHIFT 8 42262306a36Sopenharmony_ci#define EASRC_IRQC_RSDM_WIDTH 4 42362306a36Sopenharmony_ci#define EASRC_IRQC_RSDM_MASK ((BIT(EASRC_IRQC_RSDM_WIDTH) - 1) \ 42462306a36Sopenharmony_ci << EASRC_IRQC_RSDM_SHIFT) 42562306a36Sopenharmony_ci#define EASRC_IRQC_RSDM(v) (((v) << EASRC_IRQC_RSDM_SHIFT) \ 42662306a36Sopenharmony_ci & EASRC_IRQC_RSDM_MASK) 42762306a36Sopenharmony_ci#define EASRC_IRQC_OERM_SHIFT 4 42862306a36Sopenharmony_ci#define EASRC_IRQC_OERM_WIDTH 4 42962306a36Sopenharmony_ci#define EASRC_IRQC_OERM_MASK ((BIT(EASRC_IRQC_OERM_WIDTH) - 1) \ 43062306a36Sopenharmony_ci << EASRC_IRQC_OERM_SHIFT) 43162306a36Sopenharmony_ci#define EASRC_IRQC_OERM(v) (((v) << EASRC_IRQC_OERM_SHIFT) \ 43262306a36Sopenharmony_ci & EASRC_IEQC_OERM_MASK) 43362306a36Sopenharmony_ci#define EASRC_IRQC_IOM_SHIFT 0 43462306a36Sopenharmony_ci#define EASRC_IRQC_IOM_WIDTH 4 43562306a36Sopenharmony_ci#define EASRC_IRQC_IOM_MASK ((BIT(EASRC_IRQC_IOM_WIDTH) - 1) \ 43662306a36Sopenharmony_ci << EASRC_IRQC_IOM_SHIFT) 43762306a36Sopenharmony_ci#define EASRC_IRQC_IOM(v) (((v) << EASRC_IRQC_IOM_SHIFT) \ 43862306a36Sopenharmony_ci & EASRC_IRQC_IOM_MASK) 43962306a36Sopenharmony_ci 44062306a36Sopenharmony_ci/* ASRC Interrupt Status Flags (ISF) */ 44162306a36Sopenharmony_ci#define EASRC_IRQF_RSD_SHIFT 8 44262306a36Sopenharmony_ci#define EASRC_IRQF_RSD_WIDTH 4 44362306a36Sopenharmony_ci#define EASRC_IRQF_RSD_MASK ((BIT(EASRC_IRQF_RSD_WIDTH) - 1) \ 44462306a36Sopenharmony_ci << EASRC_IRQF_RSD_SHIFT) 44562306a36Sopenharmony_ci#define EASRC_IRQF_RSD(v) (((v) << EASRC_IRQF_RSD_SHIFT) \ 44662306a36Sopenharmony_ci & EASRC_IRQF_RSD_MASK) 44762306a36Sopenharmony_ci#define EASRC_IRQF_OER_SHIFT 4 44862306a36Sopenharmony_ci#define EASRC_IRQF_OER_WIDTH 4 44962306a36Sopenharmony_ci#define EASRC_IRQF_OER_MASK ((BIT(EASRC_IRQF_OER_WIDTH) - 1) \ 45062306a36Sopenharmony_ci << EASRC_IRQF_OER_SHIFT) 45162306a36Sopenharmony_ci#define EASRC_IRQF_OER(v) (((v) << EASRC_IRQF_OER_SHIFT) \ 45262306a36Sopenharmony_ci & EASRC_IRQF_OER_MASK) 45362306a36Sopenharmony_ci#define EASRC_IRQF_IFO_SHIFT 0 45462306a36Sopenharmony_ci#define EASRC_IRQF_IFO_WIDTH 4 45562306a36Sopenharmony_ci#define EASRC_IRQF_IFO_MASK ((BIT(EASRC_IRQF_IFO_WIDTH) - 1) \ 45662306a36Sopenharmony_ci << EASRC_IRQF_IFO_SHIFT) 45762306a36Sopenharmony_ci#define EASRC_IRQF_IFO(v) (((v) << EASRC_IRQF_IFO_SHIFT) \ 45862306a36Sopenharmony_ci & EASRC_IRQF_IFO_MASK) 45962306a36Sopenharmony_ci 46062306a36Sopenharmony_ci/* ASRC Context Channel STAT */ 46162306a36Sopenharmony_ci#define EASRC_CSx_CSx_SHIFT 0 46262306a36Sopenharmony_ci#define EASRC_CSx_CSx_WIDTH 32 46362306a36Sopenharmony_ci#define EASRC_CSx_CSx(v) ((v) << EASRC_CSx_CSx_SHIFT) 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_ci/* ASRC Debug Control Register */ 46662306a36Sopenharmony_ci#define EASRC_DBGC_DMS_SHIFT 0 46762306a36Sopenharmony_ci#define EASRC_DBGC_DMS_WIDTH 6 46862306a36Sopenharmony_ci#define EASRC_DBGC_DMS_MASK ((BIT(EASRC_DBGC_DMS_WIDTH) - 1) \ 46962306a36Sopenharmony_ci << EASRC_DBGC_DMS_SHIFT) 47062306a36Sopenharmony_ci#define EASRC_DBGC_DMS(v) (((v) << EASRC_DBGC_DMS_SHIFT) \ 47162306a36Sopenharmony_ci & EASRC_DBGC_DMS_MASK) 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci/* ASRC Debug Status Register */ 47462306a36Sopenharmony_ci#define EASRC_DBGS_DS_SHIFT 0 47562306a36Sopenharmony_ci#define EASRC_DBGS_DS_WIDTH 32 47662306a36Sopenharmony_ci#define EASRC_DBGS_DS(v) ((v) << EASRC_DBGS_DS_SHIFT) 47762306a36Sopenharmony_ci 47862306a36Sopenharmony_ci/* General Constants */ 47962306a36Sopenharmony_ci#define EASRC_CTX_MAX_NUM 4 48062306a36Sopenharmony_ci#define EASRC_RS_COEFF_MEM 0 48162306a36Sopenharmony_ci#define EASRC_PF_COEFF_MEM 1 48262306a36Sopenharmony_ci 48362306a36Sopenharmony_ci/* Prefilter constants */ 48462306a36Sopenharmony_ci#define EASRC_PF_ST1_ONLY 0 48562306a36Sopenharmony_ci#define EASRC_PF_TWO_STAGE_MODE 1 48662306a36Sopenharmony_ci#define EASRC_PF_ST1_COEFF_WR 0 48762306a36Sopenharmony_ci#define EASRC_PF_ST2_COEFF_WR 1 48862306a36Sopenharmony_ci#define EASRC_MAX_PF_TAPS 384 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_ci/* Resampling constants */ 49162306a36Sopenharmony_ci#define EASRC_RS_32_TAPS 0 49262306a36Sopenharmony_ci#define EASRC_RS_64_TAPS 1 49362306a36Sopenharmony_ci#define EASRC_RS_128_TAPS 2 49462306a36Sopenharmony_ci 49562306a36Sopenharmony_ci/* Initialization mode */ 49662306a36Sopenharmony_ci#define EASRC_INIT_MODE_SW_CONTROL 0 49762306a36Sopenharmony_ci#define EASRC_INIT_MODE_REPLICATE 1 49862306a36Sopenharmony_ci#define EASRC_INIT_MODE_ZERO_FILL 2 49962306a36Sopenharmony_ci 50062306a36Sopenharmony_ci/* FIFO watermarks */ 50162306a36Sopenharmony_ci#define FSL_EASRC_INPUTFIFO_WML 0x4 50262306a36Sopenharmony_ci#define FSL_EASRC_OUTPUTFIFO_WML 0x1 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_ci#define EASRC_INPUTFIFO_THRESHOLD_MIN 0 50562306a36Sopenharmony_ci#define EASRC_INPUTFIFO_THRESHOLD_MAX 127 50662306a36Sopenharmony_ci#define EASRC_OUTPUTFIFO_THRESHOLD_MIN 0 50762306a36Sopenharmony_ci#define EASRC_OUTPUTFIFO_THRESHOLD_MAX 63 50862306a36Sopenharmony_ci 50962306a36Sopenharmony_ci#define EASRC_DMA_BUFFER_SIZE (1024 * 48 * 9) 51062306a36Sopenharmony_ci#define EASRC_MAX_BUFFER_SIZE (1024 * 48) 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci#define FIRMWARE_MAGIC 0xDEAD 51362306a36Sopenharmony_ci#define FIRMWARE_VERSION 1 51462306a36Sopenharmony_ci 51562306a36Sopenharmony_ci#define PREFILTER_MEM_LEN 0x1800 51662306a36Sopenharmony_ci 51762306a36Sopenharmony_cienum easrc_word_width { 51862306a36Sopenharmony_ci EASRC_WIDTH_16_BIT = 0, 51962306a36Sopenharmony_ci EASRC_WIDTH_20_BIT = 1, 52062306a36Sopenharmony_ci EASRC_WIDTH_24_BIT = 2, 52162306a36Sopenharmony_ci EASRC_WIDTH_32_BIT = 3, 52262306a36Sopenharmony_ci}; 52362306a36Sopenharmony_ci 52462306a36Sopenharmony_cistruct __attribute__((__packed__)) asrc_firmware_hdr { 52562306a36Sopenharmony_ci u32 magic; 52662306a36Sopenharmony_ci u32 interp_scen; 52762306a36Sopenharmony_ci u32 prefil_scen; 52862306a36Sopenharmony_ci u32 firmware_version; 52962306a36Sopenharmony_ci}; 53062306a36Sopenharmony_ci 53162306a36Sopenharmony_cistruct __attribute__((__packed__)) interp_params { 53262306a36Sopenharmony_ci u32 magic; 53362306a36Sopenharmony_ci u32 num_taps; 53462306a36Sopenharmony_ci u32 num_phases; 53562306a36Sopenharmony_ci u64 center_tap; 53662306a36Sopenharmony_ci u64 coeff[8192]; 53762306a36Sopenharmony_ci}; 53862306a36Sopenharmony_ci 53962306a36Sopenharmony_cistruct __attribute__((__packed__)) prefil_params { 54062306a36Sopenharmony_ci u32 magic; 54162306a36Sopenharmony_ci u32 insr; 54262306a36Sopenharmony_ci u32 outsr; 54362306a36Sopenharmony_ci u32 st1_taps; 54462306a36Sopenharmony_ci u32 st2_taps; 54562306a36Sopenharmony_ci u32 st1_exp; 54662306a36Sopenharmony_ci u64 coeff[256]; 54762306a36Sopenharmony_ci}; 54862306a36Sopenharmony_ci 54962306a36Sopenharmony_cistruct dma_block { 55062306a36Sopenharmony_ci void *dma_vaddr; 55162306a36Sopenharmony_ci unsigned int length; 55262306a36Sopenharmony_ci unsigned int max_buf_size; 55362306a36Sopenharmony_ci}; 55462306a36Sopenharmony_ci 55562306a36Sopenharmony_cistruct fsl_easrc_data_fmt { 55662306a36Sopenharmony_ci unsigned int width : 2; 55762306a36Sopenharmony_ci unsigned int endianness : 1; 55862306a36Sopenharmony_ci unsigned int unsign : 1; 55962306a36Sopenharmony_ci unsigned int floating_point : 1; 56062306a36Sopenharmony_ci unsigned int iec958: 1; 56162306a36Sopenharmony_ci unsigned int sample_pos: 5; 56262306a36Sopenharmony_ci unsigned int addexp; 56362306a36Sopenharmony_ci}; 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_cistruct fsl_easrc_io_params { 56662306a36Sopenharmony_ci struct fsl_easrc_data_fmt fmt; 56762306a36Sopenharmony_ci unsigned int group_len; 56862306a36Sopenharmony_ci unsigned int iterations; 56962306a36Sopenharmony_ci unsigned int access_len; 57062306a36Sopenharmony_ci unsigned int fifo_wtmk; 57162306a36Sopenharmony_ci unsigned int sample_rate; 57262306a36Sopenharmony_ci snd_pcm_format_t sample_format; 57362306a36Sopenharmony_ci unsigned int norm_rate; 57462306a36Sopenharmony_ci}; 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_cistruct fsl_easrc_slot { 57762306a36Sopenharmony_ci bool busy; 57862306a36Sopenharmony_ci int ctx_index; 57962306a36Sopenharmony_ci int slot_index; 58062306a36Sopenharmony_ci int num_channel; /* maximum is 8 */ 58162306a36Sopenharmony_ci int min_channel; 58262306a36Sopenharmony_ci int max_channel; 58362306a36Sopenharmony_ci int pf_mem_used; 58462306a36Sopenharmony_ci}; 58562306a36Sopenharmony_ci 58662306a36Sopenharmony_ci/** 58762306a36Sopenharmony_ci * fsl_easrc_ctx_priv: EASRC context private data 58862306a36Sopenharmony_ci * 58962306a36Sopenharmony_ci * @in_params: input parameter 59062306a36Sopenharmony_ci * @out_params: output parameter 59162306a36Sopenharmony_ci * @st1_num_taps: tap number of stage 1 59262306a36Sopenharmony_ci * @st2_num_taps: tap number of stage 2 59362306a36Sopenharmony_ci * @st1_num_exp: exponent number of stage 1 59462306a36Sopenharmony_ci * @pf_init_mode: prefilter init mode 59562306a36Sopenharmony_ci * @rs_init_mode: resample filter init mode 59662306a36Sopenharmony_ci * @ctx_streams: stream flag of ctx 59762306a36Sopenharmony_ci * @rs_ratio: resampler ratio 59862306a36Sopenharmony_ci * @st1_coeff: pointer of stage 1 coeff 59962306a36Sopenharmony_ci * @st2_coeff: pointer of stage 2 coeff 60062306a36Sopenharmony_ci * @in_filled_sample: input filled sample 60162306a36Sopenharmony_ci * @out_missed_sample: sample missed in output 60262306a36Sopenharmony_ci * @st1_addexp: exponent added for stage1 60362306a36Sopenharmony_ci * @st2_addexp: exponent added for stage2 60462306a36Sopenharmony_ci */ 60562306a36Sopenharmony_cistruct fsl_easrc_ctx_priv { 60662306a36Sopenharmony_ci struct fsl_easrc_io_params in_params; 60762306a36Sopenharmony_ci struct fsl_easrc_io_params out_params; 60862306a36Sopenharmony_ci unsigned int st1_num_taps; 60962306a36Sopenharmony_ci unsigned int st2_num_taps; 61062306a36Sopenharmony_ci unsigned int st1_num_exp; 61162306a36Sopenharmony_ci unsigned int pf_init_mode; 61262306a36Sopenharmony_ci unsigned int rs_init_mode; 61362306a36Sopenharmony_ci unsigned int ctx_streams; 61462306a36Sopenharmony_ci u64 rs_ratio; 61562306a36Sopenharmony_ci u64 *st1_coeff; 61662306a36Sopenharmony_ci u64 *st2_coeff; 61762306a36Sopenharmony_ci int in_filled_sample; 61862306a36Sopenharmony_ci int out_missed_sample; 61962306a36Sopenharmony_ci int st1_addexp; 62062306a36Sopenharmony_ci int st2_addexp; 62162306a36Sopenharmony_ci}; 62262306a36Sopenharmony_ci 62362306a36Sopenharmony_ci/** 62462306a36Sopenharmony_ci * fsl_easrc_priv: EASRC private data 62562306a36Sopenharmony_ci * 62662306a36Sopenharmony_ci * @slot: slot setting 62762306a36Sopenharmony_ci * @firmware_hdr: the header of firmware 62862306a36Sopenharmony_ci * @interp: pointer to interpolation filter coeff 62962306a36Sopenharmony_ci * @prefil: pointer to prefilter coeff 63062306a36Sopenharmony_ci * @fw: firmware of coeff table 63162306a36Sopenharmony_ci * @fw_name: firmware name 63262306a36Sopenharmony_ci * @rs_num_taps: resample filter taps, 32, 64, or 128 63362306a36Sopenharmony_ci * @bps_iec958: bits per sample of iec958 63462306a36Sopenharmony_ci * @rs_coeff: resampler coefficient 63562306a36Sopenharmony_ci * @const_coeff: one tap prefilter coefficient 63662306a36Sopenharmony_ci * @firmware_loaded: firmware is loaded 63762306a36Sopenharmony_ci */ 63862306a36Sopenharmony_cistruct fsl_easrc_priv { 63962306a36Sopenharmony_ci struct fsl_easrc_slot slot[EASRC_CTX_MAX_NUM][2]; 64062306a36Sopenharmony_ci struct asrc_firmware_hdr *firmware_hdr; 64162306a36Sopenharmony_ci struct interp_params *interp; 64262306a36Sopenharmony_ci struct prefil_params *prefil; 64362306a36Sopenharmony_ci const struct firmware *fw; 64462306a36Sopenharmony_ci const char *fw_name; 64562306a36Sopenharmony_ci unsigned int rs_num_taps; 64662306a36Sopenharmony_ci unsigned int bps_iec958[EASRC_CTX_MAX_NUM]; 64762306a36Sopenharmony_ci u64 *rs_coeff; 64862306a36Sopenharmony_ci u64 const_coeff; 64962306a36Sopenharmony_ci int firmware_loaded; 65062306a36Sopenharmony_ci}; 65162306a36Sopenharmony_ci#endif /* _FSL_EASRC_H */ 652