Problems detected by an LED flashing problem in the MTK led driver

Source: Internet
Author: User

Today according to the latest demand to the LED light flashing frequency changes, the default 2000ms to 10000ms, but after the change did not produce the expected effect, but into a constant, baffled its solution, and finally read the fucking code, from the top layer , all the way to chase down, finally found the problem, the following directly on the MTK led driver code:

#define PMIC_PERIOD_NUM 9//* PERIOD, ex:0.01 Hz-0.01 * (1int pmic_period_array[] = {250,500,1000,1250,166 6,2000,2500,10000};//int pmic_freqsel_array[] = {99999, 9999, 4999, 1999, 999, 499, 199, 4, 0};int pmic_freqsel_array[] = {0, 4, 199, 499, 999, 1999, 1999, 1999};static int find_time_index_pmic (int time_ms) {int i;for (i=0;i<pmic_period_num;i + +) {if (Time_ms<=pmic_period_array[i]) {return i;} else {continue;}} return pmic_period_num-1;} int mt_led_blink_pmic (enum mt65xx_led_pmic pmic_type, struct nled_setting* led) {int Time_index = 0;int duty = 0; Leds_debug ("[led]led_blink_pmic:pmic_type=%d\n", Pmic_type); if (Pmic_type! = mt65xx_led_pmic_nled_isink0 & & pmic_type!= mt65xx_led_pmic_nled_isink1 &&pmic_type!= mt65xx_led_pmic_nled_isink2 && pmic_type ! = Mt65xx_led_pmic_nled_isink3) | | Led->nled_mode! = nled_blink) {return-1;} Leds_debug ("[led]led blink on time =%d Offtime =%d\n", led->blink_on_time,led->blink_off_time); Time_index = fiNd_time_index_pmic (Led->blink_on_time + led->blink_off_time); Leds_debug ("[led]led index is%d freqsel=%d\n", Time_index, Pmic_freqsel_array[time_index]);d uty=32*led->blink_on _time/(Led->blink_on_time + led->blink_off_time);

In addition to the above code can see that it does not support more than 1999ms flicker frequency, but also see another problem, the novice is often the problem of array cross-border, no matter what the access protection.

Problems detected by an LED flashing problem in the MTK led driver

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: 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.