lp872x.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Copyright 2012 Texas Instruments
  3. *
  4. * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
  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 version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. */
  11. #ifndef __LP872X_REGULATOR_H__
  12. #define __LP872X_REGULATOR_H__
  13. #include <linux/regulator/machine.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/gpio.h>
  16. #define LP872X_MAX_REGULATORS 9
  17. #define LP8720_ENABLE_DELAY 200
  18. #define LP8725_ENABLE_DELAY 30000
  19. enum lp872x_regulator_id {
  20. LP8720_ID_BASE,
  21. LP8720_ID_LDO1 = LP8720_ID_BASE,
  22. LP8720_ID_LDO2,
  23. LP8720_ID_LDO3,
  24. LP8720_ID_LDO4,
  25. LP8720_ID_LDO5,
  26. LP8720_ID_BUCK,
  27. LP8725_ID_BASE,
  28. LP8725_ID_LDO1 = LP8725_ID_BASE,
  29. LP8725_ID_LDO2,
  30. LP8725_ID_LDO3,
  31. LP8725_ID_LDO4,
  32. LP8725_ID_LDO5,
  33. LP8725_ID_LILO1,
  34. LP8725_ID_LILO2,
  35. LP8725_ID_BUCK1,
  36. LP8725_ID_BUCK2,
  37. LP872X_ID_MAX,
  38. };
  39. enum lp872x_dvs_state {
  40. DVS_LOW = GPIOF_OUT_INIT_LOW,
  41. DVS_HIGH = GPIOF_OUT_INIT_HIGH,
  42. };
  43. enum lp872x_dvs_sel {
  44. SEL_V1,
  45. SEL_V2,
  46. };
  47. /**
  48. * lp872x_dvs
  49. * @gpio : gpio pin number for dvs control
  50. * @vsel : dvs selector for buck v1 or buck v2 register
  51. * @init_state : initial dvs pin state
  52. */
  53. struct lp872x_dvs {
  54. int gpio;
  55. enum lp872x_dvs_sel vsel;
  56. enum lp872x_dvs_state init_state;
  57. };
  58. /**
  59. * lp872x_regdata
  60. * @id : regulator id
  61. * @init_data : init data for each regulator
  62. */
  63. struct lp872x_regulator_data {
  64. enum lp872x_regulator_id id;
  65. struct regulator_init_data *init_data;
  66. };
  67. /**
  68. * lp872x_platform_data
  69. * @general_config : the value of LP872X_GENERAL_CFG register
  70. * @update_config : if LP872X_GENERAL_CFG register is updated, set true
  71. * @regulator_data : platform regulator id and init data
  72. * @dvs : dvs data for buck voltage control
  73. * @enable_gpio : gpio pin number for enable control
  74. */
  75. struct lp872x_platform_data {
  76. u8 general_config;
  77. bool update_config;
  78. struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS];
  79. struct lp872x_dvs *dvs;
  80. int enable_gpio;
  81. };
  82. #endif