Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/tegra: rgb: inverted default pclk polarity in tegra_rgb_encoder_enable() --
commit 4442e43504544159a06f87b67bae36bb5b0f8fcf Author: Svyatoslav Ryhel <[email protected]> drm/tegra: rgb: Parameterize configuration based on bus flags and DT property This commit configures Tegra RGB pixel clock and display enable signal polarities from the bridge input bus flags and adds support for the "nvidia,contiguous-rgb-pins" device tree property. > diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c > index d48d498068ac8..c311f4e2c44bb 100644 > --- a/drivers/gpu/drm/tegra/rgb.c > +++ b/drivers/gpu/drm/tegra/rgb.c [ ... ] > @@ -106,6 +109,7 @@ static void tegra_rgb_encoder_enable(struct drm_encoder > *encoder, > struct tegra_output *output = encoder_to_output(encoder); > struct tegra_rgb *rgb = to_rgb(output); > struct drm_connector_state *conn_state; > + struct drm_bridge_state *bridge_state; > struct drm_crtc_state *crtc_state; > struct drm_connector *connector; > struct drm_display_mode *mode; > @@ -117,12 +121,20 @@ static void tegra_rgb_encoder_enable(struct drm_encoder > *encoder, > crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); > mode = &crtc_state->adjusted_mode; > > + /* Get but flags from the bridge state. */ > + bridge_state = drm_atomic_get_new_bridge_state(state, output->bridge); > + if (bridge_state) > + bus_flags = bridge_state->input_bus_cfg.flags; > + else > + bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE | > + DRM_BUS_FLAG_DE_HIGH; > + > tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); > > value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; > tegra_dc_writel(rgb->dc, value, DC_DISP_DATA_ENABLE_OPTIONS); > > - /* configure H- and V-sync signal polarities */ > + /* configure H- and V-sync and pixel clock signal polarities */ > value = tegra_dc_readl(rgb->dc, DC_COM_PIN_OUTPUT_POLARITY(1)); > > if (mode->flags & DRM_MODE_FLAG_NHSYNC) > @@ -135,11 +147,31 @@ static void tegra_rgb_encoder_enable(struct drm_encoder > *encoder, > else > value &= ~LVS_OUTPUT_POLARITY_LOW; > > + if (bus_flags & DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE) > + value |= PIN_POS(PIN_LSC0); > + else > + value &= ~PIN_POS(PIN_LSC0); [Severity: High] As reported by Mikko Perttunen on v8 [1], does this invert the default pixel clock polarity when bridge_state is present but neither DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE nor DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE is set in bridge_state->input_bus_cfg.flags? rgb_enable[] initializes DC_COM_PIN_OUTPUT_POLARITY(1) with PIN_POS(PIN_LSC0) (0x01000000) set. Because panel_bridge and bridge drivers such as lvds-codec allocate atomic bridge state, bridge_state is non-NULL, while existing Tegra panels (such as auo_b101aw03 in panel-simple.c) only set DRM_BUS_FLAG_DE_HIGH and omit pixel clock sampling flags. Taking the else branch clears PIN_POS(PIN_LSC0) and flips the pixel clock sampling edge on existing Tegra20 and Tegra30 boards. Testing for DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE to clear PIN_POS(PIN_LSC0) and setting PIN_POS(PIN_LSC0) otherwise would preserve positive-edge sampling as the default when no pixel clock sampling flag is specified. [1] https://lore.kernel.org/r/[email protected] -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=11
