supply.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * supply.h -- Power Supply Driver for Wolfson WM8350 PMIC
  3. *
  4. * Copyright 2007 Wolfson Microelectronics PLC
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. *
  11. */
  12. #ifndef __LINUX_MFD_WM8350_SUPPLY_H_
  13. #define __LINUX_MFD_WM8350_SUPPLY_H_
  14. #include <linux/platform_device.h>
  15. /*
  16. * Charger registers
  17. */
  18. #define WM8350_BATTERY_CHARGER_CONTROL_1 0xA8
  19. #define WM8350_BATTERY_CHARGER_CONTROL_2 0xA9
  20. #define WM8350_BATTERY_CHARGER_CONTROL_3 0xAA
  21. /*
  22. * R168 (0xA8) - Battery Charger Control 1
  23. */
  24. #define WM8350_CHG_ENA_R168 0x8000
  25. #define WM8350_CHG_THR 0x2000
  26. #define WM8350_CHG_EOC_SEL_MASK 0x1C00
  27. #define WM8350_CHG_TRICKLE_TEMP_CHOKE 0x0200
  28. #define WM8350_CHG_TRICKLE_USB_CHOKE 0x0100
  29. #define WM8350_CHG_RECOVER_T 0x0080
  30. #define WM8350_CHG_END_ACT 0x0040
  31. #define WM8350_CHG_FAST 0x0020
  32. #define WM8350_CHG_FAST_USB_THROTTLE 0x0010
  33. #define WM8350_CHG_NTC_MON 0x0008
  34. #define WM8350_CHG_BATT_HOT_MON 0x0004
  35. #define WM8350_CHG_BATT_COLD_MON 0x0002
  36. #define WM8350_CHG_CHIP_TEMP_MON 0x0001
  37. /*
  38. * R169 (0xA9) - Battery Charger Control 2
  39. */
  40. #define WM8350_CHG_ACTIVE 0x8000
  41. #define WM8350_CHG_PAUSE 0x4000
  42. #define WM8350_CHG_STS_MASK 0x3000
  43. #define WM8350_CHG_TIME_MASK 0x0F00
  44. #define WM8350_CHG_MASK_WALL_FB 0x0080
  45. #define WM8350_CHG_TRICKLE_SEL 0x0040
  46. #define WM8350_CHG_VSEL_MASK 0x0030
  47. #define WM8350_CHG_ISEL_MASK 0x000F
  48. #define WM8350_CHG_STS_OFF 0x0000
  49. #define WM8350_CHG_STS_TRICKLE 0x1000
  50. #define WM8350_CHG_STS_FAST 0x2000
  51. /*
  52. * R170 (0xAA) - Battery Charger Control 3
  53. */
  54. #define WM8350_CHG_THROTTLE_T_MASK 0x0060
  55. #define WM8350_CHG_SMART 0x0010
  56. #define WM8350_CHG_TIMER_ADJT_MASK 0x000F
  57. /*
  58. * Charger Interrupts
  59. */
  60. #define WM8350_IRQ_CHG_BAT_HOT 0
  61. #define WM8350_IRQ_CHG_BAT_COLD 1
  62. #define WM8350_IRQ_CHG_BAT_FAIL 2
  63. #define WM8350_IRQ_CHG_TO 3
  64. #define WM8350_IRQ_CHG_END 4
  65. #define WM8350_IRQ_CHG_START 5
  66. #define WM8350_IRQ_CHG_FAST_RDY 6
  67. #define WM8350_IRQ_CHG_VBATT_LT_3P9 10
  68. #define WM8350_IRQ_CHG_VBATT_LT_3P1 11
  69. #define WM8350_IRQ_CHG_VBATT_LT_2P85 12
  70. /*
  71. * Charger Policy
  72. */
  73. #define WM8350_CHG_TRICKLE_50mA (0 << 6)
  74. #define WM8350_CHG_TRICKLE_100mA (1 << 6)
  75. #define WM8350_CHG_4_05V (0 << 4)
  76. #define WM8350_CHG_4_10V (1 << 4)
  77. #define WM8350_CHG_4_15V (2 << 4)
  78. #define WM8350_CHG_4_20V (3 << 4)
  79. #define WM8350_CHG_FAST_LIMIT_mA(x) ((x / 50) & 0xf)
  80. #define WM8350_CHG_EOC_mA(x) (((x - 10) & 0x7) << 10)
  81. #define WM8350_CHG_TRICKLE_3_1V (0 << 13)
  82. #define WM8350_CHG_TRICKLE_3_9V (1 << 13)
  83. /*
  84. * Supply Registers.
  85. */
  86. #define WM8350_USB_VOLTAGE_READBACK 0x9C
  87. #define WM8350_LINE_VOLTAGE_READBACK 0x9D
  88. #define WM8350_BATT_VOLTAGE_READBACK 0x9E
  89. /*
  90. * Supply Interrupts.
  91. */
  92. #define WM8350_IRQ_USB_LIMIT 15
  93. #define WM8350_IRQ_EXT_USB_FB 36
  94. #define WM8350_IRQ_EXT_WALL_FB 37
  95. #define WM8350_IRQ_EXT_BAT_FB 38
  96. struct wm8350_power {
  97. struct platform_device *pdev;
  98. };
  99. #endif