码迷,mamicode.com
首页 > 其他好文 > 详细

MT6753/MT6755 呼吸灯功能添加

时间:2015-12-29 15:58:55      阅读:1200      评论:0      收藏:0      [点我收藏+]

标签:

利用mtk pmic自带的呼吸灯模式:
主要修改代码:
kernel-3.10/drivers/misc/mediatek/leds/mt6755/leds.c
 
int mt_brightness_set_pmic(enum mt65xx_led_pmic pmic_type, u32 level, u32 div)
{
     .......
   
    //begin: modified by chenhaibing add for breath-led 20151118
        #if 0
  pmic_set_register_value(MT6351_PMIC_RG_DRV_32K_CK_PDN, 0x0); /* Disable power down */
  pmic_set_register_value(MT6351_PMIC_RG_DRV_ISINK1_CK_PDN, 0);
  pmic_set_register_value(MT6351_PMIC_RG_DRV_ISINK1_CK_CKSEL, 0);
  pmic_set_register_value(MT6351_PMIC_ISINK_CH1_MODE, PMIC_PWM_0);
  pmic_set_register_value(MT6351_PMIC_ISINK_CH1_STEP, ISINK_3); /* 16mA */
  pmic_set_register_value(MT6351_PMIC_ISINK_DIM1_DUTY, 15);
  pmic_set_register_value(MT6351_PMIC_ISINK_DIM1_FSEL, ISINK_1KHZ); /* 1KHz */
  
  if (level) {
   pmic_set_register_value(MT6351_PMIC_ISINK_CH1_EN, NLED_ON);
  } else {
   pmic_set_register_value(MT6351_PMIC_ISINK_CH1_EN, NLED_OFF);
  }
     #endif
  
  if(255 == level) //led brightness branch for factory test
  {
  pmic_set_register_value(MT6351_PMIC_RG_DRV_32K_CK_PDN, 0x0); /* Disable power down */
  pmic_set_register_value(MT6351_PMIC_RG_DRV_ISINK1_CK_PDN, 0);
  pmic_set_register_value(MT6351_PMIC_RG_DRV_ISINK1_CK_CKSEL, 0);
  pmic_set_register_value(MT6351_PMIC_ISINK_CH1_MODE, PMIC_PWM_0);
  pmic_set_register_value(MT6351_PMIC_ISINK_CH1_STEP, ISINK_3); /* 16mA */
  pmic_set_register_value(MT6351_PMIC_ISINK_DIM1_DUTY, 15);
  pmic_set_register_value(MT6351_PMIC_ISINK_DIM1_FSEL, ISINK_1KHZ); /* 1KHz */
  pmic_set_register_value(MT6351_PMIC_ISINK_CH1_EN, NLED_ON);
  LEDS_DEBUG("chenhaibing test [LED]PMIC#%d:%d\n", pmic_type, level); 
  }
  else //led breath branch
  {
  
   pmic_set_register_value(MT6351_PMIC_RG_DRV_32K_CK_PDN,0x0); // Disable power down
         pmic_set_register_value(MT6351_PMIC_RG_DRV_ISINK1_CK_PDN,0);
         pmic_set_register_value(MT6351_PMIC_RG_DRV_ISINK1_CK_CKSEL,0);
   pmic_set_register_value(MT6351_PMIC_ISINK_CH1_MODE,ISINK_BREATH_MODE);
         pmic_set_register_value(MT6351_PMIC_ISINK_CH1_STEP,ISINK_3);//16mA
         pmic_set_register_value(MT6351_PMIC_ISINK_BREATH1_TR1_SEL,0x02);
         pmic_set_register_value(MT6351_PMIC_ISINK_BREATH1_TR2_SEL,0x02);
         pmic_set_register_value(MT6351_PMIC_ISINK_BREATH1_TF1_SEL,0x02);
         pmic_set_register_value(MT6351_PMIC_ISINK_BREATH1_TF2_SEL,0x02);
         pmic_set_register_value(MT6351_PMIC_ISINK_BREATH1_TON_SEL,0x02);
         pmic_set_register_value(MT6351_PMIC_ISINK_BREATH1_TOFF_SEL,0x03);
         pmic_set_register_value(MT6351_PMIC_ISINK_DIM1_DUTY,15);
         pmic_set_register_value(MT6351_PMIC_ISINK_DIM1_FSEL,1999);
  
   if (level)
   {
    pmic_set_register_value(MT6351_PMIC_ISINK_CHOP1_EN,1);
                           pmic_set_register_value(MT6351_PMIC_ISINK_CH1_BIAS_EN,1);
    pmic_set_register_value(MT6351_PMIC_ISINK_CH1_EN,NLED_ON);
    
   }
   else
   {
    pmic_set_register_value(MT6351_PMIC_ISINK_CHOP1_EN,0);
                           pmic_set_register_value(MT6351_PMIC_ISINK_CH1_BIAS_EN,0);
    pmic_set_register_value(MT6351_PMIC_ISINK_CH1_EN,NLED_OFF);
   }
  }
  //end: modified by chenhaibing add for breath-led 20151118
     ........
 
}

MT6753/MT6755 呼吸灯功能添加

标签:

原文地址:http://www.cnblogs.com/lexuele/p/5085643.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!