Logo Search packages:      
Sourcecode: linux version File versions

PMIC_STATUS pmic_write_reg ( int  reg,
unsigned int  reg_value,
unsigned int  reg_mask 
)

This function is called by PMIC clients to write a register on PMIC.

Parameters:
reg number of register
reg_value New value of register
reg_mask Bitmap mask indicating which bits to modify
Returns:
This function returns PMIC_SUCCESS if successful.

Definition at line 74 of file pmic_external.c.

Referenced by pmic_event_mask(), and pmic_event_unmask().

{
      int ret = 0;
      unsigned int temp = 0;

      ret = pmic_read(reg, &temp);
      if (ret != PMIC_SUCCESS) {
            return PMIC_ERROR;
      }
      temp = (temp & (~reg_mask)) | reg_value;
#ifdef CONFIG_MXC_PMIC_MC13783
      if (reg == REG_POWER_MISCELLANEOUS)
            temp &= 0xFFFE7FFF;
#endif
      ret = pmic_write(reg, temp);
      if (ret != PMIC_SUCCESS) {
            return PMIC_ERROR;
      }

      pr_debug("Write REG[ %d ] = 0x%x\n", reg, reg_value);

      return ret;
}


Generated by  Doxygen 1.6.0   Back to index