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

void pmic_get_revision ( pmic_version_t ver  ) 

This function returns the PMIC version in system.

Parameters:
ver pointer to the pmic_version_t structure
Returns:
This function returns PMIC version.

Definition at line 157 of file mc13783.c.

References pmic_version_t::id, pmic_read(), and pmic_version_t::revision.

Referenced by pmic_probe().

{
      int rev_id = 0;
      int rev1 = 0;
      int rev2 = 0;
      int finid = 0;
      int icid = 0;

      ver->id = PMIC_MC13783;
      pmic_read(REG_REVISION, &rev_id);

      rev1 = (rev_id & 0x018) >> 3;
      rev2 = (rev_id & 0x007);
      icid = (rev_id & 0x01C0) >> 6;
      finid = (rev_id & 0x01E00) >> 9;

      /* Ver 0.2 is actually 3.2a.  Report as 3.2 */
      if ((rev1 == 0) && (rev2 == 2)) {
            rev1 = 3;
      }

      if (rev1 == 0 || icid != 2) {
            ver->revision = -1;
            printk(KERN_NOTICE
                   "mc13783: Not detected.\tAccess failed\t!!!\n");
      } else {
            ver->revision = ((rev1 * 10) + rev2);
            printk(KERN_INFO "mc13783 Rev %d.%d FinVer %x detected\n", rev1,
                   rev2, finid);
      }

      return;

}


Generated by  Doxygen 1.6.0   Back to index