dsi_pwr.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DSI_PWR_H_
  6. #define _DSI_PWR_H_
  7. #include <linux/device.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/types.h>
  10. #include <linux/regulator/consumer.h>
  11. struct dsi_parser_utils;
  12. /**
  13. * struct dsi_vreg - regulator information for DSI regulators
  14. * @vreg: Handle to the regulator.
  15. * @vreg_name: Regulator name.
  16. * @min_voltage: Minimum voltage in uV.
  17. * @max_voltage: Maximum voltage in uV.
  18. * @enable_load: Load, in uA, when enabled.
  19. * @disable_load: Load, in uA, when disabled.
  20. * @pre_on_sleep: Sleep, in ms, before enabling the regulator.
  21. * @post_on_sleep: Sleep, in ms, after enabling the regulator.
  22. * @pre_off_sleep: Sleep, in ms, before disabling the regulator.
  23. * @post_off_sleep: Sleep, in ms, after disabling the regulator.
  24. */
  25. struct dsi_vreg {
  26. struct regulator *vreg;
  27. char vreg_name[32];
  28. u32 min_voltage;
  29. u32 max_voltage;
  30. u32 enable_load;
  31. u32 disable_load;
  32. u32 pre_on_sleep;
  33. u32 post_on_sleep;
  34. u32 pre_off_sleep;
  35. u32 post_off_sleep;
  36. };
  37. /**
  38. * struct dsi_regulator_info - set of vregs that are turned on/off together.
  39. * @vregs: Array of dsi_vreg structures.
  40. * @count: Number of vregs.
  41. * @refcount: Reference counting for enabling.
  42. */
  43. struct dsi_regulator_info {
  44. struct dsi_vreg *vregs;
  45. u32 count;
  46. u32 refcount;
  47. };
  48. /**
  49. * dsi_pwr_of_get_vreg_data - parse regulator supply information
  50. * @of_node: Device of node to parse for supply information.
  51. * @regs: Pointer where regulator information will be copied to.
  52. * @supply_name: Name of the supply node.
  53. *
  54. * return: error code in case of failure or 0 for success.
  55. */
  56. int dsi_pwr_of_get_vreg_data(struct dsi_parser_utils *utils,
  57. struct dsi_regulator_info *regs,
  58. char *supply_name);
  59. /**
  60. * dsi_pwr_get_dt_vreg_data - parse regulator supply information
  61. * @dev: Device whose of_node needs to be parsed.
  62. * @regs: Pointer where regulator information will be copied to.
  63. * @supply_name: Name of the supply node.
  64. *
  65. * return: error code in case of failure or 0 for success.
  66. */
  67. int dsi_pwr_get_dt_vreg_data(struct device *dev,
  68. struct dsi_regulator_info *regs,
  69. char *supply_name);
  70. /**
  71. * dsi_pwr_enable_regulator() - enable a set of regulators
  72. * @regs: Pointer to set of regulators to enable or disable.
  73. * @enable: Enable/Disable regulators.
  74. *
  75. * return: error code in case of failure or 0 for success.
  76. */
  77. int dsi_pwr_enable_regulator(struct dsi_regulator_info *regs, bool enable);
  78. #endif /* _DSI_PWR_H_ */