MTK multimedia performance in the driver layer

Source: Internet
Author: User

1. There are two audio channels:

I. T-card --> memory --> DSP decoding --> PCM signal --> analog baseband (ABB) --> [External Power Amplifier] --> output

Ii. FM/TV chip --> analog baseband (ABB) --> [External amplifier] --> output

Note: Because the earphone power is relatively small, only the abb internal first-level amplification is required when driving the earphone, and the second requires a high power when driving the speaker, so the first-level external power amplifier is required. In addition, the stereo sound of the headset is the direct differential output of the BB two-way signal (mp3_outr & mp3_outl), while the Speaker only uses one of them, and the other signal is discarded.

Because the audio signal goes through two stages: digital and analog, the signal amplification can be divided into digital gain and analog gain. Among them, the analog gain is completed by hardware circuit, and the linearity within the range is hard to be distorted. The digital gain is completed by software, and the linearity difference is prone to distortion and other problems. Function in afe2.c File

Void afe_setlevelvolume (kal_uint8 aud_func, kal_uint8 maxanaloggain, kal_uint8 step, kal_uint8 level) is a function to change the output volume by changing the analog gain. The principle is to change the sound size by changing the magnification of the programmable amplifier in ABB. Function

Void afe_setoutputvolume (kal_uint8 aud_func, kal_uint8 volume1, kal_int8 digital_gain_index) changes the volume by adjusting the numerical gain.

The task of the PCM Codec circuit is to convert digital and analog signals.

PCM buffer data processing: After receiving media_data_request in event_callback, process it as follows.

A. pcm_strm_open;

B. Call setbuffer;

C. Fill in data; getwritebuffer

D. Call writedatadone;

E. Call finishwritedata;

F. Play play (mdi_audio_play_string_with_vol_path)

2. Audio drivers mainly include the following files:

Afe2.c ------ afe_getoutputvolume (), afe_setlevelvolume (),

Afe_turnonextamplifier (), afe_turnonextamplfier ();

AFE. c ------ afe_switchextamplifier (char sw_on) and so on

 

Audcoeff. C: This file must pay attention to the outputchanal configuration. If the configuration error occurs, no sound will appear.

Const unsigned char l1sp_microphone1 = l1sp_lna_0;

Const unsigned char l1sp_microphone2 = l1sp_lna_1;

Const unsigned char l1sp_speaker1 = l1sp_buffer_0;

Const unsigned char l1sp_speaker2 = l1sp_buffer_st;

Const unsigned char l1sp_loud_speaker = l1sp_buffer_st_m | l1sp_buffer_ext ;;

 

Audcoeff_default.h: defines the Speech Enhancement parameters;

 

Gpio_drv.c: Set the mode and direction

 

Nvram_default_audio.c: configure the volume of each scale. Each parameter contains "volume 0 ~ 6 "7" volume levels and 16 level setting analog gain Adjustment

Gain_nor_ctn_vol // call wait tone

Gain_nor_key_vol // keypad volume;

Gain_nor_mic_vol // microphone input

Gain_nor_gmi_vol // FM RADIO SOUND

Gain_nor_sph_vol // speech sound

Gain_nor_sid_vol // side tone

Gain_nor_med_vol // music

The following definitions are available in l1audio. h.

# Define l1sp_keytone 0 // key tone.

# Define l1sp_tone 1 // single-tone chord.

# Define l1sp_speech 2 // speech.

# Define l1sp_snd_effect 3 // sound effect.

# Define l1sp_audio 4 // MP3, etc.

# Define l1sp_voice 5 // recording

# Define l1sp_dai 6 // digital sound

# Define l1sp_fm_radio 7 // FM sound.

The audio parameters in the mobile phone include the following content:

 

Fir = finite filter, IIR = infinite filter, adjust the response curve

Es = echo suppression: suppress echo

AEC = acoustic echo canceller, eliminate echo

AGC = automatic gain control, automatic gain compensation

NS = noise suppression, background noise suppression

 

3. audio format:

MP3

The full name of MP3 is Moving Picture Experts Group audio Layer III. Simply put, MP3 is an audio compression technology. Because the compression method is called MPEG audio layer3, It is abbreviated as MP3. MP3 uses the technology of MPEG audio Layer 3 to compress music into a smaller file with a compression rate of or even. In other words, it can compress the file to a smaller extent when the sound quality is low. In addition, the original sound quality is well maintained. It is precisely because of the small size and high sound quality of MP3 that the MP3 format almost becomes synonymous with online music. The MP3 format of music per minute is only about 1 MB, so the size of each song is only 3-4 MB. Use the MP3 player to extract (decode) MP3 files in real time. In this way, high-quality MP3 music is played.

 

WMA

WMA (Windows mediaaudio) is a heavyweight player from Microsoft. The background is tough and the sound quality is better than the MP3 format. It is far better than the RA format,

RealAudio

