Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Jessica Zhang <quic_jesszhan@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Sasha Levin <sashal@kernel.org>,
	robdclark@gmail.com, quic_abhinavk@quicinc.com, lumag@kernel.org,
	airlied@gmail.com, simona@ffwll.ch,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH AUTOSEL 6.14 027/102] drm/msm/hdmi: add runtime PM calls to DDC transfer function
Date: Sun,  1 Jun 2025 19:28:19 -0400	[thread overview]
Message-ID: <20250601232937.3510379-27-sashal@kernel.org> (raw)
In-Reply-To: <20250601232937.3510379-1-sashal@kernel.org>

From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

[ Upstream commit 531b4e2c206e5f7dead04d9da84dfa693ac57481 ]

We must be sure that the HDMI controller is powered on, while performing
the DDC transfer. Add corresponding runtime PM calls to
msm_hdmi_i2c_xfer().

Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/651727/
Link: https://lore.kernel.org/r/20250505-fd-hdmi-hpd-v5-8-48541f76318c@oss.qualcomm.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

**YES** This commit should be backported to stable kernel trees. Here's
my detailed analysis: ## Bug Fix Analysis This commit addresses a
**critical power management bug** in the MSM HDMI DDC (Display Data
Channel) implementation. The issue is that DDC transfers can occur when
the HDMI controller is not properly powered, leading to potential
hardware access failures or system instability. ## Code Changes Analysis
The changes in `drivers/gpu/drm/msm/hdmi/hdmi_i2c.c` are **minimal and
well-contained**: 1. **Added runtime PM calls around DDC operations**: -
`pm_runtime_resume_and_get()` at function start (line ~110) -
`pm_runtime_put()` in success path (line ~206) - `pm_runtime_put()` in
error path (line ~224) 2. **Fixed error handling flow**: - Changed
direct returns to proper `goto fail` to ensure PM put operations - Lines
113-114 and 172 now use `goto fail` instead of direct returns ## Risk
Assessment - LOW RISK **Minimal scope**: Only affects the
`msm_hdmi_i2c_xfer()` function, which is the DDC transfer entry point.
**Consistent with existing patterns**: The kernel tree analysis shows
runtime PM is already used extensively in this driver: -
`hdmi_bridge.c`: Uses `pm_runtime_get_sync()` and `pm_runtime_put()` -
`hdmi_hpd.c`: Uses runtime PM in 4 locations for HPD operations **No
architectural changes**: This follows the existing runtime PM pattern
established in commit 6ed9ed484d04 from 2017. ## Comparison with Similar
Commits This matches the characteristics of **Similar Commit #1**
(marked YES for backport): - Fixes a resource management bug (runtime PM
vs devres helper) - Small, contained change - Improves driver robustness
- Follows existing patterns The commit is **unlike** the rejected
commits (#2-#5) which were: - Code cleanups/refactoring - API
modernization - Feature additions - Non-critical improvements ##
Critical System Impact DDC is essential for HDMI functionality - it's
used for: - Reading display EDID data - Monitor detection - Display
capability negotiation Without proper power management, DDC operations
could fail intermittently, causing display detection issues or system
hangs when accessing unpowered hardware. ## Conclusion This is a **low-
risk, high-value bugfix** that ensures hardware is properly powered
during DDC operations. It follows established driver patterns, has
minimal scope, and fixes a potentially serious power management issue
that could affect display functionality.

 drivers/gpu/drm/msm/hdmi/hdmi_i2c.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_i2c.c b/drivers/gpu/drm/msm/hdmi/hdmi_i2c.c
index 7aa500d24240f..ebefea4fb4085 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_i2c.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_i2c.c
@@ -107,11 +107,15 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,
 	if (num == 0)
 		return num;
 
+	ret = pm_runtime_resume_and_get(&hdmi->pdev->dev);
+	if (ret)
+		return ret;
+
 	init_ddc(hdmi_i2c);
 
 	ret = ddc_clear_irq(hdmi_i2c);
 	if (ret)
-		return ret;
+		goto fail;
 
 	for (i = 0; i < num; i++) {
 		struct i2c_msg *p = &msgs[i];
@@ -169,7 +173,7 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,
 				hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS),
 				hdmi_read(hdmi, REG_HDMI_DDC_HW_STATUS),
 				hdmi_read(hdmi, REG_HDMI_DDC_INT_CTRL));
-		return ret;
+		goto fail;
 	}
 
 	ddc_status = hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS);
@@ -202,7 +206,13 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c,
 		}
 	}
 
