2 * Copyright (C) 2007 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 /*******************************************************************************
24 * MT8127 Audio Driver Afe Register setting
33 * Harvey Huang (mtk03996)
34 * Chipeng Chang (mtk02308)
36 *------------------------------------------------------------------------------
42 *******************************************************************************/
44 #ifndef _AUDDRV_AFE_H_
45 #define _AUDDRV_AFE_H_
47 #include "AudDrv_Common.h"
48 #include "AudDrv_Def.h"
49 #include <mach/mt_clkmgr.h>
50 /*****************************************************************************
51 * C O M P I L E R F L A G S
52 *****************************************************************************/
55 /*****************************************************************************
56 * E X T E R N A L R E F E R E N C E S
57 *****************************************************************************/
59 /*****************************************************************************
61 *****************************************************************************/
90 AFE_DAIMOD_8000HZ
= 0x0,
91 AFE_DAIMOD_16000HZ
= 0x1,
92 } DAIMOD_SAMPLINGRATE_T
;
102 AFE_MONO_USE_L
= 0x0,
108 AFE_DUP_WR_DISABLE
= 0x0,
109 AFE_DUP_WR_ENABLE
= 0x1
114 uint32 u4AFE_MEMIF_BUF_BASE
;
115 uint32 u4AFE_MEMIF_BUF_END
;
116 uint32 u4AFE_MEMIF_BUF_WP
;
117 uint32 u4AFE_MEMIF_BUF_RP
;
122 MEM_INTERFACE_T eMemInterface
;
123 SAMPLINGRATE_T eSamplingRate
;
124 DAIMOD_SAMPLINGRATE_T eDaiModSamplingRate
;
125 MEMIF_CH_CFG_T eChannelConfig
;
126 MEMIF_MONO_SEL_T eMonoSelect
; //Used when AWB and VUL and data is mono
127 MEMIF_DUP_WRITE_T eDupWrite
; //Used when MODPCM and DAI
128 MEMIF_BUF_T rBufferSetting
;
172 PCM_1
= 0x0, // (O7, O8, I9)
173 PCM_2
= 0x1 // (O17, O18, I14)
212 PCM_GO_ASRC
= 0x0, // (ASRC) Set to 0 when source & destination uses different crystal
213 PCM_GO_ASYNC_FIFO
= 0x1 // (Async FIFO) Set to 1 when source & destination uses same crystal
219 PCM_DMTX
= 0x0, // dual mic on TX
220 PCM_SMTX
= 0x1 // single mic on TX (In BT mode, only L channel data is sent on PCM TX.)
226 PCM_SYNC_LEN_1_BCK
= 0x0,
227 PCM_SYNC_LEN_N_BCK
= 0x1
239 PCM_VBT_16K_MODE_DISABLE
= 0x0,
240 PCM_VBT_16K_MODE_ENABLE
= 0x1
252 PCM_LB_DISABLE
= 0x0,
265 PCMMODE_T ePcm8k16kmode
;
267 PCMCLKSRC_T ePcmClkSrc
;
268 PCMBYPASRC_T ePcmBypassASRC
;
269 PCMEXTMODEM_T ePcmModemSel
;
270 PCMVBT16KMODE_T ePcmVbt16kSel
;
289 // Interconnection related
334 // Side tone filter related
342 // Sine wave generator related
373 SINE_TONE_LOOPBACK
= 9
374 } SINE_TONE_SINEMODE_T
;
378 SINE_TONE_LOOPBACK_I0_I1
= 0,
379 SINE_TONE_LOOPBACK_I2
= 1,
380 SINE_TONE_LOOPBACK_I3_I4
= 2,
381 SINE_TONE_LOOPBACK_I5_I6
= 3,
382 SINE_TONE_LOOPBACK_I7_I8
= 4,
383 SINE_TONE_LOOPBACK_I9_I10
= 5,
384 SINE_TONE_LOOPBACK_I11_I12
= 6,
385 SINE_TONE_LOOPBACK_O0_O1
= 7,
386 SINE_TONE_LOOPBACK_O2
= 8,
387 SINE_TONE_LOOPBACK_O3_O4
= 9,
388 SINE_TONE_LOOPBACK_O5_O6
= 10,
389 SINE_TONE_LOOPBACK_O7_O8
= 11,
390 SINE_TONE_LOOPBACK_O9_O10
= 12,
391 SINE_TONE_LOOPBACK_O11
= 13,
392 SINE_TONE_LOOPBACK_O12
= 14
393 } SINE_TONE_LOOPBACK_T
;
397 uint32 u4ch1_freq_div
; // 64/n sample/period
398 SINE_TONE_AMP_T rch1_amp_div
;
399 SINE_TONE_SINEMODE_T rch1_sine_mode
;
400 uint32 u4ch2_freq_div
; // 64/n sample/period
401 SINE_TONE_AMP_T rch2_amp_div
;
402 SINE_TONE_SINEMODE_T rch2_sine_mode
;
403 SINE_TONE_LOOPBACK_T rloopback_mode
;
404 } AFE_SINEGEN_INFO_T
;
407 /*****************************************************************************
409 *****************************************************************************/
410 #define AUDIO_HW_PHYSICAL_BASE (0x11220000)
411 #define AUDIO_HW_VIRTUAL_BASE (0xF1220000)
412 #ifdef AUDIO_MEM_IOREMAP
415 #define AFE_BASE (AUDIO_HW_VIRTUAL_BASE)
418 //Internal sram: 0x12004000~0x12007FFF (16K)
419 #define AFE_INTERNAL_SRAM_PHY_BASE (0x11221000)
420 #define AFE_INTERNAL_SRAM_VIR_BASE (0xF1221000)
421 #define AFE_INTERNAL_SRAM_SIZE (0x4000)
424 #define AFE_EXTERNAL_DRAM_SIZE (0x4000)
425 /*****************************************************************************
427 *****************************************************************************/
429 /*****************************************************************************
430 * R E G I S T E R D E F I N I T I O N
431 *****************************************************************************/
432 #define AUDIOAFE_TOP_CON0 (AFE_BASE + 0x0000) //AUDIO_TOP_CON0
433 #define AUDIO_TOP_CON1 (AFE_BASE + 0x0004)
434 #define AUDIO_TOP_CON2 (AFE_BASE + 0x0008)
435 #define AUDIO_TOP_CON3 (AFE_BASE + 0x000C)
436 #define AFE_DAC_CON0 (AFE_BASE + 0x0010)
437 #define AFE_DAC_CON1 (AFE_BASE + 0x0014)
438 #define AFE_I2S_CON (AFE_BASE + 0x0018)
439 //#define AFE_DAIBT_CON0 (AFE_BASE + 0x001c)
441 #define AFE_CONN0 (AFE_BASE + 0x0020)
442 #define AFE_CONN1 (AFE_BASE + 0x0024)
443 #define AFE_CONN2 (AFE_BASE + 0x0028)
444 #define AFE_CONN3 (AFE_BASE + 0x002C)
445 #define AFE_CONN4 (AFE_BASE + 0x0030)
447 #define AFE_I2S_CON1 (AFE_BASE + 0x0034)
448 #define AFE_I2S_CON2 (AFE_BASE + 0x0038)
449 //#define AFE_MRGIF_CON (AFE_BASE + 0x003C)
453 #define AFE_DL1_BASE (AFE_BASE + 0x0040)
454 #define AFE_DL1_CUR (AFE_BASE + 0x0044)
455 #define AFE_DL1_END (AFE_BASE + 0x0048)
456 #define AFE_I2S_CON3 (AFE_BASE + 0x004C)//
457 #define AFE_DL2_BASE (AFE_BASE + 0x0050)
458 #define AFE_DL2_CUR (AFE_BASE + 0x0054)
459 #define AFE_DL2_END (AFE_BASE + 0x0058)
460 #define AFE_AWB_BASE (AFE_BASE + 0x0070)
461 #define AFE_AWB_END (AFE_BASE + 0x0078)
462 #define AFE_AWB_CUR (AFE_BASE + 0x007C)
463 #define AFE_VUL_BASE (AFE_BASE + 0x0080)
464 #define AFE_VUL_END (AFE_BASE + 0x0088)
465 #define AFE_VUL_CUR (AFE_BASE + 0x008C)
466 //#define AFE_DAI_BASE (AFE_BASE + 0x0090)
467 //#define AFE_DAI_END (AFE_BASE + 0x0098)
468 //#define AFE_DAI_CUR (AFE_BASE + 0x009C)
470 //#define AFE_IRQ_CON (AFE_BASE + 0x00A0)
472 // Memory interface monitor
473 #define AFE_MEMIF_MON0 (AFE_BASE + 0x00D0)
474 #define AFE_MEMIF_MON1 (AFE_BASE + 0x00D4)
475 #define AFE_MEMIF_MON2 (AFE_BASE + 0x00D8)
476 //#define AFE_MEMIF_MON3 (AFE_BASE + 0x00DC)
477 #define AFE_MEMIF_MON4 (AFE_BASE + 0x00E0)
480 #define AFE_ADDA_DL_SRC2_CON0 (AFE_BASE+0x0108)
481 #define AFE_ADDA_DL_SRC2_CON1 (AFE_BASE+0x010C)
482 #define AFE_ADDA_UL_SRC_CON0 (AFE_BASE+0x0114)
483 #define AFE_ADDA_UL_SRC_CON1 (AFE_BASE+0x0118)
484 #define AFE_ADDA_TOP_CON0 (AFE_BASE+0x0120)
485 #define AFE_ADDA_UL_DL_CON0 (AFE_BASE+0x0124)
486 #define AFE_ADDA_SRC_DEBUG (AFE_BASE+0x012C)
487 #define AFE_ADDA_SRC_DEBUG_MON0 (AFE_BASE+0x0130)
488 #define AFE_ADDA_SRC_DEBUG_MON1 (AFE_BASE+0x0134)
489 #define AFE_ADDA_NEWIF_CFG0 (AFE_BASE+0x0138)
490 #define AFE_ADDA_NEWIF_CFG1 (AFE_BASE+0x013C)
493 //#define AFE_FOC_CON (AFE_BASE + 0x0170)
494 //#define AFE_FOC_CON1 (AFE_BASE + 0x0174)
495 //#define AFE_FOC_CON2 (AFE_BASE + 0x0178)
496 //#define AFE_FOC_CON3 (AFE_BASE + 0x017C)
497 //#define AFE_FOC_CON4 (AFE_BASE + 0x0180)
498 //#define AFE_FOC_CON5 (AFE_BASE + 0x0184)
499 //#define AFE_MON_STEP (AFE_BASE + 0x0188)
501 #define AFE_SIDETONE_DEBUG (AFE_BASE + 0x01D0)
502 #define AFE_SIDETONE_MON (AFE_BASE + 0x01D4)
503 #define AFE_SIDETONE_CON0 (AFE_BASE + 0x01E0)
504 #define AFE_SIDETONE_COEFF (AFE_BASE + 0x01E4)
505 #define AFE_SIDETONE_CON1 (AFE_BASE + 0x01E8)
506 #define AFE_SIDETONE_GAIN (AFE_BASE + 0x01EC)
507 #define AFE_SGEN_CON0 (AFE_BASE +0x01F0)
509 //#define AFE_MRG_MON0 (AFE_BASE + 0x0270)
510 //#define AFE_MRG_MON1 (AFE_BASE + 0x0274)
511 //#define AFE_MRG_MON2 (AFE_BASE + 0x0278)
514 #define AFE_TOP_CON0 (AFE_BASE + 0x0200)
516 #define AFE_PREDIS_CON0 (AFE_BASE + 0x0260)
517 #define AFE_PREDIS_CON1 (AFE_BASE + 0x0264)
519 #define AFE_MOD_PCM_BASE (AFE_BASE + 0x0330)
520 #define AFE_MOD_PCM_END (AFE_BASE + 0x0338)
521 #define AFE_MOD_PCM_CUR (AFE_BASE + 0x033C)
523 #define AFE_HDMI_OUT_CON0 (AFE_BASE + 0x0370) //8135 new
524 #define AFE_HDMI_OUT_BASE (AFE_BASE + 0x0374) //8135 new
525 #define AFE_HDMI_OUT_CUR (AFE_BASE + 0x0378) //8135 new
526 #define AFE_HDMI_OUT_END (AFE_BASE + 0x037C) //8135 new
527 #define AFE_SPDIF_OUT_CON0 (AFE_BASE + 0x0380) //8135 new
528 #define AFE_SPDIF_BASE (AFE_BASE + 0x0384) //8135 new
529 #define AFE_SPDIF_CUR (AFE_BASE + 0x0388) //8135 new
530 #define AFE_SPDIF_END (AFE_BASE + 0x038C) //8135 new
531 #define AFE_HDMI_CONN0 (AFE_BASE + 0x0390) //8135 new
532 #define AFE_8CH_I2S_OUT_CON (AFE_BASE + 0x0394) //8135 new
533 #define AFE_HDMI_CONN1 (AFE_BASE + 0x0398) //8135 new
535 #define AFE_IRQ_MCU_CON (AFE_BASE + 0x03A0)
536 #define AFE_IRQ_MCU_STATUS (AFE_BASE + 0x03A4)
537 #define AFE_IRQ_CLR (AFE_BASE + 0x03A8)
538 #define AFE_IRQ_MCU_CNT1 (AFE_BASE + 0x03AC)
539 #define AFE_IRQ_MCU_CNT2 (AFE_BASE + 0x03B0)
540 #define AFE_IRQ_MCU_MON2 (AFE_BASE + 0x03B8)
541 #define AFE_IRQ_MCU_CNT5 (AFE_BASE + 0x03BC)
542 #define AFE_IRQ1_MCU_CNT_MON (AFE_BASE + 0x03C0)
543 #define AFE_IRQ2_MCU_CNT_MON (AFE_BASE + 0x03C4)
544 #define AFE_IRQ1_MCU_EN_CNT_MON (AFE_BASE + 0x03C8)
545 #define AFE_IRQ5_MCU_EN_CNT_MON (AFE_BASE + 0x03cc)
546 //#define AFE_MEMIF_MINLEN (AFE_BASE + 0x03D0) //removed in MT8127
547 #define AFE_MEMIF_MAXLEN (AFE_BASE + 0x03D4)
548 #define AFE_MEMIF_PBUF_SIZE (AFE_BASE + 0x03D8)
550 //AFE GAIN CONTROL REGISTER
551 #define AFE_GAIN1_CON0 (AFE_BASE + 0x0410)
552 #define AFE_GAIN1_CON1 (AFE_BASE + 0x0414)
553 #define AFE_GAIN1_CON2 (AFE_BASE + 0x0418)
554 #define AFE_GAIN1_CON3 (AFE_BASE + 0x041C)
555 #define AFE_GAIN1_CONN (AFE_BASE + 0x0420)
556 #define AFE_GAIN1_CUR (AFE_BASE + 0x0424)
557 #define AFE_GAIN2_CON0 (AFE_BASE + 0x0428)
558 #define AFE_GAIN2_CON1 (AFE_BASE + 0x042C)
559 #define AFE_GAIN2_CON2 (AFE_BASE + 0x0430)
560 #define AFE_GAIN2_CON3 (AFE_BASE + 0x0434)
561 #define AFE_GAIN2_CONN (AFE_BASE + 0x0438)
562 #define AFE_GAIN2_CUR (AFE_BASE + 0x043C)
563 #define AFE_GAIN2_CONN2 (AFE_BASE + 0x0440)
565 #define AFE_IEC_CFG (AFE_BASE + 0x0480) //8135 new
566 #define AFE_IEC_NSNUM (AFE_BASE + 0x0484) //8135 new
567 #define AFE_IEC_BURST_INFO (AFE_BASE + 0x0488) //8135 new
568 #define AFE_IEC_BURST_LEN (AFE_BASE + 0x048C) //8135 new
569 #define AFE_IEC_NSADR (AFE_BASE + 0x0490) //8135 new
570 #define AFE_IEC_CHL_STAT0 (AFE_BASE + 0x04A0) //8135 new
571 #define AFE_IEC_CHL_STAT1 (AFE_BASE + 0x04A4) //8135 new
572 #define AFE_IEC_CHR_STAT0 (AFE_BASE + 0x04A8) //8135 new
573 #define AFE_IEC_CHR_STAT1 (AFE_BASE + 0x04AC) //8135 new
575 // here is only fpga needed
576 #define FPGA_CFG2 (AFE_BASE + 0x04B8)//
577 #define FPGA_CFG3 (AFE_BASE + 0x04BC)//
578 #define FPGA_CFG0 (AFE_BASE + 0x04C0)
579 #define FPGA_CFG1 (AFE_BASE + 0x04C4)
580 //#define FPGA_VERSION (AFE_BASE + 0x04C8)
581 #define FPGA_STC (AFE_BASE + 0x04CC)//
583 #define AFE_ASRC_CON0 (AFE_BASE + 0x500)
584 #define AFE_ASRC_CON1 (AFE_BASE + 0x504)
585 #define AFE_ASRC_CON2 (AFE_BASE + 0x508)
586 #define AFE_ASRC_CON3 (AFE_BASE + 0x50C)
587 #define AFE_ASRC_CON4 (AFE_BASE + 0x510)
588 #define AFE_ASRC_CON5 (AFE_BASE + 0x514)
589 #define AFE_ASRC_CON6 (AFE_BASE + 0x518)
590 #define AFE_ASRC_CON7 (AFE_BASE + 0x51C)
591 #define AFE_ASRC_CON8 (AFE_BASE + 0x520)
592 #define AFE_ASRC_CON9 (AFE_BASE + 0x524)
593 #define AFE_ASRC_CON10 (AFE_BASE + 0x528)
594 #define AFE_ASRC_CON11 (AFE_BASE + 0x52C)
596 #define PCM_INTF_CON1 (AFE_BASE + 0x530)
597 #define PCM_INTF_CON2 (AFE_BASE + 0x538)
598 #define PCM2_INTF_CON (AFE_BASE + 0x53C)
601 #define AFE_ASRC_CON13 (AFE_BASE + 0x550)
602 #define AFE_ASRC_CON14 (AFE_BASE + 0x554)
603 #define AFE_ASRC_CON15 (AFE_BASE + 0x558)
604 #define AFE_ASRC_CON16 (AFE_BASE + 0x55C)
605 #define AFE_ASRC_CON17 (AFE_BASE + 0x560)
606 #define AFE_ASRC_CON18 (AFE_BASE + 0x564)
607 #define AFE_ASRC_CON19 (AFE_BASE + 0x568)
608 #define AFE_ASRC_CON20 (AFE_BASE + 0x56C)
609 #define AFE_ASRC_CON21 (AFE_BASE + 0x570)
612 /**********************************
613 * Detailed Definitions
614 **********************************/
623 #define PDN_APLL_TUNER 19
624 #define PDN_HDMI_CK 20
625 #define PDN_SPDF_CK 21
628 #define HDMI_SPEAKER_OUT_HDMI_POS 5
629 #define HDMI_SPEAKER_OUT_HDMI_LEN 1
630 #define HDMI_BCK_DIV_LEN 6
631 #define HDMI_BCK_DIV_POS 8
632 #define HDMI_2CH_SEL_POS 6
633 #define HDMI_2CH_SEL_LEN 2
634 #define HDMI_2CH_SEL_SDATA0 0
635 #define HDMI_2CH_SEL_SDATA1 1
636 #define HDMI_2CH_SEL_SDATA2 2
637 #define HDMI_2CH_SEL_SDATA3 3
648 #define AFE_ON_RETM 12
649 #define AFE_DL1_RETM 13
650 #define AFE_DL2_RETM 14
651 #define AFE_AWB_RETM 16
654 #define DL1_MODE_LEN 4
655 #define DL1_MODE_POS 0
657 #define DL2_MODE_LEN 4
658 #define DL2_MODE_POS 4
660 #define I2S_MODE_LEN 4
661 #define I2S_MODE_POS 8
663 #define AWB_MODE_LEN 4
664 #define AWB_MODE_POS 12
666 #define VUL_MODE_LEN 4
667 #define VUL_MODE_POS 16
669 #define DAI_MODE_LEN 1
670 #define DAI_MODE_POS 20
672 #define DL1_DATA_LEN 1
673 #define DL1_DATA_POS 21
675 #define DL2_DATA_LEN 1
676 #define DL2_DATA_POS 22
678 #define I2S_DATA_LEN 1
679 #define I2S_DATA_POS 23
681 #define AWB_DATA_LEN 1
682 #define AWB_DATA_POS 24
684 #define AWB_R_MONO_LEN 1
685 #define AWB_R_MONO_POS 25
687 #define VUL_DATA_LEN 1
688 #define VUL_DATA_POS 27
690 #define VUL_R_MONO_LEN 1
691 #define VUL_R_MONO_POS 28
693 #define DAI_DUP_WR_LEN 1
694 #define DAI_DUP_WR_POS 29
696 #define MOD_PCM_MODE_LEN 1
697 #define MOD_PCM_MODE_POS 30
699 #define MOD_PCM_DUP_WR_LEN 1
700 #define MOD_PCM_DUP_WR_POS 31
702 //AFE_I2S_CON1 and AFE_I2S_CON2
703 #define AI2S_EN_POS 0
704 #define AI2S_EN_LEN 1
705 #define AI2S_WLEN_POS 1
706 #define AI2S_WLEN_LEN 1
707 #define AI2S_FMT_POS 3
708 #define AI2S_FMT_LEN 1
709 #define AI2S_OUT_MODE_POS 8
710 #define AI2S_OUT_MODE_LEN 4
711 #define AI2S_UPDATE_WORD_POS 24
712 #define AI2S_UPDATE_WORD_LEN 5
713 #define AI2S_LR_SWAP_POS 31
714 #define AI2S_LR_SWAP_LEN 1
718 #define I2S_WLEN_POS 1
719 #define I2S_WLEN_LEN 1
720 #define I2S_SRC_POS 2
721 #define I2S_SRC_LEN 1
722 #define I2S_FMT_POS 3
723 #define I2S_FMT_LEN 1
724 #define I2S_DIR_POS 4
725 #define I2S_DIR_LEN 1
726 #define I2S_OUT_MODE_POS 8
727 #define I2S_OUT_MODE_LEN 4
736 #define PCM_FMT_POS 1
737 #define PCM_FMT_LEN 2
739 #define PCM_MODE_POS 3
740 #define PCM_MODE_LEN 1
742 #define PCM_WLEN_POS 4
743 #define PCM_WLEN_LEN 1
745 #define PCM_SLAVE_POS 5
746 #define PCM_SLAVE_LEN 1
748 #define PCM_BYP_ASRC_POS 6
749 #define PCM_BYP_ASRC_LEN 1
751 #define PCM_BTMODE_POS 7
752 #define PCM_BTMODE_LEN 1
754 #define PCM_SYNC_TYPE_POS 8
755 #define PCM_SYNC_TYPE_LEN 1
757 #define PCM_SYNC_LEN_POS 9
758 #define PCM_SYNC_LEN_LEN 5
760 #define PCM_EXT_MODEM_POS 17
761 #define PCM_EXT_MODEM_LEN 1
763 #define PCM_VBT16K_MODE_POS 18
764 #define PCM_VBT16K_MODE_LEN 1
766 //#define PCM_BCKINV_POS 6
767 //#define PCM_BCKINV_LEN 1
768 //#define PCM_SYNCINV_POS 7
769 //#define PCM_SYNCINV_LEN 1
771 #define PCM_SERLOOPBK_POS 28
772 #define PCM_SERLOOPBK_LEN 1
774 #define PCM_PARLOOPBK_POS 29
775 #define PCM_PARLOOPBK_LEN 1
777 #define PCM_BUFLOOPBK_POS 30
778 #define PCM_BUFLOOPBK_LEN 1
780 #define PCM_FIX_VAL_SEL_POS 31
781 #define PCM_FIX_VAL_SEL_LEN 1
784 #define DAIBT_EN_POS 0
785 #define DAIBT_EN_LEN 1
786 #define BTPCM_EN_POS 1
787 #define BTPCM_EN_LEN 1
788 #define BTPCM_SYNC_POS 2
789 #define BTPCM_SYNC_LEN 1
790 #define DAIBT_DATARDY_POS 3
791 #define DAIBT_DATARDY_LEN 1
792 #define BTPCM_LENGTH_POS 4
793 #define BTPCM_LENGTH_LEN 3
794 #define DAIBT_MODE_POS 9
795 #define DAIBT_MODE_LEN 1
806 #define IRQ_SETTING_BIT 0x3003
808 // AFE_IRQ_MCU_STATUS
809 #define IRQ1_ON_BIT 1<<0
810 #define IRQ2_ON_BIT 1<<1
811 #define IRQ3_ON_BIT 1<<2
812 #define IRQ4_ON_BIT 1<<3
813 #define IRQ5_ON_BIT 1<<4
814 #define IRQ6_ON_BIT 1<<5
815 #define IRQ_STATUS_BIT 0x3F
818 #define IRQ1_CLR 1<<0
819 #define IRQ2_CLR 1<<1
820 #define IRQ3_CLR 1<<2
821 #define IRQ4_CLR 1<<3
824 #define IRQ1_MISS_CLR 1<<8
825 #define IRQ2_MISS_CLR 1<<9
826 #define IRQ3_MISS_CLR 1<<10
827 #define IRQ4_MISS_CLR 1<<11
828 #define IRQ5_MISS_CLR 1<<12
829 #define IRQ6_MISS_CLR 1<<13
832 #define IRQ1_MISS_BIT 1<<8
833 #define IRQ2_MISS_BIT 1<<9
834 #define IRQ3_MISS_BIT 1<<10
835 #define IRQ4_MISS_BIT 1<<11
836 #define IRQ5_MISS_BIT 1<<12
837 #define IRQ6_MISS_BIT 1<<13
838 #define IRQ_MISS_STATUS_BIT 0x3F00
841 #define HDMI_OUT_SPEAKER_BIT 4
842 #define SPEAKER_OUT_HDMI 5
843 #define HDMI_2CH_SEL_POS 6
844 #define HDMI_2CH_SEL_LEN 2
846 // AFE_SIDETONE_DEBUG
847 #define STF_SRC_SEL 16
848 #define STF_I5I6_SEL 19
851 #define STF_COEFF_VAL 0
852 #define STF_COEFF_ADDRESS 16
853 #define STF_CH_SEL 23
854 #define STF_COEFF_W_ENABLE 24
855 #define STF_W_ENABLE 25
856 #define STF_COEFF_BIT 0x0000FFFF
859 #define STF_TAP_NUM 0
861 #define STF_BYPASS 31
864 #define SINE_TONE_FREQ_DIV_CH1 0
865 #define SINE_TONE_AMP_DIV_CH1 5
866 #define SINE_TONE_MODE_CH1 8
867 #define SINE_TONE_FREQ_DIV_CH2 12
868 #define SINE_TONE_AMP_DIV_CH2 17
869 #define SINE_TONE_MODE_CH2 20
870 #define SINE_TONE_MUTE_CH1 24
871 #define SINE_TONE_MUTE_CH2 25
872 #define SINE_TONE_ENABLE 26
873 #define SINE_TONE_LOOPBACK_MOD 28
876 #define MCLK_MUX2_POS 26
877 #define MCLK_MUX2_LEN 1
878 #define MCLK_MUX1_POS 25
879 #define MCLK_MUX1_LEN 1
880 #define MCLK_MUX0_POS 24
881 #define MCLK_MUX0_LEN 1
882 #define SOFT_RST_POS 16
883 #define SOFT_RST_LEN 8\14
884 #define HOP26M_SEL_POS 12
885 #define HOP26M_SEL_LEN 2
888 #define CODEC_SEL_POS 0
889 #define DAC_SEL_POS 4
890 #define ADC_SEL_POS 8
892 #define AUDPLL_CON3 (APMIXEDSYS_BASE+0x0408)
894 //apmixed sys AUDPLL_CON4
895 #define AUDPLL_SDM_PCW_98M 0x3C7EA932
896 #define AUDPLL_SDM_PCW_90M 0x37945EA6
897 #define AUDPLL_TUNER_N_98M 0x3C7EA933 //48k-based , 98.304M , sdm_pcw+1
898 #define AUDPLL_TUNER_N_90M 0x37945EA7 //44.1k-based , 90.3168M, sdm_pcw+1
901 #define AUDPLL_EN_POS 0
902 #define AUDPLL_EN_LEN 1
903 #define AUDPLL_PREDIV_POS 4
904 #define AUDPLL_PREDIV_LEN 2
905 #define AUDPLL_POSDIV_POS 6
906 #define AUDPLL_POSDIV_LEN 3
908 #define AUDPLL_SDM_PCW_POS 0
909 #define AUDPLL_SDM_PCW_LEN 31
910 #define AUDPLL_SDM_PCW_CHG_POS 31
911 #define AUDPLL_SDM_PCW_CHG_LEN 1
913 #define AUDPLL_TUNER_N_INFO_POS 0
914 #define AUDPLL_TUNER_N_INFO_LEN 31
915 #define AUDPLL_TUNER_N_INFO_MASK 0x7FFFFFFF
916 #define AUDPLL_TUNER_EN_POS 31
917 #define AUDPLL_TUNER_EN_LEN 1
918 #define AUDPLL_TUNER_EN_MASK 0x80000000
920 /* The maximum address offset of Audio Front End */
921 #define AFE_MAX_ADDR_OFFSET (0x570)
922 #define CLK_APLL_SEL_POS 16
923 #define CLK_APLL_SEL_LEN 3
924 #define CLKSQ_MUX_CK 0
930 #define PDN_APLL_POS 23
931 #define PDN_APLL_LEN 1
933 void Afe_Set_Reg(uint32 offset
, uint32 value
, uint32 mask
);
934 uint32
Afe_Get_Reg(uint32 offset
);
937 void Afe_Log_Print(void);
939 void AP_Set_Reg(uint32 offset
, uint32 value
, uint32 mask
);
940 uint32
AP_Get_Reg(uint32 offset
);