pm: cleanup Doxygen groups and inclusion

- Add a new `subsys_pm` group, part of `subsys`
- Improve group naming
- Include conditional code using __DOXYGEN__, it allows to have better
  control of inclusion.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
diff --git a/doc/reference/power_management/index.rst b/doc/reference/power_management/index.rst
index 76e8933..cecb6e0 100644
--- a/doc/reference/power_management/index.rst
+++ b/doc/reference/power_management/index.rst
@@ -512,14 +512,16 @@
 Power Management Hook Interface
 ===============================
 
-.. doxygengroup:: power_management_hook_interface
+.. doxygengroup:: subsys_pm_sys_hooks
 
 System Power Management APIs
 ============================
 
-.. doxygengroup:: system_power_management_api
+.. doxygengroup:: subsys_pm_sys
 
 Device Power Management APIs
 ============================
 
-.. doxygengroup:: device_power_management_api
+.. doxygengroup:: subsys_pm_device
+
+.. doxygengroup:: subsys_pm_device_runtime
diff --git a/include/pm/device.h b/include/pm/device.h
index 586ef0a..5e6ba38 100644
--- a/include/pm/device.h
+++ b/include/pm/device.h
@@ -16,9 +16,8 @@
 
 /**
  * @brief Device Power Management API
- *
- * @defgroup device_power_management_api Device Power Management API
- * @ingroup power_management_api
+ * @defgroup subsys_pm_device Device
+ * @ingroup subsys_pm
  * @{
  */
 
@@ -90,7 +89,7 @@
  * @brief Device PM info
  */
 struct pm_device {
-#ifdef CONFIG_PM_DEVICE_RUNTIME
+#if defined(CONFIG_PM_DEVICE_RUNTIME) || defined(__DOXYGEN__)
 	/** Pointer to the device */
 	const struct device *dev;
 	/** Lock to synchronize the get/put operations */
@@ -183,7 +182,7 @@
 int pm_device_state_get(const struct device *dev,
 			enum pm_device_state *state);
 
-#ifdef CONFIG_PM_DEVICE
+#if defined(CONFIG_PM_DEVICE) || defined(__DOXYGEN__)
 /**
  * @brief Indicate that the device is in the middle of a transaction
  *
@@ -231,7 +230,7 @@
 static inline void pm_device_busy_clear(const struct device *dev) {}
 static inline bool pm_device_is_any_busy(void) { return false; }
 static inline bool pm_device_is_busy(const struct device *dev) { return false; }
-#endif
+#endif /* CONFIG_PM_DEVICE */
 
 __deprecated static inline void device_busy_set(const struct device *dev)
 {
diff --git a/include/pm/device_runtime.h b/include/pm/device_runtime.h
index 463e697..f924d49 100644
--- a/include/pm/device_runtime.h
+++ b/include/pm/device_runtime.h
@@ -15,8 +15,9 @@
 #endif
 
 /**
- * @defgroup runtime_power_management_api Device Runtime Power Management API
- * @ingroup power_management_api
+ * @brief Device Runtime Power Management API
+ * @defgroup subsys_pm_device_runtime Device Runtime
+ * @ingroup subsys_pm
  * @{
  */
 
diff --git a/include/pm/pm.h b/include/pm/pm.h
index 72168b0..ceb05a4 100644
--- a/include/pm/pm.h
+++ b/include/pm/pm.h
@@ -18,16 +18,17 @@
 #endif
 
 /**
- * @defgroup power_management_api Power Management
+ * @brief System and device power management
+ * @defgroup subsys_pm Power Management (PM)
+ * @ingroup subsys
  * @{
  * @}
  */
 
 /**
  * @brief System Power Management API
- *
- * @defgroup system_power_management_api System Power Management API
- * @ingroup power_management_api
+ * @defgroup subsys_pm_sys System
+ * @ingroup subsys_pm
  * @{
  */
 
@@ -63,7 +64,7 @@
 	void (*state_exit)(enum pm_state state);
 };
 
-#ifdef CONFIG_PM
+#if defined(CONFIG_PM) || defined(__DOXYGEN__)
 /**
  * @brief Force usage of given power state.
  *
@@ -105,10 +106,9 @@
  */
 
 /**
- * @brief System Power Management Constraint API
- *
- * @defgroup system_power_management_constraint_api Constraint API
- * @ingroup power_management_api
+ * @brief System Power Management Constraints API
+ * @defgroup subsys_pm_sys_constraint Constraints
+ * @ingroup subsys_pm_sys
  * @{
  */
 
@@ -155,10 +155,9 @@
  */
 
 /**
- * @brief Power Management Hooks
- *
- * @defgroup power_management_hook_interface Power Management Hooks
- * @ingroup power_management_api
+ * @brief System Power Management Hooks
+ * @defgroup subsys_pm_sys_hooks Hooks
+ * @ingroup subsys_pm_sys
  * @{
  */
 
diff --git a/include/pm/policy.h b/include/pm/policy.h
index 936c223..59cb02b 100644
--- a/include/pm/policy.h
+++ b/include/pm/policy.h
@@ -13,6 +13,8 @@
 extern "C" {
 #endif
 
+/** @cond INTERNAL_HIDDEN */
+
 /**
  * @brief Function to get the next PM state
  *
@@ -26,6 +28,7 @@
  */
 struct pm_state_info pm_policy_next_state(int32_t ticks);
 
+/** @endcond */
 
 #ifdef __cplusplus
 }
diff --git a/include/pm/state.h b/include/pm/state.h
index f90dee9..1410961 100644
--- a/include/pm/state.h
+++ b/include/pm/state.h
@@ -15,8 +15,9 @@
 #endif
 
 /**
- * @defgroup pm_states Power Management States
- * @ingroup power_management_api
+ * @brief System Power Management States
+ * @defgroup subsys_pm_states States
+ * @ingroup subsys_pm
  * @{
  */