gpio-regulator.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * gpio-regulator.h
  4. *
  5. * Copyright 2011 Heiko Stuebner <heiko@sntech.de>
  6. *
  7. * based on fixed.h
  8. *
  9. * Copyright 2008 Wolfson Microelectronics PLC.
  10. *
  11. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  12. *
  13. * Copyright (c) 2009 Nokia Corporation
  14. * Roger Quadros <ext-roger.quadros@nokia.com>
  15. */
  16. #ifndef __REGULATOR_GPIO_H
  17. #define __REGULATOR_GPIO_H
  18. #include <linux/gpio/consumer.h>
  19. struct regulator_init_data;
  20. enum regulator_type;
  21. /**
  22. * struct gpio_regulator_state - state description
  23. * @value: microvolts or microamps
  24. * @gpios: bitfield of gpio target-states for the value
  25. *
  26. * This structure describes a supported setting of the regulator
  27. * and the necessary gpio-state to achieve it.
  28. *
  29. * The n-th bit in the bitfield describes the state of the n-th GPIO
  30. * from the gpios-array defined in gpio_regulator_config below.
  31. */
  32. struct gpio_regulator_state {
  33. int value;
  34. int gpios;
  35. };
  36. /**
  37. * struct gpio_regulator_config - config structure
  38. * @supply_name: Name of the regulator supply
  39. * @enabled_at_boot: Whether regulator has been enabled at
  40. * boot or not. 1 = Yes, 0 = No
  41. * This is used to keep the regulator at
  42. * the default state
  43. * @startup_delay: Start-up time in microseconds
  44. * @gflags: Array of GPIO configuration flags for initial
  45. * states
  46. * @ngpios: Number of GPIOs and configurations available
  47. * @states: Array of gpio_regulator_state entries describing
  48. * the gpio state for specific voltages
  49. * @nr_states: Number of states available
  50. * @regulator_type: either REGULATOR_CURRENT or REGULATOR_VOLTAGE
  51. * @init_data: regulator_init_data
  52. *
  53. * This structure contains gpio-voltage regulator configuration
  54. * information that must be passed by platform code to the
  55. * gpio-voltage regulator driver.
  56. */
  57. struct gpio_regulator_config {
  58. const char *supply_name;
  59. unsigned enabled_at_boot:1;
  60. unsigned startup_delay;
  61. enum gpiod_flags *gflags;
  62. int ngpios;
  63. struct gpio_regulator_state *states;
  64. int nr_states;
  65. enum regulator_type type;
  66. struct regulator_init_data *init_data;
  67. };
  68. #endif