1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 22c394ca7SJames Schulman /* 32c394ca7SJames Schulman * cs42l42.h -- CS42L42 ALSA SoC audio driver header 42c394ca7SJames Schulman * 52c394ca7SJames Schulman * Copyright 2016 Cirrus Logic, Inc. 62c394ca7SJames Schulman * 72c394ca7SJames Schulman * Author: James Schulman <james.schulman@cirrus.com> 82c394ca7SJames Schulman * Author: Brian Austin <brian.austin@cirrus.com> 92c394ca7SJames Schulman * Author: Michael White <michael.white@cirrus.com> 102c394ca7SJames Schulman */ 112c394ca7SJames Schulman 122c394ca7SJames Schulman #ifndef __CS42L42_H__ 132c394ca7SJames Schulman #define __CS42L42_H__ 142c394ca7SJames Schulman 15c5b8ee08SLucas Tanure #include <sound/jack.h> 16c5b8ee08SLucas Tanure 172c394ca7SJames Schulman #define CS42L42_PAGE_REGISTER 0x00 /* Page Select Register */ 182c394ca7SJames Schulman #define CS42L42_WIN_START 0x00 192c394ca7SJames Schulman #define CS42L42_WIN_LEN 0x100 202c394ca7SJames Schulman #define CS42L42_RANGE_MIN 0x00 212c394ca7SJames Schulman #define CS42L42_RANGE_MAX 0x7F 222c394ca7SJames Schulman 232c394ca7SJames Schulman #define CS42L42_PAGE_10 0x1000 242c394ca7SJames Schulman #define CS42L42_PAGE_11 0x1100 252c394ca7SJames Schulman #define CS42L42_PAGE_12 0x1200 262c394ca7SJames Schulman #define CS42L42_PAGE_13 0x1300 272c394ca7SJames Schulman #define CS42L42_PAGE_15 0x1500 282c394ca7SJames Schulman #define CS42L42_PAGE_19 0x1900 292c394ca7SJames Schulman #define CS42L42_PAGE_1B 0x1B00 302c394ca7SJames Schulman #define CS42L42_PAGE_1C 0x1C00 312c394ca7SJames Schulman #define CS42L42_PAGE_1D 0x1D00 322c394ca7SJames Schulman #define CS42L42_PAGE_1F 0x1F00 332c394ca7SJames Schulman #define CS42L42_PAGE_20 0x2000 342c394ca7SJames Schulman #define CS42L42_PAGE_21 0x2100 352c394ca7SJames Schulman #define CS42L42_PAGE_23 0x2300 362c394ca7SJames Schulman #define CS42L42_PAGE_24 0x2400 372c394ca7SJames Schulman #define CS42L42_PAGE_25 0x2500 382c394ca7SJames Schulman #define CS42L42_PAGE_26 0x2600 392c394ca7SJames Schulman #define CS42L42_PAGE_28 0x2800 402c394ca7SJames Schulman #define CS42L42_PAGE_29 0x2900 412c394ca7SJames Schulman #define CS42L42_PAGE_2A 0x2A00 422c394ca7SJames Schulman #define CS42L42_PAGE_30 0x3000 432c394ca7SJames Schulman 442c394ca7SJames Schulman #define CS42L42_CHIP_ID 0x42A42 452c394ca7SJames Schulman 462c394ca7SJames Schulman /* Page 0x10 Global Registers */ 472c394ca7SJames Schulman #define CS42L42_DEVID_AB (CS42L42_PAGE_10 + 0x01) 482c394ca7SJames Schulman #define CS42L42_DEVID_CD (CS42L42_PAGE_10 + 0x02) 492c394ca7SJames Schulman #define CS42L42_DEVID_E (CS42L42_PAGE_10 + 0x03) 502c394ca7SJames Schulman #define CS42L42_FABID (CS42L42_PAGE_10 + 0x04) 512c394ca7SJames Schulman #define CS42L42_REVID (CS42L42_PAGE_10 + 0x05) 522c394ca7SJames Schulman #define CS42L42_FRZ_CTL (CS42L42_PAGE_10 + 0x06) 532c394ca7SJames Schulman 542c394ca7SJames Schulman #define CS42L42_SRC_CTL (CS42L42_PAGE_10 + 0x07) 552c394ca7SJames Schulman #define CS42L42_SRC_BYPASS_DAC_SHIFT 1 562c394ca7SJames Schulman #define CS42L42_SRC_BYPASS_DAC_MASK (1 << CS42L42_SRC_BYPASS_DAC_SHIFT) 572c394ca7SJames Schulman 582c394ca7SJames Schulman #define CS42L42_MCLK_STATUS (CS42L42_PAGE_10 + 0x08) 592c394ca7SJames Schulman 602c394ca7SJames Schulman #define CS42L42_MCLK_CTL (CS42L42_PAGE_10 + 0x09) 612c394ca7SJames Schulman #define CS42L42_INTERNAL_FS_SHIFT 1 622c394ca7SJames Schulman #define CS42L42_INTERNAL_FS_MASK (1 << CS42L42_INTERNAL_FS_SHIFT) 632c394ca7SJames Schulman 642c394ca7SJames Schulman #define CS42L42_SFTRAMP_RATE (CS42L42_PAGE_10 + 0x0A) 652c394ca7SJames Schulman #define CS42L42_I2C_DEBOUNCE (CS42L42_PAGE_10 + 0x0E) 662c394ca7SJames Schulman #define CS42L42_I2C_STRETCH (CS42L42_PAGE_10 + 0x0F) 672c394ca7SJames Schulman #define CS42L42_I2C_TIMEOUT (CS42L42_PAGE_10 + 0x10) 682c394ca7SJames Schulman 692c394ca7SJames Schulman /* Page 0x11 Power and Headset Detect Registers */ 702c394ca7SJames Schulman #define CS42L42_PWR_CTL1 (CS42L42_PAGE_11 + 0x01) 712c394ca7SJames Schulman #define CS42L42_ASP_DAO_PDN_SHIFT 7 722c394ca7SJames Schulman #define CS42L42_ASP_DAO_PDN_MASK (1 << CS42L42_ASP_DAO_PDN_SHIFT) 732c394ca7SJames Schulman #define CS42L42_ASP_DAI_PDN_SHIFT 6 742c394ca7SJames Schulman #define CS42L42_ASP_DAI_PDN_MASK (1 << CS42L42_ASP_DAI_PDN_SHIFT) 752c394ca7SJames Schulman #define CS42L42_MIXER_PDN_SHIFT 5 762c394ca7SJames Schulman #define CS42L42_MIXER_PDN_MASK (1 << CS42L42_MIXER_PDN_SHIFT) 772c394ca7SJames Schulman #define CS42L42_EQ_PDN_SHIFT 4 782c394ca7SJames Schulman #define CS42L42_EQ_PDN_MASK (1 << CS42L42_EQ_PDN_SHIFT) 792c394ca7SJames Schulman #define CS42L42_HP_PDN_SHIFT 3 802c394ca7SJames Schulman #define CS42L42_HP_PDN_MASK (1 << CS42L42_HP_PDN_SHIFT) 812c394ca7SJames Schulman #define CS42L42_ADC_PDN_SHIFT 2 822c394ca7SJames Schulman #define CS42L42_ADC_PDN_MASK (1 << CS42L42_HP_PDN_SHIFT) 832c394ca7SJames Schulman #define CS42L42_PDN_ALL_SHIFT 0 842c394ca7SJames Schulman #define CS42L42_PDN_ALL_MASK (1 << CS42L42_PDN_ALL_SHIFT) 852c394ca7SJames Schulman 862c394ca7SJames Schulman #define CS42L42_PWR_CTL2 (CS42L42_PAGE_11 + 0x02) 872c394ca7SJames Schulman #define CS42L42_ADC_SRC_PDNB_SHIFT 0 882c394ca7SJames Schulman #define CS42L42_ADC_SRC_PDNB_MASK (1 << CS42L42_ADC_SRC_PDNB_SHIFT) 892c394ca7SJames Schulman #define CS42L42_DAC_SRC_PDNB_SHIFT 1 902c394ca7SJames Schulman #define CS42L42_DAC_SRC_PDNB_MASK (1 << CS42L42_DAC_SRC_PDNB_SHIFT) 912c394ca7SJames Schulman #define CS42L42_ASP_DAI1_PDN_SHIFT 2 922c394ca7SJames Schulman #define CS42L42_ASP_DAI1_PDN_MASK (1 << CS42L42_ASP_DAI1_PDN_SHIFT) 932c394ca7SJames Schulman #define CS42L42_SRC_PDN_OVERRIDE_SHIFT 3 942c394ca7SJames Schulman #define CS42L42_SRC_PDN_OVERRIDE_MASK (1 << CS42L42_SRC_PDN_OVERRIDE_SHIFT) 952c394ca7SJames Schulman #define CS42L42_DISCHARGE_FILT_SHIFT 4 962c394ca7SJames Schulman #define CS42L42_DISCHARGE_FILT_MASK (1 << CS42L42_DISCHARGE_FILT_SHIFT) 972c394ca7SJames Schulman 982c394ca7SJames Schulman #define CS42L42_PWR_CTL3 (CS42L42_PAGE_11 + 0x03) 992c394ca7SJames Schulman #define CS42L42_RING_SENSE_PDNB_SHIFT 1 1002c394ca7SJames Schulman #define CS42L42_RING_SENSE_PDNB_MASK (1 << \ 1012c394ca7SJames Schulman CS42L42_RING_SENSE_PDNB_SHIFT) 1022c394ca7SJames Schulman #define CS42L42_VPMON_PDNB_SHIFT 2 1032c394ca7SJames Schulman #define CS42L42_VPMON_PDNB_MASK (1 << \ 1042c394ca7SJames Schulman CS42L42_VPMON_PDNB_SHIFT) 1052c394ca7SJames Schulman #define CS42L42_SW_CLK_STP_STAT_SEL_SHIFT 5 1062c394ca7SJames Schulman #define CS42L42_SW_CLK_STP_STAT_SEL_MASK (3 << \ 1072c394ca7SJames Schulman CS42L42_SW_CLK_STP_STAT_SEL_SHIFT) 1082c394ca7SJames Schulman 1092c394ca7SJames Schulman #define CS42L42_RSENSE_CTL1 (CS42L42_PAGE_11 + 0x04) 1102c394ca7SJames Schulman #define CS42L42_RS_TRIM_R_SHIFT 0 1112c394ca7SJames Schulman #define CS42L42_RS_TRIM_R_MASK (1 << \ 1122c394ca7SJames Schulman CS42L42_RS_TRIM_R_SHIFT) 1132c394ca7SJames Schulman #define CS42L42_RS_TRIM_T_SHIFT 1 1142c394ca7SJames Schulman #define CS42L42_RS_TRIM_T_MASK (1 << \ 1152c394ca7SJames Schulman CS42L42_RS_TRIM_T_SHIFT) 1162c394ca7SJames Schulman #define CS42L42_HPREF_RS_SHIFT 2 1172c394ca7SJames Schulman #define CS42L42_HPREF_RS_MASK (1 << \ 1182c394ca7SJames Schulman CS42L42_HPREF_RS_SHIFT) 1192c394ca7SJames Schulman #define CS42L42_HSBIAS_FILT_REF_RS_SHIFT 3 1202c394ca7SJames Schulman #define CS42L42_HSBIAS_FILT_REF_RS_MASK (1 << \ 1212c394ca7SJames Schulman CS42L42_HSBIAS_FILT_REF_RS_SHIFT) 1222c394ca7SJames Schulman #define CS42L42_RING_SENSE_PU_HIZ_SHIFT 6 1232c394ca7SJames Schulman #define CS42L42_RING_SENSE_PU_HIZ_MASK (1 << \ 1242c394ca7SJames Schulman CS42L42_RING_SENSE_PU_HIZ_SHIFT) 1252c394ca7SJames Schulman 1262c394ca7SJames Schulman #define CS42L42_RSENSE_CTL2 (CS42L42_PAGE_11 + 0x05) 1272c394ca7SJames Schulman #define CS42L42_TS_RS_GATE_SHIFT 7 1282c394ca7SJames Schulman #define CS42L42_TS_RS_GATE_MAS (1 << CS42L42_TS_RS_GATE_SHIFT) 1292c394ca7SJames Schulman 1302c394ca7SJames Schulman #define CS42L42_OSC_SWITCH (CS42L42_PAGE_11 + 0x07) 1312c394ca7SJames Schulman #define CS42L42_SCLK_PRESENT_SHIFT 0 1322c394ca7SJames Schulman #define CS42L42_SCLK_PRESENT_MASK (1 << CS42L42_SCLK_PRESENT_SHIFT) 1332c394ca7SJames Schulman 1342c394ca7SJames Schulman #define CS42L42_OSC_SWITCH_STATUS (CS42L42_PAGE_11 + 0x09) 1352c394ca7SJames Schulman #define CS42L42_OSC_SW_SEL_STAT_SHIFT 0 1362c394ca7SJames Schulman #define CS42L42_OSC_SW_SEL_STAT_MASK (3 << CS42L42_OSC_SW_SEL_STAT_SHIFT) 1372c394ca7SJames Schulman #define CS42L42_OSC_PDNB_STAT_SHIFT 2 1382c394ca7SJames Schulman #define CS42L42_OSC_PDNB_STAT_MASK (1 << CS42L42_OSC_SW_SEL_STAT_SHIFT) 1392c394ca7SJames Schulman 1402c394ca7SJames Schulman #define CS42L42_RSENSE_CTL3 (CS42L42_PAGE_11 + 0x12) 1412c394ca7SJames Schulman #define CS42L42_RS_RISE_DBNCE_TIME_SHIFT 0 1422c394ca7SJames Schulman #define CS42L42_RS_RISE_DBNCE_TIME_MASK (7 << \ 1432c394ca7SJames Schulman CS42L42_RS_RISE_DBNCE_TIME_SHIFT) 1442c394ca7SJames Schulman #define CS42L42_RS_FALL_DBNCE_TIME_SHIFT 3 1452c394ca7SJames Schulman #define CS42L42_RS_FALL_DBNCE_TIME_MASK (7 << \ 1462c394ca7SJames Schulman CS42L42_RS_FALL_DBNCE_TIME_SHIFT) 1472c394ca7SJames Schulman #define CS42L42_RS_PU_EN_SHIFT 6 1482c394ca7SJames Schulman #define CS42L42_RS_PU_EN_MASK (1 << \ 1492c394ca7SJames Schulman CS42L42_RS_PU_EN_SHIFT) 1502c394ca7SJames Schulman #define CS42L42_RS_INV_SHIFT 7 1512c394ca7SJames Schulman #define CS42L42_RS_INV_MASK (1 << \ 1522c394ca7SJames Schulman CS42L42_RS_INV_SHIFT) 1532c394ca7SJames Schulman 1542c394ca7SJames Schulman #define CS42L42_TSENSE_CTL (CS42L42_PAGE_11 + 0x13) 1552c394ca7SJames Schulman #define CS42L42_TS_RISE_DBNCE_TIME_SHIFT 0 1562c394ca7SJames Schulman #define CS42L42_TS_RISE_DBNCE_TIME_MASK (7 << \ 1572c394ca7SJames Schulman CS42L42_TS_RISE_DBNCE_TIME_SHIFT) 1582c394ca7SJames Schulman #define CS42L42_TS_FALL_DBNCE_TIME_SHIFT 3 1592c394ca7SJames Schulman #define CS42L42_TS_FALL_DBNCE_TIME_MASK (7 << \ 1602c394ca7SJames Schulman CS42L42_TS_FALL_DBNCE_TIME_SHIFT) 1612c394ca7SJames Schulman #define CS42L42_TS_INV_SHIFT 7 1622c394ca7SJames Schulman #define CS42L42_TS_INV_MASK (1 << \ 1632c394ca7SJames Schulman CS42L42_TS_INV_SHIFT) 1642c394ca7SJames Schulman 1652c394ca7SJames Schulman #define CS42L42_TSRS_INT_DISABLE (CS42L42_PAGE_11 + 0x14) 1662c394ca7SJames Schulman #define CS42L42_D_RS_PLUG_DBNC_SHIFT 0 1672c394ca7SJames Schulman #define CS42L42_D_RS_PLUG_DBNC_MASK (1 << CS42L42_D_RS_PLUG_DBNC_SHIFT) 1682c394ca7SJames Schulman #define CS42L42_D_RS_UNPLUG_DBNC_SHIFT 1 1692c394ca7SJames Schulman #define CS42L42_D_RS_UNPLUG_DBNC_MASK (1 << CS42L42_D_RS_UNPLUG_DBNC_SHIFT) 1702c394ca7SJames Schulman #define CS42L42_D_TS_PLUG_DBNC_SHIFT 2 1712c394ca7SJames Schulman #define CS42L42_D_TS_PLUG_DBNC_MASK (1 << CS42L42_D_TS_PLUG_DBNC_SHIFT) 1722c394ca7SJames Schulman #define CS42L42_D_TS_UNPLUG_DBNC_SHIFT 3 1732c394ca7SJames Schulman #define CS42L42_D_TS_UNPLUG_DBNC_MASK (1 << CS42L42_D_TS_UNPLUG_DBNC_SHIFT) 1742c394ca7SJames Schulman 1752c394ca7SJames Schulman #define CS42L42_TRSENSE_STATUS (CS42L42_PAGE_11 + 0x15) 1762c394ca7SJames Schulman #define CS42L42_RS_PLUG_DBNC_SHIFT 0 1772c394ca7SJames Schulman #define CS42L42_RS_PLUG_DBNC_MASK (1 << CS42L42_RS_PLUG_DBNC_SHIFT) 1782c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_DBNC_SHIFT 1 1792c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_DBNC_MASK (1 << CS42L42_RS_UNPLUG_DBNC_SHIFT) 1802c394ca7SJames Schulman #define CS42L42_TS_PLUG_DBNC_SHIFT 2 1812c394ca7SJames Schulman #define CS42L42_TS_PLUG_DBNC_MASK (1 << CS42L42_TS_PLUG_DBNC_SHIFT) 1822c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_DBNC_SHIFT 3 1832c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_DBNC_MASK (1 << CS42L42_TS_UNPLUG_DBNC_SHIFT) 1842c394ca7SJames Schulman 1852c394ca7SJames Schulman #define CS42L42_HSDET_CTL1 (CS42L42_PAGE_11 + 0x1F) 1862c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_LVL_SHIFT 0 1872c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_LVL_MASK (15 << CS42L42_HSDET_COMP1_LVL_SHIFT) 1882c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_LVL_SHIFT 4 1892c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_LVL_MASK (15 << CS42L42_HSDET_COMP2_LVL_SHIFT) 1902c394ca7SJames Schulman 1912c394ca7SJames Schulman #define CS42L42_HSDET_CTL2 (CS42L42_PAGE_11 + 0x20) 1922c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_TIME_SHIFT 0 1932c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_TIME_MASK (3 << CS42L42_HSDET_AUTO_TIME_SHIFT) 1942c394ca7SJames Schulman #define CS42L42_HSBIAS_REF_SHIFT 3 1952c394ca7SJames Schulman #define CS42L42_HSBIAS_REF_MASK (1 << CS42L42_HSBIAS_REF_SHIFT) 1962c394ca7SJames Schulman #define CS42L42_HSDET_SET_SHIFT 4 1972c394ca7SJames Schulman #define CS42L42_HSDET_SET_MASK (3 << CS42L42_HSDET_SET_SHIFT) 1982c394ca7SJames Schulman #define CS42L42_HSDET_CTRL_SHIFT 6 1992c394ca7SJames Schulman #define CS42L42_HSDET_CTRL_MASK (3 << CS42L42_HSDET_CTRL_SHIFT) 2002c394ca7SJames Schulman 2012c394ca7SJames Schulman #define CS42L42_HS_SWITCH_CTL (CS42L42_PAGE_11 + 0x21) 2022c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS4_SHIFT 0 2032c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS4_MASK (1 << CS42L42_SW_GNDHS_HS4_SHIFT) 2042c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS3_SHIFT 1 2052c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS3_MASK (1 << CS42L42_SW_GNDHS_HS3_SHIFT) 2062c394ca7SJames Schulman #define CS42L42_SW_HSB_HS4_SHIFT 2 2072c394ca7SJames Schulman #define CS42L42_SW_HSB_HS4_MASK (1 << CS42L42_SW_HSB_HS4_SHIFT) 2082c394ca7SJames Schulman #define CS42L42_SW_HSB_HS3_SHIFT 3 2092c394ca7SJames Schulman #define CS42L42_SW_HSB_HS3_MASK (1 << CS42L42_SW_HSB_HS3_SHIFT) 2102c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS4_SHIFT 4 2112c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS4_MASK (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) 2122c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS3_SHIFT 5 2132c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS3_MASK (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) 2142c394ca7SJames Schulman #define CS42L42_SW_REF_HS4_SHIFT 6 2152c394ca7SJames Schulman #define CS42L42_SW_REF_HS4_MASK (1 << CS42L42_SW_REF_HS4_SHIFT) 2162c394ca7SJames Schulman #define CS42L42_SW_REF_HS3_SHIFT 7 2172c394ca7SJames Schulman #define CS42L42_SW_REF_HS3_MASK (1 << CS42L42_SW_REF_HS3_SHIFT) 2182c394ca7SJames Schulman 2192c394ca7SJames Schulman #define CS42L42_HS_DET_STATUS (CS42L42_PAGE_11 + 0x24) 2202c394ca7SJames Schulman #define CS42L42_HSDET_TYPE_SHIFT 0 2212c394ca7SJames Schulman #define CS42L42_HSDET_TYPE_MASK (3 << CS42L42_HSDET_TYPE_SHIFT) 2222c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_OUT_SHIFT 6 2232c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_OUT_MASK (1 << CS42L42_HSDET_COMP1_OUT_SHIFT) 2242c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_OUT_SHIFT 7 2252c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_OUT_MASK (1 << CS42L42_HSDET_COMP2_OUT_SHIFT) 2262c394ca7SJames Schulman #define CS42L42_PLUG_CTIA 0 2272c394ca7SJames Schulman #define CS42L42_PLUG_OMTP 1 2282c394ca7SJames Schulman #define CS42L42_PLUG_HEADPHONE 2 2292c394ca7SJames Schulman #define CS42L42_PLUG_INVALID 3 2302c394ca7SJames Schulman 2312c394ca7SJames Schulman #define CS42L42_HS_CLAMP_DISABLE (CS42L42_PAGE_11 + 0x29) 2322c394ca7SJames Schulman #define CS42L42_HS_CLAMP_DISABLE_SHIFT 0 2332c394ca7SJames Schulman #define CS42L42_HS_CLAMP_DISABLE_MASK (1 << CS42L42_HS_CLAMP_DISABLE_SHIFT) 2342c394ca7SJames Schulman 2352c394ca7SJames Schulman /* Page 0x12 Clocking Registers */ 2362c394ca7SJames Schulman #define CS42L42_MCLK_SRC_SEL (CS42L42_PAGE_12 + 0x01) 2372c394ca7SJames Schulman #define CS42L42_MCLKDIV_SHIFT 1 2382c394ca7SJames Schulman #define CS42L42_MCLKDIV_MASK (1 << CS42L42_MCLKDIV_SHIFT) 2392c394ca7SJames Schulman #define CS42L42_MCLK_SRC_SEL_SHIFT 0 2402c394ca7SJames Schulman #define CS42L42_MCLK_SRC_SEL_MASK (1 << CS42L42_MCLK_SRC_SEL_SHIFT) 2412c394ca7SJames Schulman 2422c394ca7SJames Schulman #define CS42L42_SPDIF_CLK_CFG (CS42L42_PAGE_12 + 0x02) 2432c394ca7SJames Schulman #define CS42L42_FSYNC_PW_LOWER (CS42L42_PAGE_12 + 0x03) 2442c394ca7SJames Schulman 2452c394ca7SJames Schulman #define CS42L42_FSYNC_PW_UPPER (CS42L42_PAGE_12 + 0x04) 2462c394ca7SJames Schulman #define CS42L42_FSYNC_PULSE_WIDTH_SHIFT 0 2472c394ca7SJames Schulman #define CS42L42_FSYNC_PULSE_WIDTH_MASK (0xff << \ 2482c394ca7SJames Schulman CS42L42_FSYNC_PULSE_WIDTH_SHIFT) 2492c394ca7SJames Schulman 2502c394ca7SJames Schulman #define CS42L42_FSYNC_P_LOWER (CS42L42_PAGE_12 + 0x05) 2512c394ca7SJames Schulman 2522c394ca7SJames Schulman #define CS42L42_FSYNC_P_UPPER (CS42L42_PAGE_12 + 0x06) 2532c394ca7SJames Schulman #define CS42L42_FSYNC_PERIOD_SHIFT 0 2542c394ca7SJames Schulman #define CS42L42_FSYNC_PERIOD_MASK (0xff << CS42L42_FSYNC_PERIOD_SHIFT) 2552c394ca7SJames Schulman 2562c394ca7SJames Schulman #define CS42L42_ASP_CLK_CFG (CS42L42_PAGE_12 + 0x07) 2572c394ca7SJames Schulman #define CS42L42_ASP_SCLK_EN_SHIFT 5 2582c394ca7SJames Schulman #define CS42L42_ASP_SCLK_EN_MASK (1 << CS42L42_ASP_SCLK_EN_SHIFT) 2592c394ca7SJames Schulman #define CS42L42_ASP_MASTER_MODE 0x01 2602c394ca7SJames Schulman #define CS42L42_ASP_SLAVE_MODE 0x00 2612c394ca7SJames Schulman #define CS42L42_ASP_MODE_SHIFT 4 2622c394ca7SJames Schulman #define CS42L42_ASP_MODE_MASK (1 << CS42L42_ASP_MODE_SHIFT) 263e793c965SLucas Tanure #define CS42L42_ASP_SCPOL_SHIFT 2 264e793c965SLucas Tanure #define CS42L42_ASP_SCPOL_MASK (3 << CS42L42_ASP_SCPOL_SHIFT) 265e793c965SLucas Tanure #define CS42L42_ASP_SCPOL_NOR 3 266e793c965SLucas Tanure #define CS42L42_ASP_LCPOL_SHIFT 0 267e793c965SLucas Tanure #define CS42L42_ASP_LCPOL_MASK (3 << CS42L42_ASP_LCPOL_SHIFT) 268e793c965SLucas Tanure #define CS42L42_ASP_LCPOL_INV 3 2692c394ca7SJames Schulman 2702c394ca7SJames Schulman #define CS42L42_ASP_FRM_CFG (CS42L42_PAGE_12 + 0x08) 2712c394ca7SJames Schulman #define CS42L42_ASP_STP_SHIFT 4 2722c394ca7SJames Schulman #define CS42L42_ASP_STP_MASK (1 << CS42L42_ASP_STP_SHIFT) 2732c394ca7SJames Schulman #define CS42L42_ASP_5050_SHIFT 3 2742c394ca7SJames Schulman #define CS42L42_ASP_5050_MASK (1 << CS42L42_ASP_5050_SHIFT) 2752c394ca7SJames Schulman #define CS42L42_ASP_FSD_SHIFT 0 2762c394ca7SJames Schulman #define CS42L42_ASP_FSD_MASK (7 << CS42L42_ASP_FSD_SHIFT) 2772c394ca7SJames Schulman #define CS42L42_ASP_FSD_0_5 1 2782c394ca7SJames Schulman #define CS42L42_ASP_FSD_1_0 2 2792c394ca7SJames Schulman #define CS42L42_ASP_FSD_1_5 3 2802c394ca7SJames Schulman #define CS42L42_ASP_FSD_2_0 4 2812c394ca7SJames Schulman 2822c394ca7SJames Schulman #define CS42L42_FS_RATE_EN (CS42L42_PAGE_12 + 0x09) 2832c394ca7SJames Schulman #define CS42L42_FS_EN_SHIFT 0 2842c394ca7SJames Schulman #define CS42L42_FS_EN_MASK (0xf << CS42L42_FS_EN_SHIFT) 2852c394ca7SJames Schulman #define CS42L42_FS_EN_IASRC_96K 0x1 2862c394ca7SJames Schulman #define CS42L42_FS_EN_OASRC_96K 0x2 2872c394ca7SJames Schulman 2882c394ca7SJames Schulman #define CS42L42_IN_ASRC_CLK (CS42L42_PAGE_12 + 0x0A) 2892c394ca7SJames Schulman #define CS42L42_CLK_IASRC_SEL_SHIFT 0 2902c394ca7SJames Schulman #define CS42L42_CLK_IASRC_SEL_MASK (1 << CS42L42_CLK_IASRC_SEL_SHIFT) 2912c394ca7SJames Schulman #define CS42L42_CLK_IASRC_SEL_12 1 2922c394ca7SJames Schulman 2932c394ca7SJames Schulman #define CS42L42_OUT_ASRC_CLK (CS42L42_PAGE_12 + 0x0B) 2942c394ca7SJames Schulman #define CS42L42_CLK_OASRC_SEL_SHIFT 0 2952c394ca7SJames Schulman #define CS42L42_CLK_OASRC_SEL_MASK (1 << CS42L42_CLK_OASRC_SEL_SHIFT) 2962c394ca7SJames Schulman #define CS42L42_CLK_OASRC_SEL_12 1 2972c394ca7SJames Schulman 2982c394ca7SJames Schulman #define CS42L42_PLL_DIV_CFG1 (CS42L42_PAGE_12 + 0x0C) 2992c394ca7SJames Schulman #define CS42L42_SCLK_PREDIV_SHIFT 0 3002c394ca7SJames Schulman #define CS42L42_SCLK_PREDIV_MASK (3 << CS42L42_SCLK_PREDIV_SHIFT) 3012c394ca7SJames Schulman 3022c394ca7SJames Schulman /* Page 0x13 Interrupt Registers */ 3032c394ca7SJames Schulman /* Interrupts */ 3042c394ca7SJames Schulman #define CS42L42_ADC_OVFL_STATUS (CS42L42_PAGE_13 + 0x01) 3052c394ca7SJames Schulman #define CS42L42_MIXER_STATUS (CS42L42_PAGE_13 + 0x02) 3062c394ca7SJames Schulman #define CS42L42_SRC_STATUS (CS42L42_PAGE_13 + 0x03) 3072c394ca7SJames Schulman #define CS42L42_ASP_RX_STATUS (CS42L42_PAGE_13 + 0x04) 3082c394ca7SJames Schulman #define CS42L42_ASP_TX_STATUS (CS42L42_PAGE_13 + 0x05) 3092c394ca7SJames Schulman #define CS42L42_CODEC_STATUS (CS42L42_PAGE_13 + 0x08) 3102c394ca7SJames Schulman #define CS42L42_DET_INT_STATUS1 (CS42L42_PAGE_13 + 0x09) 3112c394ca7SJames Schulman #define CS42L42_DET_INT_STATUS2 (CS42L42_PAGE_13 + 0x0A) 3122c394ca7SJames Schulman #define CS42L42_SRCPL_INT_STATUS (CS42L42_PAGE_13 + 0x0B) 3132c394ca7SJames Schulman #define CS42L42_VPMON_STATUS (CS42L42_PAGE_13 + 0x0D) 3142c394ca7SJames Schulman #define CS42L42_PLL_LOCK_STATUS (CS42L42_PAGE_13 + 0x0E) 3152c394ca7SJames Schulman #define CS42L42_TSRS_PLUG_STATUS (CS42L42_PAGE_13 + 0x0F) 3162c394ca7SJames Schulman /* Masks */ 3172c394ca7SJames Schulman #define CS42L42_ADC_OVFL_INT_MASK (CS42L42_PAGE_13 + 0x16) 3182c394ca7SJames Schulman #define CS42L42_ADC_OVFL_SHIFT 0 3192c394ca7SJames Schulman #define CS42L42_ADC_OVFL_MASK (1 << CS42L42_ADC_OVFL_SHIFT) 3202c394ca7SJames Schulman #define CS42L42_ADC_OVFL_VAL_MASK CS42L42_ADC_OVFL_MASK 3212c394ca7SJames Schulman 3222c394ca7SJames Schulman #define CS42L42_MIXER_INT_MASK (CS42L42_PAGE_13 + 0x17) 3232c394ca7SJames Schulman #define CS42L42_MIX_CHB_OVFL_SHIFT 0 3242c394ca7SJames Schulman #define CS42L42_MIX_CHB_OVFL_MASK (1 << CS42L42_MIX_CHB_OVFL_SHIFT) 3252c394ca7SJames Schulman #define CS42L42_MIX_CHA_OVFL_SHIFT 1 3262c394ca7SJames Schulman #define CS42L42_MIX_CHA_OVFL_MASK (1 << CS42L42_MIX_CHA_OVFL_SHIFT) 3272c394ca7SJames Schulman #define CS42L42_EQ_OVFL_SHIFT 2 3282c394ca7SJames Schulman #define CS42L42_EQ_OVFL_MASK (1 << CS42L42_EQ_OVFL_SHIFT) 3292c394ca7SJames Schulman #define CS42L42_EQ_BIQUAD_OVFL_SHIFT 3 3302c394ca7SJames Schulman #define CS42L42_EQ_BIQUAD_OVFL_MASK (1 << CS42L42_EQ_BIQUAD_OVFL_SHIFT) 3312c394ca7SJames Schulman #define CS42L42_MIXER_VAL_MASK (CS42L42_MIX_CHB_OVFL_MASK | \ 3322c394ca7SJames Schulman CS42L42_MIX_CHA_OVFL_MASK | \ 3332c394ca7SJames Schulman CS42L42_EQ_OVFL_MASK | \ 3342c394ca7SJames Schulman CS42L42_EQ_BIQUAD_OVFL_MASK) 3352c394ca7SJames Schulman 3362c394ca7SJames Schulman #define CS42L42_SRC_INT_MASK (CS42L42_PAGE_13 + 0x18) 3372c394ca7SJames Schulman #define CS42L42_SRC_ILK_SHIFT 0 3382c394ca7SJames Schulman #define CS42L42_SRC_ILK_MASK (1 << CS42L42_SRC_ILK_SHIFT) 3392c394ca7SJames Schulman #define CS42L42_SRC_OLK_SHIFT 1 3402c394ca7SJames Schulman #define CS42L42_SRC_OLK_MASK (1 << CS42L42_SRC_OLK_SHIFT) 3412c394ca7SJames Schulman #define CS42L42_SRC_IUNLK_SHIFT 2 3422c394ca7SJames Schulman #define CS42L42_SRC_IUNLK_MASK (1 << CS42L42_SRC_IUNLK_SHIFT) 3432c394ca7SJames Schulman #define CS42L42_SRC_OUNLK_SHIFT 3 3442c394ca7SJames Schulman #define CS42L42_SRC_OUNLK_MASK (1 << CS42L42_SRC_OUNLK_SHIFT) 3452c394ca7SJames Schulman #define CS42L42_SRC_VAL_MASK (CS42L42_SRC_ILK_MASK | \ 3462c394ca7SJames Schulman CS42L42_SRC_OLK_MASK | \ 3472c394ca7SJames Schulman CS42L42_SRC_IUNLK_MASK | \ 3482c394ca7SJames Schulman CS42L42_SRC_OUNLK_MASK) 3492c394ca7SJames Schulman 3502c394ca7SJames Schulman #define CS42L42_ASP_RX_INT_MASK (CS42L42_PAGE_13 + 0x19) 3512c394ca7SJames Schulman #define CS42L42_ASPRX_NOLRCK_SHIFT 0 3522c394ca7SJames Schulman #define CS42L42_ASPRX_NOLRCK_MASK (1 << CS42L42_ASPRX_NOLRCK_SHIFT) 3532c394ca7SJames Schulman #define CS42L42_ASPRX_EARLY_SHIFT 1 3542c394ca7SJames Schulman #define CS42L42_ASPRX_EARLY_MASK (1 << CS42L42_ASPRX_EARLY_SHIFT) 3552c394ca7SJames Schulman #define CS42L42_ASPRX_LATE_SHIFT 2 3562c394ca7SJames Schulman #define CS42L42_ASPRX_LATE_MASK (1 << CS42L42_ASPRX_LATE_SHIFT) 3572c394ca7SJames Schulman #define CS42L42_ASPRX_ERROR_SHIFT 3 3582c394ca7SJames Schulman #define CS42L42_ASPRX_ERROR_MASK (1 << CS42L42_ASPRX_ERROR_SHIFT) 3592c394ca7SJames Schulman #define CS42L42_ASPRX_OVLD_SHIFT 4 3602c394ca7SJames Schulman #define CS42L42_ASPRX_OVLD_MASK (1 << CS42L42_ASPRX_OVLD_SHIFT) 3612c394ca7SJames Schulman #define CS42L42_ASP_RX_VAL_MASK (CS42L42_ASPRX_NOLRCK_MASK | \ 3622c394ca7SJames Schulman CS42L42_ASPRX_EARLY_MASK | \ 3632c394ca7SJames Schulman CS42L42_ASPRX_LATE_MASK | \ 3642c394ca7SJames Schulman CS42L42_ASPRX_ERROR_MASK | \ 3652c394ca7SJames Schulman CS42L42_ASPRX_OVLD_MASK) 3662c394ca7SJames Schulman 3672c394ca7SJames Schulman #define CS42L42_ASP_TX_INT_MASK (CS42L42_PAGE_13 + 0x1A) 3682c394ca7SJames Schulman #define CS42L42_ASPTX_NOLRCK_SHIFT 0 3692c394ca7SJames Schulman #define CS42L42_ASPTX_NOLRCK_MASK (1 << CS42L42_ASPTX_NOLRCK_SHIFT) 3702c394ca7SJames Schulman #define CS42L42_ASPTX_EARLY_SHIFT 1 3712c394ca7SJames Schulman #define CS42L42_ASPTX_EARLY_MASK (1 << CS42L42_ASPTX_EARLY_SHIFT) 3722c394ca7SJames Schulman #define CS42L42_ASPTX_LATE_SHIFT 2 3732c394ca7SJames Schulman #define CS42L42_ASPTX_LATE_MASK (1 << CS42L42_ASPTX_LATE_SHIFT) 3742c394ca7SJames Schulman #define CS42L42_ASPTX_SMERROR_SHIFT 3 3752c394ca7SJames Schulman #define CS42L42_ASPTX_SMERROR_MASK (1 << CS42L42_ASPTX_SMERROR_SHIFT) 3762c394ca7SJames Schulman #define CS42L42_ASP_TX_VAL_MASK (CS42L42_ASPTX_NOLRCK_MASK | \ 3772c394ca7SJames Schulman CS42L42_ASPTX_EARLY_MASK | \ 3782c394ca7SJames Schulman CS42L42_ASPTX_LATE_MASK | \ 3792c394ca7SJames Schulman CS42L42_ASPTX_SMERROR_MASK) 3802c394ca7SJames Schulman 3812c394ca7SJames Schulman #define CS42L42_CODEC_INT_MASK (CS42L42_PAGE_13 + 0x1B) 3822c394ca7SJames Schulman #define CS42L42_PDN_DONE_SHIFT 0 3832c394ca7SJames Schulman #define CS42L42_PDN_DONE_MASK (1 << CS42L42_PDN_DONE_SHIFT) 3842c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_DONE_SHIFT 1 3852c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_DONE_MASK (1 << CS42L42_HSDET_AUTO_DONE_SHIFT) 3862c394ca7SJames Schulman #define CS42L42_CODEC_VAL_MASK (CS42L42_PDN_DONE_MASK | \ 3872c394ca7SJames Schulman CS42L42_HSDET_AUTO_DONE_MASK) 3882c394ca7SJames Schulman 3892c394ca7SJames Schulman #define CS42L42_SRCPL_INT_MASK (CS42L42_PAGE_13 + 0x1C) 3902c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_LK_SHIFT 0 3912c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_LK_MASK (1 << CS42L42_SRCPL_ADC_LK_SHIFT) 3922c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_LK_SHIFT 2 3932c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_LK_MASK (1 << CS42L42_SRCPL_DAC_LK_SHIFT) 3942c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_UNLK_SHIFT 5 3952c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_UNLK_MASK (1 << CS42L42_SRCPL_ADC_UNLK_SHIFT) 3962c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_UNLK_SHIFT 6 3972c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_UNLK_MASK (1 << CS42L42_SRCPL_DAC_UNLK_SHIFT) 3982c394ca7SJames Schulman #define CS42L42_SRCPL_VAL_MASK (CS42L42_SRCPL_ADC_LK_MASK | \ 3992c394ca7SJames Schulman CS42L42_SRCPL_DAC_LK_MASK | \ 4002c394ca7SJames Schulman CS42L42_SRCPL_ADC_UNLK_MASK | \ 4012c394ca7SJames Schulman CS42L42_SRCPL_DAC_UNLK_MASK) 4022c394ca7SJames Schulman 4032c394ca7SJames Schulman #define CS42L42_VPMON_INT_MASK (CS42L42_PAGE_13 + 0x1E) 4042c394ca7SJames Schulman #define CS42L42_VPMON_SHIFT 0 4052c394ca7SJames Schulman #define CS42L42_VPMON_MASK (1 << CS42L42_VPMON_SHIFT) 4062c394ca7SJames Schulman #define CS42L42_VPMON_VAL_MASK CS42L42_VPMON_MASK 4072c394ca7SJames Schulman 4082c394ca7SJames Schulman #define CS42L42_PLL_LOCK_INT_MASK (CS42L42_PAGE_13 + 0x1F) 4092c394ca7SJames Schulman #define CS42L42_PLL_LOCK_SHIFT 0 4102c394ca7SJames Schulman #define CS42L42_PLL_LOCK_MASK (1 << CS42L42_PLL_LOCK_SHIFT) 4112c394ca7SJames Schulman #define CS42L42_PLL_LOCK_VAL_MASK CS42L42_PLL_LOCK_MASK 4122c394ca7SJames Schulman 4132c394ca7SJames Schulman #define CS42L42_TSRS_PLUG_INT_MASK (CS42L42_PAGE_13 + 0x20) 4142c394ca7SJames Schulman #define CS42L42_RS_PLUG_SHIFT 0 4152c394ca7SJames Schulman #define CS42L42_RS_PLUG_MASK (1 << CS42L42_RS_PLUG_SHIFT) 4162c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_SHIFT 1 4172c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_MASK (1 << CS42L42_RS_UNPLUG_SHIFT) 4182c394ca7SJames Schulman #define CS42L42_TS_PLUG_SHIFT 2 4192c394ca7SJames Schulman #define CS42L42_TS_PLUG_MASK (1 << CS42L42_TS_PLUG_SHIFT) 4202c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_SHIFT 3 4212c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_MASK (1 << CS42L42_TS_UNPLUG_SHIFT) 4222c394ca7SJames Schulman #define CS42L42_TSRS_PLUG_VAL_MASK (CS42L42_RS_PLUG_MASK | \ 4232c394ca7SJames Schulman CS42L42_RS_UNPLUG_MASK | \ 4242c394ca7SJames Schulman CS42L42_TS_PLUG_MASK | \ 4252c394ca7SJames Schulman CS42L42_TS_UNPLUG_MASK) 4262c394ca7SJames Schulman #define CS42L42_TS_PLUG 3 4272c394ca7SJames Schulman #define CS42L42_TS_UNPLUG 0 4282c394ca7SJames Schulman #define CS42L42_TS_TRANS 1 4292c394ca7SJames Schulman 4302c394ca7SJames Schulman /* Page 0x15 Fractional-N PLL Registers */ 4312c394ca7SJames Schulman #define CS42L42_PLL_CTL1 (CS42L42_PAGE_15 + 0x01) 4322c394ca7SJames Schulman #define CS42L42_PLL_START_SHIFT 0 4332c394ca7SJames Schulman #define CS42L42_PLL_START_MASK (1 << CS42L42_PLL_START_SHIFT) 4342c394ca7SJames Schulman 4352c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC0 (CS42L42_PAGE_15 + 0x02) 4362c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC_SHIFT 0 4372c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC_MASK (0xff << CS42L42_PLL_DIV_FRAC_SHIFT) 4382c394ca7SJames Schulman 4392c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC1 (CS42L42_PAGE_15 + 0x03) 4402c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC2 (CS42L42_PAGE_15 + 0x04) 4412c394ca7SJames Schulman 4422c394ca7SJames Schulman #define CS42L42_PLL_DIV_INT (CS42L42_PAGE_15 + 0x05) 4432c394ca7SJames Schulman #define CS42L42_PLL_DIV_INT_SHIFT 0 4442c394ca7SJames Schulman #define CS42L42_PLL_DIV_INT_MASK (0xff << CS42L42_PLL_DIV_INT_SHIFT) 4452c394ca7SJames Schulman 4462c394ca7SJames Schulman #define CS42L42_PLL_CTL3 (CS42L42_PAGE_15 + 0x08) 4472c394ca7SJames Schulman #define CS42L42_PLL_DIVOUT_SHIFT 0 4482c394ca7SJames Schulman #define CS42L42_PLL_DIVOUT_MASK (0xff << CS42L42_PLL_DIVOUT_SHIFT) 4492c394ca7SJames Schulman 4502c394ca7SJames Schulman #define CS42L42_PLL_CAL_RATIO (CS42L42_PAGE_15 + 0x0A) 4512c394ca7SJames Schulman #define CS42L42_PLL_CAL_RATIO_SHIFT 0 4522c394ca7SJames Schulman #define CS42L42_PLL_CAL_RATIO_MASK (0xff << CS42L42_PLL_CAL_RATIO_SHIFT) 4532c394ca7SJames Schulman 4542c394ca7SJames Schulman #define CS42L42_PLL_CTL4 (CS42L42_PAGE_15 + 0x1B) 4552c394ca7SJames Schulman #define CS42L42_PLL_MODE_SHIFT 0 4562c394ca7SJames Schulman #define CS42L42_PLL_MODE_MASK (3 << CS42L42_PLL_MODE_SHIFT) 4572c394ca7SJames Schulman 4582c394ca7SJames Schulman /* Page 0x19 HP Load Detect Registers */ 4592c394ca7SJames Schulman #define CS42L42_LOAD_DET_RCSTAT (CS42L42_PAGE_19 + 0x25) 4602c394ca7SJames Schulman #define CS42L42_RLA_STAT_SHIFT 0 4612c394ca7SJames Schulman #define CS42L42_RLA_STAT_MASK (3 << CS42L42_RLA_STAT_SHIFT) 4622c394ca7SJames Schulman #define CS42L42_RLA_STAT_15_OHM 0 4632c394ca7SJames Schulman 4642c394ca7SJames Schulman #define CS42L42_LOAD_DET_DONE (CS42L42_PAGE_19 + 0x26) 4652c394ca7SJames Schulman #define CS42L42_HPLOAD_DET_DONE_SHIFT 0 4662c394ca7SJames Schulman #define CS42L42_HPLOAD_DET_DONE_MASK (1 << CS42L42_HPLOAD_DET_DONE_SHIFT) 4672c394ca7SJames Schulman 4682c394ca7SJames Schulman #define CS42L42_LOAD_DET_EN (CS42L42_PAGE_19 + 0x27) 4692c394ca7SJames Schulman #define CS42L42_HP_LD_EN_SHIFT 0 4702c394ca7SJames Schulman #define CS42L42_HP_LD_EN_MASK (1 << CS42L42_HP_LD_EN_SHIFT) 4712c394ca7SJames Schulman 4722c394ca7SJames Schulman /* Page 0x1B Headset Interface Registers */ 4732c394ca7SJames Schulman #define CS42L42_HSBIAS_SC_AUTOCTL (CS42L42_PAGE_1B + 0x70) 4742c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_TRIP_SHIFT 0 4752c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_TRIP_MASK (7 << \ 4762c394ca7SJames Schulman CS42L42_HSBIAS_SENSE_TRIP_SHIFT) 4772c394ca7SJames Schulman #define CS42L42_TIP_SENSE_EN_SHIFT 5 4782c394ca7SJames Schulman #define CS42L42_TIP_SENSE_EN_MASK (1 << \ 4792c394ca7SJames Schulman CS42L42_TIP_SENSE_EN_SHIFT) 4802c394ca7SJames Schulman #define CS42L42_AUTO_HSBIAS_HIZ_SHIFT 6 4812c394ca7SJames Schulman #define CS42L42_AUTO_HSBIAS_HIZ_MASK (1 << \ 4822c394ca7SJames Schulman CS42L42_AUTO_HSBIAS_HIZ_SHIFT) 4832c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_EN_SHIFT 7 4842c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_EN_MASK (1 << \ 4852c394ca7SJames Schulman CS42L42_HSBIAS_SENSE_EN_SHIFT) 4862c394ca7SJames Schulman 4872c394ca7SJames Schulman #define CS42L42_WAKE_CTL (CS42L42_PAGE_1B + 0x71) 4882c394ca7SJames Schulman #define CS42L42_WAKEB_CLEAR_SHIFT 0 4892c394ca7SJames Schulman #define CS42L42_WAKEB_CLEAR_MASK (1 << CS42L42_WAKEB_CLEAR_SHIFT) 4902c394ca7SJames Schulman #define CS42L42_WAKEB_MODE_SHIFT 5 4912c394ca7SJames Schulman #define CS42L42_WAKEB_MODE_MASK (1 << CS42L42_WAKEB_MODE_SHIFT) 4922c394ca7SJames Schulman #define CS42L42_M_HP_WAKE_SHIFT 6 4932c394ca7SJames Schulman #define CS42L42_M_HP_WAKE_MASK (1 << CS42L42_M_HP_WAKE_SHIFT) 4942c394ca7SJames Schulman #define CS42L42_M_MIC_WAKE_SHIFT 7 4952c394ca7SJames Schulman #define CS42L42_M_MIC_WAKE_MASK (1 << CS42L42_M_MIC_WAKE_SHIFT) 4962c394ca7SJames Schulman 4972c394ca7SJames Schulman #define CS42L42_ADC_DISABLE_MUTE (CS42L42_PAGE_1B + 0x72) 4982c394ca7SJames Schulman #define CS42L42_ADC_DISABLE_S0_MUTE_SHIFT 7 4992c394ca7SJames Schulman #define CS42L42_ADC_DISABLE_S0_MUTE_MASK (1 << \ 5002c394ca7SJames Schulman CS42L42_ADC_DISABLE_S0_MUTE_SHIFT) 5012c394ca7SJames Schulman 5022c394ca7SJames Schulman #define CS42L42_TIPSENSE_CTL (CS42L42_PAGE_1B + 0x73) 5032c394ca7SJames Schulman #define CS42L42_TIP_SENSE_DEBOUNCE_SHIFT 0 5042c394ca7SJames Schulman #define CS42L42_TIP_SENSE_DEBOUNCE_MASK (3 << \ 5052c394ca7SJames Schulman CS42L42_TIP_SENSE_DEBOUNCE_SHIFT) 5062c394ca7SJames Schulman #define CS42L42_TIP_SENSE_INV_SHIFT 5 5072c394ca7SJames Schulman #define CS42L42_TIP_SENSE_INV_MASK (1 << \ 5082c394ca7SJames Schulman CS42L42_TIP_SENSE_INV_SHIFT) 5092c394ca7SJames Schulman #define CS42L42_TIP_SENSE_CTRL_SHIFT 6 5102c394ca7SJames Schulman #define CS42L42_TIP_SENSE_CTRL_MASK (3 << \ 5112c394ca7SJames Schulman CS42L42_TIP_SENSE_CTRL_SHIFT) 5122c394ca7SJames Schulman 5132c394ca7SJames Schulman #define CS42L42_MISC_DET_CTL (CS42L42_PAGE_1B + 0x74) 5142c394ca7SJames Schulman #define CS42L42_PDN_MIC_LVL_DET_SHIFT 0 5152c394ca7SJames Schulman #define CS42L42_PDN_MIC_LVL_DET_MASK (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT) 5162c394ca7SJames Schulman #define CS42L42_HSBIAS_CTL_SHIFT 1 5172c394ca7SJames Schulman #define CS42L42_HSBIAS_CTL_MASK (3 << CS42L42_HSBIAS_CTL_SHIFT) 5182c394ca7SJames Schulman #define CS42L42_DETECT_MODE_SHIFT 3 5192c394ca7SJames Schulman #define CS42L42_DETECT_MODE_MASK (3 << CS42L42_DETECT_MODE_SHIFT) 5202c394ca7SJames Schulman 5212c394ca7SJames Schulman #define CS42L42_MIC_DET_CTL1 (CS42L42_PAGE_1B + 0x75) 5222c394ca7SJames Schulman #define CS42L42_HS_DET_LEVEL_SHIFT 0 5232c394ca7SJames Schulman #define CS42L42_HS_DET_LEVEL_MASK (0x3F << CS42L42_HS_DET_LEVEL_SHIFT) 5242c394ca7SJames Schulman #define CS42L42_EVENT_STAT_SEL_SHIFT 6 5252c394ca7SJames Schulman #define CS42L42_EVENT_STAT_SEL_MASK (1 << CS42L42_EVENT_STAT_SEL_SHIFT) 5262c394ca7SJames Schulman #define CS42L42_LATCH_TO_VP_SHIFT 7 5272c394ca7SJames Schulman #define CS42L42_LATCH_TO_VP_MASK (1 << CS42L42_LATCH_TO_VP_SHIFT) 5282c394ca7SJames Schulman 5292c394ca7SJames Schulman #define CS42L42_MIC_DET_CTL2 (CS42L42_PAGE_1B + 0x76) 5302c394ca7SJames Schulman #define CS42L42_DEBOUNCE_TIME_SHIFT 5 5312c394ca7SJames Schulman #define CS42L42_DEBOUNCE_TIME_MASK (0x07 << CS42L42_DEBOUNCE_TIME_SHIFT) 5322c394ca7SJames Schulman 5332c394ca7SJames Schulman #define CS42L42_DET_STATUS1 (CS42L42_PAGE_1B + 0x77) 5342c394ca7SJames Schulman #define CS42L42_HSBIAS_HIZ_MODE_SHIFT 6 5352c394ca7SJames Schulman #define CS42L42_HSBIAS_HIZ_MODE_MASK (1 << CS42L42_HSBIAS_HIZ_MODE_SHIFT) 5362c394ca7SJames Schulman #define CS42L42_TIP_SENSE_SHIFT 7 5372c394ca7SJames Schulman #define CS42L42_TIP_SENSE_MASK (1 << CS42L42_TIP_SENSE_SHIFT) 5382c394ca7SJames Schulman 5392c394ca7SJames Schulman #define CS42L42_DET_STATUS2 (CS42L42_PAGE_1B + 0x78) 5402c394ca7SJames Schulman #define CS42L42_SHORT_TRUE_SHIFT 0 5412c394ca7SJames Schulman #define CS42L42_SHORT_TRUE_MASK (1 << CS42L42_SHORT_TRUE_SHIFT) 5422c394ca7SJames Schulman #define CS42L42_HS_TRUE_SHIFT 1 5432c394ca7SJames Schulman #define CS42L42_HS_TRUE_MASK (1 << CS42L42_HS_TRUE_SHIFT) 5442c394ca7SJames Schulman 5452c394ca7SJames Schulman #define CS42L42_DET_INT1_MASK (CS42L42_PAGE_1B + 0x79) 5462c394ca7SJames Schulman #define CS42L42_TIP_SENSE_UNPLUG_SHIFT 5 5472c394ca7SJames Schulman #define CS42L42_TIP_SENSE_UNPLUG_MASK (1 << CS42L42_TIP_SENSE_UNPLUG_SHIFT) 5482c394ca7SJames Schulman #define CS42L42_TIP_SENSE_PLUG_SHIFT 6 5492c394ca7SJames Schulman #define CS42L42_TIP_SENSE_PLUG_MASK (1 << CS42L42_TIP_SENSE_PLUG_SHIFT) 5502c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_SHIFT 7 5512c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_MASK (1 << CS42L42_HSBIAS_SENSE_SHIFT) 5522c394ca7SJames Schulman #define CS42L42_DET_INT_VAL1_MASK (CS42L42_TIP_SENSE_UNPLUG_MASK | \ 5532c394ca7SJames Schulman CS42L42_TIP_SENSE_PLUG_MASK | \ 5542c394ca7SJames Schulman CS42L42_HSBIAS_SENSE_MASK) 5552c394ca7SJames Schulman 5562c394ca7SJames Schulman #define CS42L42_DET_INT2_MASK (CS42L42_PAGE_1B + 0x7A) 5572c394ca7SJames Schulman #define CS42L42_M_SHORT_DET_SHIFT 0 5582c394ca7SJames Schulman #define CS42L42_M_SHORT_DET_MASK (1 << \ 5592c394ca7SJames Schulman CS42L42_M_SHORT_DET_SHIFT) 5602c394ca7SJames Schulman #define CS42L42_M_SHORT_RLS_SHIFT 1 5612c394ca7SJames Schulman #define CS42L42_M_SHORT_RLS_MASK (1 << \ 5622c394ca7SJames Schulman CS42L42_M_SHORT_RLS_SHIFT) 5632c394ca7SJames Schulman #define CS42L42_M_HSBIAS_HIZ_SHIFT 2 5642c394ca7SJames Schulman #define CS42L42_M_HSBIAS_HIZ_MASK (1 << \ 5652c394ca7SJames Schulman CS42L42_M_HSBIAS_HIZ_SHIFT) 5662c394ca7SJames Schulman #define CS42L42_M_DETECT_FT_SHIFT 6 5672c394ca7SJames Schulman #define CS42L42_M_DETECT_FT_MASK (1 << \ 5682c394ca7SJames Schulman CS42L42_M_DETECT_FT_SHIFT) 5692c394ca7SJames Schulman #define CS42L42_M_DETECT_TF_SHIFT 7 5702c394ca7SJames Schulman #define CS42L42_M_DETECT_TF_MASK (1 << \ 5712c394ca7SJames Schulman CS42L42_M_DETECT_TF_SHIFT) 5722c394ca7SJames Schulman #define CS42L42_DET_INT_VAL2_MASK (CS42L42_M_SHORT_DET_MASK | \ 5732c394ca7SJames Schulman CS42L42_M_SHORT_RLS_MASK | \ 5742c394ca7SJames Schulman CS42L42_M_HSBIAS_HIZ_MASK | \ 5752c394ca7SJames Schulman CS42L42_M_DETECT_FT_MASK | \ 5762c394ca7SJames Schulman CS42L42_M_DETECT_TF_MASK) 5772c394ca7SJames Schulman 5782c394ca7SJames Schulman /* Page 0x1C Headset Bias Registers */ 5792c394ca7SJames Schulman #define CS42L42_HS_BIAS_CTL (CS42L42_PAGE_1C + 0x03) 5802c394ca7SJames Schulman #define CS42L42_HSBIAS_RAMP_SHIFT 0 5812c394ca7SJames Schulman #define CS42L42_HSBIAS_RAMP_MASK (3 << CS42L42_HSBIAS_RAMP_SHIFT) 5822c394ca7SJames Schulman #define CS42L42_HSBIAS_PD_SHIFT 4 5832c394ca7SJames Schulman #define CS42L42_HSBIAS_PD_MASK (1 << CS42L42_HSBIAS_PD_SHIFT) 5842c394ca7SJames Schulman #define CS42L42_HSBIAS_CAPLESS_SHIFT 7 5852c394ca7SJames Schulman #define CS42L42_HSBIAS_CAPLESS_MASK (1 << CS42L42_HSBIAS_CAPLESS_SHIFT) 5862c394ca7SJames Schulman 5872c394ca7SJames Schulman /* Page 0x1D ADC Registers */ 5882c394ca7SJames Schulman #define CS42L42_ADC_CTL (CS42L42_PAGE_1D + 0x01) 5892c394ca7SJames Schulman #define CS42L42_ADC_NOTCH_DIS_SHIFT 5 5902c394ca7SJames Schulman #define CS42L42_ADC_FORCE_WEAK_VCM_SHIFT 4 5912c394ca7SJames Schulman #define CS42L42_ADC_INV_SHIFT 2 5922c394ca7SJames Schulman #define CS42L42_ADC_DIG_BOOST_SHIFT 0 5932c394ca7SJames Schulman 5942c394ca7SJames Schulman #define CS42L42_ADC_VOLUME (CS42L42_PAGE_1D + 0x03) 5952c394ca7SJames Schulman #define CS42L42_ADC_VOL_SHIFT 0 5962c394ca7SJames Schulman 5972c394ca7SJames Schulman #define CS42L42_ADC_WNF_HPF_CTL (CS42L42_PAGE_1D + 0x04) 5982c394ca7SJames Schulman #define CS42L42_ADC_WNF_CF_SHIFT 4 5992c394ca7SJames Schulman #define CS42L42_ADC_WNF_EN_SHIFT 3 6002c394ca7SJames Schulman #define CS42L42_ADC_HPF_CF_SHIFT 1 6012c394ca7SJames Schulman #define CS42L42_ADC_HPF_EN_SHIFT 0 6022c394ca7SJames Schulman 6032c394ca7SJames Schulman /* Page 0x1F DAC Registers */ 6042c394ca7SJames Schulman #define CS42L42_DAC_CTL1 (CS42L42_PAGE_1F + 0x01) 6052c394ca7SJames Schulman #define CS42L42_DACB_INV_SHIFT 1 6062c394ca7SJames Schulman #define CS42L42_DACA_INV_SHIFT 0 6072c394ca7SJames Schulman 6082c394ca7SJames Schulman #define CS42L42_DAC_CTL2 (CS42L42_PAGE_1F + 0x06) 6092c394ca7SJames Schulman #define CS42L42_HPOUT_PULLDOWN_SHIFT 4 6102c394ca7SJames Schulman #define CS42L42_HPOUT_PULLDOWN_MASK (15 << CS42L42_HPOUT_PULLDOWN_SHIFT) 6112c394ca7SJames Schulman #define CS42L42_HPOUT_LOAD_SHIFT 3 6122c394ca7SJames Schulman #define CS42L42_HPOUT_LOAD_MASK (1 << CS42L42_HPOUT_LOAD_SHIFT) 6132c394ca7SJames Schulman #define CS42L42_HPOUT_CLAMP_SHIFT 2 6142c394ca7SJames Schulman #define CS42L42_HPOUT_CLAMP_MASK (1 << CS42L42_HPOUT_CLAMP_SHIFT) 6152c394ca7SJames Schulman #define CS42L42_DAC_HPF_EN_SHIFT 1 6162c394ca7SJames Schulman #define CS42L42_DAC_HPF_EN_MASK (1 << CS42L42_DAC_HPF_EN_SHIFT) 6172c394ca7SJames Schulman #define CS42L42_DAC_MON_EN_SHIFT 0 6182c394ca7SJames Schulman #define CS42L42_DAC_MON_EN_MASK (1 << CS42L42_DAC_MON_EN_SHIFT) 6192c394ca7SJames Schulman 6202c394ca7SJames Schulman /* Page 0x20 HP CTL Registers */ 6212c394ca7SJames Schulman #define CS42L42_HP_CTL (CS42L42_PAGE_20 + 0x01) 6222c394ca7SJames Schulman #define CS42L42_HP_ANA_BMUTE_SHIFT 3 6232c394ca7SJames Schulman #define CS42L42_HP_ANA_BMUTE_MASK (1 << CS42L42_HP_ANA_BMUTE_SHIFT) 6242c394ca7SJames Schulman #define CS42L42_HP_ANA_AMUTE_SHIFT 2 6252c394ca7SJames Schulman #define CS42L42_HP_ANA_AMUTE_MASK (1 << CS42L42_HP_ANA_AMUTE_SHIFT) 6262c394ca7SJames Schulman #define CS42L42_HP_FULL_SCALE_VOL_SHIFT 1 6272c394ca7SJames Schulman #define CS42L42_HP_FULL_SCALE_VOL_MASK (1 << CS42L42_HP_FULL_SCALE_VOL_SHIFT) 6282c394ca7SJames Schulman 6292c394ca7SJames Schulman /* Page 0x21 Class H Registers */ 6302c394ca7SJames Schulman #define CS42L42_CLASSH_CTL (CS42L42_PAGE_21 + 0x01) 6312c394ca7SJames Schulman 6322c394ca7SJames Schulman /* Page 0x23 Mixer Volume Registers */ 6332c394ca7SJames Schulman #define CS42L42_MIXER_CHA_VOL (CS42L42_PAGE_23 + 0x01) 6342c394ca7SJames Schulman #define CS42L42_MIXER_ADC_VOL (CS42L42_PAGE_23 + 0x02) 6352c394ca7SJames Schulman 6362c394ca7SJames Schulman #define CS42L42_MIXER_CHB_VOL (CS42L42_PAGE_23 + 0x03) 6372c394ca7SJames Schulman #define CS42L42_MIXER_CH_VOL_SHIFT 0 6382c394ca7SJames Schulman #define CS42L42_MIXER_CH_VOL_MASK (0x3f << CS42L42_MIXER_CH_VOL_SHIFT) 6392c394ca7SJames Schulman 6402c394ca7SJames Schulman /* Page 0x24 EQ Registers */ 6412c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN0 (CS42L42_PAGE_24 + 0x01) 6422c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN1 (CS42L42_PAGE_24 + 0x02) 6432c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN2 (CS42L42_PAGE_24 + 0x03) 6442c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN3 (CS42L42_PAGE_24 + 0x04) 6452c394ca7SJames Schulman #define CS42L42_EQ_COEF_RW (CS42L42_PAGE_24 + 0x06) 6462c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT0 (CS42L42_PAGE_24 + 0x07) 6472c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT1 (CS42L42_PAGE_24 + 0x08) 6482c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT2 (CS42L42_PAGE_24 + 0x09) 6492c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT3 (CS42L42_PAGE_24 + 0x0A) 6502c394ca7SJames Schulman #define CS42L42_EQ_INIT_STAT (CS42L42_PAGE_24 + 0x0B) 6512c394ca7SJames Schulman #define CS42L42_EQ_START_FILT (CS42L42_PAGE_24 + 0x0C) 6522c394ca7SJames Schulman #define CS42L42_EQ_MUTE_CTL (CS42L42_PAGE_24 + 0x0E) 6532c394ca7SJames Schulman 6542c394ca7SJames Schulman /* Page 0x25 Audio Port Registers */ 6552c394ca7SJames Schulman #define CS42L42_SP_RX_CH_SEL (CS42L42_PAGE_25 + 0x01) 6562c394ca7SJames Schulman 6572c394ca7SJames Schulman #define CS42L42_SP_RX_ISOC_CTL (CS42L42_PAGE_25 + 0x02) 6582c394ca7SJames Schulman #define CS42L42_SP_RX_RSYNC_SHIFT 6 6592c394ca7SJames Schulman #define CS42L42_SP_RX_RSYNC_MASK (1 << CS42L42_SP_RX_RSYNC_SHIFT) 6602c394ca7SJames Schulman #define CS42L42_SP_RX_NSB_POS_SHIFT 3 6612c394ca7SJames Schulman #define CS42L42_SP_RX_NSB_POS_MASK (7 << CS42L42_SP_RX_NSB_POS_SHIFT) 6622c394ca7SJames Schulman #define CS42L42_SP_RX_NFS_NSBB_SHIFT 2 6632c394ca7SJames Schulman #define CS42L42_SP_RX_NFS_NSBB_MASK (1 << CS42L42_SP_RX_NFS_NSBB_SHIFT) 6642c394ca7SJames Schulman #define CS42L42_SP_RX_ISOC_MODE_SHIFT 0 6652c394ca7SJames Schulman #define CS42L42_SP_RX_ISOC_MODE_MASK (3 << CS42L42_SP_RX_ISOC_MODE_SHIFT) 6662c394ca7SJames Schulman 6672c394ca7SJames Schulman #define CS42L42_SP_RX_FS (CS42L42_PAGE_25 + 0x03) 6682c394ca7SJames Schulman #define CS42l42_SPDIF_CH_SEL (CS42L42_PAGE_25 + 0x04) 6692c394ca7SJames Schulman #define CS42L42_SP_TX_ISOC_CTL (CS42L42_PAGE_25 + 0x05) 6702c394ca7SJames Schulman #define CS42L42_SP_TX_FS (CS42L42_PAGE_25 + 0x06) 6712c394ca7SJames Schulman #define CS42L42_SPDIF_SW_CTL1 (CS42L42_PAGE_25 + 0x07) 6722c394ca7SJames Schulman 6732c394ca7SJames Schulman /* Page 0x26 SRC Registers */ 6742c394ca7SJames Schulman #define CS42L42_SRC_SDIN_FS (CS42L42_PAGE_26 + 0x01) 6752c394ca7SJames Schulman #define CS42L42_SRC_SDIN_FS_SHIFT 0 6762c394ca7SJames Schulman #define CS42L42_SRC_SDIN_FS_MASK (0x1f << CS42L42_SRC_SDIN_FS_SHIFT) 6772c394ca7SJames Schulman 6782c394ca7SJames Schulman #define CS42L42_SRC_SDOUT_FS (CS42L42_PAGE_26 + 0x09) 6792c394ca7SJames Schulman 6802c394ca7SJames Schulman /* Page 0x28 S/PDIF Registers */ 6812c394ca7SJames Schulman #define CS42L42_SPDIF_CTL1 (CS42L42_PAGE_28 + 0x01) 6822c394ca7SJames Schulman #define CS42L42_SPDIF_CTL2 (CS42L42_PAGE_28 + 0x02) 6832c394ca7SJames Schulman #define CS42L42_SPDIF_CTL3 (CS42L42_PAGE_28 + 0x03) 6842c394ca7SJames Schulman #define CS42L42_SPDIF_CTL4 (CS42L42_PAGE_28 + 0x04) 6852c394ca7SJames Schulman 6862c394ca7SJames Schulman /* Page 0x29 Serial Port TX Registers */ 6872c394ca7SJames Schulman #define CS42L42_ASP_TX_SZ_EN (CS42L42_PAGE_29 + 0x01) 688585e7079SLucas Tanure #define CS42L42_ASP_TX_EN_SHIFT 0 6892c394ca7SJames Schulman #define CS42L42_ASP_TX_CH_EN (CS42L42_PAGE_29 + 0x02) 690585e7079SLucas Tanure #define CS42L42_ASP_TX0_CH2_SHIFT 1 691585e7079SLucas Tanure #define CS42L42_ASP_TX0_CH1_SHIFT 0 692585e7079SLucas Tanure 6932c394ca7SJames Schulman #define CS42L42_ASP_TX_CH_AP_RES (CS42L42_PAGE_29 + 0x03) 694585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_AP_SHIFT 7 695585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_AP_MASK (1 << CS42L42_ASP_TX_CH1_AP_SHIFT) 696585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_AP_SHIFT 6 697585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_AP_MASK (1 << CS42L42_ASP_TX_CH2_AP_SHIFT) 698585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_RES_SHIFT 2 699585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_RES_MASK (3 << CS42L42_ASP_TX_CH2_RES_SHIFT) 700585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_RES_SHIFT 0 701585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_RES_MASK (3 << CS42L42_ASP_TX_CH1_RES_SHIFT) 7022c394ca7SJames Schulman #define CS42L42_ASP_TX_CH1_BIT_MSB (CS42L42_PAGE_29 + 0x04) 7032c394ca7SJames Schulman #define CS42L42_ASP_TX_CH1_BIT_LSB (CS42L42_PAGE_29 + 0x05) 7042c394ca7SJames Schulman #define CS42L42_ASP_TX_HIZ_DLY_CFG (CS42L42_PAGE_29 + 0x06) 7052c394ca7SJames Schulman #define CS42L42_ASP_TX_CH2_BIT_MSB (CS42L42_PAGE_29 + 0x0A) 7062c394ca7SJames Schulman #define CS42L42_ASP_TX_CH2_BIT_LSB (CS42L42_PAGE_29 + 0x0B) 7072c394ca7SJames Schulman 7082c394ca7SJames Schulman /* Page 0x2A Serial Port RX Registers */ 7092c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_EN (CS42L42_PAGE_2A + 0x01) 7102c394ca7SJames Schulman #define CS42L42_ASP_RX0_CH_EN_SHIFT 2 7112c394ca7SJames Schulman #define CS42L42_ASP_RX0_CH_EN_MASK (0xf << CS42L42_ASP_RX0_CH_EN_SHIFT) 712621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH1_SHIFT 2 713621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH2_SHIFT 3 714621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH3_SHIFT 4 715621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH4_SHIFT 5 7162c394ca7SJames Schulman 7172c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH1_AP_RES (CS42L42_PAGE_2A + 0x02) 7182c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH1_BIT_MSB (CS42L42_PAGE_2A + 0x03) 7192c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH1_BIT_LSB (CS42L42_PAGE_2A + 0x04) 7202c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH2_AP_RES (CS42L42_PAGE_2A + 0x05) 7212c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH2_BIT_MSB (CS42L42_PAGE_2A + 0x06) 7222c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH2_BIT_LSB (CS42L42_PAGE_2A + 0x07) 7232c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH3_AP_RES (CS42L42_PAGE_2A + 0x08) 7242c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH3_BIT_MSB (CS42L42_PAGE_2A + 0x09) 7252c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH3_BIT_LSB (CS42L42_PAGE_2A + 0x0A) 7262c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH4_AP_RES (CS42L42_PAGE_2A + 0x0B) 7272c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH4_BIT_MSB (CS42L42_PAGE_2A + 0x0C) 7282c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH4_BIT_LSB (CS42L42_PAGE_2A + 0x0D) 7292c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH1_AP_RES (CS42L42_PAGE_2A + 0x0E) 7302c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH1_BIT_MSB (CS42L42_PAGE_2A + 0x0F) 7312c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH1_BIT_LSB (CS42L42_PAGE_2A + 0x10) 7322c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH2_AP_RES (CS42L42_PAGE_2A + 0x11) 7332c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH2_BIT_MSB (CS42L42_PAGE_2A + 0x12) 7342c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH2_BIT_LSB (CS42L42_PAGE_2A + 0x13) 7352c394ca7SJames Schulman 7362c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_SHIFT 6 7372c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_MASK (1 << CS42L42_ASP_RX_CH_AP_SHIFT) 7382c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_LOW 0 7392c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_HI 1 7402c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_SHIFT 0 7412c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_MASK (3 << CS42L42_ASP_RX_CH_RES_SHIFT) 7422c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_32 3 7432c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_16 1 7442c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_BIT_ST_SHIFT 0 7452c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_BIT_ST_MASK (0xff << CS42L42_ASP_RX_CH_BIT_ST_SHIFT) 7462c394ca7SJames Schulman 7472c394ca7SJames Schulman /* Page 0x30 ID Registers */ 7482c394ca7SJames Schulman #define CS42L42_SUB_REVID (CS42L42_PAGE_30 + 0x14) 7492c394ca7SJames Schulman #define CS42L42_MAX_REGISTER (CS42L42_PAGE_30 + 0x14) 7502c394ca7SJames Schulman 7512c394ca7SJames Schulman /* Defines for fracturing values spread across multiple registers */ 7522c394ca7SJames Schulman #define CS42L42_FRAC0_VAL(val) ((val) & 0x0000ff) 7532c394ca7SJames Schulman #define CS42L42_FRAC1_VAL(val) (((val) & 0x00ff00) >> 8) 7542c394ca7SJames Schulman #define CS42L42_FRAC2_VAL(val) (((val) & 0xff0000) >> 16) 7552c394ca7SJames Schulman 7562c394ca7SJames Schulman #define CS42L42_NUM_SUPPLIES 5 75719325cfeSLucas Tanure #define CS42L42_BOOT_TIME_US 3000 758*1c52825cSLucas Tanure #define CS42L42_PLL_DIVOUT_TIME_US 800 7590ea23660SRichard Fitzgerald #define CS42L42_CLOCK_SWITCH_DELAY_US 150 760b7d00776SRichard Fitzgerald #define CS42L42_PLL_LOCK_POLL_US 250 761b7d00776SRichard Fitzgerald #define CS42L42_PLL_LOCK_TIMEOUT_US 1250 7622c394ca7SJames Schulman 7632c394ca7SJames Schulman static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = { 7642c394ca7SJames Schulman "VA", 7652c394ca7SJames Schulman "VP", 7662c394ca7SJames Schulman "VCP", 7672c394ca7SJames Schulman "VD_FILT", 7682c394ca7SJames Schulman "VL", 7692c394ca7SJames Schulman }; 7702c394ca7SJames Schulman 7712c394ca7SJames Schulman struct cs42l42_private { 7722c394ca7SJames Schulman struct regmap *regmap; 773c9261402SKuninori Morimoto struct snd_soc_component *component; 7742c394ca7SJames Schulman struct regulator_bulk_data supplies[CS42L42_NUM_SUPPLIES]; 7752c394ca7SJames Schulman struct gpio_desc *reset_gpio; 7762c394ca7SJames Schulman struct completion pdn_done; 777c26a5289SLucas Tanure struct snd_soc_jack *jack; 7782cdba9b0SLucas Tanure int bclk; 7792c394ca7SJames Schulman u32 sclk; 7802c394ca7SJames Schulman u32 srate; 781*1c52825cSLucas Tanure u8 pll_divout; 7822c394ca7SJames Schulman u8 plug_state; 7832c394ca7SJames Schulman u8 hs_type; 7842c394ca7SJames Schulman u8 ts_inv; 7852c394ca7SJames Schulman u8 ts_dbnc_rise; 7862c394ca7SJames Schulman u8 ts_dbnc_fall; 7872c394ca7SJames Schulman u8 btn_det_init_dbnce; 7882c394ca7SJames Schulman u8 btn_det_event_dbnce; 7892c394ca7SJames Schulman u8 bias_thresholds[CS42L42_NUM_BIASES]; 7902c394ca7SJames Schulman u8 hs_bias_ramp_rate; 7912c394ca7SJames Schulman u8 hs_bias_ramp_time; 792c9f2e3c3SVitaly Rodionov u8 hs_bias_sense_en; 79343fc3571SLucas Tanure u8 stream_use; 7942c394ca7SJames Schulman }; 7952c394ca7SJames Schulman 7962c394ca7SJames Schulman #endif /* __CS42L42_H__ */ 797