From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C2081F2361 for ; Thu, 12 Jun 2025 06:25:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749709522; cv=none; b=Z6fhKnFZwILWFkf5/aH3F78f5rcn9Lim57diJx9yYDNblBpZmJoVrU9E2IOaY5JIBXuNknburrZi21ewIMkXs2t1CXLPI2A+RyKjVYQm195ipWAzlpWdH4Xu5xiIPb6ENQ2xTIHfB2ZE2Xc1qknYZi7JnpbE1NF0j18Xbc1KnEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749709522; c=relaxed/simple; bh=PQJmkAhs0+DDg7gFAm77VALi+Wci8r3f7bubmERM/Cw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hyoaaIRvMVslCrjUTF3Nra4rpiSO+vG+OghKpOEV/hHFXRjTw6rGwJGgoUfo4c2Hk+ZyI/dc3Z0cngTFbSbNhSNm/eslWzpeL+zG8UiDVZIfsuciTQjPbYuzJVWEOfzNSbSs3O9qLTOmSg81vI/w13eq60BUNSOD7ryXbyqHdLU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=LTJXCfri; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LTJXCfri" Received: from [192.168.88.20] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A1356250; Thu, 12 Jun 2025 08:25:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1749709507; bh=PQJmkAhs0+DDg7gFAm77VALi+Wci8r3f7bubmERM/Cw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=LTJXCfricRXIlEF8YOcswAGTZtVyZQ5Tz7V9lpK3znd2tpiQ+/vcJWX5nL7/du5EL /FpK0K3XQHLr5Rq26E1XrlHi8eyFUpOTe02lffk52uRtBMOsqEqSKdcr5fCzcK4KBX Dv7oGw7R43w7Ny0gwvn4pJLpw9iS5PWNlO6E5RG0= Message-ID: <9cd2f481-07e4-4c1e-9daa-aceeec47f871@ideasonboard.com> Date: Thu, 12 Jun 2025 09:25:12 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] drm/bridge: ti-sn65dsi86: Add HPD for DisplayPort connector type To: Jayesh Choudhary Cc: jonas@kwiboo.se, jernej.skrabec@gmail.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, kieran.bingham+renesas@ideasonboard.com, linux-kernel@vger.kernel.org, max.oss.09@gmail.com, devarsht@ti.com, geert@linux-m68k.org, dianders@chromium.org, andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, dri-devel@lists.freedesktop.org, max.krummenacher@toradex.com, ernestvanhoecke@gmail.com References: <20250611052947.5776-1-j-choudhary@ti.com> Content-Language: en-US From: Tomi Valkeinen Aut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mV3lq0aFdwbaX16DG22c6flkkBSjyWXYepFtHz9KsBS0DaZb 4IkLmZwEXpZcIOQjQ71fqlpiXkXSIaQ6YMEs8WjBbpP81h7QxWIfWtp+VnwNGc6nq5IQDESH mvQcsFS7d3eGVI6eyjCFdcAO8eMAEQEAAcLBXwQYAQIACQUCTqazRwIbDAAKCRD6PaqMvJYe 9fA7EACS6exUedsBKmt4pT7nqXBcRsqm6YzT6DeCM8PWMTeaVGHiR4TnNFiT3otD5UpYQI7S suYxoTdHrrrBzdlKe5rUWpzoZkVK6p0s9OIvGzLT0lrb0HC9iNDWT3JgpYDnk4Z2mFi6tTbq xKMtpVFRA6FjviGDRsfkfoURZI51nf2RSAk/A8BEDDZ7lgJHskYoklSpwyrXhkp9FHGMaYII m9EKuUTX9JPDG2FTthCBrdsgWYPdJQvM+zscq09vFMQ9Fykbx5N8z/oFEUy3ACyPqW2oyfvU CH5WDpWBG0s5BALp1gBJPytIAd/pY/5ZdNoi0Cx3+Z7jaBFEyYJdWy1hGddpkgnMjyOfLI7B CFrdecTZbR5upjNSDvQ7RG85SnpYJTIin+SAUazAeA2nS6gTZzumgtdw8XmVXZwdBfF+ICof 92UkbYcYNbzWO/GHgsNT1WnM4sa9lwCSWH8Fw1o/3bX1VVPEsnESOfxkNdu+gAF5S6+I6n3a ueeIlwJl5CpT5l8RpoZXEOVtXYn8zzOJ7oGZYINRV9Pf8qKGLf3Dft7zKBP832I3PQjeok7F yjt+9S+KgSFSHP3Pa4E7lsSdWhSlHYNdG/czhoUkSCN09C0rEK93wxACx3vtxPLjXu6RptBw 3dRq7n+mQChEB1am0BueV1JZaBboIL0AGlSJkm23kw== In-Reply-To: <20250611052947.5776-1-j-choudhary@ti.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi, On 11/06/2025 08:29, Jayesh Choudhary wrote: > By default, HPD was disabled on SN65DSI86 bridge. When the driver was > added (commit "a095f15c00e27"), the HPD_DISABLE bit was set in pre-enable > call which was moved to other function calls subsequently. > Later on, commit "c312b0df3b13" added detect utility for DP mode. But with > HPD_DISABLE bit set, all the HPD events are disabled[0] and the debounced > state always return 1 (always connected state). > > Set HPD_DISABLE bit conditionally based on connector type. > Since the HPD_STATE is reflected correctly only after waiting for debounce > time (~100-400ms) and adding this delay in detect() is not feasible > owing to the performace impact (glitches and frame drop), remove runtime > calls in detect() and add hpd_enable()/disable() bridge hooks with runtime > calls, to detect hpd properly without any delay. > > [0]: (Pg. 32) > > Fixes: c312b0df3b13 ("drm/bridge: ti-sn65dsi86: Implement bridge connector operations for DP") > Cc: Max Krummenacher > Signed-off-by: Jayesh Choudhary > --- > > Changelog v3->v4: > - Remove "no-hpd" support due to backward compatibility issues > - Change the conditional from "no-hpd" back to connector type > but still address [1] > > v3 patch link: > > > Changelog v2->v3: > - Change conditional based on no-hpd property to address [1] > - Remove runtime calls in detect() with appropriate comments > - Add hpd_enable() and hpd_disable() in drm_bridge_funcs > > v2 patch link: > > > Changelog v1->v2: > - Drop additional property in bindings and use conditional. > - Instead of register read for HPD state, use dpcd read which returns 0 > for success and error codes for no connection > - Add relevant history for the required change in commit message > - Drop RFC subject-prefix in v2 > - Add "Cc:" tag > > v1 patch link: > > > [1]: > > drivers/gpu/drm/bridge/ti-sn65dsi86.c | 49 ++++++++++++++++++++++----- > 1 file changed, 41 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c > index 60224f476e1d..b674a1aa1a37 100644 > --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c > +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c > @@ -348,12 +348,20 @@ static void ti_sn65dsi86_enable_comms(struct ti_sn65dsi86 *pdata, > * 200 ms. We'll assume that the panel driver will have the hardcoded > * delay in its prepare and always disable HPD. > * > - * If HPD somehow makes sense on some future panel we'll have to > - * change this to be conditional on someone specifying that HPD should > - * be used. > + * For DisplayPort connector type, now that HPD makes sense and is This comment also is written like a commit description ("now that HPD makes sense"). > + * required, use the connector type to conditionally disable HPD. > + * > + * NOTE: The bridge type is set in auxiliary_bridge probe but > + * enable_comms() can be called before. So for DisplayPort, > + * HPD will be enabled once bridge type is set. > + * "no-hpd" property is not used properly in devicetree description > + * and hence is unreliable. Therefore HPD is being enabled using > + * this conditional. > */ > - regmap_update_bits(pdata->regmap, SN_HPD_DISABLE_REG, HPD_DISABLE, > - HPD_DISABLE); > + > + if (pdata->bridge.type != DRM_MODE_CONNECTOR_DisplayPort) > + regmap_update_bits(pdata->regmap, SN_HPD_DISABLE_REG, HPD_DISABLE, > + HPD_DISABLE); > > pdata->comms_enabled = true; > > @@ -1195,9 +1203,17 @@ static enum drm_connector_status ti_sn_bridge_detect(struct drm_bridge *bridge) > struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge); > int val = 0; > > - pm_runtime_get_sync(pdata->dev); > + /* > + * The chip won't report HPD right after being powered on as > + * HPD_DEBOUNCED_STATE reflects correct state only after the > + * debounce time (~100-400 ms). > + * So having pm_runtime_get_sync() and immediately reading > + * the register in detect() won't work, and adding delay() > + * in detect will have performace impact in display. > + * So remove runtime calls here. > + */ > + As Doug mentioned, the style here is more like a commit message. But also, in my opinion, it would make more sense to have the comment in hpd_enable() rather than having it here, mentioning that the chip needs to be powered to have a reliable HPD due to the long debounce time. > regmap_read(pdata->regmap, SN_HPD_DISABLE_REG, &val); > - pm_runtime_put_autosuspend(pdata->dev); > > return val & HPD_DEBOUNCED_STATE ? connector_status_connected > : connector_status_disconnected; > @@ -1220,6 +1236,20 @@ static void ti_sn65dsi86_debugfs_init(struct drm_bridge *bridge, struct dentry * > debugfs_create_file("status", 0600, debugfs, pdata, &status_fops); > } > > +static void ti_sn_bridge_hpd_enable(struct drm_bridge *bridge) > +{ > + struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge); > + > + pm_runtime_get_sync(pdata->dev); > +} > + > +static void ti_sn_bridge_hpd_disable(struct drm_bridge *bridge) > +{ > + struct ti_sn65dsi86 *pdata = bridge_to_ti_sn65dsi86(bridge); > + > + pm_runtime_put_sync(pdata->dev); No need for _sync, afaics. Why not pm_runtime_put_autosuspend()? Tomi > +} > + > static const struct drm_bridge_funcs ti_sn_bridge_funcs = { > .attach = ti_sn_bridge_attach, > .detach = ti_sn_bridge_detach, > @@ -1234,6 +1264,8 @@ static const struct drm_bridge_funcs ti_sn_bridge_funcs = { > .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, > .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, > .debugfs_init = ti_sn65dsi86_debugfs_init, > + .hpd_enable = ti_sn_bridge_hpd_enable, > + .hpd_disable = ti_sn_bridge_hpd_disable, > }; > > static void ti_sn_bridge_parse_lanes(struct ti_sn65dsi86 *pdata, > @@ -1322,7 +1354,8 @@ static int ti_sn_bridge_probe(struct auxiliary_device *adev, > ? DRM_MODE_CONNECTOR_DisplayPort : DRM_MODE_CONNECTOR_eDP; > > if (pdata->bridge.type == DRM_MODE_CONNECTOR_DisplayPort) > - pdata->bridge.ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT; > + pdata->bridge.ops = DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_DETECT | > + DRM_BRIDGE_OP_HPD; > > drm_bridge_add(&pdata->bridge); >