fixed.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. * @startup_delay: Start-up time in microseconds
  25. * @gpio_is_open_drain: Gpio pin is open drain or normal type.
  26. * If it is open drain type then HIGH will be set
  27. * through PULL-UP with setting gpio as input
  28. * and low will be set as gpio-output with driven
  29. * to low. For non-open-drain case, the gpio will
  30. * will be in output and drive to low/high accordingly.
  31. * @enable_high: Polarity of enable GPIO
  32. * 1 = Active high, 0 = Active low
  33. * @enabled_at_boot: Whether regulator has been enabled at
  34. * boot or not. 1 = Yes, 0 = No
  35. * This is used to keep the regulator at
  36. * the default state
  37. * @init_data: regulator_init_data
  38. *
  39. * This structure contains fixed voltage regulator configuration
  40. * information that must be passed by platform code to the fixed
  41. * voltage regulator driver.
  42. */
  43. struct fixed_voltage_config {
  44. const char *supply_name;
  45. const char *input_supply;
  46. int microvolts;
  47. unsigned startup_delay;
  48. unsigned gpio_is_open_drain:1;
  49. unsigned enable_high:1;
  50. unsigned enabled_at_boot:1;
  51. struct regulator_init_data *init_data;
  52. };
  53. struct regulator_consumer_supply;
  54. #if IS_ENABLED(CONFIG_REGULATOR)
  55. struct platform_device *regulator_register_always_on(int id, const char *name,
  56. struct regulator_consumer_supply *supplies, int num_supplies, int uv);
  57. #else
  58. static inline struct platform_device *regulator_register_always_on(int id, const char *name,
  59. struct regulator_consumer_supply *supplies, int num_supplies, int uv)
  60. {
  61. return NULL;
  62. }
  63. #endif
  64. #define regulator_register_fixed(id, s, ns) regulator_register_always_on(id, \
  65. "fixed-dummy", s, ns, 0)
  66. #endif