1*a2df8c2dSSameer Pujar /* SPDX-License-Identifier: GPL-2.0-only */ 2*a2df8c2dSSameer Pujar /* 3*a2df8c2dSSameer Pujar * tegra186_asrc.h - Definitions for Tegra186 ASRC driver 4*a2df8c2dSSameer Pujar * 5*a2df8c2dSSameer Pujar * Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. 6*a2df8c2dSSameer Pujar * 7*a2df8c2dSSameer Pujar */ 8*a2df8c2dSSameer Pujar 9*a2df8c2dSSameer Pujar #ifndef __TEGRA186_ASRC_H__ 10*a2df8c2dSSameer Pujar #define __TEGRA186_ASRC_H__ 11*a2df8c2dSSameer Pujar 12*a2df8c2dSSameer Pujar /* ASRC stream related offset */ 13*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_CFG 0x0 14*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RATIO_INT_PART 0x4 15*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RATIO_FRAC_PART 0x8 16*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RATIO_LOCK_STATUS 0xc 17*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_MUTE_UNMUTE_DURATION 0x10 18*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_TX_THRESHOLD 0x14 19*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RX_THRESHOLD 0x18 20*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RATIO_COMP 0x1c 21*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RX_STATUS 0x20 22*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RX_CIF_CTRL 0x24 23*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_TX_STATUS 0x2c 24*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_TX_CIF_CTRL 0x30 25*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_ENABLE 0x38 26*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_SOFT_RESET 0x3c 27*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STATUS 0x4c 28*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STATEBUF_ADDR 0x5c 29*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STATEBUF_CFG 0x60 30*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_INSAMPLEBUF_ADDR 0x64 31*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_INSAMPLEBUF_CFG 0x68 32*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_OUTSAMPLEBUF_ADDR 0x6c 33*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_OUTSAMPLEBUF_CFG 0x70 34*a2df8c2dSSameer Pujar 35*a2df8c2dSSameer Pujar /* ASRC Global registers offset */ 36*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_ENB 0x2f4 37*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_SOFT_RESET 0x2f8 38*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_CG 0x2fc 39*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_CFG 0x300 40*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_SCRATCH_ADDR 0x304 41*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_SCRATCH_CFG 0x308 42*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RATIO_UPD_RX_CIF_CTRL 0x30c 43*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RATIO_UPD_RX_STATUS 0x310 44*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_STATUS 0x314 45*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_STREAM_ENABLE_STATUS 0x318 46*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_INT_STATUS 0x324 47*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_INT_MASK 0x328 48*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_INT_SET 0x32c 49*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_INT_CLEAR 0x330 50*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_TRANSFER_ERROR_LOG 0x334 51*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_APR_CTRL 0x1000 52*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_APR_CTRL_ACCESS_CTRL 0x1004 53*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_DISARM_APR 0x1008 54*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_DISARM_APR_ACCESS_CTRL 0x100c 55*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_RATIO_WR_ACCESS 0x1010 56*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_RATIO_WR_ACCESS_CTRL 0x1014 57*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_CYA 0x1018 58*a2df8c2dSSameer Pujar 59*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_DEFAULT_HW_COMP_BIAS_VALUE 0xaaaa 60*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_DEFAULT_INPUT_HW_COMP_THRESH_CFG 0x00201002 61*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_DEFAULT_OUTPUT_HW_COMP_THRESH_CFG 0x00201002 62*a2df8c2dSSameer Pujar 63*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_CFG_FRAC_28BIT_PRECISION 0 64*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_CFG_FRAC_32BIT_PRECISION 1 65*a2df8c2dSSameer Pujar 66*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_ENABLE_HW_RATIO_COMP_SHIFT 31 67*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_ENABLE_HW_RATIO_COMP_MASK (1 << TEGRA186_ASRC_STREAM_ENABLE_HW_RATIO_COMP_SHIFT) 68*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_ENABLE_HW_RATIO_COMP_ENABLE (1 << TEGRA186_ASRC_STREAM_ENABLE_HW_RATIO_COMP_SHIFT) 69*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_ENABLE_HW_RATIO_COMP_DISABLE (0 << TEGRA186_ASRC_STREAM_ENABLE_HW_RATIO_COMP_SHIFT) 70*a2df8c2dSSameer Pujar 71*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_RATIO_TYPE_SHIFT 0 72*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_RATIO_TYPE_MASK (1 << TEGRA186_ASRC_STREAM_RATIO_TYPE_SHIFT) 73*a2df8c2dSSameer Pujar 74*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_EN_SHIFT 0 75*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_EN (1 << TEGRA186_ASRC_STREAM_EN_SHIFT) 76*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_EN_SHIFT 0 77*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_GLOBAL_EN (1 << TEGRA186_ASRC_GLOBAL_EN_SHIFT) 78*a2df8c2dSSameer Pujar 79*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_STATEBUF_CFG_SIZE_SHIFT 0 80*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_STATEBUF_CFG_SIZE_MASK (0xffff << TEGRA186_ASRC_STREAM_STATEBUF_CFG_SIZE_SHIFT) 81*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_INSAMPLEBUF_CFG_SIZE_SHIFT 0 82*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_INSAMPLEBUF_CFG_SIZE_MASK (0xffff << TEGRA186_ASRC_STREAM_INSAMPLEBUF_CFG_SIZE_SHIFT) 83*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_OUTSAMPLEBUF_CFG_SIZE_SHIFT 0 84*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_OUTSAMPLEBUF_CFG_SIZE_MASK (0xffff << TEGRA186_ASRC_STREAM_OUTSAMPLEBUF_CFG_SIZE_SHIFT) 85*a2df8c2dSSameer Pujar 86*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_RATIO_INT_PART_MASK 0x1f 87*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_RATIO_FRAC_PART_MASK 0xffffffff 88*a2df8c2dSSameer Pujar 89*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_STRIDE 0x80 90*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_MAX 0x6 91*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_STREAM_LIMIT 0x2f0 92*a2df8c2dSSameer Pujar 93*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RATIO_SOURCE_ARAD 0x0 94*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_RATIO_SOURCE_SW 0x1 95*a2df8c2dSSameer Pujar 96*a2df8c2dSSameer Pujar #define TEGRA186_ASRC_ARAM_START_ADDR 0x3f800000 97*a2df8c2dSSameer Pujar 98*a2df8c2dSSameer Pujar struct tegra186_asrc_lane { 99*a2df8c2dSSameer Pujar unsigned int int_part; 100*a2df8c2dSSameer Pujar unsigned int frac_part; 101*a2df8c2dSSameer Pujar unsigned int ratio_source; 102*a2df8c2dSSameer Pujar unsigned int hwcomp_disable; 103*a2df8c2dSSameer Pujar unsigned int input_thresh; 104*a2df8c2dSSameer Pujar unsigned int output_thresh; 105*a2df8c2dSSameer Pujar }; 106*a2df8c2dSSameer Pujar 107*a2df8c2dSSameer Pujar struct tegra186_asrc { 108*a2df8c2dSSameer Pujar struct tegra186_asrc_lane lane[TEGRA186_ASRC_STREAM_MAX]; 109*a2df8c2dSSameer Pujar struct regmap *regmap; 110*a2df8c2dSSameer Pujar }; 111*a2df8c2dSSameer Pujar 112*a2df8c2dSSameer Pujar #endif 113