RealAudio is mainly applicable to online music appreciation on the network. These formats are characterized by the ability to change the quality of voice based on the bandwidth of the network. While ensuring that most people hear a smooth voice, this improves the sound quality of the audience with richer bandwidth.

MIDI

MIDI (musical instrumentdigitalinterface)

The mid file records the sound information instead of a recorded sound, and then instructs the sound card how to reproduce the music.

 

CD

*. The CDA format is the CD audio. The standard CD format is the sampling frequency of 44.1k, with a rate of 88 K/second and 16-bit quantize bits. Because the CD track is almost lossless, its sound is basically loyal to the original sound, therefore, if you are an audio enthusiast, CD is your first choice.

 

4. "pop" noise refers to the burst sound produced by the transient impact of various operations on audio devices upon power-on, power-off, and stable power-on. The transient impact that generates "pop" noise is usually a very narrow sharp pulse ......

How to eliminate POP sound:

Pop sound when playing the video: the audio is output first. After a delay of a period, the audio amplifier is enabled.

This method only uses the Indicator Method concealed by the Software. To eliminate this method, we should start with hardware, such as reducing coupling capacitance at the output end and switching to a bridge circuit;

5. Audio Amplifier

Audio Amplifiers include class A, Class B, class AB, Class D, and Class K amplifiers. Generally, Class D amplifiers are used because of high efficiency and small size.

During the design, the audio input and output are generally in a differential mode. The dual channel is used to provide the headset, and the power amplifier is bias one way.

 

BMT charging introduction:

 

1. Battery Charging files: BMT. c chr_parameter.c

 

2. There are three processes for charging: Pre-charging, constant current charging, and constant voltage charging.

1) When vbat <3.3 V is in the pre-charging phase, the charging has nothing to do with the voltage of the battery, even if the battery voltage is 0 V, it should be able to rush into the power (generally, the battery of a regular manufacturer has a protection circuit inside it. When the discharge reaches two-point a few volts, it has ended and cannot be released ), as long as the battery itself is okay! The key is to ensure that the batdet foot is low! Mobile phone charging has no response.

2) When the battery voltage is less than 3.3v, PMIC (power management chip) cannot provide vcore, VDD, and Other voltages. the CPU is shut down, and the CPU does not work at this time! The mobile phone has no response. In this mode, you only need to set the batdet foot to a lower value through the drop-down resistor to perform pre-filling!

Charging current ipre = 10mV/rsense now MTK platform rsense = 0.33r, We know ipre = 30mA

 

2 ). when the 3.3 V <bat <4.2 v pmic lvs start to output voltage, the CPU starts to work. This is the charging current ICC = 160mV/rsense in the constant current charging phase. Now, the MTK platform rsense = 0.33r, we can see that ICC = 480mA

3). vbat> 4.2 V enters the constant voltage charging phase. The current gradually decreases and the voltage remains unchanged! When the current is reduced to close to 0, the CPU stops charging when a control signal is sent!

 

 

The following figure shows the charging status:

 

 

3. when the charger is inserted, that is, the vcharge voltage is provided for the PMIC charging module. As long as the batdet foot of the PMIC is grounded, the charging module can be started. A charging interruption signal is generated to the CPU, notifies the CPU that it is in the charging status. In this case, PMIC will interrupt the CPU, and the CPU starts to start the following modules:

 

I. ADC sampling is mainly used to collect vchrg, vbat, and the voltage output from the drain pole of the MOs.

 

2. Send a message to the MMI layer to display the charging status and some sampling data.

 

3. Check whether the battery voltage exceeds the protection voltage and whether the battery connection is correct. If there is any problem, you can use chrctrl (gpi031) to cut off the charging circuit!

 

4. The warning "no charger connection" is displayed at ordinary times because PMIC's batdet foot float (suspended) is not turned on, and no charging current is caused.

 

PMIC uses the battery bat ID to determine whether to charge the battery. It is not used to identify whether the battery is lithium or Mh-Ni battery! The difference between lithium batteries and MH-Ni batteries is through the Batuse foot of PMIC, and the low level is lithium batteries! The current battery ID resistance is about 10 KB. As long as the three battery feet are connected to the battery ctor, The batdet pin can be grounded by the battery ID resistance, charging starts (including pre-charging )! After the charger is plugged in, you only need to ground the batdet foot of PMIC to ensure that there is a current flowing in. The battery voltage only affects the charging status (such as pre-charging or constant current charging ), if the battery voltage is low, it takes a little longer to pre-charge the battery. You can complete the pre-charge within one or two hours to enter the constant current charging status!

Generally, batteries are self-protected. A qualified battery should not be 0 V!

 

 

 

Appendix:

1. When the battery voltage is too low, it is locked. Use A multimeter to measure the voltage at both ends of the battery is 0 V! After the mobile phone is locked for a low voltage, it cannot be charged. It has nothing to do with the charging circuit of the mobile phone!

2. battery protection IC mainly has the following functions: Chong protection, over-discharge protection, and high current protection.

