drm/bridge: cdns-mhdp8546: Add suspend resume support to the bridge driver
Subsystems (3)
PATCH v4 1/1 drm/bridge: cdns-mhdp8546: Add suspend resume support to the bridge driver
Add system suspend and resume hooks to the cdns-mhdp8546 bridge driver.
While resuming we either load the firmware or activate it. Firmware is loaded only when resuming from a successful suspend-resume cycle.
If resuming due to an aborted suspend, loading the firmware is not possible because the uCPU's IMEM is only accessible after a reset and the bridge has not gone through a reset in this case. Hence, activate the firmware that is already loaded.
Use the KEEP_ALIVE register to determine if there is a firmware already running or not and load the FW accordingly.
---
Hi,
Changes in v4:
- Use LATE_SYSTEM_SLEEP_PM_OPS for the pm_ops.
- Replace genpd_notifier callback with reading the KEEP_ALIVE register to determine if FW is already running in the bridge
- Link to v3: https://lore.kernel.org/all/[email protected]/
Changes in v3:
- Register genpd_notifier callback only when genpd is available.
- Mark mhdp->powered_off = false after resume is successful.
- Use SIMPLE_DEV_PM_OPS instead of SET_SYSTEM_SLEEP_PM_OPS.
- Set mhdp->hw_state appropriately in error paths.
- Link to v2: https://lore.kernel.org/all/[email protected]/
Changes in v2:
- Fixed defined but not used [-Wunused-function] warning for suspend and resume calls.
- Link to v1: https://lore.kernel.org/all/[email protected]/
Thanks and Regards,
Abhash
.../drm/bridge/cadence/cdns-mhdp8546-core.c | 121 +++++++++++++++++- 1 file changed, 120 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +120 -1
@@ -12,7 +12,6 @@* * TODO: * - Implement optimized mailbox communication using mailbox interrupts -* - Add support for power management * - Add support for features like audio, MST and fast link training * - Implement request_fw_cancel to handle HW_STATE * - Fix asynchronous loading of firmware implementation
@@ -2287,6 +2286,125 @@ static void cdns_mhdp_hpd_work(struct work_struct *work)drm_bridge_hpd_notify (&mhdp->bridge,cdns_mhdp_detect (mhdp)); } +static int cdns_mhdp_resume (struct device *dev) +{ +struct cdns_mhdp_device *mhdp =dev_get_drvdata (dev); +unsigned int keep_alive, keep_alive_inc; +unsigned long rate; +int ret; + + ret =clk_prepare_enable (mhdp->clk); +if (ret) +return ret; + + rate =clk_get_rate (mhdp->clk); +writel (rate %1000000 , mhdp->regs +CDNS_SW_CLK_L ); +writel (rate /1000000 , mhdp->regs +CDNS_SW_CLK_H ); +writel (~0 , mhdp->regs +CDNS_APB_INT_MASK ); + + ret =phy_init (mhdp->phy); +if (ret) { +dev_err (mhdp->dev,"Failed to initialize PHY: %d\n" , ret); + goto disable_clk; + } + ret =phy_power_on (mhdp->phy); +if (ret <0 ) { +dev_err (mhdp->dev,"Failed to power on PHY: %d\n" , ret); + goto phy_exit; + } + +/* +* The KEEP_ALIVE register is incremented at every scheduler loop of the +* firmware. If it changes between reads, the firmware is still running +* (e.g. the suspend was aborted) and only needs to be activated. If it +* does not change, the bridge lost power and the firmware must be loaded +* again. +*/ + keep_alive =readl (mhdp->regs +CDNS_KEEP_ALIVE ) &CDNS_KEEP_ALIVE_MASK ; + ret =readl_poll_timeout (mhdp->regs +CDNS_KEEP_ALIVE , keep_alive_inc, + (keep_alive_inc &CDNS_KEEP_ALIVE_MASK ) != keep_alive, +2000 ,2 *CDNS_KEEP_ALIVE_TIMEOUT ); +if (ret) { + ret =cdns_mhdp_load_firmware (mhdp); +if (ret) + goto phy_off; + + ret =wait_event_timeout (mhdp->fw_load_wq, + mhdp->hw_state ==MHDP_HW_READY , +msecs_to_jiffies (1000 )); +if (ret ==0 ) { +dev_err (mhdp->dev,"%s: Timeout waiting for fw loading\n" , + __func__); + ret = -ETIMEDOUT ; + goto phy_off; + } + }else { + ret =cdns_mhdp_set_firmware_active (mhdp, true); +if (ret) { +dev_err (mhdp->dev,"Failed to activate firmware (%pe)\n" , +ERR_PTR (ret)); + goto phy_off; + } + +spin_lock (&mhdp->start_lock); + mhdp->hw_state =MHDP_HW_READY ; +if (!mhdp->no_hpd) +cdns_mhdp_bridge_hpd_enable (&mhdp->bridge); +spin_unlock (&mhdp->start_lock); + } + +return 0 ; + +phy_off: +phy_power_off (mhdp->phy); +phy_exit: +phy_exit (mhdp->phy); +disable_clk: +clk_disable_unprepare (mhdp->clk); + +return ret; +} + +static int cdns_mhdp_suspend (struct device *dev) +{ +struct cdns_mhdp_device *mhdp =dev_get_drvdata (dev); +unsigned long timeout =msecs_to_jiffies (100 ); +int ret; + +cancel_work_sync (&mhdp->hpd_work); + + ret =wait_event_timeout (mhdp->fw_load_wq, + mhdp->hw_state ==MHDP_HW_READY , + timeout); +if (ret ==0 ) { +dev_err (mhdp->dev,"%s: Timeout waiting for fw loading\n" , __func__); +return -ETIMEDOUT ; + } + +spin_lock (&mhdp->start_lock); + mhdp->hw_state =MHDP_HW_STOPPED ; +spin_unlock (&mhdp->start_lock); + + ret =cdns_mhdp_set_firmware_active (mhdp, false); +if (ret) { +dev_err (mhdp->dev,"Failed to stop firmware (%pe)\n" ,ERR_PTR (ret)); +spin_lock (&mhdp->start_lock); + mhdp->hw_state =MHDP_HW_READY ; +spin_unlock (&mhdp->start_lock); +return ret; + } + +phy_power_off (mhdp->phy); +phy_exit (mhdp->phy); +clk_disable_unprepare (mhdp->clk); + +return 0 ; +} + +static const struct dev_pm_ops cdns_mhdp_pm_ops = { +LATE_SYSTEM_SLEEP_PM_OPS (cdns_mhdp_suspend, cdns_mhdp_resume) +}; +static int cdns_mhdp_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -2497,6 +2615,7 @@ static struct platform_driver mhdp_driver = { .driver = { .name = "cdns-mhdp8546", .of_match_table = mhdp_ids, + .pm = pm_sleep_ptr(&cdns_mhdp_pm_ops), }, .probe = cdns_mhdp_probe, .remove = cdns_mhdp_remove,
Signature · 1 line
2.34.1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [High] drm/bridge: cdns-mhdp8546: build failure on mhdp->no_hpd in cdns_mhdp_resume() - [High] drm/bridge…
Thank you for your contribution! Sashiko AI review found 5 potential issues to consider:
- [High] drm/bridge: cdns-mhdp8546: build failure on mhdp->no_hpd in cdns_mhdp_resume()
- [High] drm/bridge: cdns-mhdp8546: unbalanced phy_power_off() and phy_power_on()
- [High] drm/bridge: cdns-mhdp8546: uncanceled async fw load on cdns_mhdp_resume() error
- [High] drm/bridge: cdns-mhdp8546: unmasked HPD IRQ race in cdns_mhdp_suspend()
- [Medium] drm/bridge: cdns-mhdp8546: double clk and phy teardown after failed resume
--
commit 8f4412907134191fa8e20db994148c5d7ad2f2b4
Author: Abhash Kumar Jha <[email protected]>
drm/bridge: cdns-mhdp8546: Add suspend resume support to the bridge driver
This commit adds system suspend and resume hooks to the cdns-mhdp8546 bridge driver, checking the KEEP_ALIVE register on resume to either reload the firmware or reactivate it if the device did not lose power.
Quoted 4 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +0
-0
[ ... ]
Quoted 46 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +42
-0@@ -2258,6 +2257,125 @@ static void cdns_mhdp_hpd_work(struct work_struct *work)drm_bridge_hpd_notify (&mhdp->bridge,cdns_mhdp_detect (mhdp)); } +static int cdns_mhdp_resume (struct device *dev) +{ +struct cdns_mhdp_device *mhdp =dev_get_drvdata (dev); +unsigned int keep_alive, keep_alive_inc; +unsigned long rate; +int ret; + + ret =clk_prepare_enable (mhdp->clk); +if (ret) +return ret; + + rate =clk_get_rate (mhdp->clk); +writel (rate %1000000 , mhdp->regs +CDNS_SW_CLK_L ); +writel (rate /1000000 , mhdp->regs +CDNS_SW_CLK_H ); +writel (~0 , mhdp->regs +CDNS_APB_INT_MASK ); + + ret =phy_init (mhdp->phy); +if (ret) { +dev_err (mhdp->dev,"Failed to initialize PHY: %d\n" , ret); + goto disable_clk; + } + ret =phy_power_on (mhdp->phy); +if (ret <0 ) { +dev_err (mhdp->dev,"Failed to power on PHY: %d\n" , ret); + goto phy_exit; + } + +/* +* The KEEP_ALIVE register is incremented at every scheduler loop of the +* firmware. If it changes between reads, the firmware is still running +* (e.g. the suspend was aborted) and only needs to be activated. If it +* does not change, the bridge lost power and the firmware must be loaded +* again. +*/ + keep_alive =readl (mhdp->regs +CDNS_KEEP_ALIVE ) &CDNS_KEEP_ALIVE_MASK ; + ret =readl_poll_timeout (mhdp->regs +CDNS_KEEP_ALIVE , keep_alive_inc, + (keep_alive_inc &CDNS_KEEP_ALIVE_MASK ) != keep_alive, +2000 ,2 *CDNS_KEEP_ALIVE_TIMEOUT ); +if (ret) { + ret =cdns_mhdp_load_firmware (mhdp); +if (ret) + goto phy_off;
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_hpd_work(struct work_struct *work) · line 2311
Quoted 10 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +10
-0+ + ret =wait_event_timeout (mhdp->fw_load_wq, + mhdp->hw_state ==MHDP_HW_READY , +msecs_to_jiffies (1000 )); +if (ret ==0 ) { +dev_err (mhdp->dev,"%s: Timeout waiting for fw loading\n" , + __func__); + ret = -ETIMEDOUT ; + goto phy_off; + }
[Severity: High]
Can a timeout here leave the asynchronous cdns_mhdp_fw_cb() callback running after mhdp->clk is disabled?
cdns_mhdp_load_firmware() schedules cdns_mhdp_fw_cb() via request_firmware_nowait(). If wait_event_timeout() times out after 1000 ms, jumping to phy_off disables mhdp->clk without cancelling or synchronizing with the pending callback:
CPU0 kworkercdns_mhdp_resume()
cdns_mhdp_load_firmware()
request_firmware_nowait(...)
wait_event_timeout(...) == 0
...
clk_disable_unprepare(mhdp->clk)
cdns_mhdp_fw_cb()
cdns_mhdp_fw_activate()
writel(..., mhdp->regs + CDNS_APB_CTRL)
<-- unclocked MMIO accesscdns_mhdp_fw_activate() then writes to mhdp->regs and copies the firmware image to CDNS_MHDP_IMEM while the clock is disabled, which triggers a synchronous external abort on ARM64 SoCs.
Quoted 4 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +4
-0+ }else { + ret =cdns_mhdp_set_firmware_active (mhdp, true); +if (ret) { + dev_err(mhdp->dev, "Failed to activate firmware (%pe)\n",
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_hpd_work(struct work_struct *work) · line 2354
Quoted 10 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +10
-0+ ERR_PTR(ret)); + goto phy_off; + } + +spin_lock (&mhdp->start_lock); + mhdp->hw_state =MHDP_HW_READY ; +if (!mhdp->no_hpd) +cdns_mhdp_bridge_hpd_enable (&mhdp->bridge); +spin_unlock (&mhdp->start_lock); + }
[Severity: High]
Does this compile when CONFIG_DRM_CDNS_MHDP8546 is enabled? struct cdns_mhdp_device has no no_hpd member.
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_hpd_work(struct work_struct *work) · line 2366
Quoted 12 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +12
-0+ +return 0 ; + +phy_off: +phy_power_off (mhdp->phy); +phy_exit: +phy_exit (mhdp->phy); +disable_clk: +clk_disable_unprepare (mhdp->clk); + +return ret; +}
[Severity: Medium]
If cdns_mhdp_resume() fails, won't driver removal later double-exit mhdp->phy and double-disable mhdp->clk?
cdns_mhdp_probe() enables mhdp->clk with devm_clk_get_enabled() and calls phy_init(mhdp->phy), and cdns_mhdp_remove() unconditionally calls phy_exit(mhdp->phy) before devres disables and unprepares mhdp->clk. When cdns_mhdp_resume() fails, mhdp->phy and mhdp->clk are left torn down, so unbinding the driver underflows phy->init_count and triggers clk framework WARN_ON splats.
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_hpd_work(struct work_struct *work) · line 2374
Quoted 8 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +8
-0+ +static int cdns_mhdp_suspend (struct device *dev) +{ +struct cdns_mhdp_device *mhdp =dev_get_drvdata (dev); +unsigned long timeout =msecs_to_jiffies (100 ); +int ret; + +cancel_work_sync (&mhdp->hpd_work);
[Severity: High]
Can an HPD interrupt fire after cancel_work_sync(&mhdp->hpd_work) and access mhdp->regs after mhdp->clk is disabled?
cdns_mhdp_suspend() runs in .suspend_late while device IRQs are still enabled, and it never masks CDNS_APB_INT_MASK. Because cdns_mhdp_irq_handler() only checks mhdp->bridge_attached before scheduling mhdp->hpd_work, an HPD interrupt after cancel_work_sync() re-queues the work while suspend proceeds to disable the clock:
CPU0 CPU1cdns_mhdp_suspend()
cancel_work_sync(&mhdp->hpd_work)
cdns_mhdp_irq_handler()
schedule_work(&mhdp->hpd_work) ...
clk_disable_unprepare(mhdp->clk)
cdns_mhdp_hpd_work()
cdns_mhdp_update_link_status()
<-- unclocked MMIO/mailbox access
Masking CDNS_APB_INT_MASK (or calling cdns_mhdp_bridge_hpd_disable()) and synchronizing with the IRQ before cancelling mhdp->hpd_work would prevent it from being re-queued.
Quoted 18 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +18
-0+ + ret =wait_event_timeout (mhdp->fw_load_wq, + mhdp->hw_state ==MHDP_HW_READY , + timeout); +if (ret ==0 ) { +dev_err (mhdp->dev,"%s: Timeout waiting for fw loading\n" , __func__); +return -ETIMEDOUT ; + } + +spin_lock (&mhdp->start_lock); + mhdp->hw_state =MHDP_HW_STOPPED ; +spin_unlock (&mhdp->start_lock); + + ret =cdns_mhdp_set_firmware_active (mhdp, false); +if (ret) { +dev_err (mhdp->dev,"Failed to stop firmware (%pe)\n" ,ERR_PTR (ret)); +spin_lock (&mhdp->start_lock); + mhdp->hw_state =MHDP_HW_READY ;
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static void cdns_mhdp_hpd_work(struct work_struct *work) · line 2402
Quoted 10 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +10
-0+spin_unlock (&mhdp->start_lock); +return ret; + } + +phy_power_off (mhdp->phy); +phy_exit (mhdp->phy); +clk_disable_unprepare (mhdp->clk); + +return 0 ; +}
[Severity: High]
Are phy_power_off() here and phy_power_on() in cdns_mhdp_resume() balanced with cdns_mhdp_probe()?
cdns_mhdp_probe() only calls phy_init(mhdp->phy) and never calls phy_power_on(mhdp->phy) (phy_power_on() is only called in cdns_mhdp_connector_enable() / cdns_mhdp_atomic_enable() and balanced in the corresponding disable hooks). When the bridge is not actively enabled, mhdp->phy->power_count is 0, so calling phy_power_off() here underflows power_count to -1, performs an unbalanced runtime PM put and regulator disable on the PHY, and causes both phy_power_off() and the subsequent phy_power_on() in cdns_mhdp_resume() to skip the PHY driver's callbacks.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Abhash,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v7.4-rc4 next-20261125] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Abhash-Kumar-Jha/drm-bridge-cdns-mhdp8546-Add-suspend-resume-support-to-the-bridge-driver/20261126-113532 base: https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next patch link: https://lore.kernel.org/r/20261126060532.2379444-1-a-kumar2%40ti.com patch subject: [PATCH v4] drm/bridge: cdns-mhdp8546: Add suspend resume support to the bridge driver config: csky-randconfig-1001-20261126 (https://download.01.org/0day-ci/archive/20261126/[email protected]/config) compiler: csky-linux-gcc (GCC) 14.4.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261126/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c: In function 'cdns_mhdp_resume':
>> drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c:2322:26: error: 'struct cdns_mhdp_device' has no member named 'no_hpd'
2322 | if (!mhdp->no_hpd)
| ^~vim +2322 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
2259
2260 static int cdns_mhdp_resume(struct device *dev)
2261 {
2262 struct cdns_mhdp_device *mhdp = dev_get_drvdata(dev);
2263 unsigned int keep_alive, keep_alive_inc;
2264 unsigned long rate;
2265 int ret;
2266
2267 ret = clk_prepare_enable(mhdp->clk);
2268 if (ret)
2269 return ret;
2270
2271 rate = clk_get_rate(mhdp->clk);
2272 writel(rate % 1000000, mhdp->regs + CDNS_SW_CLK_L);
2273 writel(rate / 1000000, mhdp->regs + CDNS_SW_CLK_H);
2274 writel(~0, mhdp->regs + CDNS_APB_INT_MASK);
2275
2276 ret = phy_init(mhdp->phy);
2277 if (ret) {
2278 dev_err(mhdp->dev, "Failed to initialize PHY: %d\n", ret);
2279 goto disable_clk;
2280 }
2281 ret = phy_power_on(mhdp->phy);
2282 if (ret < 0) {
2283 dev_err(mhdp->dev, "Failed to power on PHY: %d\n", ret);
2284 goto phy_exit;
2285 }
2286
2287 /*
2288 * The KEEP_ALIVE register is incremented at every scheduler loop of the
2289 * firmware. If it changes between reads, the firmware is still running
2290 * (e.g. the suspend was aborted) and only needs to be activated. If it
2291 * does not change, the bridge lost power and the firmware must be loaded
2292 * again.
2293 */
2294 keep_alive = readl(mhdp->regs + CDNS_KEEP_ALIVE) & CDNS_KEEP_ALIVE_MASK;
2295 ret = readl_poll_timeout(mhdp->regs + CDNS_KEEP_ALIVE, keep_alive_inc,
2296 (keep_alive_inc & CDNS_KEEP_ALIVE_MASK) != keep_alive,
2297 2000, 2 * CDNS_KEEP_ALIVE_TIMEOUT);
2298 if (ret) {
2299 ret = cdns_mhdp_load_firmware(mhdp);
2300 if (ret)
2301 goto phy_off;
2302
2303 ret = wait_event_timeout(mhdp->fw_load_wq,
2304 mhdp->hw_state == MHDP_HW_READY,
2305 msecs_to_jiffies(1000));
2306 if (ret == 0) {
2307 dev_err(mhdp->dev, "%s: Timeout waiting for fw loading\n",
2308 __func__);
2309 ret = -ETIMEDOUT;
2310 goto phy_off;
2311 }
2312 } else {
2313 ret = cdns_mhdp_set_firmware_active(mhdp, true);
2314 if (ret) {
2315 dev_err(mhdp->dev, "Failed to activate firmware (%pe)\n",
2316 ERR_PTR(ret));
2317 goto phy_off;
2318 }
2319
2320 spin_lock(&mhdp->start_lock);
2321 mhdp->hw_state = MHDP_HW_READY;
> 2322 if (!mhdp->no_hpd)
2323 cdns_mhdp_bridge_hpd_enable(&mhdp->bridge);
2324 spin_unlock(&mhdp->start_lock);
2325 }
2326
2327 return 0;
2328
2329 phy_off:
2330 phy_power_off(mhdp->phy);
2331 phy_exit:
2332 phy_exit(mhdp->phy);
2333 disable_clk:
2334 clk_disable_unprepare(mhdp->clk);
2335
2336 return ret;
2337 }
2338
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Abhash,
kernel test robot noticed the following build errors:
[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v7.4-rc4 next-20261125] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Abhash-Kumar-Jha/drm-bridge-cdns-mhdp8546-Add-suspend-resume-support-to-the-bridge-driver/20261126-113532 base: https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next patch link: https://lore.kernel.org/r/20261126060532.2379444-1-a-kumar2%40ti.com patch subject: [PATCH v4] drm/bridge: cdns-mhdp8546: Add suspend resume support to the bridge driver config: x86_64-buildonly-randconfig-1005-20261126 (https://download.01.org/0day-ci/archive/20261127/[email protected]/config) compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261127/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c:2322:14: error: no member named 'no_hpd' in 'struct cdns_mhdp_device'
2322 | if (!mhdp->no_hpd)
| ~~~~ ^
1 error generated.
vim +2322 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
2259
2260 static int cdns_mhdp_resume(struct device *dev)
2261 {
2262 struct cdns_mhdp_device *mhdp = dev_get_drvdata(dev);
2263 unsigned int keep_alive, keep_alive_inc;
2264 unsigned long rate;
2265 int ret;
2266
2267 ret = clk_prepare_enable(mhdp->clk);
2268 if (ret)
2269 return ret;
2270
2271 rate = clk_get_rate(mhdp->clk);
2272 writel(rate % 1000000, mhdp->regs + CDNS_SW_CLK_L);
2273 writel(rate / 1000000, mhdp->regs + CDNS_SW_CLK_H);
2274 writel(~0, mhdp->regs + CDNS_APB_INT_MASK);
2275
2276 ret = phy_init(mhdp->phy);
2277 if (ret) {
2278 dev_err(mhdp->dev, "Failed to initialize PHY: %d\n", ret);
2279 goto disable_clk;
2280 }
2281 ret = phy_power_on(mhdp->phy);
2282 if (ret < 0) {
2283 dev_err(mhdp->dev, "Failed to power on PHY: %d\n", ret);
2284 goto phy_exit;
2285 }
2286
2287 /*
2288 * The KEEP_ALIVE register is incremented at every scheduler loop of the
2289 * firmware. If it changes between reads, the firmware is still running
2290 * (e.g. the suspend was aborted) and only needs to be activated. If it
2291 * does not change, the bridge lost power and the firmware must be loaded
2292 * again.
2293 */
2294 keep_alive = readl(mhdp->regs + CDNS_KEEP_ALIVE) & CDNS_KEEP_ALIVE_MASK;
2295 ret = readl_poll_timeout(mhdp->regs + CDNS_KEEP_ALIVE, keep_alive_inc,
2296 (keep_alive_inc & CDNS_KEEP_ALIVE_MASK) != keep_alive,
2297 2000, 2 * CDNS_KEEP_ALIVE_TIMEOUT);
2298 if (ret) {
2299 ret = cdns_mhdp_load_firmware(mhdp);
2300 if (ret)
2301 goto phy_off;
2302
2303 ret = wait_event_timeout(mhdp->fw_load_wq,
2304 mhdp->hw_state == MHDP_HW_READY,
2305 msecs_to_jiffies(1000));
2306 if (ret == 0) {
2307 dev_err(mhdp->dev, "%s: Timeout waiting for fw loading\n",
2308 __func__);
2309 ret = -ETIMEDOUT;
2310 goto phy_off;
2311 }
2312 } else {
2313 ret = cdns_mhdp_set_firmware_active(mhdp, true);
2314 if (ret) {
2315 dev_err(mhdp->dev, "Failed to activate firmware (%pe)\n",
2316 ERR_PTR(ret));
2317 goto phy_off;
2318 }
2319
2320 spin_lock(&mhdp->start_lock);
2321 mhdp->hw_state = MHDP_HW_READY;
> 2322 if (!mhdp->no_hpd)
2323 cdns_mhdp_bridge_hpd_enable(&mhdp->bridge);
2324 spin_unlock(&mhdp->start_lock);
2325 }
2326
2327 return 0;
2328
2329 phy_off:
2330 phy_power_off(mhdp->phy);
2331 phy_exit:
2332 phy_exit(mhdp->phy);
2333 disable_clk:
2334 clk_disable_unprepare(mhdp->clk);
2335
2336 return ret;
2337 }
2338
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki