smartreflex-class3.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Smart reflex Class 3 specific implementations
  3. *
  4. * Author: Thara Gopinath <thara@ti.com>
  5. *
  6. * Copyright (C) 2010 Texas Instruments, Inc.
  7. * Thara Gopinath <thara@ti.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include "smartreflex.h"
  14. static int sr_class3_enable(struct voltagedomain *voltdm)
  15. {
  16. unsigned long volt = voltdm_get_voltage(voltdm);
  17. if (!volt) {
  18. pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n",
  19. __func__, voltdm->name);
  20. return -ENODATA;
  21. }
  22. omap_vp_enable(voltdm);
  23. return sr_enable(voltdm, volt);
  24. }
  25. static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
  26. {
  27. sr_disable_errgen(voltdm);
  28. omap_vp_disable(voltdm);
  29. sr_disable(voltdm);
  30. if (is_volt_reset)
  31. voltdm_reset(voltdm);
  32. return 0;
  33. }
  34. static int sr_class3_configure(struct voltagedomain *voltdm)
  35. {
  36. return sr_configure_errgen(voltdm);
  37. }
  38. /* SR class3 structure */
  39. static struct omap_sr_class_data class3_data = {
  40. .enable = sr_class3_enable,
  41. .disable = sr_class3_disable,
  42. .configure = sr_class3_configure,
  43. .class_type = SR_CLASS3,
  44. };
  45. /* Smartreflex Class3 init API to be called from board file */
  46. static int __init sr_class3_init(void)
  47. {
  48. pr_info("SmartReflex Class3 initialized\n");
  49. return sr_register_class(&class3_data);
  50. }
  51. late_initcall(sr_class3_init);