gpio-regulator.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * gpio-regulator.h
  4. *
  5. * Copyright 2011 Heiko Stuebner <[email protected]>
  6. *
  7. * based on fixed.h
  8. *
  9. * Copyright 2008 Wolfson Microelectronics PLC.
  10. *
  11. * Author: Mark Brown <[email protected]>
  12. *
  13. * Copyright (c) 2009 Nokia Corporation
  14. * Roger Quadros <[email protected]>
  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. * @input_supply: Name of the input regulator supply
  40. * @enabled_at_boot: Whether regulator has been enabled at
  41. * boot or not. 1 = Yes, 0 = No
  42. * This is used to keep the regulator at
  43. * the default state
  44. * @startup_delay: Start-up time in microseconds
  45. * @gflags: Array of GPIO configuration flags for initial
  46. * states
  47. * @ngpios: Number of GPIOs and configurations available
  48. * @states: Array of gpio_regulator_state entries describing
  49. * the gpio state for specific voltages
  50. * @nr_states: Number of states available
  51. * @regulator_type: either REGULATOR_CURRENT or REGULATOR_VOLTAGE
  52. * @init_data: regulator_init_data
  53. *
  54. * This structure contains gpio-voltage regulator configuration
  55. * information that must be passed by platform code to the
  56. * gpio-voltage regulator driver.
  57. */
  58. struct gpio_regulator_config {
  59. const char *supply_name;
  60. const char *input_supply;
  61. unsigned enabled_at_boot:1;
  62. unsigned startup_delay;
  63. enum gpiod_flags *gflags;
  64. int ngpios;
  65. struct gpio_regulator_state *states;
  66. int nr_states;
  67. enum regulator_type type;
  68. struct regulator_init_data *init_data;
  69. };
  70. #endif