Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * ALSA SoC CS4349 codec driver
0004  *
0005  * Copyright 2015 Cirrus Logic, Inc.
0006  *
0007  * Author: Tim Howe <Tim.Howe@cirrus.com>
0008  */
0009 
0010 #ifndef __CS4349_H__
0011 #define __CS4349_H__
0012 
0013 /* CS4349 registers addresses */
0014 #define CS4349_CHIPID       0x01    /* Device and Rev ID, Read Only */
0015 #define CS4349_MODE     0x02    /* Mode Control */
0016 #define CS4349_VMI      0x03    /* Volume, Mixing, Inversion Control */
0017 #define CS4349_MUTE     0x04    /* Mute Control */
0018 #define CS4349_VOLA     0x05    /* DAC Channel A Volume Control */
0019 #define CS4349_VOLB     0x06    /* DAC Channel B Volume Control */
0020 #define CS4349_RMPFLT       0x07    /* Ramp and Filter Control */
0021 #define CS4349_MISC     0x08    /* Power Down,Freeze Control,Pop Stop*/
0022 
0023 #define CS4349_I2C_INCR     0x80
0024 
0025 
0026 /* Device and Revision ID */
0027 #define CS4349_REVA     0xF0    /* Rev A */
0028 #define CS4349_REVB     0xF1    /* Rev B */
0029 #define CS4349_REVC2        0xFF    /* Rev C2 */
0030 
0031 
0032 /* PDN_DONE Poll Maximum
0033  * If soft ramp is set it will take much longer to power down
0034  * the system.
0035  */
0036 #define PDN_POLL_MAX        900
0037 
0038 
0039 /* Bitfield Definitions */
0040 
0041 /* CS4349_MODE */
0042 /* (Digital Interface Format, De-Emphasis Control, Functional Mode */
0043 #define DIF2            (1 << 6)
0044 #define DIF1            (1 << 5)
0045 #define DIF0            (1 << 4)
0046 #define DEM1            (1 << 3)
0047 #define DEM0            (1 << 2)
0048 #define FM1         (1 << 1)
0049 #define DIF_LEFT_JST        0x00
0050 #define DIF_I2S         0x01
0051 #define DIF_RGHT_JST16      0x02
0052 #define DIF_RGHT_JST24      0x03
0053 #define DIF_TDM0        0x04
0054 #define DIF_TDM1        0x05
0055 #define DIF_TDM2        0x06
0056 #define DIF_TDM3        0x07
0057 #define DIF_MASK        0x70
0058 #define MODE_FORMAT(x)      (((x)&7)<<4)
0059 #define DEM_MASK        0x0C
0060 #define NO_DEM          0x00
0061 #define DEM_441         0x04
0062 #define DEM_48K         0x08
0063 #define DEM_32K         0x0C
0064 #define FM_AUTO         0x00
0065 #define FM_SNGL         0x01
0066 #define FM_DBL          0x02
0067 #define FM_QUAD         0x03
0068 #define FM_SNGL_MIN     30000
0069 #define FM_SNGL_MAX     54000
0070 #define FM_DBL_MAX      108000
0071 #define FM_QUAD_MAX     216000
0072 #define FM_MASK         0x03
0073 
0074 /* CS4349_VMI (VMI = Volume, Mixing and Inversion Controls) */
0075 #define VOLBISA         (1 << 7)
0076 #define VOLAISB         (1 << 7)
0077 /* INVERT_A only available for Left Jstfd, Right Jstfd16 and Right Jstfd24 */
0078 #define INVERT_A        (1 << 6)
0079 /* INVERT_B only available for Left Jstfd, Right Jstfd16 and Right Jstfd24 */
0080 #define INVERT_B        (1 << 5)
0081 #define ATAPI3          (1 << 3)
0082 #define ATAPI2          (1 << 2)
0083 #define ATAPI1          (1 << 1)
0084 #define ATAPI0          (1 << 0)
0085 #define MUTEAB          0x00
0086 #define MUTEA_RIGHTB        0x01
0087 #define MUTEA_LEFTB     0x02
0088 #define MUTEA_SUMLRDIV2B    0x03
0089 #define RIGHTA_MUTEB        0x04
0090 #define RIGHTA_RIGHTB       0x05
0091 #define RIGHTA_LEFTB        0x06
0092 #define RIGHTA_SUMLRDIV2B   0x07
0093 #define LEFTA_MUTEB     0x08
0094 #define LEFTA_RIGHTB        0x09    /* Default */
0095 #define LEFTA_LEFTB     0x0A
0096 #define LEFTA_SUMLRDIV2B    0x0B
0097 #define SUMLRDIV2A_MUTEB    0x0C
0098 #define SUMLRDIV2A_RIGHTB   0x0D
0099 #define SUMLRDIV2A_LEFTB    0x0E
0100 #define SUMLRDIV2_AB        0x0F
0101 #define CHMIX_MASK      0x0F
0102 
0103 /* CS4349_MUTE */
0104 #define AUTOMUTE        (1 << 7)
0105 #define MUTEC_AB        (1 << 5)
0106 #define MUTE_A          (1 << 4)
0107 #define MUTE_B          (1 << 3)
0108 #define MUTE_AB_MASK        0x18
0109 
0110 /* CS4349_RMPFLT (Ramp and Filter Control) */
0111 #define SCZ1            (1 << 7)
0112 #define SCZ0            (1 << 6)
0113 #define RMP_UP          (1 << 5)
0114 #define RMP_DN          (1 << 4)
0115 #define FILT_SEL        (1 << 2)
0116 #define IMMDT_CHNG      0x31
0117 #define ZEROCRSS        0x71
0118 #define SOFT_RMP        0xB1
0119 #define SFTRMP_ZEROCRSS     0xF1
0120 #define SR_ZC_MASK      0xC0
0121 
0122 /* CS4349_MISC */
0123 #define PWR_DWN         (1 << 7)
0124 #define FREEZE          (1 << 5)
0125 #define POPG_EN         (1 << 4)
0126 
0127 #endif  /* __CS4349_H__ */