Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

uint16_t ddi_power_SetMaxBatteryChargeCurrent ( uint16_t  u16MaxCur  ) 

Name: ddi_power_SetMaxBatteryChargeCurrent

Definition at line 1214 of file ddi_power_battery.c.

References ddi_power_convert_setting_to_current().

Referenced by ddi_bc_hwSetMaxCurrent().

{
      uint32_t   u16OldSetting;
      uint32_t   u16NewSetting;
      uint32_t   u16ToggleMask;

      // Get the old setting.
      u16OldSetting = (__raw_readl(REGS_POWER_BASE + HW_POWER_CHARGE) & BM_POWER_CHARGE_BATTCHRG_I) >>
            BP_POWER_CHARGE_BATTCHRG_I;

      // Convert the new threshold into a setting.
      u16NewSetting = ddi_power_convert_current_to_setting(u16MaxCur);

      /* Compute the toggle mask. */
      u16ToggleMask = u16OldSetting ^ u16NewSetting;

      /* Write to the toggle register.*/
      __raw_writel(u16ToggleMask << BP_POWER_CHARGE_BATTCHRG_I,
                  REGS_POWER_BASE + HW_POWER_CHARGE_TOG);

      // Tell the caller what current we're set at now.
      return ddi_power_convert_setting_to_current(u16NewSetting);
}


Generated by  Doxygen 1.6.0   Back to index