lp872x.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. enum lp872x_regulator_id {
  18. LP8720_ID_BASE,
  19. LP8720_ID_LDO1 = LP8720_ID_BASE,
  20. LP8720_ID_LDO2,
  21. LP8720_ID_LDO3,
  22. LP8720_ID_LDO4,
  23. LP8720_ID_LDO5,
  24. LP8720_ID_BUCK,
  25. LP8725_ID_BASE,
  26. LP8725_ID_LDO1 = LP8725_ID_BASE,
  27. LP8725_ID_LDO2,
  28. LP8725_ID_LDO3,
  29. LP8725_ID_LDO4,
  30. LP8725_ID_LDO5,
  31. LP8725_ID_LILO1,
  32. LP8725_ID_LILO2,
  33. LP8725_ID_BUCK1,
  34. LP8725_ID_BUCK2,
  35. LP872X_ID_MAX,
  36. };
  37. enum lp872x_dvs_state {
  38. DVS_LOW = GPIOF_OUT_INIT_LOW,
  39. DVS_HIGH = GPIOF_OUT_INIT_HIGH,
  40. };
  41. enum lp872x_dvs_sel {
  42. SEL_V1,
  43. SEL_V2,
  44. };
  45. /**
  46. * lp872x_dvs
  47. * @gpio : gpio pin number for dvs control
  48. * @vsel : dvs selector for buck v1 or buck v2 register
  49. * @init_state : initial dvs pin state
  50. */
  51. struct lp872x_dvs {
  52. int gpio;
  53. enum lp872x_dvs_sel vsel;
  54. enum lp872x_dvs_state init_state;
  55. };
  56. /**
  57. * lp872x_regdata
  58. * @id : regulator id
  59. * @init_data : init data for each regulator
  60. */
  61. struct lp872x_regulator_data {
  62. enum lp872x_regulator_id id;
  63. struct regulator_init_data *init_data;
  64. };
  65. /**
  66. * lp872x_platform_data
  67. * @general_config : the value of LP872X_GENERAL_CFG register
  68. * @update_config : if LP872X_GENERAL_CFG register is updated, set true
  69. * @regulator_data : platform regulator id and init data
  70. * @dvs : dvs data for buck voltage control
  71. */
  72. struct lp872x_platform_data {
  73. u8 general_config;
  74. bool update_config;
  75. struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS];
  76. struct lp872x_dvs *dvs;
  77. };
  78. #endif