fixed.h 2.3 KB

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