max1586.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * max1586.h -- Voltage regulation for the Maxim 1586
  4. *
  5. * Copyright (C) 2008 Robert Jarzmik
  6. */
  7. #ifndef REGULATOR_MAX1586
  8. #define REGULATOR_MAX1586
  9. #include <linux/regulator/machine.h>
  10. #define MAX1586_V3 0
  11. #define MAX1586_V6 1
  12. /* precalculated values for v3_gain */
  13. #define MAX1586_GAIN_NO_R24 1000000 /* 700000 .. 1475000 mV */
  14. #define MAX1586_GAIN_R24_3k32 1051098 /* 735768 .. 1550369 mV */
  15. #define MAX1586_GAIN_R24_5k11 1078648 /* 755053 .. 1591005 mV */
  16. #define MAX1586_GAIN_R24_7k5 1115432 /* 780802 .. 1645262 mV */
  17. /**
  18. * max1586_subdev_data - regulator data
  19. * @id: regulator Id (either MAX1586_V3 or MAX1586_V6)
  20. * @name: regulator cute name (example for V3: "vcc_core")
  21. * @platform_data: regulator init data (constraints, supplies, ...)
  22. */
  23. struct max1586_subdev_data {
  24. int id;
  25. const char *name;
  26. struct regulator_init_data *platform_data;
  27. };
  28. /**
  29. * max1586_platform_data - platform data for max1586
  30. * @num_subdevs: number of regulators used (may be 1 or 2)
  31. * @subdevs: regulator used
  32. * At most, there will be a regulator for V3 and one for V6 voltages.
  33. * @v3_gain: gain on the V3 voltage output multiplied by 1e6.
  34. * This can be calculated as ((1 + R24/R25 + R24/185.5kOhm) * 1e6)
  35. * for an external resistor configuration as described in the
  36. * data sheet (R25=100kOhm).
  37. */
  38. struct max1586_platform_data {
  39. int num_subdevs;
  40. struct max1586_subdev_data *subdevs;
  41. int v3_gain;
  42. };
  43. #endif