memoryCall.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * OMAP powerdomain control
  3. *
  4. * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
  5. * Copyright (C) 2007-2011 Nokia Corporation
  6. *
  7. * Written by Paul Walmsley
  8. * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com>
  9. * State counting code by Tero Kristo <tero.kristo@nokia.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #undef DEBUG
  16. #include <linux/kernel.h>
  17. #include <linux/types.h>
  18. #include <linux/list.h>
  19. #include <linux/errno.h>
  20. #include <linux/string.h>
  21. #include <trace/events/power.h>
  22. #include "cm2xxx_3xxx.h"
  23. #include "prcm44xx.h"
  24. #include "cm44xx.h"
  25. #include "prm2xxx_3xxx.h"
  26. #include "prm44xx.h"
  27. #include <asm/cpu.h>
  28. #include "powerdomain.h"
  29. #include "clockdomain.h"
  30. #include "soc.h"
  31. #include "pm.h"
  32. #define PWRDM_TRACE_STATES_FLAG (1<<31)
  33. enum {
  34. PWRDM_STATE_NOW = 0,
  35. PWRDM_STATE_PREV,
  36. };
  37. /* pwrdm_list contains all registered struct powerdomains */
  38. static LIST_HEAD(pwrdm_list);
  39. static struct pwrdm_ops *arch_pwrdm;
  40. /* Private functions */
  41. static struct powerdomain *_pwrdm_lookup(const char *name)
  42. {
  43. struct powerdomain *pwrdm, *temp_pwrdm;
  44. pwrdm = NULL;
  45. list_for_each_entry(temp_pwrdm, &pwrdm_list, node) {
  46. if (!strcmp(name, temp_pwrdm->name)) {
  47. pwrdm = temp_pwrdm;
  48. break;
  49. }
  50. }
  51. return pwrdm;
  52. }
  53. /**
  54. * _pwrdm_register - register a powerdomain
  55. * @pwrdm: struct powerdomain * to register
  56. *
  57. * Adds a powerdomain to the internal powerdomain list. Returns
  58. * -EINVAL if given a null pointer, -EEXIST if a powerdomain is
  59. * already registered by the provided name, or 0 upon success.