| 1 | /******************************************************************************* |
| 2 | * |
| 3 | * Filename: |
| 4 | * --------- |
| 5 | * external_codec_driver.h |
| 6 | * |
| 7 | * Project: |
| 8 | * -------- |
| 9 | * MT6592_phone_v1 |
| 10 | * |
| 11 | * Description: |
| 12 | * ------------ |
| 13 | * external codec control |
| 14 | * |
| 15 | * Author: |
| 16 | * ------- |
| 17 | * Stephen Chen |
| 18 | * |
| 19 | * |
| 20 | *------------------------------------------------------------------------------ |
| 21 | * $Revision$ |
| 22 | * $Modtime:$ |
| 23 | * $Log:$ |
| 24 | * * |
| 25 | * |
| 26 | *******************************************************************************/ |
| 27 | #include <linux/kernel.h> |
| 28 | #include <linux/module.h> |
| 29 | #include <linux/init.h> |
| 30 | #include <linux/device.h> |
| 31 | #include <linux/slab.h> |
| 32 | #include <linux/fs.h> |
| 33 | #include <linux/mm.h> |
| 34 | #include <linux/interrupt.h> |
| 35 | #include <linux/vmalloc.h> |
| 36 | #include <linux/wait.h> |
| 37 | #include <linux/spinlock.h> |
| 38 | #include <linux/semaphore.h> |
| 39 | #include <mach/mt_typedefs.h> |
| 40 | |
| 41 | #ifndef _EXTERNAL_CODEC_DRIVER_H_ |
| 42 | #define _EXTERNAL_CODEC_DRIVER_H_ |
| 43 | |
| 44 | /* CS4398 registers addresses */ |
| 45 | #define CS4398_CHIPID 0x01 /* Chip ID */ |
| 46 | #define CS4398_MODE 0x02 /* Mode Control */ |
| 47 | #define CS4398_MIXING 0x03 |
| 48 | #define CS4398_MUTE 0x04 /* Mute Control */ |
| 49 | #define CS4398_VOLA 0x05 /* DAC Channel A Volume Control */ |
| 50 | #define CS4398_VOLB 0x06 /* DAC Channel B Volume Control */ |
| 51 | #define CS4398_RAMP 0x07 |
| 52 | #define CS4398_MISC1 0x08 |
| 53 | #define CS4398_MISC2 0x09 |
| 54 | |
| 55 | #define CS4398_FIRSTREG 0x01 |
| 56 | #define CS4398_LASTREG 0x09 |
| 57 | #define CS4398_NUMREGS (CS4398_LASTREG - CS4398_FIRSTREG + 1) |
| 58 | |
| 59 | typedef enum |
| 60 | { |
| 61 | DIF_LEFT_JUSTIFIED, |
| 62 | DIF_I2S, |
| 63 | DIF_RIGHT_JUSTIFIED_16BIT, |
| 64 | DIF_RIGHT_JUSTIFIED_24BIT, |
| 65 | DIF_RIGHT_JUSTIFIED_20BIT, |
| 66 | DIF_RIGHT_JUSTIFIED_18BIT, |
| 67 | NUM_OF_DIF |
| 68 | } DIGITAL_INTERFACE_FORMAT; |
| 69 | |
| 70 | |
| 71 | enum ECODEC_CONTROL_SUBCOMMAND |
| 72 | { |
| 73 | ECODEC_GETREGISTER_VALUE, |
| 74 | ECODEC_SETREGISTER_VALUE, |
| 75 | }; |
| 76 | |
| 77 | enum AUDIO_ECODEC_CONTROL_COMMAND |
| 78 | { |
| 79 | NUM_AUD_ECODEC_COMMAND, |
| 80 | }; |
| 81 | |
| 82 | typedef struct |
| 83 | { |
| 84 | unsigned long int command; |
| 85 | unsigned long int param1; |
| 86 | unsigned long int param2; |
| 87 | } ECODEC_Control; |
| 88 | |
| 89 | void ExtCodec_Init(void); |
| 90 | void ExtCodec_PowerOn(void); |
| 91 | void ExtCodec_PowerOff(void); |
| 92 | bool ExtCodec_Register(void); |
| 93 | void ExtCodec_Mute(void); |
| 94 | void ExtCodec_SetGain(u8 leftright, u8 gain); |
| 95 | u8 ExtCodec_ReadReg(u8 addr); |
| 96 | void ExtCodec_DumpReg(void); |
| 97 | void ExtCodecDevice_Suspend(void); |
| 98 | void ExtCodecDevice_Resume(void); |
| 99 | void cust_extcodec_gpio_on(void); |
| 100 | void cust_extcodec_gpio_off(void); |
| 101 | void cust_extHPAmp_gpio_on(void); |
| 102 | void cust_extHPAmp_gpio_off(void); |
| 103 | void cust_extPLL_gpio_config(void); |
| 104 | #endif |