3. the lithium battery cannot completely discharge the power. A protection IC must be added. If the battery voltage is less than 2 V, the power cannot be fully charged!

4. After the battery is locked, activate the voltage to wake up the battery.

5. The battery cannot be charged at low voltage. It is related to the protection IC selected by the battery manufacturer!

The chr_parmeter.c file contains the following data structure, which defines all the typical values for the battery and charge sections.

Bmt_customized_struct bmt_custom_chr_def =

{

# Ifndef _ cust_new __

31,/* gpio_chrctrl */

14,/* gpio_batdet */

7,/* gpio_vibrator */

# Endif/* _ cust_new __*/

 

/* Charing parameters */

/* Check PHY parameters, maybe changed */

1100000,/* typical_li_battype */typical lithium battery value (capacity)

1100000,/* typical_ni_battype */typical NIMH battery value (capacity)

1000000,/* icharge_on_high */maximum charge current

0,/* icharge_on_low */minimum charge current

1000000,/* icharge_off_high *///?? 50000

4050000,/* v_fast2topoff_thres */

2500000,/* battmp_minus_40c */

1469409,/* battmp_0c */

520042,/* battmp_45c */

6000000,/* max_vbat_li */

Maximum vbat value of Lithium Battery

5500000,/* max_vbat_ni */

Maximum vbat value of Ni-MH Battery

3400000, * v_pre2fast_thres */

250000,/* I _topoff2fast_thres * // * 250ma, topoff-> fast */

Fast Charge Off Current

120000,/* I _topoff2full_thres * // * 120ma, topoff-> batfull */

Normal charge off current

4110000,/* v_full2fast_thres * // * batfull-> fast */

414557,/* v_temp_fast2full_thres_ni * // * 50oC, fast-> batfull */

4050000,/* v_full2fast_thres_ni */

600000,/* fast_icharge_highlevel * // * 600ma, for table search */

Maximum limit current for fast charging

400000,/* fast_icharge_lowlevel * // * 400ma, for table search */

Minimum Limit Current for fast charging

4050000,/* v_protect_high_li */

3800000,/* v_protect_low_li */

# If defined (_ rgt_drv_m100 _) // M100 support Nokia charger

7000000, Nokia charger voltage 7 V

# Else

6500000,/* vcharger_high */normal charger voltage of 6.5 V

# Endif

0,/* vcharger_low */

/* Time Delay */

/* Pre charge, search table */

/* Ton = 3 s, toff = 2 S */

3,/* pre_ton */

2,/* pre_toff */

 

/* Fast charge, search table */

/* Ton = 3 s, toff = 0 S */

3,/* topoff_ton */

0,/* topoff_toff */

 

6,/* batfull_ton_li * // * Unit: Second */

0,/* batfull_toff_li */

1,/* batfull_ton_ni * // * Unit: Second */

9,/* batfull_toff_ni */

6,/* batfull_toff */

10,/* bathold_off */

 

5,/* adc_isense_resistance_factor * // * 1/0. 2 */

24,/* bmt_measure_discard_time * // * 24 ticks */

// Adc_calidata adc_cali_param

The following is the ADC calibration value for the cell phone voltage detection section.

{

{

5524,

5524,

5524,

5524,

5524,

5524

},

{

(23286 ),

(23286 ),

(23286 ),

(23286 ),

(23286 ),

(23286)

}

},

/* Ratio = adc_volt_factor/100 */

// Const kal_uint16 adc_volt_factor [adc_max_channel]

{

50,

50,

50,

100,

50,

50

},

// Const kal_uint8 tonofftable [6] [2] =

{

{7, 1 },

{8, 1 },

{9,1 },

{7, 1},/* talk */

{8, 1},/* talk */

{9,1}/* talk */

},

// Const kal_int32 curroffset [3] =

{

100000, // 100ma

100000,

100000

},

Kal_false,/* enable checking temperature while charging */

# If defined (_ mt6253_platform_support __)

Kal_true/* enable checking charging voltage while charging */

# Else

Kal_false/* enable checking charging voltage while charging */

# Endif

};

Macro in pmic_custom.c File

# Define ac_chr_current chr_current_650

# Define usb_chr_current chr_current_450

The current limits for AC charger and USB charging are hybrid Ma and hybrid Ma, respectively.

Bmt_main.c is the driver file about the battery and charger.

In the file auxmain. c file aux_task_main Function

Case msg_id_read_all_adc_channel_req:

Adc_measure_count = 0;

Vbat_value = 0;

Aux_read_adc_channel (vbat_adc_logic_id );

Visense_value = 0;

Aux_read_adc_channel (visense_adc_logic_id );

Vcharger_value = 0;

Aux_read_adc_channel (vcharger_adc_logic_id );

Vbattemp_value = 0;

Aux_read_adc_channel (vbattemp_adc_logic_id );

Vaux_value = 0;

Aux_read_adc_channel (vaux_adc_logic_id );

Break;

Part of the code is to read the power-related ADC value in engineering mode after the instance is started.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.