max17042_fg.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics
  3. * Lukasz Majewski <l.majewski@samsung.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef __MAX17042_FG_H_
  24. #define __MAX17042_FG_H_
  25. /* MAX 17042 registers */
  26. enum {
  27. MAX17042_STATUS = 0x00,
  28. MAX17042_SOCREP = 0x06,
  29. MAX17042_VCELL = 0x09,
  30. MAX17042_CURRENT = 0x0A,
  31. MAX17042_AVG_CURRENT = 0x0B,
  32. MAX17042_SOCMIX = 0x0D,
  33. MAX17042_SOCAV = 0x0E,
  34. MAX17042_DESIGN_CAP = 0x18,
  35. MAX17042_AVG_VCELL = 0x19,
  36. MAX17042_CONFIG = 0x1D,
  37. MAX17042_VERSION = 0x21,
  38. MAX17042_LEARNCFG = 0x28,
  39. MAX17042_FILTERCFG = 0x29,
  40. MAX17042_RELAXCFG = 0x2A,
  41. MAX17042_MISCCFG = 0x2B,
  42. MAX17042_CGAIN = 0x2E,
  43. MAX17042_COFF = 0x2F,
  44. MAX17042_RCOMP0 = 0x38,
  45. MAX17042_TEMPCO = 0x39,
  46. MAX17042_FSTAT = 0x3D,
  47. MAX17042_MLOCKReg1 = 0x62,
  48. MAX17042_MLOCKReg2 = 0x63,
  49. MAX17042_MODEL1 = 0x80,
  50. MAX17042_MODEL2 = 0x90,
  51. MAX17042_MODEL3 = 0xA0,
  52. MAX17042_VFOCV = 0xFB,
  53. MAX17042_VFSOC = 0xFF,
  54. FG_NUM_OF_REGS = 0x100,
  55. };
  56. #define RCOMP0 0x0060
  57. #define TempCo 0x1015
  58. #define MAX17042_POR (1 << 1)
  59. #define MODEL_UNLOCK1 0x0059
  60. #define MODEL_UNLOCK2 0x00c4
  61. #define MODEL_LOCK1 0x0000
  62. #define MODEL_LOCK2 0x0000
  63. #define MAX17042_I2C_ADDR (0x6C >> 1)
  64. int power_fg_init(unsigned char bus);
  65. #endif /* __MAX17042_FG_H_ */