1c173dba4SDan Murphy /* SPDX-License-Identifier: GPL-2.0-only */ 2c173dba4SDan Murphy /* 3c173dba4SDan Murphy * tas2562.h - ALSA SoC Texas Instruments TAS2562 Mono Audio Amplifier 4c173dba4SDan Murphy * 55856d8bdSAlexander A. Klimov * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com 6c173dba4SDan Murphy * 7c173dba4SDan Murphy * Author: Dan Murphy <dmurphy@ti.com> 8c173dba4SDan Murphy */ 9c173dba4SDan Murphy 10c173dba4SDan Murphy #ifndef __TAS2562_H__ 11c173dba4SDan Murphy #define __TAS2562_H__ 12c173dba4SDan Murphy 13c173dba4SDan Murphy #define TAS2562_PAGE_CTRL 0x00 14c173dba4SDan Murphy 15c173dba4SDan Murphy #define TAS2562_REG(page, reg) ((page * 128) + reg) 16c173dba4SDan Murphy 17c173dba4SDan Murphy #define TAS2562_SW_RESET TAS2562_REG(0, 0x01) 18c173dba4SDan Murphy #define TAS2562_PWR_CTRL TAS2562_REG(0, 0x02) 19c173dba4SDan Murphy #define TAS2562_PB_CFG1 TAS2562_REG(0, 0x03) 20c173dba4SDan Murphy #define TAS2562_MISC_CFG1 TAS2562_REG(0, 0x04) 21c173dba4SDan Murphy #define TAS2562_MISC_CFG2 TAS2562_REG(0, 0x05) 22c173dba4SDan Murphy 23c173dba4SDan Murphy #define TAS2562_TDM_CFG0 TAS2562_REG(0, 0x06) 24c173dba4SDan Murphy #define TAS2562_TDM_CFG1 TAS2562_REG(0, 0x07) 25c173dba4SDan Murphy #define TAS2562_TDM_CFG2 TAS2562_REG(0, 0x08) 26c173dba4SDan Murphy #define TAS2562_TDM_CFG3 TAS2562_REG(0, 0x09) 27c173dba4SDan Murphy #define TAS2562_TDM_CFG4 TAS2562_REG(0, 0x0a) 28c173dba4SDan Murphy #define TAS2562_TDM_CFG5 TAS2562_REG(0, 0x0b) 29c173dba4SDan Murphy #define TAS2562_TDM_CFG6 TAS2562_REG(0, 0x0c) 30c173dba4SDan Murphy #define TAS2562_TDM_CFG7 TAS2562_REG(0, 0x0d) 31c173dba4SDan Murphy #define TAS2562_TDM_CFG8 TAS2562_REG(0, 0x0e) 32c173dba4SDan Murphy #define TAS2562_TDM_CFG9 TAS2562_REG(0, 0x0f) 33c173dba4SDan Murphy #define TAS2562_TDM_CFG10 TAS2562_REG(0, 0x10) 34c173dba4SDan Murphy #define TAS2562_TDM_DET TAS2562_REG(0, 0x11) 35c173dba4SDan Murphy #define TAS2562_REV_ID TAS2562_REG(0, 0x7d) 36c173dba4SDan Murphy 37d7bd40aeSDan Murphy #define TAS2562_RX_OFF_MASK GENMASK(5, 1) 38d7bd40aeSDan Murphy #define TAS2562_TX_OFF_MASK GENMASK(3, 1) 39d7bd40aeSDan Murphy #define TAS2562_RIGHT_SLOT_SHIFT 4 40d7bd40aeSDan Murphy 41c173dba4SDan Murphy /* Page 2 */ 42bf726b1cSDan Murphy #define TAS2562_DVC_CFG1 TAS2562_REG(2, 0x0c) 43bf726b1cSDan Murphy #define TAS2562_DVC_CFG2 TAS2562_REG(2, 0x0d) 44bf726b1cSDan Murphy #define TAS2562_DVC_CFG3 TAS2562_REG(2, 0x0e) 45bf726b1cSDan Murphy #define TAS2562_DVC_CFG4 TAS2562_REG(2, 0x0f) 46c173dba4SDan Murphy 47c173dba4SDan Murphy #define TAS2562_RESET BIT(0) 48c173dba4SDan Murphy 4969e53129SDan Murphy #define TAS2562_MODE_MASK GENMASK(1,0) 50c173dba4SDan Murphy #define TAS2562_ACTIVE 0x0 51c173dba4SDan Murphy #define TAS2562_MUTE 0x1 52c173dba4SDan Murphy #define TAS2562_SHUTDOWN 0x2 53c173dba4SDan Murphy 54c173dba4SDan Murphy #define TAS2562_TDM_CFG1_RX_EDGE_MASK BIT(0) 55c173dba4SDan Murphy #define TAS2562_TDM_CFG1_RX_FALLING 1 56c173dba4SDan Murphy 57c173dba4SDan Murphy #define TAS2562_TDM_CFG0_RAMPRATE_MASK BIT(5) 58c173dba4SDan Murphy #define TAS2562_TDM_CFG0_RAMPRATE_44_1 BIT(5) 59c173dba4SDan Murphy #define TAS2562_TDM_CFG0_SAMPRATE_MASK GENMASK(3, 1) 60*8bef925eSRichard Weinberger #define TAS2562_TDM_CFG0_SAMPRATE_7305_8KHZ (0x0 << 1) 61*8bef925eSRichard Weinberger #define TAS2562_TDM_CFG0_SAMPRATE_14_7_16KHZ (0x1 << 1) 62*8bef925eSRichard Weinberger #define TAS2562_TDM_CFG0_SAMPRATE_22_05_24KHZ (0x2 << 1) 63*8bef925eSRichard Weinberger #define TAS2562_TDM_CFG0_SAMPRATE_29_4_32KHZ (0x3 << 1) 64*8bef925eSRichard Weinberger #define TAS2562_TDM_CFG0_SAMPRATE_44_1_48KHZ (0x4 << 1) 65*8bef925eSRichard Weinberger #define TAS2562_TDM_CFG0_SAMPRATE_88_2_96KHZ (0x5 << 1) 66*8bef925eSRichard Weinberger #define TAS2562_TDM_CFG0_SAMPRATE_176_4_192KHZ (0x6 << 1) 67c173dba4SDan Murphy 68c173dba4SDan Murphy #define TAS2562_TDM_CFG2_RIGHT_JUSTIFY BIT(6) 69c173dba4SDan Murphy 700e4b8717SRikard Falkeborn #define TAS2562_TDM_CFG2_RXLEN_MASK GENMASK(1, 0) 71c173dba4SDan Murphy #define TAS2562_TDM_CFG2_RXLEN_16B 0x0 72c173dba4SDan Murphy #define TAS2562_TDM_CFG2_RXLEN_24B BIT(0) 73c173dba4SDan Murphy #define TAS2562_TDM_CFG2_RXLEN_32B BIT(1) 74c173dba4SDan Murphy 75c173dba4SDan Murphy #define TAS2562_TDM_CFG2_RXWLEN_MASK GENMASK(3, 2) 76c173dba4SDan Murphy #define TAS2562_TDM_CFG2_RXWLEN_16B 0x0 77c173dba4SDan Murphy #define TAS2562_TDM_CFG2_RXWLEN_20B BIT(2) 78c173dba4SDan Murphy #define TAS2562_TDM_CFG2_RXWLEN_24B BIT(3) 79c173dba4SDan Murphy #define TAS2562_TDM_CFG2_RXWLEN_32B (BIT(2) | BIT(3)) 80c173dba4SDan Murphy 8169e53129SDan Murphy #define TAS2562_VSENSE_POWER_EN 2 8269e53129SDan Murphy #define TAS2562_ISENSE_POWER_EN 3 83c173dba4SDan Murphy 84c173dba4SDan Murphy #define TAS2562_TDM_CFG5_VSNS_EN BIT(6) 85c173dba4SDan Murphy #define TAS2562_TDM_CFG5_VSNS_SLOT_MASK GENMASK(5, 0) 86c173dba4SDan Murphy 87c173dba4SDan Murphy #define TAS2562_TDM_CFG6_ISNS_EN BIT(6) 88c173dba4SDan Murphy #define TAS2562_TDM_CFG6_ISNS_SLOT_MASK GENMASK(5, 0) 89c173dba4SDan Murphy 90c173dba4SDan Murphy #endif /* __TAS2562_H__ */ 91