Add a simple helper for the UNLOCK command.

Signed-off-by: Chia-I Wu <olva...@gmail.com>
---
 drivers/gpu/drm/panthor/panthor_mmu.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c 
b/drivers/gpu/drm/panthor/panthor_mmu.c
index 8600d98842345..953348f9afdb8 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -588,6 +588,19 @@ static void mmu_hw_cmd_lock(struct panthor_device *ptdev, 
u32 as_nr, u64 region_
        write_cmd(ptdev, as_nr, AS_COMMAND_LOCK);
 }
 
+/**
+ * mmu_hw_cmd_unlock() - Issue an UNLOCK command
+ * @ptdev: Device.
+ * @as_nr: AS to issue command to.
+ *
+ * Issue an UNLOCK command to unblock transactions for a locked region. The
+ * region is implied by the last mmu_hw_cmd_lock call.
+ */
+static void mmu_hw_cmd_unlock(struct panthor_device *ptdev, u32 as_nr)
+{
+       write_cmd(ptdev, as_nr, AS_COMMAND_UNLOCK);
+}
+
 static int mmu_hw_do_operation_locked(struct panthor_device *ptdev, int as_nr,
                                      u64 iova, u64 size, u32 op)
 {
@@ -633,7 +646,7 @@ static int mmu_hw_do_operation_locked(struct panthor_device 
*ptdev, int as_nr,
         * at the end of the GPU_CONTROL cache flush command, unlike
         * AS_COMMAND_FLUSH_MEM or AS_COMMAND_FLUSH_PT.
         */
-       write_cmd(ptdev, as_nr, AS_COMMAND_UNLOCK);
+       mmu_hw_cmd_unlock(ptdev, as_nr);
 
        /* Wait for the unlock command to complete */
        return mmu_hw_wait_ready(ptdev, as_nr);
-- 
2.51.0.384.g4c02a37b29-goog

Reply via email to