tps65090.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Core driver interface for TI TPS65090 PMIC family
  3. *
  4. * Copyright (C) 2012 NVIDIA Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. *
  20. */
  21. #ifndef __LINUX_MFD_TPS65090_H
  22. #define __LINUX_MFD_TPS65090_H
  23. #include <linux/irq.h>
  24. /* TPS65090 Regulator ID */
  25. enum {
  26. TPS65090_REGULATOR_DCDC1,
  27. TPS65090_REGULATOR_DCDC2,
  28. TPS65090_REGULATOR_DCDC3,
  29. TPS65090_REGULATOR_FET1,
  30. TPS65090_REGULATOR_FET2,
  31. TPS65090_REGULATOR_FET3,
  32. TPS65090_REGULATOR_FET4,
  33. TPS65090_REGULATOR_FET5,
  34. TPS65090_REGULATOR_FET6,
  35. TPS65090_REGULATOR_FET7,
  36. TPS65090_REGULATOR_LDO1,
  37. TPS65090_REGULATOR_LDO2,
  38. /* Last entry for maximum ID */
  39. TPS65090_REGULATOR_MAX,
  40. };
  41. struct tps65090 {
  42. struct mutex lock;
  43. struct device *dev;
  44. struct i2c_client *client;
  45. struct regmap *rmap;
  46. struct irq_chip irq_chip;
  47. struct mutex irq_lock;
  48. int irq_base;
  49. unsigned int id;
  50. };
  51. struct tps65090_subdev_info {
  52. int id;
  53. const char *name;
  54. void *platform_data;
  55. };
  56. /*
  57. * struct tps65090_regulator_plat_data
  58. *
  59. * @reg_init_data: The regulator init data.
  60. * @enable_ext_control: Enable extrenal control or not. Only available for
  61. * DCDC1, DCDC2 and DCDC3.
  62. * @gpio: Gpio number if external control is enabled and controlled through
  63. * gpio.
  64. */
  65. struct tps65090_regulator_plat_data {
  66. struct regulator_init_data *reg_init_data;
  67. bool enable_ext_control;
  68. int gpio;
  69. };
  70. struct tps65090_platform_data {
  71. int irq_base;
  72. int num_subdevs;
  73. struct tps65090_subdev_info *subdevs;
  74. struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX];
  75. };
  76. /*
  77. * NOTE: the functions below are not intended for use outside
  78. * of the TPS65090 sub-device drivers
  79. */
  80. extern int tps65090_write(struct device *dev, int reg, uint8_t val);
  81. extern int tps65090_read(struct device *dev, int reg, uint8_t *val);
  82. extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num);
  83. extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num);
  84. #endif /*__LINUX_MFD_TPS65090_H */