From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED2503BBFDE for ; Wed, 29 Jul 2026 06:06:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785305217; cv=none; b=jEdTZgu0YISCrQrV+Km4mJ4ERG0jPEKDnD3jX2y8zHP3JETsrsnis5842H6YIDmgCGZPeU/SnFb4dReVcb3Btbi6qq+hofSsZ1yFmMUhgUqb9/JZXMG4Pqdj874c7v8cCrhBHJxs7/pM+QkXxui27CCV1s0IkY5tqMBua+qbXpc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785305217; c=relaxed/simple; bh=QRxN5MDr5FIc8PSFipSzi/f3VAveC9b8plWzbqt7zQs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MVzmKzMh0Kp7qe8wuoHYQwBDN1Ir3MIxSZWbf3p9AHVnE9z0G8Wd6E0JvgY6075bjLUfLLju9t/CtLT/fsIYAloJqh6RYC8+vpdBn2jQujIBC+X4myVelcqE8v4SadJH1TIcer334nT1g055QF2utpoflE6/E/ynX+P3Y+YlRr0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GSCy/n2G; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GSCy/n2G" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-8485b358552so641402b3a.2 for ; Tue, 28 Jul 2026 23:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785305215; x=1785910015; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=qs8cSOjWBzZH3Gfw1u3IO4v1AqoupOCUcrhQMOFV05g=; b=GSCy/n2GXKKxwHjtg38/TReMjbNPzH3822xCNKb0Yy5woI09ply4mkCP/KQ+1npiZi 7K59mGn4TtOmwKTeI2Lsw4Xs+C9tug7xdBBj9qAuCt5ev9qIqJPit5fiZIbiz9tXJx8F Wln3kywDd90Q5TdBJPjYrLTBqveRFPmDWJErQbvAm4SNbBlc2GWOGd8USyjRI3oUcxuV L/osn7CfRyp+w8wWPymy2XrfOEidmHTg6ypx1PLzbAeHO6hWaaagT17wxYfTRMjtCt80 B0SYxvdkzwY3n22g0OE3L9bsNSRgS/wHCnus219BSWSNa5Gg+GNOTGteGBCpTkiEaue5 QaIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785305215; x=1785910015; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qs8cSOjWBzZH3Gfw1u3IO4v1AqoupOCUcrhQMOFV05g=; b=ZtYG+j2clIJ3qkFBuPXqwZ9ztR724koaC7XcHqGF2QsgdGx4T9tYAPOJvS1I1A5E28 GoeguNBVWpQNBIbtCfSkqpz1R3rzI3AkLrpYfpTap9OQ8W6b62mNqeqoQ2TQgoYqi5ll GTJSzAlj24UGXAqKFcuTxqkQmhzcdaYOUKJS/TDY27uHA6N+3i1ANIkd5Vns/4L0A3Do QKkESBgclprLoLP2YMe4/yPLV5RV4EnOd5UyC6AvybExJHXYBDxuSo2YzOjTGS4AXaDo z2FyZ9/L0V1xDg5QGRR8gMZn/tN3cwKwhxdJmV89abI+etYUSw9HHk1Trf1KrJ8ldips GL1Q== X-Forwarded-Encrypted: i=1; AHgh+Rp4btNRRrOQ0YryZRl9pNer8LjpnIF4AbRUa6i0RLd2YlcF6rv3J3eAw3ivWsAqwDLqjrIwaUlI9RlEG4Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwC0by0Mb23nIg0pX1fR9PtZtyFX5ayf8tf3uh8hrDAtz3NzV7Y 36O60MdbdB/YEWNJfpg4+yE7xOUkTHFbcojz6pM5xkm3Sj5qb3CJYta8 X-Gm-Gg: AR+sD12ALKC29AKGuNqsVQxS2G01GyPGjqXM1yZQ9GBddkVEv/xoVpyOT6qEqPkAHxA +UxkUK61i26JllmavXhdQwYUMLODTQPXjj9QEgKmJWpWUR+DZA9LyNeKXUcar/PXnVru9hnx0bD fKPvoX9uWzOfCTdyXzRBwPh/quKXAQy6XREjqLPRyQhcgUUAhJ4kMQmIkW8WuJMcVJc7jJfmMZk xc4J4QC2rEKX+2geoLqk3f0mIhInmrccB2D/ISNgR2Yu3bDZr7diWidCylUXc1T1zZ3KtUk6mAp wS/HZM4czHzQiajvdPwkd3BAmEl0R8B+Is6MgVtaRU+KOMv7u15CdEZsqehY+dg2Q1NOxgopypt bYEEDPKCxF561POWJ4MI5nCfFtnFYNE/aXjEB7XL7NvGhLQVgsY8RFFzI1wPdL8LQf3YWnQt5Of KBh3WUEXGn7AQ0r5TSI0nvgXl+kQ8MgzIGFsJw13fG3mcsTNzWemZKqwj3P+FcNwJLSXC39YY2Q 43I66OfJ1vhuAa6dqtuQZrpr5aA7qQQAQVv0LP4nSG1dW2XeIA= X-Received: by 2002:a05:6a00:4614:b0:847:e791:d5c5 with SMTP id d2e1a72fcca58-84e93264595mr5862999b3a.35.1785305215191; Tue, 28 Jul 2026 23:06:55 -0700 (PDT) Received: from debian-rockchip-rock5b-rk3588.. ([2405:9800:b670:b64b:1c6e:95da:41c0:e7b6]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84ea02f8473sm805504b3a.31.2026.07.28.23.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2026 23:06:54 -0700 (PDT) From: Tharit Tangkijwanichakul To: Nicolas Dufresne , Benjamin Gaignard , Philipp Zabel , Mauro Carvalho Chehab Cc: Ezequiel Garcia , Hans Verkuil , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel-mentees@lists.linux.dev, skhan@linuxfoundation.org, me@brighamcampbell.com, jkoolstra@xs4all.nl, Frank.li@oss.nxp.com, Tharit Tangkijwanichakul Subject: [PATCH v5 0/2] media: hantro: fix runtime PM resource handling Date: Wed, 29 Jul 2026 06:04:38 +0000 Message-ID: <20260729060440.2092-1-tharitt97@gmail.com> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The Hantro device_run() path acquires a runtime PM reference before invoking the codec-specific run callback. Failure paths can leave the runtime PM reference and enabled clocks held. Patch 1 moves clock enable and disable operations into the runtime PM callbacks and releases the runtime PM reference when device_run() fails. It retains the existing CONFIG_PM conditional so that the patch remains independently buildable. Patch 2 removes the explicit CONFIG_PM conditional, defines the PM operations with DEFINE_RUNTIME_DEV_PM_OPS(), and uses pm_ptr() when assigning the PM operations to the platform driver. Changes in v5: - Split the runtime PM changes into two patches. - Move clock management into the runtime PM callbacks. - Release the runtime PM reference on device_run() failure. - Retain the CONFIG_PM conditional in patch 1. - Remove the CONFIG_PM conditional in patch 2 using DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr(). v4: https://lore.kernel.org/linux-media/20260728045921.4761-1-tharitt97@gmail.com Tharit Tangkijwanichakul (2): media: hantro: release runtime resources when device_run fails media: hantro: use DEFINE_RUNTIME_DEV_PM_OPS .../media/platform/verisilicon/hantro_drv.c | 75 ++++++++++--------- 1 file changed, 41 insertions(+), 34 deletions(-) --- Tested on a Rockchip RK3588 (Rock 5B) board with Fluster: H.264 (JVT-AVC_V1): 129/135, unchanged MPEG-2 (MPEG2_VIDEO-MAIN): 23/43, unchanged VP8 (VP8-TEST-VECTORS): 61/61, unchanged base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482 -- 2.47.3