Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/loongson: skipped CRTC and encoder hardware reset in lsdc_create_device() --
commit 8beeb01686f101cdce0b7603e2b5e7c72cefba29 Author: Maxime Ripard <[email protected]> drm/loongson: Switch to drm_mode_config_create_initial_state This commit replaces drm_mode_config_reset() with drm_mode_config_create_initial_state() during device creation in lsdc_create_device(). > diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c > b/drivers/gpu/drm/loongson/lsdc_drv.c > index 5a13df31eb902..fbb2658acce40 100644 > --- a/drivers/gpu/drm/loongson/lsdc_drv.c > +++ b/drivers/gpu/drm/loongson/lsdc_drv.c > @@ -247,7 +247,9 @@ lsdc_create_device(struct pci_dev *pdev, > if (ret) > return ERR_PTR(ret); > > - drm_mode_config_reset(ddev); > + ret = drm_mode_config_create_initial_state(ddev); > + if (ret) > + return ERR_PTR(ret); > > return ldev; > } [Severity: High] Does replacing drm_mode_config_reset() with drm_mode_config_create_initial_state() skip hardware initialization that this driver relies on during probe? Unlike drm_mode_config_reset(), drm_mode_config_create_initial_state() does not call crtc->helper_private->hw_reset() or encoder->funcs->reset(): drivers/gpu/drm/loongson/lsdc_output_7a2000.c:ls7a2000_hdmi0_encoder_reset() { ... val = PHY_CLOCK_POL | PHY_CLOCK_EN | PHY_DATA_EN; lsdc_wreg32(ldev, LSDC_CRTC0_DVO_CONF_REG, val); /* using software gpio emulated i2c */ val = lsdc_rreg32(ldev, LSDC_HDMI0_INTF_CTRL_REG); val &= ~HW_I2C_EN; lsdc_wreg32(ldev, LSDC_HDMI0_INTF_CTRL_REG, val); /* help the hdmi phy to get out of reset state */ lsdc_wreg32(ldev, LSDC_HDMI0_PHY_CTRL_REG, HDMI_PHY_RESET_N); ... } On both LS7A1000 and LS7A2000, the encoder reset callbacks are the only places in the driver that program LSDC_CRTC0_DVO_CONF_REG and LSDC_CRTC1_DVO_CONF_REG. On LS7A2000, skipping encoder reset also leaves the HDMI PHY in reset and HW_I2C_EN set, breaking software GPIO I2C for connector detection and EDID reads before an atomic enable runs. In addition, skipping lsdc_crtc_hw_reset() leaves LSDC_CRTC0_CFG_REG and LSDC_CRTC1_CFG_REG with firmware settings across read-modify-write modeset updates instead of initializing them to CFG_RESET_N | LSDC_PF_XRGB8888. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=17