+	pm_runtime_put(&hdmi->pdev->dev);
+
 	return i;
+
+fail:
+	pm_runtime_put(&hdmi->pdev->dev);
+	return ret;
 }
 
 static u32 msm_hdmi_i2c_func(struct i2c_adapter *adapter)
-- 
2.39.5


  parent reply	other threads:[~2025-06-01 23:30 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-01 23:27 [PATCH AUTOSEL 6.14 001/102] drm/amd/display: disable DPP RCG before DPP CLK enable Sasha Levin
2025-06-01 23:27 ` [PATCH AUTOSEL 6.14 002/102] drm/bridge: select DRM_KMS_HELPER for AUX_BRIDGE Sasha Levin
2025-06-01 23:27 ` [PATCH AUTOSEL 6.14 003/102] drm/amdgpu/gfx6: fix CSIB handling Sasha Levin
2025-06-01 23:27 ` [PATCH AUTOSEL 6.14 004/102] media: imx-jpeg: Check decoding is ongoing for motion-jpeg Sasha Levin
2025-06-01 23:27 ` [PATCH AUTOSEL 6.14 005/102] drm/rockchip: inno-hdmi: Fix video timing HSYNC/VSYNC polarity setting for rk3036 Sasha Levin
2025-06-01 23:27 ` [PATCH AUTOSEL 6.14 006/102] drm/dp: add option to disable zero sized address only transactions Sasha Levin
2025-06-01 23:27 ` [PATCH AUTOSEL 6.14 007/102] sunrpc: update nextcheck time when adding new cache entries Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 008/102] drm/amdgpu: Fix API status offset for MES queue reset Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 009/102] drm/amd/display: DCN32 null data check Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 010/102] drm/xe: Fix CFI violation when accessing sysfs files Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 011/102] drm/bridge: analogix_dp: Add irq flag IRQF_NO_AUTOEN instead of calling disable_irq() Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 012/102] workqueue: Fix race condition in wq->stats incrementation Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 013/102] drm/panel/sharp-ls043t1le01: Use _multi variants Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 014/102] exfat: fix double free in delayed_free Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 015/102] drm/bridge: anx7625: enable HPD interrupts Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 016/102] arm64/cpuinfo: only show one cpu's info in c_show() Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 017/102] drm/panthor: Don't update MMU_INT_MASK in panthor_mmu_irq_handler() Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 018/102] drm/bridge: anx7625: change the gpiod_set_value API Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 019/102] exfat: do not clear volume dirty flag during sync Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 020/102] drm/amdkfd: Drop workaround for GC v9.4.3 revID 0 Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 021/102] drm/amdgpu/gfx11: fix CSIB handling Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 022/102] media: nuvoton: npcm-video: Fix stuck due to no video signal error Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 023/102] drm/nouveau: fix hibernate on disabled GPU Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 024/102] media: i2c: imx334: Enable runtime PM before sub-device registration Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 025/102] drm/amd/display: Avoid divide by zero by initializing dummy pitch to 1 Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 026/102] drm/nouveau/gsp: fix rm shutdown wait condition Sasha Levin
2025-06-01 23:28 ` Sasha Levin [this message]
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 028/102] media: uapi: v4l: Fix V4L2_TYPE_IS_OUTPUT condition Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 029/102] drm/amd/display: Add NULL pointer checks in dm_force_atomic_commit() Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 030/102] media: verisilicon: Enable wide 4K in AV1 decoder Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 031/102] drm/amd/display: Skip to enable dsc if it has been off Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 032/102] dlm: use SHUT_RDWR for SCTP shutdown Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 033/102] drm/msm/a6xx: Increase HFI response timeout Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 034/102] drm/amd/display: Do Not Consider DSC if Valid Config Not Found Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 035/102] media: i2c: imx334: Fix runtime PM handling in remove function Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 036/102] drm/amdgpu/gfx10: fix CSIB handling Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 037/102] drm: panel-orientation-quirks: Add ZOTAC Gaming Zone Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 038/102] media: ccs-pll: Better validate VT PLL branch Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 039/102] media: uapi: v4l: Change V4L2_TYPE_IS_CAPTURE condition Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 040/102] drm/amd/display: fix zero value for APU watermark_c Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 041/102] drm/ttm/tests: fix incorrect assert in ttm_bo_unreserve_bulk() Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 042/102] drm/amdgpu/gfx7: fix CSIB handling Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 043/102] ext4: ext4: unify EXT4_EX_NOCACHE|NOFAIL flags in ext4_ext_remove_space() Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 044/102] jfs: fix array-index-out-of-bounds read in add_missing_indices Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 045/102] media: ti: cal: Fix wrong goto on error path Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 046/102] drm/xe/vf: Fix guc_info debugfs for VFs Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 047/102] drm/amd/display: Correct SSC enable detection for DCN351 Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 048/102] media: rkvdec: h264: Use bytesperline and buffer height as virstride Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 049/102] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 050/102] media: rkvdec: Initialize the m2m context before the controls Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 051/102] drm/amdgpu: fix MES GFX mask Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 052/102] drm/amdgpu: Disallow partition query during reset Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 053/102] sunrpc: fix race in cache cleanup causing stale nextcheck time Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 054/102] ext4: prevent stale extent cache entries caused by concurrent get es_cache Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 055/102] drm/amdgpu/gfx8: fix CSIB handling Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 056/102] drm/amd/display: disable EASF narrow filter sharpening Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 057/102] drm/amdgpu/gfx9: fix CSIB handling Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 058/102] drm/amd/display: Fix VUpdate offset calculations for dcn401 Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 059/102] jfs: Fix null-ptr-deref in jfs_ioc_trim Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 060/102] drm/amd/display: Correct prefetch calculation Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 061/102] drm/amd/display: Restructure DMI quirks Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 062/102] media: renesas: vsp1: Fix media bus code setup on RWPF source pad Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 063/102] drm/msm/dpu: don't select single flush for active CTL blocks Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 064/102] drm/amdkfd: Set SDMA_RLCx_IB_CNTL/SWITCH_INSIDE_IB Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 065/102] media: tc358743: ignore video while HPD is low Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 066/102] media: platform: exynos4-is: Add hardware sync wait to fimc_is_hw_change_mode() Sasha Levin
2025-06-01 23:28 ` [PATCH AUTOSEL 6.14 067/102] media: i2c: imx334: update mode_3840x2160_regs array Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 068/102] nios2: force update_mmu_cache on spurious tlb-permission--related pagefaults Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 069/102] media: rcar-vin: Fix stride setting for RAW8 formats Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 070/102] drm/amdgpu: Add indirect L1_TLB_CNTL reg programming for VFs Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 071/102] drm/xe/uc: Remove static from loop variable Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 072/102] media: qcom: venus: Fix uninitialized variable warning Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 073/102] drm/panel: simple: Add POWERTIP PH128800T004-ZZA01 panel entry Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 074/102] Make 'cc-option' work correctly for the -Wno-xyzzy pattern Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 075/102] ACPI: bus: Bail out if acpi_kobj registration fails Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 076/102] selftests: harness: Mark functions without prototypes static Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 077/102] pmdomain: ti: Fix STANDBY handling of PER power domain Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 078/102] PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn() Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 079/102] ASoC: amd: yc: Add quirk for Lenovo Yoga Pro 7 14ASP9 Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 080/102] thermal/drivers/qcom/tsens: Update conditions to strictly evaluate for IP v2+ Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 081/102] clocksource/drivers/timer-tegra186: Fix watchdog self-pinging Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 082/102] gpio: pxa: Make irq_chip immutable Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 083/102] gpio: grgpio: " Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 084/102] gpio: xgene-sb: " Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 085/102] genirq: Retain disable depth for managed interrupts across CPU hotplug Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 086/102] mmc: sdhci-esdhc-imx: reset async FIFO before sending manual tuning command Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 087/102] mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspend Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 088/102] mmc: Add quirk to disable DDR50 tuning Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 089/102] ASoC: intel/sdw_utils: Assign initial value in asoc_sdw_rt_amp_spk_rtd_init() Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 090/102] clocksource: Fix the CPUs' choice in the watchdog per CPU verification Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 091/102] ACPICA: Avoid sequence overread in call to strncmp() Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 092/102] ACPICA: utilities: Fix overflow check in vsnprintf() Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 093/102] ACPI: EC: Add device to acpi_ec_no_wakeup[] qurik list Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 094/102] ALSA: seq: Remove unused snd_seq_queue_client_leave_cells Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 095/102] spi: axi-spi-engine: wait for completion in setup Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 096/102] cpufreq: Force sync policy boost with global boost on sysfs update Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 097/102] power: supply: bq27xxx: Retrieve again when busy Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 098/102] pmdomain: core: Reset genpd->states to avoid freeing invalid data Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 099/102] tools/nolibc: use intmax definitions from compiler Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 100/102] EDAC/igen6: Skip absent memory controllers Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 101/102] gpio: ds4520: don't check the 'ngpios' property in the driver Sasha Levin
2025-06-01 23:29 ` [PATCH AUTOSEL 6.14 102/102] ASoC: tas2770: Power cycle amp on ISENSE/VSENSE change Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250601232937.3510379-27-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=airlied@gmail.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_jesszhan@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox