radeon_pm.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Permission is hereby granted, free of charge, to any person obtaining a
  3. * copy of this software and associated documentation files (the "Software"),
  4. * to deal in the Software without restriction, including without limitation
  5. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  6. * and/or sell copies of the Software, and to permit persons to whom the
  7. * Software is furnished to do so, subject to the following conditions:
  8. *
  9. * The above copyright notice and this permission notice shall be included in
  10. * all copies or substantial portions of the Software.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  15. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  16. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  17. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  18. * OTHER DEALINGS IN THE SOFTWARE.
  19. *
  20. * Authors: Rafał Miłecki <zajec5@gmail.com>
  21. */
  22. #include "drmP.h"
  23. #include "radeon.h"
  24. int radeon_debugfs_pm_init(struct radeon_device *rdev);
  25. int radeon_pm_init(struct radeon_device *rdev)
  26. {
  27. if (radeon_debugfs_pm_init(rdev)) {
  28. DRM_ERROR("Failed to register debugfs file for PM!\n");
  29. }
  30. return 0;
  31. }
  32. /*
  33. * Debugfs info
  34. */
  35. #if defined(CONFIG_DEBUG_FS)
  36. static int radeon_debugfs_pm_info(struct seq_file *m, void *data)
  37. {
  38. struct drm_info_node *node = (struct drm_info_node *) m->private;
  39. struct drm_device *dev = node->minor->dev;
  40. struct radeon_device *rdev = dev->dev_private;
  41. seq_printf(m, "default engine clock: %u0 kHz\n", rdev->clock.default_sclk);
  42. seq_printf(m, "current engine clock: %u0 kHz\n", radeon_get_engine_clock(rdev));
  43. seq_printf(m, "default memory clock: %u0 kHz\n", rdev->clock.default_mclk);
  44. if (rdev->asic->get_memory_clock)
  45. seq_printf(m, "current memory clock: %u0 kHz\n", radeon_get_memory_clock(rdev));
  46. return 0;
  47. }
  48. static struct drm_info_list radeon_pm_info_list[] = {
  49. {"radeon_pm_info", radeon_debugfs_pm_info, 0, NULL},
  50. };
  51. #endif
  52. int radeon_debugfs_pm_init(struct radeon_device *rdev)
  53. {
  54. #if defined(CONFIG_DEBUG_FS)
  55. return radeon_debugfs_add_files(rdev, radeon_pm_info_list, ARRAY_SIZE(radeon_pm_info_list));
  56. #else
  57. return 0;
  58. #endif
  59. }