tps65218.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2014
  4. * Texas Instruments, <www.ti.com>
  5. */
  6. #ifndef __POWER_TPS65218_H__
  7. #define __POWER_TPS65218_H__
  8. #include <linux/bitops.h>
  9. /* I2C chip address */
  10. #define TPS65218_CHIP_PM 0x24
  11. /* Registers */
  12. enum {
  13. TPS65218_CHIPID = 0x00,
  14. TPS65218_INT1,
  15. TPS65218_INT2,
  16. TPS65218_INT_MASK1,
  17. TPS65218_INT_MASK2,
  18. TPS65218_STATUS,
  19. TPS65218_CONTROL,
  20. TPS65218_FLAG,
  21. TPS65218_PASSWORD = 0x10,
  22. TPS65218_ENABLE1,
  23. TPS65218_ENABLE2,
  24. TPS65218_CONFIG1,
  25. TPS65218_CONFIG2,
  26. TPS65218_CONFIG3,
  27. TPS65218_DCDC1,
  28. TPS65218_DCDC2,
  29. TPS65218_DCDC3,
  30. TPS65218_DCDC4,
  31. TPS65218_SLEW,
  32. TPS65218_LDO1,
  33. TPS65218_SEQ1 = 0x20,
  34. TPS65218_SEQ2,
  35. TPS65218_SEQ3,
  36. TPS65218_SEQ4,
  37. TPS65218_SEQ5,
  38. TPS65218_SEQ6,
  39. TPS65218_SEQ7,
  40. TPS65218_PMIC_NUM_OF_REGS,
  41. };
  42. #define TPS65218_PROT_LEVEL_NONE 0x00
  43. #define TPS65218_PROT_LEVEL_1 0x01
  44. #define TPS65218_PROT_LEVEL_2 0x02
  45. #define TPS65218_PASSWORD_LOCK_FOR_WRITE 0x00
  46. #define TPS65218_PASSWORD_UNLOCK 0x7D
  47. #define TPS65218_DCDC_GO 0x80
  48. #define TPS65218_MASK_ALL_BITS 0xFF
  49. #define TPS65218_DCDC_VSEL_MASK 0x3F
  50. #define TPS65218_DCDC_VOLT_SEL_0950MV 0x0a
  51. #define TPS65218_DCDC_VOLT_SEL_1100MV 0x19
  52. #define TPS65218_DCDC_VOLT_SEL_1200MV 0x23
  53. #define TPS65218_DCDC_VOLT_SEL_1260MV 0x29
  54. #define TPS65218_DCDC_VOLT_SEL_1330MV 0x30
  55. #define TPS65218_DCDC3_VOLT_SEL_1350MV 0x12
  56. #define TPS65218_DCDC3_VOLT_SEL_1200MV 0xC
  57. #define TPS65218_CC_STAT (BIT(0) | BIT(1))
  58. #define TPS65218_STATE (BIT(2) | BIT(3))
  59. #define TPS65218_PB_STATE BIT(4)
  60. #define TPS65218_AC_STATE BIT(5)
  61. #define TPS65218_EE BIT(6)
  62. #define TPS65218_FSEAL BIT(7)
  63. int tps65218_reg_read(uchar dest_reg, uchar *dest_val);
  64. int tps65218_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val,
  65. uchar mask);
  66. int tps65218_voltage_update(uchar dc_cntrl_reg, uchar volt_sel);
  67. int tps65218_toggle_fseal(void);
  68. int tps65218_lock_fseal(void);
  69. int power_tps65218_init(unsigned char bus);
  70. #endif /* __POWER_TPS65218_H__ */