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

int pmic_read ( unsigned int  reg_num,
unsigned int *  reg_val 

This function is called to read a register on PMIC.

reg_num number of the pmic register to be read
reg_val return value of register
Returns 0 on success -1 on failure.

Definition at line 61 of file mc13783.c.

References mxc_pmic::spi.

Referenced by pmic_get_active_events(), pmic_get_revision(), pmic_read_reg(), and pmic_write_reg().

      unsigned int frame = 0;
      int ret = 0;

      if (reg_num > MXC_PMIC_MAX_REG_NUM)
            return PMIC_ERROR;

      frame |= reg_num << MXC_PMIC_REG_NUM_SHIFT;

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

      *reg_val = frame & MXC_PMIC_FRAME_MASK;

      return ret;

Generated by  Doxygen 1.6.0   Back to index