nohlt.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (c) 2009, 2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. /*
  14. * MSM architecture driver to control arm halt behavior
  15. */
  16. #include <linux/module.h>
  17. #include <linux/debugfs.h>
  18. #include <linux/fs.h>
  19. #include <asm/system.h>
  20. static int set_nohalt(void *data, u64 val)
  21. {
  22. if (val)
  23. disable_hlt();
  24. else
  25. enable_hlt();
  26. return 0;
  27. }
  28. static int get_nohalt(void *data, u64 *val)
  29. {
  30. *val = (unsigned int)get_hlt();
  31. return 0;
  32. }
  33. DEFINE_SIMPLE_ATTRIBUTE(nohalt_ops, get_nohalt, set_nohalt, "%llu\n");
  34. static int __init init_hlt_debug(void)
  35. {
  36. debugfs_create_file("nohlt", 0600, NULL, NULL, &nohalt_ops);
  37. return 0;
  38. }
  39. late_initcall(init_hlt_debug);