Skip to contentSkip to conversation

reset: Add devm_reset_control_get_optional_exclusive_released()

PATCH In review Dmitry Osipenko 2 participants 2 messages Jan 23, 2021 – Jan 25, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reset: Add devm_reset_control_get_optional_exclusive_released()

NVIDIA Tegra DRM and media drivers will need a resource-managed-optional variant of reset_control_get_exclusive_released() in order to switch away from a legacy Tegra-specific PD API to a GENPD API without much hassle. Add the new reset helper to the reset API.

---

Hello Philipp,

This patch is a prerequisite for a power domain enablement using GENPD API on NVIDIA Tegra20/30 SoCs. The hardware resets are acquired by a Tegra PMC (Power Management Controller) driver until device is RPM-resumed if GENPD API is used, and thus, device drivers need to request resets in a released state. The resets are also optional, depending on hardware and DTB versions. This is why we will need the new helper. Will be awesome if you could pick up this patch for v5.12, this will help to avoid inter-subsystem dependencies for the driver patches that will target v5.13. Thanks in advance!

 include/linux/reset.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
include/linux/reset.h +19 -0
index 439fec7112a9..b9109efa2a5c 100644
@@ -362,6 +362,25 @@ __must_check devm_reset_control_get_exclusive_released(struct device *dev,
 	return __devm_reset_control_get(dev, id, 0, false, false, false);
 }
 
+/**
+ * devm_reset_control_get_optional_exclusive_released - resource managed
+ *                                                      reset_control_get_optional_exclusive_released()
+ * @dev: device to be reset by the controller
+ * @id: reset line name
+ *
+ * Managed-and-optional variant of reset_control_get_exclusive_released(). For
+ * reset controllers returned from this function, reset_control_put() is called
+ * automatically on driver detach.
+ *
+ * See reset_control_get_exclusive_released() for more information.
+ */
+static inline struct reset_control *
+__must_check devm_reset_control_get_optional_exclusive_released(struct device *dev,
+								const char *id)
+{
+	return __devm_reset_control_get(dev, id, 0, false, true, false);
+}
+
 /**
  * devm_reset_control_get_shared - resource managed reset_control_get_shared()
  * @dev: device to be reset by the controller
Signature · 1 line
2.29.2
maintainer
#1 lore raw

Hi Dmitry,

Quoted 13 lines · Dmitry Osipenko

NVIDIA Tegra DRM and media drivers will need a resource-managed-optional variant of reset_control_get_exclusive_released() in order to switch away from a legacy Tegra-specific PD API to a GENPD API without much hassle. Add the new reset helper to the reset API.

---

Hello Philipp,

Quoted 9 lines

This patch is a prerequisite for a power domain enablement using GENPD API on NVIDIA Tegra20/30 SoCs. The hardware resets are acquired by a Tegra PMC (Power Management Controller) driver until device is RPM-resumed if GENPD API is used, and thus, device drivers need to request resets in a released state. The resets are also optional, depending on hardware and DTB versions. This is why we will need the new helper. Will be awesome if you could pick up this patch for v5.12, this will help to avoid inter-subsystem dependencies for the driver patches that will target v5.13. Thanks in advance!

Thank you, looks good to me. Applied to reset/next for v5.12.

regards
Philipp