tps6507x.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /* linux/mfd/tps6507x.h
  2. *
  3. * Functions to access TPS65070 power management chip.
  4. *
  5. * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
  6. *
  7. *
  8. * For licencing details see kernel-base/COPYING
  9. */
  10. #ifndef __LINUX_MFD_TPS6507X_H
  11. #define __LINUX_MFD_TPS6507X_H
  12. /*
  13. * ----------------------------------------------------------------------------
  14. * Registers, all 8 bits
  15. * ----------------------------------------------------------------------------
  16. */
  17. /* Register definitions */
  18. #define TPS6507X_REG_PPATH1 0X01
  19. #define TPS6507X_CHG_USB BIT(7)
  20. #define TPS6507X_CHG_AC BIT(6)
  21. #define TPS6507X_CHG_USB_PW_ENABLE BIT(5)
  22. #define TPS6507X_CHG_AC_PW_ENABLE BIT(4)
  23. #define TPS6507X_CHG_AC_CURRENT BIT(2)
  24. #define TPS6507X_CHG_USB_CURRENT BIT(0)
  25. #define TPS6507X_REG_INT 0X02
  26. #define TPS6507X_REG_MASK_AC_USB BIT(7)
  27. #define TPS6507X_REG_MASK_TSC BIT(6)
  28. #define TPS6507X_REG_MASK_PB_IN BIT(5)
  29. #define TPS6507X_REG_TSC_INT BIT(3)
  30. #define TPS6507X_REG_PB_IN_INT BIT(2)
  31. #define TPS6507X_REG_AC_USB_APPLIED BIT(1)
  32. #define TPS6507X_REG_AC_USB_REMOVED BIT(0)
  33. #define TPS6507X_REG_CHGCONFIG0 0X03
  34. #define TPS6507X_REG_CHGCONFIG1 0X04
  35. #define TPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
  36. #define TPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
  37. #define TPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
  38. #define TPS6507X_CON_CTRL1_LDO1_ENABLE BIT(1)
  39. #define TPS6507X_CON_CTRL1_LDO2_ENABLE BIT(0)
  40. #define TPS6507X_REG_CHGCONFIG2 0X05
  41. #define TPS6507X_REG_CHGCONFIG3 0X06
  42. #define TPS6507X_REG_ADCONFIG 0X07
  43. #define TPS6507X_ADCONFIG_AD_ENABLE BIT(7)
  44. #define TPS6507X_ADCONFIG_START_CONVERSION BIT(6)
  45. #define TPS6507X_ADCONFIG_CONVERSION_DONE BIT(5)
  46. #define TPS6507X_ADCONFIG_VREF_ENABLE BIT(4)
  47. #define TPS6507X_ADCONFIG_INPUT_AD_IN1 0
  48. #define TPS6507X_ADCONFIG_INPUT_AD_IN2 1
  49. #define TPS6507X_ADCONFIG_INPUT_AD_IN3 2
  50. #define TPS6507X_ADCONFIG_INPUT_AD_IN4 3
  51. #define TPS6507X_ADCONFIG_INPUT_TS_PIN 4
  52. #define TPS6507X_ADCONFIG_INPUT_BAT_CURRENT 5
  53. #define TPS6507X_ADCONFIG_INPUT_AC_VOLTAGE 6
  54. #define TPS6507X_ADCONFIG_INPUT_SYS_VOLTAGE 7
  55. #define TPS6507X_ADCONFIG_INPUT_CHARGER_VOLTAGE 8
  56. #define TPS6507X_ADCONFIG_INPUT_BAT_VOLTAGE 9
  57. #define TPS6507X_ADCONFIG_INPUT_THRESHOLD_VOLTAGE 10
  58. #define TPS6507X_ADCONFIG_INPUT_ISET1_VOLTAGE 11
  59. #define TPS6507X_ADCONFIG_INPUT_ISET2_VOLTAGE 12
  60. #define TPS6507X_ADCONFIG_INPUT_REAL_TSC 14
  61. #define TPS6507X_ADCONFIG_INPUT_TSC 15
  62. #define TPS6507X_REG_TSCMODE 0X08
  63. #define TPS6507X_TSCMODE_X_POSITION 0
  64. #define TPS6507X_TSCMODE_Y_POSITION 1
  65. #define TPS6507X_TSCMODE_PRESSURE 2
  66. #define TPS6507X_TSCMODE_X_PLATE 3
  67. #define TPS6507X_TSCMODE_Y_PLATE 4
  68. #define TPS6507X_TSCMODE_STANDBY 5
  69. #define TPS6507X_TSCMODE_ADC_INPUT 6
  70. #define TPS6507X_TSCMODE_DISABLE 7
  71. #define TPS6507X_REG_ADRESULT_1 0X09
  72. #define TPS6507X_REG_ADRESULT_2 0X0A
  73. #define TPS6507X_REG_ADRESULT_2_MASK (BIT(1) | BIT(0))
  74. #define TPS6507X_REG_PGOOD 0X0B
  75. #define TPS6507X_REG_PGOODMASK 0X0C
  76. #define TPS6507X_REG_CON_CTRL1 0X0D
  77. #define TPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
  78. #define TPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
  79. #define TPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
  80. #define TPS6507X_CON_CTRL1_LDO1_ENABLE BIT(1)
  81. #define TPS6507X_CON_CTRL1_LDO2_ENABLE BIT(0)
  82. #define TPS6507X_REG_CON_CTRL2 0X0E
  83. #define TPS6507X_REG_CON_CTRL3 0X0F
  84. #define TPS6507X_REG_DEFDCDC1 0X10
  85. #define TPS6507X_DEFDCDC1_DCDC1_EXT_ADJ_EN BIT(7)
  86. #define TPS6507X_DEFDCDC1_DCDC1_MASK 0X3F
  87. #define TPS6507X_REG_DEFDCDC2_LOW 0X11
  88. #define TPS6507X_DEFDCDC2_LOW_DCDC2_MASK 0X3F
  89. #define TPS6507X_REG_DEFDCDC2_HIGH 0X12
  90. #define TPS6507X_DEFDCDC2_HIGH_DCDC2_MASK 0X3F
  91. #define TPS6507X_REG_DEFDCDC3_LOW 0X13
  92. #define TPS6507X_DEFDCDC3_LOW_DCDC3_MASK 0X3F
  93. #define TPS6507X_REG_DEFDCDC3_HIGH 0X14
  94. #define TPS6507X_DEFDCDC3_HIGH_DCDC3_MASK 0X3F
  95. #define TPS6507X_REG_DEFSLEW 0X15
  96. #define TPS6507X_REG_LDO_CTRL1 0X16
  97. #define TPS6507X_REG_LDO_CTRL1_LDO1_MASK 0X0F
  98. #define TPS6507X_REG_DEFLDO2 0X17
  99. #define TPS6507X_REG_DEFLDO2_LDO2_MASK 0X3F
  100. #define TPS6507X_REG_WLED_CTRL1 0X18
  101. #define TPS6507X_REG_WLED_CTRL2 0X19
  102. /* VDCDC MASK */
  103. #define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F
  104. #define TPS6507X_MAX_REGISTER 0X19
  105. /**
  106. * struct tps6507x_board - packages regulator and touchscreen init data
  107. * @tps6507x_regulator_data: regulator initialization values
  108. *
  109. * Board data may be used to initialize regulator and touchscreen.
  110. */
  111. struct tps6507x_board {
  112. struct regulator_init_data *tps6507x_pmic_init_data;
  113. struct touchscreen_init_data *tps6507x_ts_init_data;
  114. };
  115. /**
  116. * struct tps6507x_dev - tps6507x sub-driver chip access routines
  117. * @read_dev() - I2C register read function
  118. * @write_dev() - I2C register write function
  119. *
  120. * Device data may be used to access the TPS6507x chip
  121. */
  122. struct tps6507x_dev {
  123. struct device *dev;
  124. struct i2c_client *i2c_client;
  125. int (*read_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
  126. void *dest);
  127. int (*write_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
  128. void *src);
  129. /* Client devices */
  130. struct tps6507x_pmic *pmic;
  131. };
  132. #endif /* __LINUX_MFD_TPS6507X_H */