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

int pmic_write ( int  reg_num,
const unsigned int  reg_val 
)

This function is called to write a value to the register on PMIC.

Parameters:
reg_num number of the pmic register to be written
reg_val value to be written
Returns:
Returns 0 on success -1 on failure.

Definition at line 86 of file mc13783.c.

Referenced by pmic_get_active_events(), pmic_init_registers(), and pmic_write_reg().

{
      unsigned int frame = 0;
      int ret = 0;

      if (reg_num > MXC_PMIC_MAX_REG_NUM)
            return PMIC_ERROR;

      frame |= (1 << MXC_PMIC_WRITE_BIT_SHIFT);

      frame |= reg_num << MXC_PMIC_REG_NUM_SHIFT;

      frame |= reg_val & MXC_PMIC_FRAME_MASK;

      ret = spi_rw(pmic_drv_data.spi, (u8 *) & frame, 1);

      return ret;
}


Generated by  Doxygen 1.6.0   Back to index