firmware.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics.
  3. * Kyungmin Park <kyungmin.park@samsung.com>
  4. * Tomasz Figa <t.figa@samsung.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_ARM_FIRMWARE_H
  11. #define __ASM_ARM_FIRMWARE_H
  12. #include <linux/bug.h>
  13. /*
  14. * struct firmware_ops
  15. *
  16. * A structure to specify available firmware operations.
  17. *
  18. * A filled up structure can be registered with register_firmware_ops().
  19. */
  20. struct firmware_ops {
  21. /*
  22. * Inform the firmware we intend to enter CPU idle mode
  23. */
  24. int (*prepare_idle)(void);
  25. /*
  26. * Enters CPU idle mode
  27. */
  28. int (*do_idle)(unsigned long mode);
  29. /*
  30. * Sets boot address of specified physical CPU
  31. */
  32. int (*set_cpu_boot_addr)(int cpu, unsigned long boot_addr);
  33. /*
  34. * Boots specified physical CPU
  35. */
  36. int (*cpu_boot)(int cpu);
  37. /*
  38. * Initializes L2 cache
  39. */
  40. int (*l2x0_init)(void);
  41. /*
  42. * Enter system-wide suspend.
  43. */
  44. int (*suspend)(void);
  45. /*
  46. * Restore state of privileged hardware after system-wide suspend.
  47. */
  48. int (*resume)(void);
  49. };
  50. /* Global pointer for current firmware_ops structure, can't be NULL. */
  51. extern const struct firmware_ops *firmware_ops;
  52. /*
  53. * call_firmware_op(op, ...)
  54. *
  55. * Checks if firmware operation is present and calls it,
  56. * otherwise returns -ENOSYS
  57. */
  58. #define call_firmware_op(op, ...) \
  59. ((firmware_ops->op) ? firmware_ops->op(__VA_ARGS__) : (-ENOSYS))
  60. /*
  61. * register_firmware_ops(ops)
  62. *
  63. * A function to register platform firmware_ops struct.
  64. */
  65. static inline void register_firmware_ops(const struct firmware_ops *ops)
  66. {
  67. BUG_ON(!ops);
  68. firmware_ops = ops;
  69. }
  70. #endif