public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Javier Martinez Canillas <javierm@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	David Airlie <airlied@gmail.com>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Phong LE <ple@baylibre.com>, Robert Foss <rfoss@kernel.org>,
	Simona Vetter <simona@ffwll.ch>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 1/2] drm/bridge: ite-it66121: Set TX mode in the .atomic_enable callback
Date: Wed, 13 May 2026 13:55:57 +0200	[thread overview]
Message-ID: <20260513-huge-mongoose-of-wealth-464fac@houat> (raw)
In-Reply-To: <87tsscxxuy.fsf@ocarina.mail-host-address-is-not-set>

[-- Attachment #1: Type: text/plain, Size: 3314 bytes --]

On Tue, May 12, 2026 at 08:54:13PM +0200, Javier Martinez Canillas wrote:
> Maxime Ripard <mripard@kernel.org> writes:
> 
> Thanks again for your feedback!
> 
> > Hi,
> >
> > On Tue, May 12, 2026 at 03:22:15PM +0200, Javier Martinez Canillas wrote:
> >> The HDMI transmission mode set and AVI infoframes enable are done in the
> >> .mode_set callback, but it is more correct to do this in .atomic_enable.
> >> 
> >> Because the information about the sink type is in the struct drm_connector
> >> display_info.is_hdmi and this might not be available when the .mode_set
> >> callback is executed.
> >> 
> >> Currently the driver is not checking display info to determine whether the
> >> mode has to be set to HDMI or DVI, but this is a bug that will be fixed by
> >> a follow-up change.
> >> 
> >> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> >> ---
> >> 
> >> (no changes since v1)
> >> 
> >>  drivers/gpu/drm/bridge/ite-it66121.c | 18 ++++++++++++++++++
> >>  1 file changed, 18 insertions(+)
> >> 
> >> diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
> >> index 19a027d75b61..648ca50712df 100644
> >> --- a/drivers/gpu/drm/bridge/ite-it66121.c
> >> +++ b/drivers/gpu/drm/bridge/ite-it66121.c
> >> @@ -669,6 +669,22 @@ static int it66121_set_mute(struct it66121_ctx *ctx, bool mute)
> >>  			    IT66121_PKT_GEN_CTRL_ON | IT66121_PKT_GEN_CTRL_RPT);
> >>  }
> >>  
> >> +static void it66121_set_tx_mode(struct it66121_ctx *ctx)
> >> +{
> >> +	mutex_lock(&ctx->lock);
> >> +
> >> +	/* Enable AVI infoframe */
> >> +	if (regmap_write(ctx->regmap, IT66121_AVI_INFO_PKT_REG,
> >> +			 IT66121_AVI_INFO_PKT_ON | IT66121_AVI_INFO_PKT_RPT))
> >> +		goto unlock;
> >> +
> >> +	/* Set TX mode to HDMI */
> >> +	regmap_write(ctx->regmap, IT66121_HDMI_MODE_REG, IT66121_HDMI_MODE_HDMI);
> >> +
> >> +unlock:
> >> +	mutex_unlock(&ctx->lock);
> >> +}
> >> +
> >>  #define MAX_OUTPUT_SEL_FORMATS	1
> >>  
> >>  static u32 *it66121_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> >> @@ -729,6 +745,8 @@ static void it66121_bridge_enable(struct drm_bridge *bridge,
> >>  	ctx->connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
> >>  
> >>  	it66121_set_mute(ctx, false);
> >> +
> >> +	it66121_set_tx_mode(ctx);
> >>  }
> >
> > Having some part of it in mode_set and some part in enable is still kind
> > of weird. The best there would be to put everything in enable (and
> > pre_enable), and drop mode_set entirely.
> >
> 
> I agree that this will be the correct approach. I wonder though if could be
> acceptable to land the changes in this series as a minimal fix for the DVI
> mode issue, and then do further refactoring as a follow-up.

The thing is that you're now making the driver and its interaction with
the hardware more complex. Like, what would happen if mode_set is now
called after atomic_enable? How does the hardware behavies if you modify
the SII902X_SYS_CTRL_DATA register only after it's been enabled?

Moving everything to atomic_enable keeps things simple and keep the
hardware access ordering the same.

And if you don't plan on sending that to fixes, the fact that the patch
is small is kind of irrelevant anyway.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

  reply	other threads:[~2026-05-13 11:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 13:22 [PATCH v3 0/2] drm/bridge: it66121: Fix display output on DVI monitors Javier Martinez Canillas
2026-05-12 13:22 ` [PATCH v3 1/2] drm/bridge: ite-it66121: Set TX mode in the .atomic_enable callback Javier Martinez Canillas
2026-05-12 14:07   ` Maxime Ripard
2026-05-12 18:54     ` Javier Martinez Canillas
2026-05-13 11:55       ` Maxime Ripard [this message]
2026-05-13 12:38         ` Javier Martinez Canillas
2026-05-16  3:19   ` Claude review: " Claude Code Review Bot
2026-05-12 13:22 ` [PATCH v3 2/2] drm/bridge: ite-it66121: Select HDMI or DVI mode based on sink type Javier Martinez Canillas
2026-05-16  3:19   ` Claude review: " Claude Code Review Bot
2026-05-16  3:19 ` Claude review: drm/bridge: it66121: Fix display output on DVI monitors Claude Code Review Bot

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=20260513-huge-mongoose-of-wealth-464fac@houat \
    --to=mripard@kernel.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=neil.armstrong@linaro.org \
    --cc=ple@baylibre.com \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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