fixed.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * fixed.h
  3. *
  4. * Copyright 2008 Wolfson Microelectronics PLC.
  5. *
  6. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  7. *
  8. * Copyright (c) 2009 Nokia Corporation
  9. * Roger Quadros <ext-roger.quadros@nokia.com>
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of the
  14. * License, or (at your option) any later version.
  15. */
  16. #ifndef __REGULATOR_FIXED_H
  17. #define __REGULATOR_FIXED_H
  18. struct regulator_init_data;
  19. /**
  20. * struct fixed_voltage_config - fixed_voltage_config structure
  21. * @supply_name: Name of the regulator supply
  22. * @input_supply: Name of the input regulator supply
  23. * @microvolts: Output voltage of regulator
  24. * @gpio: GPIO to use for enable control
  25. * set to -EINVAL if not used
  26. * @startup_delay: Start-up time in microseconds
  27. * @gpio_is_open_drain: Gpio pin is open drain or normal type.
  28. * If it is open drain type then HIGH will be set
  29. * through PULL-UP with setting gpio as input
  30. * and low will be set as gpio-output with driven
  31. * to low. For non-open-drain case, the gpio will
  32. * will be in output and drive to low/high accordingly.
  33. * @enable_high: Polarity of enable GPIO
  34. * 1 = Active high, 0 = Active low
  35. * @enabled_at_boot: Whether regulator has been enabled at
  36. * boot or not. 1 = Yes, 0 = No
  37. * This is used to keep the regulator at
  38. * the default state
  39. * @init_data: regulator_init_data
  40. *
  41. * This structure contains fixed voltage regulator configuration
  42. * information that must be passed by platform code to the fixed
  43. * voltage regulator driver.
  44. */
  45. struct fixed_voltage_config {
  46. const char *supply_name;
  47. const char *input_supply;
  48. int microvolts;
  49. int gpio;
  50. unsigned startup_delay;
  51. unsigned gpio_is_open_drain:1;
  52. unsigned enable_high:1;
  53. unsigned enabled_at_boot:1;
  54. struct regulator_init_data *init_data;
  55. };
  56. struct regulator_consumer_supply;
  57. #if IS_ENABLED(CONFIG_REGULATOR)
  58. struct platform_device *regulator_register_always_on(int id, const char *name,
  59. struct regulator_consumer_supply *supplies, int num_supplies, int uv);
  60. #else
  61. static inline struct platform_device *regulator_register_always_on(int id, const char *name,
  62. struct regulator_consumer_supply *supplies, int num_supplies, int uv)
  63. {
  64. return NULL;
  65. }
  66. #endif
  67. #define regulator_register_fixed(id, s, ns) regulator_register_always_on(id, \
  68. "fixed-dummy", s, ns, 0)
  69. #endif