1e4961125SRichard Fitzgerald /* SPDX-License-Identifier: GPL-2.0-only */ 2e4961125SRichard Fitzgerald /* 3e4961125SRichard Fitzgerald * Common definitions for Cirrus Logic CS35L56 smart amp 4e4961125SRichard Fitzgerald * 5e4961125SRichard Fitzgerald * Copyright (C) 2023 Cirrus Logic, Inc. and 6e4961125SRichard Fitzgerald * Cirrus Logic International Semiconductor Ltd. 7e4961125SRichard Fitzgerald */ 8e4961125SRichard Fitzgerald 9e4961125SRichard Fitzgerald #ifndef __CS35L56_H 10e4961125SRichard Fitzgerald #define __CS35L56_H 11e4961125SRichard Fitzgerald 12e4961125SRichard Fitzgerald #include <linux/firmware/cirrus/cs_dsp.h> 13e4961125SRichard Fitzgerald #include <linux/regulator/consumer.h> 14e4961125SRichard Fitzgerald #include <linux/regmap.h> 15e1830f66SRichard Fitzgerald #include <sound/cs-amp-lib.h> 16e4961125SRichard Fitzgerald 17e4961125SRichard Fitzgerald #define CS35L56_DEVID 0x0000000 18e4961125SRichard Fitzgerald #define CS35L56_REVID 0x0000004 19e4961125SRichard Fitzgerald #define CS35L56_RELID 0x000000C 20e4961125SRichard Fitzgerald #define CS35L56_OTPID 0x0000010 21e4961125SRichard Fitzgerald #define CS35L56_SFT_RESET 0x0000020 22e4961125SRichard Fitzgerald #define CS35L56_GLOBAL_ENABLES 0x0002014 23e4961125SRichard Fitzgerald #define CS35L56_BLOCK_ENABLES 0x0002018 24e4961125SRichard Fitzgerald #define CS35L56_BLOCK_ENABLES2 0x000201C 25e4961125SRichard Fitzgerald #define CS35L56_REFCLK_INPUT 0x0002C04 26e4961125SRichard Fitzgerald #define CS35L56_GLOBAL_SAMPLE_RATE 0x0002C0C 27e1830f66SRichard Fitzgerald #define CS35L56_OTP_MEM_53 0x00300D4 28e1830f66SRichard Fitzgerald #define CS35L56_OTP_MEM_54 0x00300D8 29e1830f66SRichard Fitzgerald #define CS35L56_OTP_MEM_55 0x00300DC 30e4961125SRichard Fitzgerald #define CS35L56_ASP1_ENABLES1 0x0004800 31e4961125SRichard Fitzgerald #define CS35L56_ASP1_CONTROL1 0x0004804 32e4961125SRichard Fitzgerald #define CS35L56_ASP1_CONTROL2 0x0004808 33e4961125SRichard Fitzgerald #define CS35L56_ASP1_CONTROL3 0x000480C 34e4961125SRichard Fitzgerald #define CS35L56_ASP1_FRAME_CONTROL1 0x0004810 35e4961125SRichard Fitzgerald #define CS35L56_ASP1_FRAME_CONTROL5 0x0004820 36e4961125SRichard Fitzgerald #define CS35L56_ASP1_DATA_CONTROL1 0x0004830 37e4961125SRichard Fitzgerald #define CS35L56_ASP1_DATA_CONTROL5 0x0004840 38e4961125SRichard Fitzgerald #define CS35L56_DACPCM1_INPUT 0x0004C00 39e4961125SRichard Fitzgerald #define CS35L56_DACPCM2_INPUT 0x0004C08 40e4961125SRichard Fitzgerald #define CS35L56_ASP1TX1_INPUT 0x0004C20 41e4961125SRichard Fitzgerald #define CS35L56_ASP1TX2_INPUT 0x0004C24 42e4961125SRichard Fitzgerald #define CS35L56_ASP1TX3_INPUT 0x0004C28 43e4961125SRichard Fitzgerald #define CS35L56_ASP1TX4_INPUT 0x0004C2C 44e4961125SRichard Fitzgerald #define CS35L56_DSP1RX1_INPUT 0x0004C40 45e4961125SRichard Fitzgerald #define CS35L56_DSP1RX2_INPUT 0x0004C44 46e4961125SRichard Fitzgerald #define CS35L56_SWIRE_DP3_CH1_INPUT 0x0004C70 47e4961125SRichard Fitzgerald #define CS35L56_SWIRE_DP3_CH2_INPUT 0x0004C74 48e4961125SRichard Fitzgerald #define CS35L56_SWIRE_DP3_CH3_INPUT 0x0004C78 49e4961125SRichard Fitzgerald #define CS35L56_SWIRE_DP3_CH4_INPUT 0x0004C7C 50e4961125SRichard Fitzgerald #define CS35L56_IRQ1_CFG 0x000E000 51e4961125SRichard Fitzgerald #define CS35L56_IRQ1_STATUS 0x000E004 52e4961125SRichard Fitzgerald #define CS35L56_IRQ1_EINT_1 0x000E010 53e4961125SRichard Fitzgerald #define CS35L56_IRQ1_EINT_2 0x000E014 54e4961125SRichard Fitzgerald #define CS35L56_IRQ1_EINT_4 0x000E01C 55e4961125SRichard Fitzgerald #define CS35L56_IRQ1_EINT_8 0x000E02C 56e4961125SRichard Fitzgerald #define CS35L56_IRQ1_EINT_18 0x000E054 57e4961125SRichard Fitzgerald #define CS35L56_IRQ1_EINT_20 0x000E05C 58e4961125SRichard Fitzgerald #define CS35L56_IRQ1_MASK_1 0x000E090 59e4961125SRichard Fitzgerald #define CS35L56_IRQ1_MASK_2 0x000E094 60e4961125SRichard Fitzgerald #define CS35L56_IRQ1_MASK_4 0x000E09C 61e4961125SRichard Fitzgerald #define CS35L56_IRQ1_MASK_8 0x000E0AC 62e4961125SRichard Fitzgerald #define CS35L56_IRQ1_MASK_18 0x000E0D4 63e4961125SRichard Fitzgerald #define CS35L56_IRQ1_MASK_20 0x000E0DC 64e4961125SRichard Fitzgerald #define CS35L56_DSP_VIRTUAL1_MBOX_1 0x0011020 65e4961125SRichard Fitzgerald #define CS35L56_DSP_VIRTUAL1_MBOX_2 0x0011024 66e4961125SRichard Fitzgerald #define CS35L56_DSP_VIRTUAL1_MBOX_3 0x0011028 67e4961125SRichard Fitzgerald #define CS35L56_DSP_VIRTUAL1_MBOX_4 0x001102C 68e4961125SRichard Fitzgerald #define CS35L56_DSP_VIRTUAL1_MBOX_5 0x0011030 69e4961125SRichard Fitzgerald #define CS35L56_DSP_VIRTUAL1_MBOX_6 0x0011034 70e4961125SRichard Fitzgerald #define CS35L56_DSP_VIRTUAL1_MBOX_7 0x0011038 71e4961125SRichard Fitzgerald #define CS35L56_DSP_VIRTUAL1_MBOX_8 0x001103C 72e4961125SRichard Fitzgerald #define CS35L56_DSP_RESTRICT_STS1 0x00190F0 73e4961125SRichard Fitzgerald #define CS35L56_DSP1_XMEM_PACKED_0 0x2000000 74e4961125SRichard Fitzgerald #define CS35L56_DSP1_XMEM_PACKED_6143 0x2005FFC 75e4961125SRichard Fitzgerald #define CS35L56_DSP1_XMEM_UNPACKED32_0 0x2400000 76e4961125SRichard Fitzgerald #define CS35L56_DSP1_XMEM_UNPACKED32_4095 0x2403FFC 77e4961125SRichard Fitzgerald #define CS35L56_DSP1_SYS_INFO_ID 0x25E0000 78e4961125SRichard Fitzgerald #define CS35L56_DSP1_SYS_INFO_END 0x25E004C 79e4961125SRichard Fitzgerald #define CS35L56_DSP1_AHBM_WINDOW_DEBUG_0 0x25E2040 80e4961125SRichard Fitzgerald #define CS35L56_DSP1_AHBM_WINDOW_DEBUG_1 0x25E2044 81e4961125SRichard Fitzgerald #define CS35L56_DSP1_XMEM_UNPACKED24_0 0x2800000 82f4ef5149SRichard Fitzgerald #define CS35L56_DSP1_FW_VER 0x2800010 83e4961125SRichard Fitzgerald #define CS35L56_DSP1_HALO_STATE 0x28021E0 84e4961125SRichard Fitzgerald #define CS35L56_DSP1_PM_CUR_STATE 0x2804308 85e4961125SRichard Fitzgerald #define CS35L56_DSP1_XMEM_UNPACKED24_8191 0x2807FFC 86e4961125SRichard Fitzgerald #define CS35L56_DSP1_CORE_BASE 0x2B80000 87e4961125SRichard Fitzgerald #define CS35L56_DSP1_SCRATCH1 0x2B805C0 88e4961125SRichard Fitzgerald #define CS35L56_DSP1_SCRATCH2 0x2B805C8 89e4961125SRichard Fitzgerald #define CS35L56_DSP1_SCRATCH3 0x2B805D0 90e4961125SRichard Fitzgerald #define CS35L56_DSP1_SCRATCH4 0x2B805D8 91e4961125SRichard Fitzgerald #define CS35L56_DSP1_YMEM_PACKED_0 0x2C00000 92e4961125SRichard Fitzgerald #define CS35L56_DSP1_YMEM_PACKED_4604 0x2C047F0 93e4961125SRichard Fitzgerald #define CS35L56_DSP1_YMEM_UNPACKED32_0 0x3000000 94e4961125SRichard Fitzgerald #define CS35L56_DSP1_YMEM_UNPACKED32_3070 0x3002FF8 95e4961125SRichard Fitzgerald #define CS35L56_DSP1_YMEM_UNPACKED24_0 0x3400000 96e4961125SRichard Fitzgerald #define CS35L56_MAIN_RENDER_USER_MUTE 0x3400024 97e4961125SRichard Fitzgerald #define CS35L56_MAIN_RENDER_USER_VOLUME 0x340002C 98e4961125SRichard Fitzgerald #define CS35L56_MAIN_POSTURE_NUMBER 0x3400094 9959322d35SRichard Fitzgerald #define CS35L56_PROTECTION_STATUS 0x34000D8 100e4961125SRichard Fitzgerald #define CS35L56_TRANSDUCER_ACTUAL_PS 0x3400150 101e4961125SRichard Fitzgerald #define CS35L56_DSP1_YMEM_UNPACKED24_6141 0x3405FF4 102e4961125SRichard Fitzgerald #define CS35L56_DSP1_PMEM_0 0x3800000 103e4961125SRichard Fitzgerald #define CS35L56_DSP1_PMEM_5114 0x3804FE8 104e4961125SRichard Fitzgerald 105e4961125SRichard Fitzgerald /* DEVID */ 106e4961125SRichard Fitzgerald #define CS35L56_DEVID_MASK 0x00FFFFFF 107e4961125SRichard Fitzgerald 108e4961125SRichard Fitzgerald /* REVID */ 109e4961125SRichard Fitzgerald #define CS35L56_AREVID_MASK 0x000000F0 110e4961125SRichard Fitzgerald #define CS35L56_MTLREVID_MASK 0x0000000F 111e4961125SRichard Fitzgerald #define CS35L56_REVID_B0 0x000000B0 112e4961125SRichard Fitzgerald 113e4961125SRichard Fitzgerald /* ASP_ENABLES1 */ 114e4961125SRichard Fitzgerald #define CS35L56_ASP_RX2_EN_SHIFT 17 115e4961125SRichard Fitzgerald #define CS35L56_ASP_RX1_EN_SHIFT 16 116e4961125SRichard Fitzgerald #define CS35L56_ASP_TX4_EN_SHIFT 3 117e4961125SRichard Fitzgerald #define CS35L56_ASP_TX3_EN_SHIFT 2 118e4961125SRichard Fitzgerald #define CS35L56_ASP_TX2_EN_SHIFT 1 119e4961125SRichard Fitzgerald #define CS35L56_ASP_TX1_EN_SHIFT 0 120e4961125SRichard Fitzgerald 121e4961125SRichard Fitzgerald /* ASP_CONTROL1 */ 122e4961125SRichard Fitzgerald #define CS35L56_ASP_BCLK_FREQ_MASK 0x0000003F 123e4961125SRichard Fitzgerald #define CS35L56_ASP_BCLK_FREQ_SHIFT 0 124e4961125SRichard Fitzgerald 125e4961125SRichard Fitzgerald /* ASP_CONTROL2 */ 126e4961125SRichard Fitzgerald #define CS35L56_ASP_RX_WIDTH_MASK 0xFF000000 127e4961125SRichard Fitzgerald #define CS35L56_ASP_RX_WIDTH_SHIFT 24 128e4961125SRichard Fitzgerald #define CS35L56_ASP_TX_WIDTH_MASK 0x00FF0000 129e4961125SRichard Fitzgerald #define CS35L56_ASP_TX_WIDTH_SHIFT 16 130e4961125SRichard Fitzgerald #define CS35L56_ASP_FMT_MASK 0x00000700 131e4961125SRichard Fitzgerald #define CS35L56_ASP_FMT_SHIFT 8 132e4961125SRichard Fitzgerald #define CS35L56_ASP_BCLK_INV_MASK 0x00000040 133e4961125SRichard Fitzgerald #define CS35L56_ASP_FSYNC_INV_MASK 0x00000004 134e4961125SRichard Fitzgerald 135e4961125SRichard Fitzgerald /* ASP_CONTROL3 */ 136e4961125SRichard Fitzgerald #define CS35L56_ASP1_DOUT_HIZ_CTRL_MASK 0x00000003 137e4961125SRichard Fitzgerald 138e4961125SRichard Fitzgerald /* ASP_DATA_CONTROL1 */ 139e4961125SRichard Fitzgerald #define CS35L56_ASP_TX_WL_MASK 0x0000003F 140e4961125SRichard Fitzgerald 141e4961125SRichard Fitzgerald /* ASP_DATA_CONTROL5 */ 142e4961125SRichard Fitzgerald #define CS35L56_ASP_RX_WL_MASK 0x0000003F 143e4961125SRichard Fitzgerald 144e4961125SRichard Fitzgerald /* ASPTXn_INPUT */ 145e4961125SRichard Fitzgerald #define CS35L56_ASP_TXn_SRC_MASK 0x0000007F 146e4961125SRichard Fitzgerald 147e4961125SRichard Fitzgerald /* SWIRETX[1..7]_SRC SDWTXn INPUT */ 148e4961125SRichard Fitzgerald #define CS35L56_SWIRETXn_SRC_MASK 0x0000007F 149e4961125SRichard Fitzgerald 150e4961125SRichard Fitzgerald /* IRQ1_STATUS */ 151e4961125SRichard Fitzgerald #define CS35L56_IRQ1_STS_MASK 0x00000001 152e4961125SRichard Fitzgerald 153e4961125SRichard Fitzgerald /* IRQ1_EINT_1 */ 154e4961125SRichard Fitzgerald #define CS35L56_AMP_SHORT_ERR_EINT1_MASK 0x80000000 155e4961125SRichard Fitzgerald 156e4961125SRichard Fitzgerald /* IRQ1_EINT_2 */ 157e4961125SRichard Fitzgerald #define CS35L56_DSP_VIRTUAL2_MBOX_WR_EINT1_MASK 0x00200000 158e4961125SRichard Fitzgerald 159e4961125SRichard Fitzgerald /* IRQ1_EINT_4 */ 160e4961125SRichard Fitzgerald #define CS35L56_OTP_BOOT_DONE_MASK 0x00000002 161e4961125SRichard Fitzgerald 162e4961125SRichard Fitzgerald /* IRQ1_EINT_8 */ 163e4961125SRichard Fitzgerald #define CS35L56_TEMP_ERR_EINT1_MASK 0x80000000 164e4961125SRichard Fitzgerald 165e4961125SRichard Fitzgerald /* Mixer input sources */ 166e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_NONE 0x00 167e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_ASP1RX1 0x08 168e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_ASP1RX2 0x09 169e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_VMON 0x18 170e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_IMON 0x19 171e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_ERR_VOL 0x20 172e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_CLASSH 0x21 173e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_VDDBMON 0x28 174e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_VBSTMON 0x29 175e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_DSP1TX1 0x32 176e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_DSP1TX2 0x33 177e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_DSP1TX3 0x34 178e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_DSP1TX4 0x35 179e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_DSP1TX5 0x36 180e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_DSP1TX6 0x37 181e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_DSP1TX7 0x38 182e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_DSP1TX8 0x39 183e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_TEMPMON 0x3A 184e4961125SRichard Fitzgerald #define CS35L56_INPUT_SRC_INTERPOLATOR 0x40 185d29a966bSRichard Fitzgerald #define CS35L56_INPUT_SRC_SWIRE_DP1_CHANNEL1 0x44 186d29a966bSRichard Fitzgerald #define CS35L56_INPUT_SRC_SWIRE_DP1_CHANNEL2 0x45 187e4961125SRichard Fitzgerald #define CS35L56_INPUT_MASK 0x7F 188e4961125SRichard Fitzgerald 189d3a4efb3SRichard Fitzgerald #define CS35L56_NUM_INPUT_SRC 21 190e4961125SRichard Fitzgerald 191e4961125SRichard Fitzgerald /* ASP formats */ 192e4961125SRichard Fitzgerald #define CS35L56_ASP_FMT_DSP_A 0 193e4961125SRichard Fitzgerald #define CS35L56_ASP_FMT_I2S 2 194e4961125SRichard Fitzgerald 195e4961125SRichard Fitzgerald /* ASP HiZ modes */ 196e4961125SRichard Fitzgerald #define CS35L56_ASP_UNUSED_HIZ_OFF_HIZ 3 197e4961125SRichard Fitzgerald 198e4961125SRichard Fitzgerald /* MAIN_RENDER_ACTUAL_PS */ 199e4961125SRichard Fitzgerald #define CS35L56_PS0 0 200e4961125SRichard Fitzgerald #define CS35L56_PS3 3 201e4961125SRichard Fitzgerald 202e4961125SRichard Fitzgerald /* CS35L56_DSP_RESTRICT_STS1 */ 203e4961125SRichard Fitzgerald #define CS35L56_RESTRICTED_MASK 0x7 204e4961125SRichard Fitzgerald 205e4961125SRichard Fitzgerald /* CS35L56_MAIN_RENDER_USER_MUTE */ 206e4961125SRichard Fitzgerald #define CS35L56_MAIN_RENDER_USER_MUTE_MASK 1 207e4961125SRichard Fitzgerald 208e4961125SRichard Fitzgerald /* CS35L56_MAIN_RENDER_USER_VOLUME */ 209e4961125SRichard Fitzgerald #define CS35L56_MAIN_RENDER_USER_VOLUME_MIN -400 210244389bdSRichard Fitzgerald #define CS35L56_MAIN_RENDER_USER_VOLUME_MAX 48 211e4961125SRichard Fitzgerald #define CS35L56_MAIN_RENDER_USER_VOLUME_MASK 0x0000FFC0 212e4961125SRichard Fitzgerald #define CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT 6 213e4961125SRichard Fitzgerald #define CS35L56_MAIN_RENDER_USER_VOLUME_SIGNBIT 9 214e4961125SRichard Fitzgerald 215e4961125SRichard Fitzgerald /* CS35L56_MAIN_POSTURE_NUMBER */ 216e4961125SRichard Fitzgerald #define CS35L56_MAIN_POSTURE_MIN 0 217e4961125SRichard Fitzgerald #define CS35L56_MAIN_POSTURE_MAX 255 218e4961125SRichard Fitzgerald #define CS35L56_MAIN_POSTURE_MASK CS35L56_MAIN_POSTURE_MAX 219e4961125SRichard Fitzgerald 22059322d35SRichard Fitzgerald /* CS35L56_PROTECTION_STATUS */ 22159322d35SRichard Fitzgerald #define CS35L56_FIRMWARE_MISSING BIT(0) 22259322d35SRichard Fitzgerald 223e4961125SRichard Fitzgerald /* Software Values */ 224e4961125SRichard Fitzgerald #define CS35L56_HALO_STATE_SHUTDOWN 1 225e4961125SRichard Fitzgerald #define CS35L56_HALO_STATE_BOOT_DONE 2 226e4961125SRichard Fitzgerald 227e4961125SRichard Fitzgerald #define CS35L56_MBOX_CMD_AUDIO_PLAY 0x0B000001 228e4961125SRichard Fitzgerald #define CS35L56_MBOX_CMD_AUDIO_PAUSE 0x0B000002 2291a8edfcfSSimon Trimmer #define CS35L56_MBOX_CMD_AUDIO_REINIT 0x0B000003 230e4961125SRichard Fitzgerald #define CS35L56_MBOX_CMD_HIBERNATE_NOW 0x02000001 231e4961125SRichard Fitzgerald #define CS35L56_MBOX_CMD_WAKEUP 0x02000002 232e4961125SRichard Fitzgerald #define CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE 0x02000003 233e4961125SRichard Fitzgerald #define CS35L56_MBOX_CMD_ALLOW_AUTO_HIBERNATE 0x02000004 234e4961125SRichard Fitzgerald #define CS35L56_MBOX_CMD_SHUTDOWN 0x02000005 235e4961125SRichard Fitzgerald #define CS35L56_MBOX_CMD_SYSTEM_RESET 0x02000007 236e4961125SRichard Fitzgerald 237e4961125SRichard Fitzgerald #define CS35L56_MBOX_TIMEOUT_US 5000 238e4961125SRichard Fitzgerald #define CS35L56_MBOX_POLL_US 250 239e4961125SRichard Fitzgerald 240e4961125SRichard Fitzgerald #define CS35L56_PS0_POLL_US 500 241e4961125SRichard Fitzgerald #define CS35L56_PS0_TIMEOUT_US 50000 242e4961125SRichard Fitzgerald #define CS35L56_PS3_POLL_US 500 243e4961125SRichard Fitzgerald #define CS35L56_PS3_TIMEOUT_US 300000 244e4961125SRichard Fitzgerald 245e4961125SRichard Fitzgerald #define CS35L56_CONTROL_PORT_READY_US 2200 246e4961125SRichard Fitzgerald #define CS35L56_HALO_STATE_POLL_US 1000 2479e92b77cSRichard Fitzgerald #define CS35L56_HALO_STATE_TIMEOUT_US 250000 248e4961125SRichard Fitzgerald #define CS35L56_RESET_PULSE_MIN_US 1100 2493df761bdSSimon Trimmer #define CS35L56_WAKE_HOLD_TIME_US 1000 250e4961125SRichard Fitzgerald 251e4961125SRichard Fitzgerald #define CS35L56_SDW1_PLAYBACK_PORT 1 252e4961125SRichard Fitzgerald #define CS35L56_SDW1_CAPTURE_PORT 3 253e4961125SRichard Fitzgerald 254e4961125SRichard Fitzgerald #define CS35L56_NUM_BULK_SUPPLIES 3 255e4961125SRichard Fitzgerald #define CS35L56_NUM_DSP_REGIONS 5 256e4961125SRichard Fitzgerald 257898673b9SSimon Trimmer struct cs35l56_base { 258898673b9SSimon Trimmer struct device *dev; 259898673b9SSimon Trimmer struct regmap *regmap; 260898673b9SSimon Trimmer int irq; 261898673b9SSimon Trimmer struct mutex irq_lock; 262afd17e6dSSimon Trimmer u8 type; 263898673b9SSimon Trimmer u8 rev; 264898673b9SSimon Trimmer bool init_done; 265898673b9SSimon Trimmer bool fw_patched; 266898673b9SSimon Trimmer bool secured; 267898673b9SSimon Trimmer bool can_hibernate; 268e1830f66SRichard Fitzgerald bool cal_data_valid; 269e1830f66SRichard Fitzgerald s8 cal_index; 270e1830f66SRichard Fitzgerald struct cirrus_amp_cal_data cal_data; 271898673b9SSimon Trimmer struct gpio_desc *reset_gpio; 272898673b9SSimon Trimmer }; 273898673b9SSimon Trimmer 2745d7e328eSRichard Fitzgerald /* Temporary to avoid a build break with the HDA driver */ 2755d7e328eSRichard Fitzgerald static inline int cs35l56_force_sync_asp1_registers_from_cache(struct cs35l56_base *cs35l56_base) 2765d7e328eSRichard Fitzgerald { 2775d7e328eSRichard Fitzgerald return 0; 2785d7e328eSRichard Fitzgerald } 2795d7e328eSRichard Fitzgerald 280*e42066dfSRichard Fitzgerald static inline bool cs35l56_is_otp_register(unsigned int reg) 281*e42066dfSRichard Fitzgerald { 282*e42066dfSRichard Fitzgerald return (reg >> 16) == 3; 283*e42066dfSRichard Fitzgerald } 284*e42066dfSRichard Fitzgerald 285e4961125SRichard Fitzgerald extern struct regmap_config cs35l56_regmap_i2c; 286e4961125SRichard Fitzgerald extern struct regmap_config cs35l56_regmap_spi; 287e4961125SRichard Fitzgerald extern struct regmap_config cs35l56_regmap_sdw; 288e4961125SRichard Fitzgerald 289e1830f66SRichard Fitzgerald extern const struct cirrus_amp_cal_controls cs35l56_calibration_controls; 290e1830f66SRichard Fitzgerald 291e4961125SRichard Fitzgerald extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC]; 292e4961125SRichard Fitzgerald extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC]; 293e4961125SRichard Fitzgerald 294898673b9SSimon Trimmer int cs35l56_set_patch(struct cs35l56_base *cs35l56_base); 2958a731fd3SSimon Trimmer int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command); 296444dfa09SSimon Trimmer int cs35l56_firmware_shutdown(struct cs35l56_base *cs35l56_base); 2978a731fd3SSimon Trimmer int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base); 298f32a2bcbSSimon Trimmer void cs35l56_wait_control_port_ready(void); 2998a731fd3SSimon Trimmer void cs35l56_wait_min_reset_pulse(void); 3008a731fd3SSimon Trimmer void cs35l56_system_reset(struct cs35l56_base *cs35l56_base, bool is_soundwire); 3018a731fd3SSimon Trimmer int cs35l56_irq_request(struct cs35l56_base *cs35l56_base, int irq); 3028a731fd3SSimon Trimmer irqreturn_t cs35l56_irq(int irq, void *data); 3038a731fd3SSimon Trimmer int cs35l56_is_fw_reload_needed(struct cs35l56_base *cs35l56_base); 3049974d5b5SRichard Fitzgerald int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base); 3059974d5b5SRichard Fitzgerald int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_soundwire); 30622e51dbbSRichard Fitzgerald void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp); 307e1830f66SRichard Fitzgerald int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base); 308f4ef5149SRichard Fitzgerald int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, 309f4ef5149SRichard Fitzgerald bool *fw_missing, unsigned int *fw_version); 31084851aa0SRichard Fitzgerald int cs35l56_hw_init(struct cs35l56_base *cs35l56_base); 311245eeff1SRichard Fitzgerald int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base); 312e4961125SRichard Fitzgerald int cs35l56_get_bclk_freq_id(unsigned int freq); 313e4961125SRichard Fitzgerald void cs35l56_fill_supply_names(struct regulator_bulk_data *data); 314e4961125SRichard Fitzgerald 315e4961125SRichard Fitzgerald #endif /* ifndef __CS35L56_H */ 316