gpio-regulator.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * gpio-regulator.h
  3. *
  4. * Copyright 2011 Heiko Stuebner <heiko@sntech.de>
  5. *
  6. * based on fixed.h
  7. *
  8. * Copyright 2008 Wolfson Microelectronics PLC.
  9. *
  10. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  11. *
  12. * Copyright (c) 2009 Nokia Corporation
  13. * Roger Quadros <ext-roger.quadros@nokia.com>
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License as
  17. * published by the Free Software Foundation; either version 2 of the
  18. * License, or (at your option) any later version.
  19. */
  20. #ifndef __REGULATOR_GPIO_H
  21. #define __REGULATOR_GPIO_H
  22. struct regulator_init_data;
  23. enum regulator_type;
  24. /**
  25. * struct gpio_regulator_state - state description
  26. * @value: microvolts or microamps
  27. * @gpios: bitfield of gpio target-states for the value
  28. *
  29. * This structure describes a supported setting of the regulator
  30. * and the necessary gpio-state to achieve it.
  31. *
  32. * The n-th bit in the bitfield describes the state of the n-th GPIO
  33. * from the gpios-array defined in gpio_regulator_config below.
  34. */
  35. struct gpio_regulator_state {
  36. int value;
  37. int gpios;
  38. };
  39. /**
  40. * struct gpio_regulator_config - config structure
  41. * @supply_name: Name of the regulator supply
  42. * @enable_gpio: GPIO to use for enable control
  43. * set to -EINVAL if not used
  44. * @enable_high: Polarity of enable GPIO
  45. * 1 = Active high, 0 = Active low
  46. * @enabled_at_boot: Whether regulator has been enabled at
  47. * boot or not. 1 = Yes, 0 = No
  48. * This is used to keep the regulator at
  49. * the default state
  50. * @startup_delay: Start-up time in microseconds
  51. * @gpios: Array containing the gpios needed to control
  52. * the setting of the regulator
  53. * @nr_gpios: Number of gpios
  54. * @states: Array of gpio_regulator_state entries describing
  55. * the gpio state for specific voltages
  56. * @nr_states: Number of states available
  57. * @regulator_type: either REGULATOR_CURRENT or REGULATOR_VOLTAGE
  58. * @init_data: regulator_init_data
  59. *
  60. * This structure contains gpio-voltage regulator configuration
  61. * information that must be passed by platform code to the
  62. * gpio-voltage regulator driver.
  63. */
  64. struct gpio_regulator_config {
  65. const char *supply_name;
  66. int enable_gpio;
  67. unsigned enable_high:1;
  68. unsigned enabled_at_boot:1;
  69. unsigned startup_delay;
  70. struct gpio *gpios;
  71. int nr_gpios;
  72. struct gpio_regulator_state *states;
  73. int nr_states;
  74. enum regulator_type type;
  75. struct regulator_init_data *init_data;
  76. };
  77. #endif