162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * cs42l52.h -- CS42L56 ALSA SoC audio driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright 2014 CirrusLogic, Inc. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Author: Brian Austin <brian.austin@cirrus.com> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef __CS42L56_H__ 1162306a36Sopenharmony_ci#define __CS42L56_H__ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#define CS42L56_CHIP_ID_1 0x01 1462306a36Sopenharmony_ci#define CS42L56_CHIP_ID_2 0x02 1562306a36Sopenharmony_ci#define CS42L56_PWRCTL_1 0x03 1662306a36Sopenharmony_ci#define CS42L56_PWRCTL_2 0x04 1762306a36Sopenharmony_ci#define CS42L56_CLKCTL_1 0x05 1862306a36Sopenharmony_ci#define CS42L56_CLKCTL_2 0x06 1962306a36Sopenharmony_ci#define CS42L56_SERIAL_FMT 0x07 2062306a36Sopenharmony_ci#define CS42L56_CLASSH_CTL 0x08 2162306a36Sopenharmony_ci#define CS42L56_MISC_CTL 0x09 2262306a36Sopenharmony_ci#define CS42L56_INT_STATUS 0x0a 2362306a36Sopenharmony_ci#define CS42L56_PLAYBACK_CTL 0x0b 2462306a36Sopenharmony_ci#define CS42L56_DSP_MUTE_CTL 0x0c 2562306a36Sopenharmony_ci#define CS42L56_ADCA_MIX_VOLUME 0x0d 2662306a36Sopenharmony_ci#define CS42L56_ADCB_MIX_VOLUME 0x0e 2762306a36Sopenharmony_ci#define CS42L56_PCMA_MIX_VOLUME 0x0f 2862306a36Sopenharmony_ci#define CS42L56_PCMB_MIX_VOLUME 0x10 2962306a36Sopenharmony_ci#define CS42L56_ANAINPUT_ADV_VOLUME 0x11 3062306a36Sopenharmony_ci#define CS42L56_DIGINPUT_ADV_VOLUME 0x12 3162306a36Sopenharmony_ci#define CS42L56_MASTER_A_VOLUME 0x13 3262306a36Sopenharmony_ci#define CS42L56_MASTER_B_VOLUME 0x14 3362306a36Sopenharmony_ci#define CS42L56_BEEP_FREQ_ONTIME 0x15 3462306a36Sopenharmony_ci#define CS42L56_BEEP_FREQ_OFFTIME 0x16 3562306a36Sopenharmony_ci#define CS42L56_BEEP_TONE_CFG 0x17 3662306a36Sopenharmony_ci#define CS42L56_TONE_CTL 0x18 3762306a36Sopenharmony_ci#define CS42L56_CHAN_MIX_SWAP 0x19 3862306a36Sopenharmony_ci#define CS42L56_AIN_REFCFG_ADC_MUX 0x1a 3962306a36Sopenharmony_ci#define CS42L56_HPF_CTL 0x1b 4062306a36Sopenharmony_ci#define CS42L56_MISC_ADC_CTL 0x1c 4162306a36Sopenharmony_ci#define CS42L56_GAIN_BIAS_CTL 0x1d 4262306a36Sopenharmony_ci#define CS42L56_PGAA_MUX_VOLUME 0x1e 4362306a36Sopenharmony_ci#define CS42L56_PGAB_MUX_VOLUME 0x1f 4462306a36Sopenharmony_ci#define CS42L56_ADCA_ATTENUATOR 0x20 4562306a36Sopenharmony_ci#define CS42L56_ADCB_ATTENUATOR 0x21 4662306a36Sopenharmony_ci#define CS42L56_ALC_EN_ATTACK_RATE 0x22 4762306a36Sopenharmony_ci#define CS42L56_ALC_RELEASE_RATE 0x23 4862306a36Sopenharmony_ci#define CS42L56_ALC_THRESHOLD 0x24 4962306a36Sopenharmony_ci#define CS42L56_NOISE_GATE_CTL 0x25 5062306a36Sopenharmony_ci#define CS42L56_ALC_LIM_SFT_ZC 0x26 5162306a36Sopenharmony_ci#define CS42L56_AMUTE_HPLO_MUX 0x27 5262306a36Sopenharmony_ci#define CS42L56_HPA_VOLUME 0x28 5362306a36Sopenharmony_ci#define CS42L56_HPB_VOLUME 0x29 5462306a36Sopenharmony_ci#define CS42L56_LOA_VOLUME 0x2a 5562306a36Sopenharmony_ci#define CS42L56_LOB_VOLUME 0x2b 5662306a36Sopenharmony_ci#define CS42L56_LIM_THRESHOLD_CTL 0x2c 5762306a36Sopenharmony_ci#define CS42L56_LIM_CTL_RELEASE_RATE 0x2d 5862306a36Sopenharmony_ci#define CS42L56_LIM_ATTACK_RATE 0x2e 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci/* Device ID and Rev ID Masks */ 6162306a36Sopenharmony_ci#define CS42L56_DEVID 0x56 6262306a36Sopenharmony_ci#define CS42L56_CHIP_ID_MASK 0xff 6362306a36Sopenharmony_ci#define CS42L56_AREV_MASK 0x1c 6462306a36Sopenharmony_ci#define CS42L56_MTLREV_MASK 0x03 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci/* Power bit masks */ 6762306a36Sopenharmony_ci#define CS42L56_PDN_ALL_MASK 0x01 6862306a36Sopenharmony_ci#define CS42L56_PDN_ADCA_MASK 0x02 6962306a36Sopenharmony_ci#define CS42L56_PDN_ADCB_MASK 0x04 7062306a36Sopenharmony_ci#define CS42L56_PDN_CHRG_MASK 0x08 7162306a36Sopenharmony_ci#define CS42L56_PDN_BIAS_MASK 0x10 7262306a36Sopenharmony_ci#define CS42L56_PDN_VBUF_MASK 0x20 7362306a36Sopenharmony_ci#define CS42L56_PDN_LOA_MASK 0x03 7462306a36Sopenharmony_ci#define CS42L56_PDN_LOB_MASK 0x0c 7562306a36Sopenharmony_ci#define CS42L56_PDN_HPA_MASK 0x30 7662306a36Sopenharmony_ci#define CS42L56_PDN_HPB_MASK 0xc0 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci/* serial port and clk masks */ 7962306a36Sopenharmony_ci#define CS42L56_MASTER_MODE 0x40 8062306a36Sopenharmony_ci#define CS42L56_SLAVE_MODE 0 8162306a36Sopenharmony_ci#define CS42L56_MS_MODE_MASK 0x40 8262306a36Sopenharmony_ci#define CS42L56_SCLK_INV 0x20 8362306a36Sopenharmony_ci#define CS42L56_SCLK_INV_MASK 0x20 8462306a36Sopenharmony_ci#define CS42L56_SCLK_MCLK_MASK 0x18 8562306a36Sopenharmony_ci#define CS42L56_MCLK_PREDIV 0x04 8662306a36Sopenharmony_ci#define CS42L56_MCLK_PREDIV_MASK 0x04 8762306a36Sopenharmony_ci#define CS42L56_MCLK_DIV2 0x02 8862306a36Sopenharmony_ci#define CS42L56_MCLK_DIV2_MASK 0x02 8962306a36Sopenharmony_ci#define CS42L56_MCLK_DIS_MASK 0x01 9062306a36Sopenharmony_ci#define CS42L56_CLK_AUTO_MASK 0x20 9162306a36Sopenharmony_ci#define CS42L56_CLK_RATIO_MASK 0x1f 9262306a36Sopenharmony_ci#define CS42L56_DIG_FMT_I2S 0 9362306a36Sopenharmony_ci#define CS42L56_DIG_FMT_LEFT_J 0x08 9462306a36Sopenharmony_ci#define CS42L56_DIG_FMT_MASK 0x08 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci/* Class H and misc ctl masks */ 9762306a36Sopenharmony_ci#define CS42L56_ADAPT_PWR_MASK 0xc0 9862306a36Sopenharmony_ci#define CS42L56_CHRG_FREQ_MASK 0x0f 9962306a36Sopenharmony_ci#define CS42L56_DIG_MUX_MASK 0x80 10062306a36Sopenharmony_ci#define CS42L56_ANLGSFT_MASK 0x10 10162306a36Sopenharmony_ci#define CS42L56_ANLGZC_MASK 0x08 10262306a36Sopenharmony_ci#define CS42L56_DIGSFT_MASK 0x04 10362306a36Sopenharmony_ci#define CS42L56_FREEZE_MASK 0x01 10462306a36Sopenharmony_ci#define CS42L56_MIC_BIAS_MASK 0x03 10562306a36Sopenharmony_ci#define CS42L56_HPFA_FREQ_MASK 0x03 10662306a36Sopenharmony_ci#define CS42L56_HPFB_FREQ_MASK 0xc0 10762306a36Sopenharmony_ci#define CS42L56_AIN1A_REF_MASK 0x10 10862306a36Sopenharmony_ci#define CS42L56_AIN2A_REF_MASK 0x40 10962306a36Sopenharmony_ci#define CS42L56_AIN1B_REF_MASK 0x20 11062306a36Sopenharmony_ci#define CS42L56_AIN2B_REF_MASK 0x80 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci/* Playback Capture ctl masks */ 11362306a36Sopenharmony_ci#define CS42L56_PDN_DSP_MASK 0x80 11462306a36Sopenharmony_ci#define CS42L56_DEEMPH_MASK 0x40 11562306a36Sopenharmony_ci#define CS42L56_PLYBCK_GANG_MASK 0x10 11662306a36Sopenharmony_ci#define CS42L56_PCM_INV_MASK 0x0c 11762306a36Sopenharmony_ci#define CS42L56_MUTE_ALL 0xff 11862306a36Sopenharmony_ci#define CS42L56_UNMUTE 0 11962306a36Sopenharmony_ci#define CS42L56_ADCAMIX_MUTE_MASK 0x40 12062306a36Sopenharmony_ci#define CS42L56_ADCBMIX_MUTE_MASK 0x80 12162306a36Sopenharmony_ci#define CS42L56_PCMAMIX_MUTE_MASK 0x10 12262306a36Sopenharmony_ci#define CS42L56_PCMBMIX_MUTE_MASK 0x20 12362306a36Sopenharmony_ci#define CS42L56_MSTB_MUTE_MASK 0x02 12462306a36Sopenharmony_ci#define CS42L56_MSTA_MUTE_MASK 0x01 12562306a36Sopenharmony_ci#define CS42L56_ADCA_MUTE_MASK 0x01 12662306a36Sopenharmony_ci#define CS42L56_ADCB_MUTE_MASK 0x02 12762306a36Sopenharmony_ci#define CS42L56_HP_MUTE_MASK 0x80 12862306a36Sopenharmony_ci#define CS42L56_LO_MUTE_MASK 0x80 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci/* Beep masks */ 13162306a36Sopenharmony_ci#define CS42L56_BEEP_FREQ_MASK 0xf0 13262306a36Sopenharmony_ci#define CS42L56_BEEP_ONTIME_MASK 0x0f 13362306a36Sopenharmony_ci#define CS42L56_BEEP_OFFTIME_MASK 0xe0 13462306a36Sopenharmony_ci#define CS42L56_BEEP_CFG_MASK 0xc0 13562306a36Sopenharmony_ci#define CS42L56_BEEP_TREBCF_MASK 0x18 13662306a36Sopenharmony_ci#define CS42L56_BEEP_BASSCF_MASK 0x06 13762306a36Sopenharmony_ci#define CS42L56_BEEP_TCEN_MASK 0x01 13862306a36Sopenharmony_ci#define CS42L56_BEEP_RATE_SHIFT 4 13962306a36Sopenharmony_ci#define CS42L56_BEEP_EN_MASK 0x3f 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci/* Supported MCLKS */ 14362306a36Sopenharmony_ci#define CS42L56_MCLK_5P6448MHZ 5644800 14462306a36Sopenharmony_ci#define CS42L56_MCLK_6MHZ 6000000 14562306a36Sopenharmony_ci#define CS42L56_MCLK_6P144MHZ 6144000 14662306a36Sopenharmony_ci#define CS42L56_MCLK_11P2896MHZ 11289600 14762306a36Sopenharmony_ci#define CS42L56_MCLK_12MHZ 12000000 14862306a36Sopenharmony_ci#define CS42L56_MCLK_12P288MHZ 12288000 14962306a36Sopenharmony_ci#define CS42L56_MCLK_22P5792MHZ 22579200 15062306a36Sopenharmony_ci#define CS42L56_MCLK_24MHZ 24000000 15162306a36Sopenharmony_ci#define CS42L56_MCLK_24P576MHZ 24576000 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci/* Clock ratios */ 15462306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_128 0x08 15562306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_125 0x09 15662306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_136 0x0b 15762306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_192 0x0c 15862306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_187P5 0x0d 15962306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_256 0x10 16062306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_250 0x11 16162306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_272 0x13 16262306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_384 0x14 16362306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_375 0x15 16462306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_512 0x18 16562306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_500 0x19 16662306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_544 0x1b 16762306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_750 0x1c 16862306a36Sopenharmony_ci#define CS42L56_MCLK_LRCLK_768 0x1d 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci#define CS42L56_MAX_REGISTER 0x34 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci#endif 174