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 15fdd53528SRichard Fitzgerald #include <linux/mutex.h> 16c5b8ee08SLucas Tanure #include <sound/jack.h> 17c5b8ee08SLucas Tanure 182c394ca7SJames Schulman #define CS42L42_PAGE_REGISTER 0x00 /* Page Select Register */ 192c394ca7SJames Schulman #define CS42L42_WIN_START 0x00 202c394ca7SJames Schulman #define CS42L42_WIN_LEN 0x100 212c394ca7SJames Schulman #define CS42L42_RANGE_MIN 0x00 222c394ca7SJames Schulman #define CS42L42_RANGE_MAX 0x7F 232c394ca7SJames Schulman 242c394ca7SJames Schulman #define CS42L42_PAGE_10 0x1000 252c394ca7SJames Schulman #define CS42L42_PAGE_11 0x1100 262c394ca7SJames Schulman #define CS42L42_PAGE_12 0x1200 272c394ca7SJames Schulman #define CS42L42_PAGE_13 0x1300 282c394ca7SJames Schulman #define CS42L42_PAGE_15 0x1500 292c394ca7SJames Schulman #define CS42L42_PAGE_19 0x1900 302c394ca7SJames Schulman #define CS42L42_PAGE_1B 0x1B00 312c394ca7SJames Schulman #define CS42L42_PAGE_1C 0x1C00 322c394ca7SJames Schulman #define CS42L42_PAGE_1D 0x1D00 332c394ca7SJames Schulman #define CS42L42_PAGE_1F 0x1F00 342c394ca7SJames Schulman #define CS42L42_PAGE_20 0x2000 352c394ca7SJames Schulman #define CS42L42_PAGE_21 0x2100 362c394ca7SJames Schulman #define CS42L42_PAGE_23 0x2300 372c394ca7SJames Schulman #define CS42L42_PAGE_24 0x2400 382c394ca7SJames Schulman #define CS42L42_PAGE_25 0x2500 392c394ca7SJames Schulman #define CS42L42_PAGE_26 0x2600 402c394ca7SJames Schulman #define CS42L42_PAGE_28 0x2800 412c394ca7SJames Schulman #define CS42L42_PAGE_29 0x2900 422c394ca7SJames Schulman #define CS42L42_PAGE_2A 0x2A00 432c394ca7SJames Schulman #define CS42L42_PAGE_30 0x3000 442c394ca7SJames Schulman 452c394ca7SJames Schulman #define CS42L42_CHIP_ID 0x42A42 462c394ca7SJames Schulman 472c394ca7SJames Schulman /* Page 0x10 Global Registers */ 482c394ca7SJames Schulman #define CS42L42_DEVID_AB (CS42L42_PAGE_10 + 0x01) 492c394ca7SJames Schulman #define CS42L42_DEVID_CD (CS42L42_PAGE_10 + 0x02) 502c394ca7SJames Schulman #define CS42L42_DEVID_E (CS42L42_PAGE_10 + 0x03) 512c394ca7SJames Schulman #define CS42L42_FABID (CS42L42_PAGE_10 + 0x04) 522c394ca7SJames Schulman #define CS42L42_REVID (CS42L42_PAGE_10 + 0x05) 532c394ca7SJames Schulman #define CS42L42_FRZ_CTL (CS42L42_PAGE_10 + 0x06) 542c394ca7SJames Schulman 552c394ca7SJames Schulman #define CS42L42_SRC_CTL (CS42L42_PAGE_10 + 0x07) 562c394ca7SJames Schulman #define CS42L42_SRC_BYPASS_DAC_SHIFT 1 572c394ca7SJames Schulman #define CS42L42_SRC_BYPASS_DAC_MASK (1 << CS42L42_SRC_BYPASS_DAC_SHIFT) 582c394ca7SJames Schulman 592c394ca7SJames Schulman #define CS42L42_MCLK_STATUS (CS42L42_PAGE_10 + 0x08) 602c394ca7SJames Schulman 612c394ca7SJames Schulman #define CS42L42_MCLK_CTL (CS42L42_PAGE_10 + 0x09) 622c394ca7SJames Schulman #define CS42L42_INTERNAL_FS_SHIFT 1 632c394ca7SJames Schulman #define CS42L42_INTERNAL_FS_MASK (1 << CS42L42_INTERNAL_FS_SHIFT) 642c394ca7SJames Schulman 652c394ca7SJames Schulman #define CS42L42_SFTRAMP_RATE (CS42L42_PAGE_10 + 0x0A) 667ec4a058SRichard Fitzgerald #define CS42L42_SLOW_START_ENABLE (CS42L42_PAGE_10 + 0x0B) 677ec4a058SRichard Fitzgerald #define CS42L42_SLOW_START_EN_MASK GENMASK(6, 4) 687ec4a058SRichard Fitzgerald #define CS42L42_SLOW_START_EN_SHIFT 4 692c394ca7SJames Schulman #define CS42L42_I2C_DEBOUNCE (CS42L42_PAGE_10 + 0x0E) 702c394ca7SJames Schulman #define CS42L42_I2C_STRETCH (CS42L42_PAGE_10 + 0x0F) 712c394ca7SJames Schulman #define CS42L42_I2C_TIMEOUT (CS42L42_PAGE_10 + 0x10) 722c394ca7SJames Schulman 732c394ca7SJames Schulman /* Page 0x11 Power and Headset Detect Registers */ 742c394ca7SJames Schulman #define CS42L42_PWR_CTL1 (CS42L42_PAGE_11 + 0x01) 752c394ca7SJames Schulman #define CS42L42_ASP_DAO_PDN_SHIFT 7 762c394ca7SJames Schulman #define CS42L42_ASP_DAO_PDN_MASK (1 << CS42L42_ASP_DAO_PDN_SHIFT) 772c394ca7SJames Schulman #define CS42L42_ASP_DAI_PDN_SHIFT 6 782c394ca7SJames Schulman #define CS42L42_ASP_DAI_PDN_MASK (1 << CS42L42_ASP_DAI_PDN_SHIFT) 792c394ca7SJames Schulman #define CS42L42_MIXER_PDN_SHIFT 5 802c394ca7SJames Schulman #define CS42L42_MIXER_PDN_MASK (1 << CS42L42_MIXER_PDN_SHIFT) 812c394ca7SJames Schulman #define CS42L42_EQ_PDN_SHIFT 4 822c394ca7SJames Schulman #define CS42L42_EQ_PDN_MASK (1 << CS42L42_EQ_PDN_SHIFT) 832c394ca7SJames Schulman #define CS42L42_HP_PDN_SHIFT 3 842c394ca7SJames Schulman #define CS42L42_HP_PDN_MASK (1 << CS42L42_HP_PDN_SHIFT) 852c394ca7SJames Schulman #define CS42L42_ADC_PDN_SHIFT 2 86fac165f2SRichard Fitzgerald #define CS42L42_ADC_PDN_MASK (1 << CS42L42_ADC_PDN_SHIFT) 872c394ca7SJames Schulman #define CS42L42_PDN_ALL_SHIFT 0 882c394ca7SJames Schulman #define CS42L42_PDN_ALL_MASK (1 << CS42L42_PDN_ALL_SHIFT) 892c394ca7SJames Schulman 902c394ca7SJames Schulman #define CS42L42_PWR_CTL2 (CS42L42_PAGE_11 + 0x02) 912c394ca7SJames Schulman #define CS42L42_ADC_SRC_PDNB_SHIFT 0 922c394ca7SJames Schulman #define CS42L42_ADC_SRC_PDNB_MASK (1 << CS42L42_ADC_SRC_PDNB_SHIFT) 932c394ca7SJames Schulman #define CS42L42_DAC_SRC_PDNB_SHIFT 1 942c394ca7SJames Schulman #define CS42L42_DAC_SRC_PDNB_MASK (1 << CS42L42_DAC_SRC_PDNB_SHIFT) 952c394ca7SJames Schulman #define CS42L42_ASP_DAI1_PDN_SHIFT 2 962c394ca7SJames Schulman #define CS42L42_ASP_DAI1_PDN_MASK (1 << CS42L42_ASP_DAI1_PDN_SHIFT) 972c394ca7SJames Schulman #define CS42L42_SRC_PDN_OVERRIDE_SHIFT 3 982c394ca7SJames Schulman #define CS42L42_SRC_PDN_OVERRIDE_MASK (1 << CS42L42_SRC_PDN_OVERRIDE_SHIFT) 992c394ca7SJames Schulman #define CS42L42_DISCHARGE_FILT_SHIFT 4 1002c394ca7SJames Schulman #define CS42L42_DISCHARGE_FILT_MASK (1 << CS42L42_DISCHARGE_FILT_SHIFT) 1012c394ca7SJames Schulman 1022c394ca7SJames Schulman #define CS42L42_PWR_CTL3 (CS42L42_PAGE_11 + 0x03) 1032c394ca7SJames Schulman #define CS42L42_RING_SENSE_PDNB_SHIFT 1 1042c394ca7SJames Schulman #define CS42L42_RING_SENSE_PDNB_MASK (1 << \ 1052c394ca7SJames Schulman CS42L42_RING_SENSE_PDNB_SHIFT) 1062c394ca7SJames Schulman #define CS42L42_VPMON_PDNB_SHIFT 2 1072c394ca7SJames Schulman #define CS42L42_VPMON_PDNB_MASK (1 << \ 1082c394ca7SJames Schulman CS42L42_VPMON_PDNB_SHIFT) 1092c394ca7SJames Schulman #define CS42L42_SW_CLK_STP_STAT_SEL_SHIFT 5 1102c394ca7SJames Schulman #define CS42L42_SW_CLK_STP_STAT_SEL_MASK (3 << \ 1112c394ca7SJames Schulman CS42L42_SW_CLK_STP_STAT_SEL_SHIFT) 1122c394ca7SJames Schulman 1132c394ca7SJames Schulman #define CS42L42_RSENSE_CTL1 (CS42L42_PAGE_11 + 0x04) 1142c394ca7SJames Schulman #define CS42L42_RS_TRIM_R_SHIFT 0 1152c394ca7SJames Schulman #define CS42L42_RS_TRIM_R_MASK (1 << \ 1162c394ca7SJames Schulman CS42L42_RS_TRIM_R_SHIFT) 1172c394ca7SJames Schulman #define CS42L42_RS_TRIM_T_SHIFT 1 1182c394ca7SJames Schulman #define CS42L42_RS_TRIM_T_MASK (1 << \ 1192c394ca7SJames Schulman CS42L42_RS_TRIM_T_SHIFT) 1202c394ca7SJames Schulman #define CS42L42_HPREF_RS_SHIFT 2 1212c394ca7SJames Schulman #define CS42L42_HPREF_RS_MASK (1 << \ 1222c394ca7SJames Schulman CS42L42_HPREF_RS_SHIFT) 1232c394ca7SJames Schulman #define CS42L42_HSBIAS_FILT_REF_RS_SHIFT 3 1242c394ca7SJames Schulman #define CS42L42_HSBIAS_FILT_REF_RS_MASK (1 << \ 1252c394ca7SJames Schulman CS42L42_HSBIAS_FILT_REF_RS_SHIFT) 1262c394ca7SJames Schulman #define CS42L42_RING_SENSE_PU_HIZ_SHIFT 6 1272c394ca7SJames Schulman #define CS42L42_RING_SENSE_PU_HIZ_MASK (1 << \ 1282c394ca7SJames Schulman CS42L42_RING_SENSE_PU_HIZ_SHIFT) 1292c394ca7SJames Schulman 1302c394ca7SJames Schulman #define CS42L42_RSENSE_CTL2 (CS42L42_PAGE_11 + 0x05) 1312c394ca7SJames Schulman #define CS42L42_TS_RS_GATE_SHIFT 7 1322c394ca7SJames Schulman #define CS42L42_TS_RS_GATE_MAS (1 << CS42L42_TS_RS_GATE_SHIFT) 1332c394ca7SJames Schulman 1342c394ca7SJames Schulman #define CS42L42_OSC_SWITCH (CS42L42_PAGE_11 + 0x07) 1352c394ca7SJames Schulman #define CS42L42_SCLK_PRESENT_SHIFT 0 1362c394ca7SJames Schulman #define CS42L42_SCLK_PRESENT_MASK (1 << CS42L42_SCLK_PRESENT_SHIFT) 1372c394ca7SJames Schulman 1382c394ca7SJames Schulman #define CS42L42_OSC_SWITCH_STATUS (CS42L42_PAGE_11 + 0x09) 1392c394ca7SJames Schulman #define CS42L42_OSC_SW_SEL_STAT_SHIFT 0 1402c394ca7SJames Schulman #define CS42L42_OSC_SW_SEL_STAT_MASK (3 << CS42L42_OSC_SW_SEL_STAT_SHIFT) 1412c394ca7SJames Schulman #define CS42L42_OSC_PDNB_STAT_SHIFT 2 1422c394ca7SJames Schulman #define CS42L42_OSC_PDNB_STAT_MASK (1 << CS42L42_OSC_SW_SEL_STAT_SHIFT) 1432c394ca7SJames Schulman 1442c394ca7SJames Schulman #define CS42L42_RSENSE_CTL3 (CS42L42_PAGE_11 + 0x12) 1452c394ca7SJames Schulman #define CS42L42_RS_RISE_DBNCE_TIME_SHIFT 0 1462c394ca7SJames Schulman #define CS42L42_RS_RISE_DBNCE_TIME_MASK (7 << \ 1472c394ca7SJames Schulman CS42L42_RS_RISE_DBNCE_TIME_SHIFT) 1482c394ca7SJames Schulman #define CS42L42_RS_FALL_DBNCE_TIME_SHIFT 3 1492c394ca7SJames Schulman #define CS42L42_RS_FALL_DBNCE_TIME_MASK (7 << \ 1502c394ca7SJames Schulman CS42L42_RS_FALL_DBNCE_TIME_SHIFT) 1512c394ca7SJames Schulman #define CS42L42_RS_PU_EN_SHIFT 6 1522c394ca7SJames Schulman #define CS42L42_RS_PU_EN_MASK (1 << \ 1532c394ca7SJames Schulman CS42L42_RS_PU_EN_SHIFT) 1542c394ca7SJames Schulman #define CS42L42_RS_INV_SHIFT 7 1552c394ca7SJames Schulman #define CS42L42_RS_INV_MASK (1 << \ 1562c394ca7SJames Schulman CS42L42_RS_INV_SHIFT) 1572c394ca7SJames Schulman 1582c394ca7SJames Schulman #define CS42L42_TSENSE_CTL (CS42L42_PAGE_11 + 0x13) 1592c394ca7SJames Schulman #define CS42L42_TS_RISE_DBNCE_TIME_SHIFT 0 1602c394ca7SJames Schulman #define CS42L42_TS_RISE_DBNCE_TIME_MASK (7 << \ 1612c394ca7SJames Schulman CS42L42_TS_RISE_DBNCE_TIME_SHIFT) 1622c394ca7SJames Schulman #define CS42L42_TS_FALL_DBNCE_TIME_SHIFT 3 1632c394ca7SJames Schulman #define CS42L42_TS_FALL_DBNCE_TIME_MASK (7 << \ 1642c394ca7SJames Schulman CS42L42_TS_FALL_DBNCE_TIME_SHIFT) 1652c394ca7SJames Schulman #define CS42L42_TS_INV_SHIFT 7 1662c394ca7SJames Schulman #define CS42L42_TS_INV_MASK (1 << \ 1672c394ca7SJames Schulman CS42L42_TS_INV_SHIFT) 1682c394ca7SJames Schulman 1692c394ca7SJames Schulman #define CS42L42_TSRS_INT_DISABLE (CS42L42_PAGE_11 + 0x14) 1702c394ca7SJames Schulman #define CS42L42_D_RS_PLUG_DBNC_SHIFT 0 1712c394ca7SJames Schulman #define CS42L42_D_RS_PLUG_DBNC_MASK (1 << CS42L42_D_RS_PLUG_DBNC_SHIFT) 1722c394ca7SJames Schulman #define CS42L42_D_RS_UNPLUG_DBNC_SHIFT 1 1732c394ca7SJames Schulman #define CS42L42_D_RS_UNPLUG_DBNC_MASK (1 << CS42L42_D_RS_UNPLUG_DBNC_SHIFT) 1742c394ca7SJames Schulman #define CS42L42_D_TS_PLUG_DBNC_SHIFT 2 1752c394ca7SJames Schulman #define CS42L42_D_TS_PLUG_DBNC_MASK (1 << CS42L42_D_TS_PLUG_DBNC_SHIFT) 1762c394ca7SJames Schulman #define CS42L42_D_TS_UNPLUG_DBNC_SHIFT 3 1772c394ca7SJames Schulman #define CS42L42_D_TS_UNPLUG_DBNC_MASK (1 << CS42L42_D_TS_UNPLUG_DBNC_SHIFT) 1782c394ca7SJames Schulman 1792c394ca7SJames Schulman #define CS42L42_TRSENSE_STATUS (CS42L42_PAGE_11 + 0x15) 1802c394ca7SJames Schulman #define CS42L42_RS_PLUG_DBNC_SHIFT 0 1812c394ca7SJames Schulman #define CS42L42_RS_PLUG_DBNC_MASK (1 << CS42L42_RS_PLUG_DBNC_SHIFT) 1822c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_DBNC_SHIFT 1 1832c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_DBNC_MASK (1 << CS42L42_RS_UNPLUG_DBNC_SHIFT) 1842c394ca7SJames Schulman #define CS42L42_TS_PLUG_DBNC_SHIFT 2 1852c394ca7SJames Schulman #define CS42L42_TS_PLUG_DBNC_MASK (1 << CS42L42_TS_PLUG_DBNC_SHIFT) 1862c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_DBNC_SHIFT 3 1872c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_DBNC_MASK (1 << CS42L42_TS_UNPLUG_DBNC_SHIFT) 1882c394ca7SJames Schulman 1892c394ca7SJames Schulman #define CS42L42_HSDET_CTL1 (CS42L42_PAGE_11 + 0x1F) 1902c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_LVL_SHIFT 0 1912c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_LVL_MASK (15 << CS42L42_HSDET_COMP1_LVL_SHIFT) 1922c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_LVL_SHIFT 4 1932c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_LVL_MASK (15 << CS42L42_HSDET_COMP2_LVL_SHIFT) 1942c394ca7SJames Schulman 195edd6dffdSStefan Binding #define CS42L42_HSDET_COMP1_LVL_VAL 12 /* 1.25V Comparator */ 196edd6dffdSStefan Binding #define CS42L42_HSDET_COMP2_LVL_VAL 2 /* 1.75V Comparator */ 197edd6dffdSStefan Binding #define CS42L42_HSDET_COMP1_LVL_DEFAULT 7 /* 1V Comparator */ 198edd6dffdSStefan Binding #define CS42L42_HSDET_COMP2_LVL_DEFAULT 7 /* 2V Comparator */ 199edd6dffdSStefan Binding 2002c394ca7SJames Schulman #define CS42L42_HSDET_CTL2 (CS42L42_PAGE_11 + 0x20) 2012c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_TIME_SHIFT 0 2022c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_TIME_MASK (3 << CS42L42_HSDET_AUTO_TIME_SHIFT) 2032c394ca7SJames Schulman #define CS42L42_HSBIAS_REF_SHIFT 3 2042c394ca7SJames Schulman #define CS42L42_HSBIAS_REF_MASK (1 << CS42L42_HSBIAS_REF_SHIFT) 2052c394ca7SJames Schulman #define CS42L42_HSDET_SET_SHIFT 4 2062c394ca7SJames Schulman #define CS42L42_HSDET_SET_MASK (3 << CS42L42_HSDET_SET_SHIFT) 2072c394ca7SJames Schulman #define CS42L42_HSDET_CTRL_SHIFT 6 2082c394ca7SJames Schulman #define CS42L42_HSDET_CTRL_MASK (3 << CS42L42_HSDET_CTRL_SHIFT) 2092c394ca7SJames Schulman 2102c394ca7SJames Schulman #define CS42L42_HS_SWITCH_CTL (CS42L42_PAGE_11 + 0x21) 2112c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS4_SHIFT 0 2122c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS4_MASK (1 << CS42L42_SW_GNDHS_HS4_SHIFT) 2132c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS3_SHIFT 1 2142c394ca7SJames Schulman #define CS42L42_SW_GNDHS_HS3_MASK (1 << CS42L42_SW_GNDHS_HS3_SHIFT) 2152c394ca7SJames Schulman #define CS42L42_SW_HSB_HS4_SHIFT 2 2162c394ca7SJames Schulman #define CS42L42_SW_HSB_HS4_MASK (1 << CS42L42_SW_HSB_HS4_SHIFT) 2172c394ca7SJames Schulman #define CS42L42_SW_HSB_HS3_SHIFT 3 2182c394ca7SJames Schulman #define CS42L42_SW_HSB_HS3_MASK (1 << CS42L42_SW_HSB_HS3_SHIFT) 2192c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS4_SHIFT 4 2202c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS4_MASK (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) 2212c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS3_SHIFT 5 2222c394ca7SJames Schulman #define CS42L42_SW_HSB_FILT_HS3_MASK (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) 2232c394ca7SJames Schulman #define CS42L42_SW_REF_HS4_SHIFT 6 2242c394ca7SJames Schulman #define CS42L42_SW_REF_HS4_MASK (1 << CS42L42_SW_REF_HS4_SHIFT) 2252c394ca7SJames Schulman #define CS42L42_SW_REF_HS3_SHIFT 7 2262c394ca7SJames Schulman #define CS42L42_SW_REF_HS3_MASK (1 << CS42L42_SW_REF_HS3_SHIFT) 2272c394ca7SJames Schulman 2282c394ca7SJames Schulman #define CS42L42_HS_DET_STATUS (CS42L42_PAGE_11 + 0x24) 2292c394ca7SJames Schulman #define CS42L42_HSDET_TYPE_SHIFT 0 2302c394ca7SJames Schulman #define CS42L42_HSDET_TYPE_MASK (3 << CS42L42_HSDET_TYPE_SHIFT) 2312c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_OUT_SHIFT 6 2322c394ca7SJames Schulman #define CS42L42_HSDET_COMP1_OUT_MASK (1 << CS42L42_HSDET_COMP1_OUT_SHIFT) 2332c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_OUT_SHIFT 7 2342c394ca7SJames Schulman #define CS42L42_HSDET_COMP2_OUT_MASK (1 << CS42L42_HSDET_COMP2_OUT_SHIFT) 2352c394ca7SJames Schulman #define CS42L42_PLUG_CTIA 0 2362c394ca7SJames Schulman #define CS42L42_PLUG_OMTP 1 2372c394ca7SJames Schulman #define CS42L42_PLUG_HEADPHONE 2 2382c394ca7SJames Schulman #define CS42L42_PLUG_INVALID 3 2392c394ca7SJames Schulman 24012451814SStefan Binding #define CS42L42_HSDET_SW_COMP1 ((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ 24112451814SStefan Binding (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ 24212451814SStefan Binding (1 << CS42L42_SW_HSB_HS4_SHIFT) | \ 24312451814SStefan Binding (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ 24412451814SStefan Binding (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ 24512451814SStefan Binding (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ 24612451814SStefan Binding (0 << CS42L42_SW_REF_HS4_SHIFT) | \ 24712451814SStefan Binding (1 << CS42L42_SW_REF_HS3_SHIFT)) 24812451814SStefan Binding #define CS42L42_HSDET_SW_COMP2 ((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ 24912451814SStefan Binding (0 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ 25012451814SStefan Binding (0 << CS42L42_SW_HSB_HS4_SHIFT) | \ 25112451814SStefan Binding (1 << CS42L42_SW_HSB_HS3_SHIFT) | \ 25212451814SStefan Binding (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ 25312451814SStefan Binding (0 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ 25412451814SStefan Binding (1 << CS42L42_SW_REF_HS4_SHIFT) | \ 25512451814SStefan Binding (0 << CS42L42_SW_REF_HS3_SHIFT)) 25612451814SStefan Binding #define CS42L42_HSDET_SW_TYPE1 ((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ 25712451814SStefan Binding (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ 25812451814SStefan Binding (1 << CS42L42_SW_HSB_HS4_SHIFT) | \ 25912451814SStefan Binding (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ 26012451814SStefan Binding (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ 26112451814SStefan Binding (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ 26212451814SStefan Binding (0 << CS42L42_SW_REF_HS4_SHIFT) | \ 26312451814SStefan Binding (1 << CS42L42_SW_REF_HS3_SHIFT)) 26412451814SStefan Binding #define CS42L42_HSDET_SW_TYPE2 ((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ 26512451814SStefan Binding (0 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ 26612451814SStefan Binding (0 << CS42L42_SW_HSB_HS4_SHIFT) | \ 26712451814SStefan Binding (1 << CS42L42_SW_HSB_HS3_SHIFT) | \ 26812451814SStefan Binding (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ 26912451814SStefan Binding (0 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ 27012451814SStefan Binding (1 << CS42L42_SW_REF_HS4_SHIFT) | \ 27112451814SStefan Binding (0 << CS42L42_SW_REF_HS3_SHIFT)) 27212451814SStefan Binding #define CS42L42_HSDET_SW_TYPE3 ((1 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ 27312451814SStefan Binding (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ 27412451814SStefan Binding (0 << CS42L42_SW_HSB_HS4_SHIFT) | \ 27512451814SStefan Binding (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ 27612451814SStefan Binding (1 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ 27712451814SStefan Binding (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ 27812451814SStefan Binding (1 << CS42L42_SW_REF_HS4_SHIFT) | \ 27912451814SStefan Binding (1 << CS42L42_SW_REF_HS3_SHIFT)) 28012451814SStefan Binding #define CS42L42_HSDET_SW_TYPE4 ((0 << CS42L42_SW_GNDHS_HS4_SHIFT) | \ 28112451814SStefan Binding (1 << CS42L42_SW_GNDHS_HS3_SHIFT) | \ 28212451814SStefan Binding (1 << CS42L42_SW_HSB_HS4_SHIFT) | \ 28312451814SStefan Binding (0 << CS42L42_SW_HSB_HS3_SHIFT) | \ 28412451814SStefan Binding (0 << CS42L42_SW_HSB_FILT_HS4_SHIFT) | \ 28512451814SStefan Binding (1 << CS42L42_SW_HSB_FILT_HS3_SHIFT) | \ 28612451814SStefan Binding (0 << CS42L42_SW_REF_HS4_SHIFT) | \ 28712451814SStefan Binding (1 << CS42L42_SW_REF_HS3_SHIFT)) 28812451814SStefan Binding 28912451814SStefan Binding #define CS42L42_HSDET_COMP_TYPE1 1 29012451814SStefan Binding #define CS42L42_HSDET_COMP_TYPE2 2 29112451814SStefan Binding #define CS42L42_HSDET_COMP_TYPE3 0 29212451814SStefan Binding #define CS42L42_HSDET_COMP_TYPE4 3 29312451814SStefan Binding 2942c394ca7SJames Schulman #define CS42L42_HS_CLAMP_DISABLE (CS42L42_PAGE_11 + 0x29) 2952c394ca7SJames Schulman #define CS42L42_HS_CLAMP_DISABLE_SHIFT 0 2962c394ca7SJames Schulman #define CS42L42_HS_CLAMP_DISABLE_MASK (1 << CS42L42_HS_CLAMP_DISABLE_SHIFT) 2972c394ca7SJames Schulman 2982c394ca7SJames Schulman /* Page 0x12 Clocking Registers */ 2992c394ca7SJames Schulman #define CS42L42_MCLK_SRC_SEL (CS42L42_PAGE_12 + 0x01) 3002c394ca7SJames Schulman #define CS42L42_MCLKDIV_SHIFT 1 3012c394ca7SJames Schulman #define CS42L42_MCLKDIV_MASK (1 << CS42L42_MCLKDIV_SHIFT) 3022c394ca7SJames Schulman #define CS42L42_MCLK_SRC_SEL_SHIFT 0 3032c394ca7SJames Schulman #define CS42L42_MCLK_SRC_SEL_MASK (1 << CS42L42_MCLK_SRC_SEL_SHIFT) 3042c394ca7SJames Schulman 3052c394ca7SJames Schulman #define CS42L42_SPDIF_CLK_CFG (CS42L42_PAGE_12 + 0x02) 3062c394ca7SJames Schulman #define CS42L42_FSYNC_PW_LOWER (CS42L42_PAGE_12 + 0x03) 3072c394ca7SJames Schulman 3082c394ca7SJames Schulman #define CS42L42_FSYNC_PW_UPPER (CS42L42_PAGE_12 + 0x04) 3092c394ca7SJames Schulman #define CS42L42_FSYNC_PULSE_WIDTH_SHIFT 0 3102c394ca7SJames Schulman #define CS42L42_FSYNC_PULSE_WIDTH_MASK (0xff << \ 3112c394ca7SJames Schulman CS42L42_FSYNC_PULSE_WIDTH_SHIFT) 3122c394ca7SJames Schulman 3132c394ca7SJames Schulman #define CS42L42_FSYNC_P_LOWER (CS42L42_PAGE_12 + 0x05) 3142c394ca7SJames Schulman 3152c394ca7SJames Schulman #define CS42L42_FSYNC_P_UPPER (CS42L42_PAGE_12 + 0x06) 3162c394ca7SJames Schulman #define CS42L42_FSYNC_PERIOD_SHIFT 0 3172c394ca7SJames Schulman #define CS42L42_FSYNC_PERIOD_MASK (0xff << CS42L42_FSYNC_PERIOD_SHIFT) 3182c394ca7SJames Schulman 3192c394ca7SJames Schulman #define CS42L42_ASP_CLK_CFG (CS42L42_PAGE_12 + 0x07) 3202c394ca7SJames Schulman #define CS42L42_ASP_SCLK_EN_SHIFT 5 3212c394ca7SJames Schulman #define CS42L42_ASP_SCLK_EN_MASK (1 << CS42L42_ASP_SCLK_EN_SHIFT) 3222c394ca7SJames Schulman #define CS42L42_ASP_MASTER_MODE 0x01 3232c394ca7SJames Schulman #define CS42L42_ASP_SLAVE_MODE 0x00 3242c394ca7SJames Schulman #define CS42L42_ASP_MODE_SHIFT 4 3252c394ca7SJames Schulman #define CS42L42_ASP_MODE_MASK (1 << CS42L42_ASP_MODE_SHIFT) 326e793c965SLucas Tanure #define CS42L42_ASP_SCPOL_SHIFT 2 327e793c965SLucas Tanure #define CS42L42_ASP_SCPOL_MASK (3 << CS42L42_ASP_SCPOL_SHIFT) 328e793c965SLucas Tanure #define CS42L42_ASP_SCPOL_NOR 3 329e793c965SLucas Tanure #define CS42L42_ASP_LCPOL_SHIFT 0 330e793c965SLucas Tanure #define CS42L42_ASP_LCPOL_MASK (3 << CS42L42_ASP_LCPOL_SHIFT) 331e793c965SLucas Tanure #define CS42L42_ASP_LCPOL_INV 3 3322c394ca7SJames Schulman 3332c394ca7SJames Schulman #define CS42L42_ASP_FRM_CFG (CS42L42_PAGE_12 + 0x08) 3342c394ca7SJames Schulman #define CS42L42_ASP_STP_SHIFT 4 3352c394ca7SJames Schulman #define CS42L42_ASP_STP_MASK (1 << CS42L42_ASP_STP_SHIFT) 3362c394ca7SJames Schulman #define CS42L42_ASP_5050_SHIFT 3 3372c394ca7SJames Schulman #define CS42L42_ASP_5050_MASK (1 << CS42L42_ASP_5050_SHIFT) 3382c394ca7SJames Schulman #define CS42L42_ASP_FSD_SHIFT 0 3392c394ca7SJames Schulman #define CS42L42_ASP_FSD_MASK (7 << CS42L42_ASP_FSD_SHIFT) 3402c394ca7SJames Schulman #define CS42L42_ASP_FSD_0_5 1 3412c394ca7SJames Schulman #define CS42L42_ASP_FSD_1_0 2 3422c394ca7SJames Schulman #define CS42L42_ASP_FSD_1_5 3 3432c394ca7SJames Schulman #define CS42L42_ASP_FSD_2_0 4 3442c394ca7SJames Schulman 3452c394ca7SJames Schulman #define CS42L42_FS_RATE_EN (CS42L42_PAGE_12 + 0x09) 3462c394ca7SJames Schulman #define CS42L42_FS_EN_SHIFT 0 3472c394ca7SJames Schulman #define CS42L42_FS_EN_MASK (0xf << CS42L42_FS_EN_SHIFT) 3482c394ca7SJames Schulman #define CS42L42_FS_EN_IASRC_96K 0x1 3492c394ca7SJames Schulman #define CS42L42_FS_EN_OASRC_96K 0x2 3502c394ca7SJames Schulman 3512c394ca7SJames Schulman #define CS42L42_IN_ASRC_CLK (CS42L42_PAGE_12 + 0x0A) 3522c394ca7SJames Schulman #define CS42L42_CLK_IASRC_SEL_SHIFT 0 3532c394ca7SJames Schulman #define CS42L42_CLK_IASRC_SEL_MASK (1 << CS42L42_CLK_IASRC_SEL_SHIFT) 354fdbd2561SRichard Fitzgerald #define CS42L42_CLK_IASRC_SEL_6 0 3552c394ca7SJames Schulman #define CS42L42_CLK_IASRC_SEL_12 1 3562c394ca7SJames Schulman 3572c394ca7SJames Schulman #define CS42L42_OUT_ASRC_CLK (CS42L42_PAGE_12 + 0x0B) 3582c394ca7SJames Schulman #define CS42L42_CLK_OASRC_SEL_SHIFT 0 3592c394ca7SJames Schulman #define CS42L42_CLK_OASRC_SEL_MASK (1 << CS42L42_CLK_OASRC_SEL_SHIFT) 3602c394ca7SJames Schulman #define CS42L42_CLK_OASRC_SEL_12 1 3612c394ca7SJames Schulman 3622c394ca7SJames Schulman #define CS42L42_PLL_DIV_CFG1 (CS42L42_PAGE_12 + 0x0C) 3632c394ca7SJames Schulman #define CS42L42_SCLK_PREDIV_SHIFT 0 3642c394ca7SJames Schulman #define CS42L42_SCLK_PREDIV_MASK (3 << CS42L42_SCLK_PREDIV_SHIFT) 3652c394ca7SJames Schulman 3662c394ca7SJames Schulman /* Page 0x13 Interrupt Registers */ 3672c394ca7SJames Schulman /* Interrupts */ 3682c394ca7SJames Schulman #define CS42L42_ADC_OVFL_STATUS (CS42L42_PAGE_13 + 0x01) 3692c394ca7SJames Schulman #define CS42L42_MIXER_STATUS (CS42L42_PAGE_13 + 0x02) 3702c394ca7SJames Schulman #define CS42L42_SRC_STATUS (CS42L42_PAGE_13 + 0x03) 3712c394ca7SJames Schulman #define CS42L42_ASP_RX_STATUS (CS42L42_PAGE_13 + 0x04) 3722c394ca7SJames Schulman #define CS42L42_ASP_TX_STATUS (CS42L42_PAGE_13 + 0x05) 3732c394ca7SJames Schulman #define CS42L42_CODEC_STATUS (CS42L42_PAGE_13 + 0x08) 3742c394ca7SJames Schulman #define CS42L42_DET_INT_STATUS1 (CS42L42_PAGE_13 + 0x09) 3752c394ca7SJames Schulman #define CS42L42_DET_INT_STATUS2 (CS42L42_PAGE_13 + 0x0A) 3762c394ca7SJames Schulman #define CS42L42_SRCPL_INT_STATUS (CS42L42_PAGE_13 + 0x0B) 3772c394ca7SJames Schulman #define CS42L42_VPMON_STATUS (CS42L42_PAGE_13 + 0x0D) 3782c394ca7SJames Schulman #define CS42L42_PLL_LOCK_STATUS (CS42L42_PAGE_13 + 0x0E) 3792c394ca7SJames Schulman #define CS42L42_TSRS_PLUG_STATUS (CS42L42_PAGE_13 + 0x0F) 3802c394ca7SJames Schulman /* Masks */ 3812c394ca7SJames Schulman #define CS42L42_ADC_OVFL_INT_MASK (CS42L42_PAGE_13 + 0x16) 3822c394ca7SJames Schulman #define CS42L42_ADC_OVFL_SHIFT 0 3832c394ca7SJames Schulman #define CS42L42_ADC_OVFL_MASK (1 << CS42L42_ADC_OVFL_SHIFT) 3842c394ca7SJames Schulman #define CS42L42_ADC_OVFL_VAL_MASK CS42L42_ADC_OVFL_MASK 3852c394ca7SJames Schulman 3862c394ca7SJames Schulman #define CS42L42_MIXER_INT_MASK (CS42L42_PAGE_13 + 0x17) 3872c394ca7SJames Schulman #define CS42L42_MIX_CHB_OVFL_SHIFT 0 3882c394ca7SJames Schulman #define CS42L42_MIX_CHB_OVFL_MASK (1 << CS42L42_MIX_CHB_OVFL_SHIFT) 3892c394ca7SJames Schulman #define CS42L42_MIX_CHA_OVFL_SHIFT 1 3902c394ca7SJames Schulman #define CS42L42_MIX_CHA_OVFL_MASK (1 << CS42L42_MIX_CHA_OVFL_SHIFT) 3912c394ca7SJames Schulman #define CS42L42_EQ_OVFL_SHIFT 2 3922c394ca7SJames Schulman #define CS42L42_EQ_OVFL_MASK (1 << CS42L42_EQ_OVFL_SHIFT) 3932c394ca7SJames Schulman #define CS42L42_EQ_BIQUAD_OVFL_SHIFT 3 3942c394ca7SJames Schulman #define CS42L42_EQ_BIQUAD_OVFL_MASK (1 << CS42L42_EQ_BIQUAD_OVFL_SHIFT) 3952c394ca7SJames Schulman #define CS42L42_MIXER_VAL_MASK (CS42L42_MIX_CHB_OVFL_MASK | \ 3962c394ca7SJames Schulman CS42L42_MIX_CHA_OVFL_MASK | \ 3972c394ca7SJames Schulman CS42L42_EQ_OVFL_MASK | \ 3982c394ca7SJames Schulman CS42L42_EQ_BIQUAD_OVFL_MASK) 3992c394ca7SJames Schulman 4002c394ca7SJames Schulman #define CS42L42_SRC_INT_MASK (CS42L42_PAGE_13 + 0x18) 4012c394ca7SJames Schulman #define CS42L42_SRC_ILK_SHIFT 0 4022c394ca7SJames Schulman #define CS42L42_SRC_ILK_MASK (1 << CS42L42_SRC_ILK_SHIFT) 4032c394ca7SJames Schulman #define CS42L42_SRC_OLK_SHIFT 1 4042c394ca7SJames Schulman #define CS42L42_SRC_OLK_MASK (1 << CS42L42_SRC_OLK_SHIFT) 4052c394ca7SJames Schulman #define CS42L42_SRC_IUNLK_SHIFT 2 4062c394ca7SJames Schulman #define CS42L42_SRC_IUNLK_MASK (1 << CS42L42_SRC_IUNLK_SHIFT) 4072c394ca7SJames Schulman #define CS42L42_SRC_OUNLK_SHIFT 3 4082c394ca7SJames Schulman #define CS42L42_SRC_OUNLK_MASK (1 << CS42L42_SRC_OUNLK_SHIFT) 4092c394ca7SJames Schulman #define CS42L42_SRC_VAL_MASK (CS42L42_SRC_ILK_MASK | \ 4102c394ca7SJames Schulman CS42L42_SRC_OLK_MASK | \ 4112c394ca7SJames Schulman CS42L42_SRC_IUNLK_MASK | \ 4122c394ca7SJames Schulman CS42L42_SRC_OUNLK_MASK) 4132c394ca7SJames Schulman 4142c394ca7SJames Schulman #define CS42L42_ASP_RX_INT_MASK (CS42L42_PAGE_13 + 0x19) 4152c394ca7SJames Schulman #define CS42L42_ASPRX_NOLRCK_SHIFT 0 4162c394ca7SJames Schulman #define CS42L42_ASPRX_NOLRCK_MASK (1 << CS42L42_ASPRX_NOLRCK_SHIFT) 4172c394ca7SJames Schulman #define CS42L42_ASPRX_EARLY_SHIFT 1 4182c394ca7SJames Schulman #define CS42L42_ASPRX_EARLY_MASK (1 << CS42L42_ASPRX_EARLY_SHIFT) 4192c394ca7SJames Schulman #define CS42L42_ASPRX_LATE_SHIFT 2 4202c394ca7SJames Schulman #define CS42L42_ASPRX_LATE_MASK (1 << CS42L42_ASPRX_LATE_SHIFT) 4212c394ca7SJames Schulman #define CS42L42_ASPRX_ERROR_SHIFT 3 4222c394ca7SJames Schulman #define CS42L42_ASPRX_ERROR_MASK (1 << CS42L42_ASPRX_ERROR_SHIFT) 4232c394ca7SJames Schulman #define CS42L42_ASPRX_OVLD_SHIFT 4 4242c394ca7SJames Schulman #define CS42L42_ASPRX_OVLD_MASK (1 << CS42L42_ASPRX_OVLD_SHIFT) 4252c394ca7SJames Schulman #define CS42L42_ASP_RX_VAL_MASK (CS42L42_ASPRX_NOLRCK_MASK | \ 4262c394ca7SJames Schulman CS42L42_ASPRX_EARLY_MASK | \ 4272c394ca7SJames Schulman CS42L42_ASPRX_LATE_MASK | \ 4282c394ca7SJames Schulman CS42L42_ASPRX_ERROR_MASK | \ 4292c394ca7SJames Schulman CS42L42_ASPRX_OVLD_MASK) 4302c394ca7SJames Schulman 4312c394ca7SJames Schulman #define CS42L42_ASP_TX_INT_MASK (CS42L42_PAGE_13 + 0x1A) 4322c394ca7SJames Schulman #define CS42L42_ASPTX_NOLRCK_SHIFT 0 4332c394ca7SJames Schulman #define CS42L42_ASPTX_NOLRCK_MASK (1 << CS42L42_ASPTX_NOLRCK_SHIFT) 4342c394ca7SJames Schulman #define CS42L42_ASPTX_EARLY_SHIFT 1 4352c394ca7SJames Schulman #define CS42L42_ASPTX_EARLY_MASK (1 << CS42L42_ASPTX_EARLY_SHIFT) 4362c394ca7SJames Schulman #define CS42L42_ASPTX_LATE_SHIFT 2 4372c394ca7SJames Schulman #define CS42L42_ASPTX_LATE_MASK (1 << CS42L42_ASPTX_LATE_SHIFT) 4382c394ca7SJames Schulman #define CS42L42_ASPTX_SMERROR_SHIFT 3 4392c394ca7SJames Schulman #define CS42L42_ASPTX_SMERROR_MASK (1 << CS42L42_ASPTX_SMERROR_SHIFT) 4402c394ca7SJames Schulman #define CS42L42_ASP_TX_VAL_MASK (CS42L42_ASPTX_NOLRCK_MASK | \ 4412c394ca7SJames Schulman CS42L42_ASPTX_EARLY_MASK | \ 4422c394ca7SJames Schulman CS42L42_ASPTX_LATE_MASK | \ 4432c394ca7SJames Schulman CS42L42_ASPTX_SMERROR_MASK) 4442c394ca7SJames Schulman 4452c394ca7SJames Schulman #define CS42L42_CODEC_INT_MASK (CS42L42_PAGE_13 + 0x1B) 4462c394ca7SJames Schulman #define CS42L42_PDN_DONE_SHIFT 0 4472c394ca7SJames Schulman #define CS42L42_PDN_DONE_MASK (1 << CS42L42_PDN_DONE_SHIFT) 4482c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_DONE_SHIFT 1 4492c394ca7SJames Schulman #define CS42L42_HSDET_AUTO_DONE_MASK (1 << CS42L42_HSDET_AUTO_DONE_SHIFT) 4502c394ca7SJames Schulman #define CS42L42_CODEC_VAL_MASK (CS42L42_PDN_DONE_MASK | \ 4512c394ca7SJames Schulman CS42L42_HSDET_AUTO_DONE_MASK) 4522c394ca7SJames Schulman 4532c394ca7SJames Schulman #define CS42L42_SRCPL_INT_MASK (CS42L42_PAGE_13 + 0x1C) 4542c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_LK_SHIFT 0 4552c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_LK_MASK (1 << CS42L42_SRCPL_ADC_LK_SHIFT) 4562c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_LK_SHIFT 2 4572c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_LK_MASK (1 << CS42L42_SRCPL_DAC_LK_SHIFT) 4582c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_UNLK_SHIFT 5 4592c394ca7SJames Schulman #define CS42L42_SRCPL_ADC_UNLK_MASK (1 << CS42L42_SRCPL_ADC_UNLK_SHIFT) 4602c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_UNLK_SHIFT 6 4612c394ca7SJames Schulman #define CS42L42_SRCPL_DAC_UNLK_MASK (1 << CS42L42_SRCPL_DAC_UNLK_SHIFT) 4622c394ca7SJames Schulman #define CS42L42_SRCPL_VAL_MASK (CS42L42_SRCPL_ADC_LK_MASK | \ 4632c394ca7SJames Schulman CS42L42_SRCPL_DAC_LK_MASK | \ 4642c394ca7SJames Schulman CS42L42_SRCPL_ADC_UNLK_MASK | \ 4652c394ca7SJames Schulman CS42L42_SRCPL_DAC_UNLK_MASK) 4662c394ca7SJames Schulman 4672c394ca7SJames Schulman #define CS42L42_VPMON_INT_MASK (CS42L42_PAGE_13 + 0x1E) 4682c394ca7SJames Schulman #define CS42L42_VPMON_SHIFT 0 4692c394ca7SJames Schulman #define CS42L42_VPMON_MASK (1 << CS42L42_VPMON_SHIFT) 4702c394ca7SJames Schulman #define CS42L42_VPMON_VAL_MASK CS42L42_VPMON_MASK 4712c394ca7SJames Schulman 4722c394ca7SJames Schulman #define CS42L42_PLL_LOCK_INT_MASK (CS42L42_PAGE_13 + 0x1F) 4732c394ca7SJames Schulman #define CS42L42_PLL_LOCK_SHIFT 0 4742c394ca7SJames Schulman #define CS42L42_PLL_LOCK_MASK (1 << CS42L42_PLL_LOCK_SHIFT) 4752c394ca7SJames Schulman #define CS42L42_PLL_LOCK_VAL_MASK CS42L42_PLL_LOCK_MASK 4762c394ca7SJames Schulman 4772c394ca7SJames Schulman #define CS42L42_TSRS_PLUG_INT_MASK (CS42L42_PAGE_13 + 0x20) 4782c394ca7SJames Schulman #define CS42L42_RS_PLUG_SHIFT 0 4792c394ca7SJames Schulman #define CS42L42_RS_PLUG_MASK (1 << CS42L42_RS_PLUG_SHIFT) 4802c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_SHIFT 1 4812c394ca7SJames Schulman #define CS42L42_RS_UNPLUG_MASK (1 << CS42L42_RS_UNPLUG_SHIFT) 4822c394ca7SJames Schulman #define CS42L42_TS_PLUG_SHIFT 2 4832c394ca7SJames Schulman #define CS42L42_TS_PLUG_MASK (1 << CS42L42_TS_PLUG_SHIFT) 4842c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_SHIFT 3 4852c394ca7SJames Schulman #define CS42L42_TS_UNPLUG_MASK (1 << CS42L42_TS_UNPLUG_SHIFT) 4862c394ca7SJames Schulman #define CS42L42_TSRS_PLUG_VAL_MASK (CS42L42_RS_PLUG_MASK | \ 4872c394ca7SJames Schulman CS42L42_RS_UNPLUG_MASK | \ 4882c394ca7SJames Schulman CS42L42_TS_PLUG_MASK | \ 4892c394ca7SJames Schulman CS42L42_TS_UNPLUG_MASK) 4902c394ca7SJames Schulman #define CS42L42_TS_PLUG 3 4912c394ca7SJames Schulman #define CS42L42_TS_UNPLUG 0 4922c394ca7SJames Schulman #define CS42L42_TS_TRANS 1 4932c394ca7SJames Schulman 4942c394ca7SJames Schulman /* Page 0x15 Fractional-N PLL Registers */ 4952c394ca7SJames Schulman #define CS42L42_PLL_CTL1 (CS42L42_PAGE_15 + 0x01) 4962c394ca7SJames Schulman #define CS42L42_PLL_START_SHIFT 0 4972c394ca7SJames Schulman #define CS42L42_PLL_START_MASK (1 << CS42L42_PLL_START_SHIFT) 4982c394ca7SJames Schulman 4992c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC0 (CS42L42_PAGE_15 + 0x02) 5002c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC_SHIFT 0 5012c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC_MASK (0xff << CS42L42_PLL_DIV_FRAC_SHIFT) 5022c394ca7SJames Schulman 5032c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC1 (CS42L42_PAGE_15 + 0x03) 5042c394ca7SJames Schulman #define CS42L42_PLL_DIV_FRAC2 (CS42L42_PAGE_15 + 0x04) 5052c394ca7SJames Schulman 5062c394ca7SJames Schulman #define CS42L42_PLL_DIV_INT (CS42L42_PAGE_15 + 0x05) 5072c394ca7SJames Schulman #define CS42L42_PLL_DIV_INT_SHIFT 0 5082c394ca7SJames Schulman #define CS42L42_PLL_DIV_INT_MASK (0xff << CS42L42_PLL_DIV_INT_SHIFT) 5092c394ca7SJames Schulman 5102c394ca7SJames Schulman #define CS42L42_PLL_CTL3 (CS42L42_PAGE_15 + 0x08) 5112c394ca7SJames Schulman #define CS42L42_PLL_DIVOUT_SHIFT 0 5122c394ca7SJames Schulman #define CS42L42_PLL_DIVOUT_MASK (0xff << CS42L42_PLL_DIVOUT_SHIFT) 5132c394ca7SJames Schulman 5142c394ca7SJames Schulman #define CS42L42_PLL_CAL_RATIO (CS42L42_PAGE_15 + 0x0A) 5152c394ca7SJames Schulman #define CS42L42_PLL_CAL_RATIO_SHIFT 0 5162c394ca7SJames Schulman #define CS42L42_PLL_CAL_RATIO_MASK (0xff << CS42L42_PLL_CAL_RATIO_SHIFT) 5172c394ca7SJames Schulman 5182c394ca7SJames Schulman #define CS42L42_PLL_CTL4 (CS42L42_PAGE_15 + 0x1B) 5192c394ca7SJames Schulman #define CS42L42_PLL_MODE_SHIFT 0 5202c394ca7SJames Schulman #define CS42L42_PLL_MODE_MASK (3 << CS42L42_PLL_MODE_SHIFT) 5212c394ca7SJames Schulman 5222c394ca7SJames Schulman /* Page 0x19 HP Load Detect Registers */ 5232c394ca7SJames Schulman #define CS42L42_LOAD_DET_RCSTAT (CS42L42_PAGE_19 + 0x25) 5242c394ca7SJames Schulman #define CS42L42_RLA_STAT_SHIFT 0 5252c394ca7SJames Schulman #define CS42L42_RLA_STAT_MASK (3 << CS42L42_RLA_STAT_SHIFT) 5262c394ca7SJames Schulman #define CS42L42_RLA_STAT_15_OHM 0 5272c394ca7SJames Schulman 5282c394ca7SJames Schulman #define CS42L42_LOAD_DET_DONE (CS42L42_PAGE_19 + 0x26) 5292c394ca7SJames Schulman #define CS42L42_HPLOAD_DET_DONE_SHIFT 0 5302c394ca7SJames Schulman #define CS42L42_HPLOAD_DET_DONE_MASK (1 << CS42L42_HPLOAD_DET_DONE_SHIFT) 5312c394ca7SJames Schulman 5322c394ca7SJames Schulman #define CS42L42_LOAD_DET_EN (CS42L42_PAGE_19 + 0x27) 5332c394ca7SJames Schulman #define CS42L42_HP_LD_EN_SHIFT 0 5342c394ca7SJames Schulman #define CS42L42_HP_LD_EN_MASK (1 << CS42L42_HP_LD_EN_SHIFT) 5352c394ca7SJames Schulman 5362c394ca7SJames Schulman /* Page 0x1B Headset Interface Registers */ 5372c394ca7SJames Schulman #define CS42L42_HSBIAS_SC_AUTOCTL (CS42L42_PAGE_1B + 0x70) 5382c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_TRIP_SHIFT 0 5392c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_TRIP_MASK (7 << \ 5402c394ca7SJames Schulman CS42L42_HSBIAS_SENSE_TRIP_SHIFT) 5412c394ca7SJames Schulman #define CS42L42_TIP_SENSE_EN_SHIFT 5 5422c394ca7SJames Schulman #define CS42L42_TIP_SENSE_EN_MASK (1 << \ 5432c394ca7SJames Schulman CS42L42_TIP_SENSE_EN_SHIFT) 5442c394ca7SJames Schulman #define CS42L42_AUTO_HSBIAS_HIZ_SHIFT 6 5452c394ca7SJames Schulman #define CS42L42_AUTO_HSBIAS_HIZ_MASK (1 << \ 5462c394ca7SJames Schulman CS42L42_AUTO_HSBIAS_HIZ_SHIFT) 5472c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_EN_SHIFT 7 5482c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_EN_MASK (1 << \ 5492c394ca7SJames Schulman CS42L42_HSBIAS_SENSE_EN_SHIFT) 5502c394ca7SJames Schulman 5512c394ca7SJames Schulman #define CS42L42_WAKE_CTL (CS42L42_PAGE_1B + 0x71) 5522c394ca7SJames Schulman #define CS42L42_WAKEB_CLEAR_SHIFT 0 5532c394ca7SJames Schulman #define CS42L42_WAKEB_CLEAR_MASK (1 << CS42L42_WAKEB_CLEAR_SHIFT) 5542c394ca7SJames Schulman #define CS42L42_WAKEB_MODE_SHIFT 5 5552c394ca7SJames Schulman #define CS42L42_WAKEB_MODE_MASK (1 << CS42L42_WAKEB_MODE_SHIFT) 5562c394ca7SJames Schulman #define CS42L42_M_HP_WAKE_SHIFT 6 5572c394ca7SJames Schulman #define CS42L42_M_HP_WAKE_MASK (1 << CS42L42_M_HP_WAKE_SHIFT) 5582c394ca7SJames Schulman #define CS42L42_M_MIC_WAKE_SHIFT 7 5592c394ca7SJames Schulman #define CS42L42_M_MIC_WAKE_MASK (1 << CS42L42_M_MIC_WAKE_SHIFT) 5602c394ca7SJames Schulman 5612c394ca7SJames Schulman #define CS42L42_ADC_DISABLE_MUTE (CS42L42_PAGE_1B + 0x72) 5622c394ca7SJames Schulman #define CS42L42_ADC_DISABLE_S0_MUTE_SHIFT 7 5632c394ca7SJames Schulman #define CS42L42_ADC_DISABLE_S0_MUTE_MASK (1 << \ 5642c394ca7SJames Schulman CS42L42_ADC_DISABLE_S0_MUTE_SHIFT) 5652c394ca7SJames Schulman 5662c394ca7SJames Schulman #define CS42L42_TIPSENSE_CTL (CS42L42_PAGE_1B + 0x73) 5672c394ca7SJames Schulman #define CS42L42_TIP_SENSE_DEBOUNCE_SHIFT 0 5682c394ca7SJames Schulman #define CS42L42_TIP_SENSE_DEBOUNCE_MASK (3 << \ 5692c394ca7SJames Schulman CS42L42_TIP_SENSE_DEBOUNCE_SHIFT) 5702c394ca7SJames Schulman #define CS42L42_TIP_SENSE_INV_SHIFT 5 5712c394ca7SJames Schulman #define CS42L42_TIP_SENSE_INV_MASK (1 << \ 5722c394ca7SJames Schulman CS42L42_TIP_SENSE_INV_SHIFT) 5732c394ca7SJames Schulman #define CS42L42_TIP_SENSE_CTRL_SHIFT 6 5742c394ca7SJames Schulman #define CS42L42_TIP_SENSE_CTRL_MASK (3 << \ 5752c394ca7SJames Schulman CS42L42_TIP_SENSE_CTRL_SHIFT) 5762c394ca7SJames Schulman 5772c394ca7SJames Schulman #define CS42L42_MISC_DET_CTL (CS42L42_PAGE_1B + 0x74) 5782c394ca7SJames Schulman #define CS42L42_PDN_MIC_LVL_DET_SHIFT 0 5792c394ca7SJames Schulman #define CS42L42_PDN_MIC_LVL_DET_MASK (1 << CS42L42_PDN_MIC_LVL_DET_SHIFT) 5802c394ca7SJames Schulman #define CS42L42_HSBIAS_CTL_SHIFT 1 5812c394ca7SJames Schulman #define CS42L42_HSBIAS_CTL_MASK (3 << CS42L42_HSBIAS_CTL_SHIFT) 5822c394ca7SJames Schulman #define CS42L42_DETECT_MODE_SHIFT 3 5832c394ca7SJames Schulman #define CS42L42_DETECT_MODE_MASK (3 << CS42L42_DETECT_MODE_SHIFT) 5842c394ca7SJames Schulman 5852c394ca7SJames Schulman #define CS42L42_MIC_DET_CTL1 (CS42L42_PAGE_1B + 0x75) 5862c394ca7SJames Schulman #define CS42L42_HS_DET_LEVEL_SHIFT 0 5872c394ca7SJames Schulman #define CS42L42_HS_DET_LEVEL_MASK (0x3F << CS42L42_HS_DET_LEVEL_SHIFT) 5882c394ca7SJames Schulman #define CS42L42_EVENT_STAT_SEL_SHIFT 6 5892c394ca7SJames Schulman #define CS42L42_EVENT_STAT_SEL_MASK (1 << CS42L42_EVENT_STAT_SEL_SHIFT) 5902c394ca7SJames Schulman #define CS42L42_LATCH_TO_VP_SHIFT 7 5912c394ca7SJames Schulman #define CS42L42_LATCH_TO_VP_MASK (1 << CS42L42_LATCH_TO_VP_SHIFT) 5922c394ca7SJames Schulman 5932c394ca7SJames Schulman #define CS42L42_MIC_DET_CTL2 (CS42L42_PAGE_1B + 0x76) 5942c394ca7SJames Schulman #define CS42L42_DEBOUNCE_TIME_SHIFT 5 5952c394ca7SJames Schulman #define CS42L42_DEBOUNCE_TIME_MASK (0x07 << CS42L42_DEBOUNCE_TIME_SHIFT) 5962c394ca7SJames Schulman 5972c394ca7SJames Schulman #define CS42L42_DET_STATUS1 (CS42L42_PAGE_1B + 0x77) 5982c394ca7SJames Schulman #define CS42L42_HSBIAS_HIZ_MODE_SHIFT 6 5992c394ca7SJames Schulman #define CS42L42_HSBIAS_HIZ_MODE_MASK (1 << CS42L42_HSBIAS_HIZ_MODE_SHIFT) 6002c394ca7SJames Schulman #define CS42L42_TIP_SENSE_SHIFT 7 6012c394ca7SJames Schulman #define CS42L42_TIP_SENSE_MASK (1 << CS42L42_TIP_SENSE_SHIFT) 6022c394ca7SJames Schulman 6032c394ca7SJames Schulman #define CS42L42_DET_STATUS2 (CS42L42_PAGE_1B + 0x78) 6042c394ca7SJames Schulman #define CS42L42_SHORT_TRUE_SHIFT 0 6052c394ca7SJames Schulman #define CS42L42_SHORT_TRUE_MASK (1 << CS42L42_SHORT_TRUE_SHIFT) 6062c394ca7SJames Schulman #define CS42L42_HS_TRUE_SHIFT 1 6072c394ca7SJames Schulman #define CS42L42_HS_TRUE_MASK (1 << CS42L42_HS_TRUE_SHIFT) 6082c394ca7SJames Schulman 6092c394ca7SJames Schulman #define CS42L42_DET_INT1_MASK (CS42L42_PAGE_1B + 0x79) 6102c394ca7SJames Schulman #define CS42L42_TIP_SENSE_UNPLUG_SHIFT 5 6112c394ca7SJames Schulman #define CS42L42_TIP_SENSE_UNPLUG_MASK (1 << CS42L42_TIP_SENSE_UNPLUG_SHIFT) 6122c394ca7SJames Schulman #define CS42L42_TIP_SENSE_PLUG_SHIFT 6 6132c394ca7SJames Schulman #define CS42L42_TIP_SENSE_PLUG_MASK (1 << CS42L42_TIP_SENSE_PLUG_SHIFT) 6142c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_SHIFT 7 6152c394ca7SJames Schulman #define CS42L42_HSBIAS_SENSE_MASK (1 << CS42L42_HSBIAS_SENSE_SHIFT) 6162c394ca7SJames Schulman #define CS42L42_DET_INT_VAL1_MASK (CS42L42_TIP_SENSE_UNPLUG_MASK | \ 6172c394ca7SJames Schulman CS42L42_TIP_SENSE_PLUG_MASK | \ 6182c394ca7SJames Schulman CS42L42_HSBIAS_SENSE_MASK) 6192c394ca7SJames Schulman 6202c394ca7SJames Schulman #define CS42L42_DET_INT2_MASK (CS42L42_PAGE_1B + 0x7A) 6212c394ca7SJames Schulman #define CS42L42_M_SHORT_DET_SHIFT 0 6222c394ca7SJames Schulman #define CS42L42_M_SHORT_DET_MASK (1 << \ 6232c394ca7SJames Schulman CS42L42_M_SHORT_DET_SHIFT) 6242c394ca7SJames Schulman #define CS42L42_M_SHORT_RLS_SHIFT 1 6252c394ca7SJames Schulman #define CS42L42_M_SHORT_RLS_MASK (1 << \ 6262c394ca7SJames Schulman CS42L42_M_SHORT_RLS_SHIFT) 6272c394ca7SJames Schulman #define CS42L42_M_HSBIAS_HIZ_SHIFT 2 6282c394ca7SJames Schulman #define CS42L42_M_HSBIAS_HIZ_MASK (1 << \ 6292c394ca7SJames Schulman CS42L42_M_HSBIAS_HIZ_SHIFT) 6302c394ca7SJames Schulman #define CS42L42_M_DETECT_FT_SHIFT 6 6312c394ca7SJames Schulman #define CS42L42_M_DETECT_FT_MASK (1 << \ 6322c394ca7SJames Schulman CS42L42_M_DETECT_FT_SHIFT) 6332c394ca7SJames Schulman #define CS42L42_M_DETECT_TF_SHIFT 7 6342c394ca7SJames Schulman #define CS42L42_M_DETECT_TF_MASK (1 << \ 6352c394ca7SJames Schulman CS42L42_M_DETECT_TF_SHIFT) 6362c394ca7SJames Schulman #define CS42L42_DET_INT_VAL2_MASK (CS42L42_M_SHORT_DET_MASK | \ 6372c394ca7SJames Schulman CS42L42_M_SHORT_RLS_MASK | \ 6382c394ca7SJames Schulman CS42L42_M_HSBIAS_HIZ_MASK | \ 6392c394ca7SJames Schulman CS42L42_M_DETECT_FT_MASK | \ 6402c394ca7SJames Schulman CS42L42_M_DETECT_TF_MASK) 6412c394ca7SJames Schulman 6422c394ca7SJames Schulman /* Page 0x1C Headset Bias Registers */ 6432c394ca7SJames Schulman #define CS42L42_HS_BIAS_CTL (CS42L42_PAGE_1C + 0x03) 6442c394ca7SJames Schulman #define CS42L42_HSBIAS_RAMP_SHIFT 0 6452c394ca7SJames Schulman #define CS42L42_HSBIAS_RAMP_MASK (3 << CS42L42_HSBIAS_RAMP_SHIFT) 6462c394ca7SJames Schulman #define CS42L42_HSBIAS_PD_SHIFT 4 6472c394ca7SJames Schulman #define CS42L42_HSBIAS_PD_MASK (1 << CS42L42_HSBIAS_PD_SHIFT) 6482c394ca7SJames Schulman #define CS42L42_HSBIAS_CAPLESS_SHIFT 7 6492c394ca7SJames Schulman #define CS42L42_HSBIAS_CAPLESS_MASK (1 << CS42L42_HSBIAS_CAPLESS_SHIFT) 6502c394ca7SJames Schulman 6512c394ca7SJames Schulman /* Page 0x1D ADC Registers */ 6522c394ca7SJames Schulman #define CS42L42_ADC_CTL (CS42L42_PAGE_1D + 0x01) 6532c394ca7SJames Schulman #define CS42L42_ADC_NOTCH_DIS_SHIFT 5 6542c394ca7SJames Schulman #define CS42L42_ADC_FORCE_WEAK_VCM_SHIFT 4 6552c394ca7SJames Schulman #define CS42L42_ADC_INV_SHIFT 2 6562c394ca7SJames Schulman #define CS42L42_ADC_DIG_BOOST_SHIFT 0 6572c394ca7SJames Schulman 6582c394ca7SJames Schulman #define CS42L42_ADC_VOLUME (CS42L42_PAGE_1D + 0x03) 6592c394ca7SJames Schulman #define CS42L42_ADC_VOL_SHIFT 0 6602c394ca7SJames Schulman 6612c394ca7SJames Schulman #define CS42L42_ADC_WNF_HPF_CTL (CS42L42_PAGE_1D + 0x04) 6622c394ca7SJames Schulman #define CS42L42_ADC_WNF_CF_SHIFT 4 6632c394ca7SJames Schulman #define CS42L42_ADC_WNF_EN_SHIFT 3 6642c394ca7SJames Schulman #define CS42L42_ADC_HPF_CF_SHIFT 1 6652c394ca7SJames Schulman #define CS42L42_ADC_HPF_EN_SHIFT 0 6662c394ca7SJames Schulman 6672c394ca7SJames Schulman /* Page 0x1F DAC Registers */ 6682c394ca7SJames Schulman #define CS42L42_DAC_CTL1 (CS42L42_PAGE_1F + 0x01) 6692c394ca7SJames Schulman #define CS42L42_DACB_INV_SHIFT 1 6702c394ca7SJames Schulman #define CS42L42_DACA_INV_SHIFT 0 6712c394ca7SJames Schulman 6722c394ca7SJames Schulman #define CS42L42_DAC_CTL2 (CS42L42_PAGE_1F + 0x06) 6732c394ca7SJames Schulman #define CS42L42_HPOUT_PULLDOWN_SHIFT 4 6742c394ca7SJames Schulman #define CS42L42_HPOUT_PULLDOWN_MASK (15 << CS42L42_HPOUT_PULLDOWN_SHIFT) 6752c394ca7SJames Schulman #define CS42L42_HPOUT_LOAD_SHIFT 3 6762c394ca7SJames Schulman #define CS42L42_HPOUT_LOAD_MASK (1 << CS42L42_HPOUT_LOAD_SHIFT) 6772c394ca7SJames Schulman #define CS42L42_HPOUT_CLAMP_SHIFT 2 6782c394ca7SJames Schulman #define CS42L42_HPOUT_CLAMP_MASK (1 << CS42L42_HPOUT_CLAMP_SHIFT) 6792c394ca7SJames Schulman #define CS42L42_DAC_HPF_EN_SHIFT 1 6802c394ca7SJames Schulman #define CS42L42_DAC_HPF_EN_MASK (1 << CS42L42_DAC_HPF_EN_SHIFT) 6812c394ca7SJames Schulman #define CS42L42_DAC_MON_EN_SHIFT 0 6822c394ca7SJames Schulman #define CS42L42_DAC_MON_EN_MASK (1 << CS42L42_DAC_MON_EN_SHIFT) 6832c394ca7SJames Schulman 6842c394ca7SJames Schulman /* Page 0x20 HP CTL Registers */ 6852c394ca7SJames Schulman #define CS42L42_HP_CTL (CS42L42_PAGE_20 + 0x01) 6862c394ca7SJames Schulman #define CS42L42_HP_ANA_BMUTE_SHIFT 3 6872c394ca7SJames Schulman #define CS42L42_HP_ANA_BMUTE_MASK (1 << CS42L42_HP_ANA_BMUTE_SHIFT) 6882c394ca7SJames Schulman #define CS42L42_HP_ANA_AMUTE_SHIFT 2 6892c394ca7SJames Schulman #define CS42L42_HP_ANA_AMUTE_MASK (1 << CS42L42_HP_ANA_AMUTE_SHIFT) 6902c394ca7SJames Schulman #define CS42L42_HP_FULL_SCALE_VOL_SHIFT 1 6912c394ca7SJames Schulman #define CS42L42_HP_FULL_SCALE_VOL_MASK (1 << CS42L42_HP_FULL_SCALE_VOL_SHIFT) 6922c394ca7SJames Schulman 6932c394ca7SJames Schulman /* Page 0x21 Class H Registers */ 6942c394ca7SJames Schulman #define CS42L42_CLASSH_CTL (CS42L42_PAGE_21 + 0x01) 6952c394ca7SJames Schulman 6962c394ca7SJames Schulman /* Page 0x23 Mixer Volume Registers */ 6972c394ca7SJames Schulman #define CS42L42_MIXER_CHA_VOL (CS42L42_PAGE_23 + 0x01) 6982c394ca7SJames Schulman #define CS42L42_MIXER_ADC_VOL (CS42L42_PAGE_23 + 0x02) 6992c394ca7SJames Schulman 7002c394ca7SJames Schulman #define CS42L42_MIXER_CHB_VOL (CS42L42_PAGE_23 + 0x03) 7012c394ca7SJames Schulman #define CS42L42_MIXER_CH_VOL_SHIFT 0 7022c394ca7SJames Schulman #define CS42L42_MIXER_CH_VOL_MASK (0x3f << CS42L42_MIXER_CH_VOL_SHIFT) 7032c394ca7SJames Schulman 7042c394ca7SJames Schulman /* Page 0x24 EQ Registers */ 7052c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN0 (CS42L42_PAGE_24 + 0x01) 7062c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN1 (CS42L42_PAGE_24 + 0x02) 7072c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN2 (CS42L42_PAGE_24 + 0x03) 7082c394ca7SJames Schulman #define CS42L42_EQ_COEF_IN3 (CS42L42_PAGE_24 + 0x04) 7092c394ca7SJames Schulman #define CS42L42_EQ_COEF_RW (CS42L42_PAGE_24 + 0x06) 7102c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT0 (CS42L42_PAGE_24 + 0x07) 7112c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT1 (CS42L42_PAGE_24 + 0x08) 7122c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT2 (CS42L42_PAGE_24 + 0x09) 7132c394ca7SJames Schulman #define CS42L42_EQ_COEF_OUT3 (CS42L42_PAGE_24 + 0x0A) 7142c394ca7SJames Schulman #define CS42L42_EQ_INIT_STAT (CS42L42_PAGE_24 + 0x0B) 7152c394ca7SJames Schulman #define CS42L42_EQ_START_FILT (CS42L42_PAGE_24 + 0x0C) 7162c394ca7SJames Schulman #define CS42L42_EQ_MUTE_CTL (CS42L42_PAGE_24 + 0x0E) 7172c394ca7SJames Schulman 7182c394ca7SJames Schulman /* Page 0x25 Audio Port Registers */ 7192c394ca7SJames Schulman #define CS42L42_SP_RX_CH_SEL (CS42L42_PAGE_25 + 0x01) 720e5ada3f6SRichard Fitzgerald #define CS42L42_SP_RX_CHB_SEL_SHIFT 2 721e5ada3f6SRichard Fitzgerald #define CS42L42_SP_RX_CHB_SEL_MASK (3 << CS42L42_SP_RX_CHB_SEL_SHIFT) 7222c394ca7SJames Schulman 7232c394ca7SJames Schulman #define CS42L42_SP_RX_ISOC_CTL (CS42L42_PAGE_25 + 0x02) 7242c394ca7SJames Schulman #define CS42L42_SP_RX_RSYNC_SHIFT 6 7252c394ca7SJames Schulman #define CS42L42_SP_RX_RSYNC_MASK (1 << CS42L42_SP_RX_RSYNC_SHIFT) 7262c394ca7SJames Schulman #define CS42L42_SP_RX_NSB_POS_SHIFT 3 7272c394ca7SJames Schulman #define CS42L42_SP_RX_NSB_POS_MASK (7 << CS42L42_SP_RX_NSB_POS_SHIFT) 7282c394ca7SJames Schulman #define CS42L42_SP_RX_NFS_NSBB_SHIFT 2 7292c394ca7SJames Schulman #define CS42L42_SP_RX_NFS_NSBB_MASK (1 << CS42L42_SP_RX_NFS_NSBB_SHIFT) 7302c394ca7SJames Schulman #define CS42L42_SP_RX_ISOC_MODE_SHIFT 0 7312c394ca7SJames Schulman #define CS42L42_SP_RX_ISOC_MODE_MASK (3 << CS42L42_SP_RX_ISOC_MODE_SHIFT) 7322c394ca7SJames Schulman 7332c394ca7SJames Schulman #define CS42L42_SP_RX_FS (CS42L42_PAGE_25 + 0x03) 7342c394ca7SJames Schulman #define CS42l42_SPDIF_CH_SEL (CS42L42_PAGE_25 + 0x04) 7352c394ca7SJames Schulman #define CS42L42_SP_TX_ISOC_CTL (CS42L42_PAGE_25 + 0x05) 7362c394ca7SJames Schulman #define CS42L42_SP_TX_FS (CS42L42_PAGE_25 + 0x06) 7372c394ca7SJames Schulman #define CS42L42_SPDIF_SW_CTL1 (CS42L42_PAGE_25 + 0x07) 7382c394ca7SJames Schulman 7392c394ca7SJames Schulman /* Page 0x26 SRC Registers */ 7402c394ca7SJames Schulman #define CS42L42_SRC_SDIN_FS (CS42L42_PAGE_26 + 0x01) 7412c394ca7SJames Schulman #define CS42L42_SRC_SDIN_FS_SHIFT 0 7422c394ca7SJames Schulman #define CS42L42_SRC_SDIN_FS_MASK (0x1f << CS42L42_SRC_SDIN_FS_SHIFT) 7432c394ca7SJames Schulman 7442c394ca7SJames Schulman #define CS42L42_SRC_SDOUT_FS (CS42L42_PAGE_26 + 0x09) 7452c394ca7SJames Schulman 7462c394ca7SJames Schulman /* Page 0x28 S/PDIF Registers */ 7472c394ca7SJames Schulman #define CS42L42_SPDIF_CTL1 (CS42L42_PAGE_28 + 0x01) 7482c394ca7SJames Schulman #define CS42L42_SPDIF_CTL2 (CS42L42_PAGE_28 + 0x02) 7492c394ca7SJames Schulman #define CS42L42_SPDIF_CTL3 (CS42L42_PAGE_28 + 0x03) 7502c394ca7SJames Schulman #define CS42L42_SPDIF_CTL4 (CS42L42_PAGE_28 + 0x04) 7512c394ca7SJames Schulman 7522c394ca7SJames Schulman /* Page 0x29 Serial Port TX Registers */ 7532c394ca7SJames Schulman #define CS42L42_ASP_TX_SZ_EN (CS42L42_PAGE_29 + 0x01) 754585e7079SLucas Tanure #define CS42L42_ASP_TX_EN_SHIFT 0 7552c394ca7SJames Schulman #define CS42L42_ASP_TX_CH_EN (CS42L42_PAGE_29 + 0x02) 756585e7079SLucas Tanure #define CS42L42_ASP_TX0_CH2_SHIFT 1 757585e7079SLucas Tanure #define CS42L42_ASP_TX0_CH1_SHIFT 0 758585e7079SLucas Tanure 7592c394ca7SJames Schulman #define CS42L42_ASP_TX_CH_AP_RES (CS42L42_PAGE_29 + 0x03) 760585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_AP_SHIFT 7 761585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_AP_MASK (1 << CS42L42_ASP_TX_CH1_AP_SHIFT) 762585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_AP_SHIFT 6 763585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_AP_MASK (1 << CS42L42_ASP_TX_CH2_AP_SHIFT) 764585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_RES_SHIFT 2 765585e7079SLucas Tanure #define CS42L42_ASP_TX_CH2_RES_MASK (3 << CS42L42_ASP_TX_CH2_RES_SHIFT) 766585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_RES_SHIFT 0 767585e7079SLucas Tanure #define CS42L42_ASP_TX_CH1_RES_MASK (3 << CS42L42_ASP_TX_CH1_RES_SHIFT) 7682c394ca7SJames Schulman #define CS42L42_ASP_TX_CH1_BIT_MSB (CS42L42_PAGE_29 + 0x04) 7692c394ca7SJames Schulman #define CS42L42_ASP_TX_CH1_BIT_LSB (CS42L42_PAGE_29 + 0x05) 7702c394ca7SJames Schulman #define CS42L42_ASP_TX_HIZ_DLY_CFG (CS42L42_PAGE_29 + 0x06) 7712c394ca7SJames Schulman #define CS42L42_ASP_TX_CH2_BIT_MSB (CS42L42_PAGE_29 + 0x0A) 7722c394ca7SJames Schulman #define CS42L42_ASP_TX_CH2_BIT_LSB (CS42L42_PAGE_29 + 0x0B) 7732c394ca7SJames Schulman 7742c394ca7SJames Schulman /* Page 0x2A Serial Port RX Registers */ 7752c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_EN (CS42L42_PAGE_2A + 0x01) 7762c394ca7SJames Schulman #define CS42L42_ASP_RX0_CH_EN_SHIFT 2 7772c394ca7SJames Schulman #define CS42L42_ASP_RX0_CH_EN_MASK (0xf << CS42L42_ASP_RX0_CH_EN_SHIFT) 778621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH1_SHIFT 2 779621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH2_SHIFT 3 780621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH3_SHIFT 4 781621d65f3SLucas Tanure #define CS42L42_ASP_RX0_CH4_SHIFT 5 7822c394ca7SJames Schulman 7832c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH1_AP_RES (CS42L42_PAGE_2A + 0x02) 7842c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH1_BIT_MSB (CS42L42_PAGE_2A + 0x03) 7852c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH1_BIT_LSB (CS42L42_PAGE_2A + 0x04) 7862c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH2_AP_RES (CS42L42_PAGE_2A + 0x05) 7872c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH2_BIT_MSB (CS42L42_PAGE_2A + 0x06) 7882c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH2_BIT_LSB (CS42L42_PAGE_2A + 0x07) 7892c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH3_AP_RES (CS42L42_PAGE_2A + 0x08) 7902c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH3_BIT_MSB (CS42L42_PAGE_2A + 0x09) 7912c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH3_BIT_LSB (CS42L42_PAGE_2A + 0x0A) 7922c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH4_AP_RES (CS42L42_PAGE_2A + 0x0B) 7932c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH4_BIT_MSB (CS42L42_PAGE_2A + 0x0C) 7942c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI0_CH4_BIT_LSB (CS42L42_PAGE_2A + 0x0D) 7952c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH1_AP_RES (CS42L42_PAGE_2A + 0x0E) 7962c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH1_BIT_MSB (CS42L42_PAGE_2A + 0x0F) 7972c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH1_BIT_LSB (CS42L42_PAGE_2A + 0x10) 7982c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH2_AP_RES (CS42L42_PAGE_2A + 0x11) 7992c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH2_BIT_MSB (CS42L42_PAGE_2A + 0x12) 8002c394ca7SJames Schulman #define CS42L42_ASP_RX_DAI1_CH2_BIT_LSB (CS42L42_PAGE_2A + 0x13) 8012c394ca7SJames Schulman 8022c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_SHIFT 6 8032c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_MASK (1 << CS42L42_ASP_RX_CH_AP_SHIFT) 8042c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_LOW 0 8052c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_AP_HI 1 8062c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_SHIFT 0 8072c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_MASK (3 << CS42L42_ASP_RX_CH_RES_SHIFT) 8082c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_32 3 8092c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_RES_16 1 8102c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_BIT_ST_SHIFT 0 8112c394ca7SJames Schulman #define CS42L42_ASP_RX_CH_BIT_ST_MASK (0xff << CS42L42_ASP_RX_CH_BIT_ST_SHIFT) 8122c394ca7SJames Schulman 8132c394ca7SJames Schulman /* Page 0x30 ID Registers */ 8142c394ca7SJames Schulman #define CS42L42_SUB_REVID (CS42L42_PAGE_30 + 0x14) 8152c394ca7SJames Schulman #define CS42L42_MAX_REGISTER (CS42L42_PAGE_30 + 0x14) 8162c394ca7SJames Schulman 8172c394ca7SJames Schulman /* Defines for fracturing values spread across multiple registers */ 8182c394ca7SJames Schulman #define CS42L42_FRAC0_VAL(val) ((val) & 0x0000ff) 8192c394ca7SJames Schulman #define CS42L42_FRAC1_VAL(val) (((val) & 0x00ff00) >> 8) 8202c394ca7SJames Schulman #define CS42L42_FRAC2_VAL(val) (((val) & 0xff0000) >> 16) 8212c394ca7SJames Schulman 8222c394ca7SJames Schulman #define CS42L42_NUM_SUPPLIES 5 82319325cfeSLucas Tanure #define CS42L42_BOOT_TIME_US 3000 8241c52825cSLucas Tanure #define CS42L42_PLL_DIVOUT_TIME_US 800 8250ea23660SRichard Fitzgerald #define CS42L42_CLOCK_SWITCH_DELAY_US 150 826b7d00776SRichard Fitzgerald #define CS42L42_PLL_LOCK_POLL_US 250 827b7d00776SRichard Fitzgerald #define CS42L42_PLL_LOCK_TIMEOUT_US 1250 8284ae1d8f9SRichard Fitzgerald #define CS42L42_HP_ADC_EN_TIME_US 20000 829*f8593e88SRichard Fitzgerald #define CS42L42_PDN_DONE_POLL_US 1000 830*f8593e88SRichard Fitzgerald #define CS42L42_PDN_DONE_TIMEOUT_US 200000 831*f8593e88SRichard Fitzgerald #define CS42L42_PDN_DONE_TIME_MS 100 832*f8593e88SRichard Fitzgerald #define CS42L42_FILT_DISCHARGE_TIME_MS 46 8332c394ca7SJames Schulman 8342c394ca7SJames Schulman static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = { 8352c394ca7SJames Schulman "VA", 8362c394ca7SJames Schulman "VP", 8372c394ca7SJames Schulman "VCP", 8382c394ca7SJames Schulman "VD_FILT", 8392c394ca7SJames Schulman "VL", 8402c394ca7SJames Schulman }; 8412c394ca7SJames Schulman 8422c394ca7SJames Schulman struct cs42l42_private { 8432c394ca7SJames Schulman struct regmap *regmap; 8442003c44eSRichard Fitzgerald struct device *dev; 8452c394ca7SJames Schulman struct regulator_bulk_data supplies[CS42L42_NUM_SUPPLIES]; 8462c394ca7SJames Schulman struct gpio_desc *reset_gpio; 8472c394ca7SJames Schulman struct completion pdn_done; 848c26a5289SLucas Tanure struct snd_soc_jack *jack; 8495982b5a8SRichard Fitzgerald struct mutex irq_lock; 850f1040e86SRichard Fitzgerald int pll_config; 8512cdba9b0SLucas Tanure int bclk; 8522c394ca7SJames Schulman u32 sclk; 8532c394ca7SJames Schulman u32 srate; 8542c394ca7SJames Schulman u8 plug_state; 8552c394ca7SJames Schulman u8 hs_type; 8562c394ca7SJames Schulman u8 ts_inv; 8572c394ca7SJames Schulman u8 ts_dbnc_rise; 8582c394ca7SJames Schulman u8 ts_dbnc_fall; 8592c394ca7SJames Schulman u8 btn_det_init_dbnce; 8602c394ca7SJames Schulman u8 btn_det_event_dbnce; 8612c394ca7SJames Schulman u8 bias_thresholds[CS42L42_NUM_BIASES]; 8622c394ca7SJames Schulman u8 hs_bias_ramp_rate; 8632c394ca7SJames Schulman u8 hs_bias_ramp_time; 864c9f2e3c3SVitaly Rodionov u8 hs_bias_sense_en; 86543fc3571SLucas Tanure u8 stream_use; 8664ae1d8f9SRichard Fitzgerald bool hp_adc_up_pending; 867*f8593e88SRichard Fitzgerald bool suspended; 8682c394ca7SJames Schulman }; 8692c394ca7SJames Schulman 8702c394ca7SJames Schulman #endif /* __CS42L42_H__ */ 871