diff mbox series

[v2] drm/ast: Fix ast_dp connection status

Message ID 20250124141142.2434138-1-jfalempe@redhat.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm/ast: Fix ast_dp connection status | expand

Commit Message

Jocelyn Falempe Jan. 24, 2025, 2:11 p.m. UTC
ast_dp_is_connected() used to also check for link training success
to report the DP connector as connected. Without this check, the
physical_status is always connected. So if no monitor is present, it
will fail to read the EDID and set the default resolution to 640x480
instead of 1024x768.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Fixes: 2281475168d2 ("drm/ast: astdp: Perform link training during atomic_enable")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Dave Airlie <airlied@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v6.12+
---
 drivers/gpu/drm/ast/ast_dp.c | 6 ++++++
 1 file changed, 6 insertions(+)


base-commit: 798047e63ac970f105c49c22e6d44df901c486b2

Comments

Thomas Zimmermann Jan. 27, 2025, 11:55 a.m. UTC | #1
Hi


Am 24.01.25 um 15:11 schrieb Jocelyn Falempe:
> ast_dp_is_connected() used to also check for link training success
> to report the DP connector as connected. Without this check, the
> physical_status is always connected. So if no monitor is present, it
> will fail to read the EDID and set the default resolution to 640x480
> instead of 1024x768.
>
> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
> Fixes: 2281475168d2 ("drm/ast: astdp: Perform link training during atomic_enable")
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: dri-devel@lists.freedesktop.org
> Cc: <stable@vger.kernel.org> # v6.12+

I cannot reproduce the problem, but the patch looks correct. My AST2600 
with ASTDP still works correctly with the patch allied.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regards
Thomas

> ---
>   drivers/gpu/drm/ast/ast_dp.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/ast/ast_dp.c b/drivers/gpu/drm/ast/ast_dp.c
> index 0e282b7b167c..30aad5c0112a 100644
> --- a/drivers/gpu/drm/ast/ast_dp.c
> +++ b/drivers/gpu/drm/ast/ast_dp.c
> @@ -17,6 +17,12 @@ static bool ast_astdp_is_connected(struct ast_device *ast)
>   {
>   	if (!ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xDF, AST_IO_VGACRDF_HPD))
>   		return false;
> +	/*
> +	 * HPD might be set even if no monitor is connected, so also check that
> +	 * the link training was successful.
> +	 */
> +	if (!ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xDC, AST_IO_VGACRDC_LINK_SUCCESS))
> +		return false;
>   	return true;
>   }
>   
>
> base-commit: 798047e63ac970f105c49c22e6d44df901c486b2
Jocelyn Falempe Jan. 27, 2025, 12:52 p.m. UTC | #2
On 27/01/2025 12:55, Thomas Zimmermann wrote:
> Hi
> 
> 
> Am 24.01.25 um 15:11 schrieb Jocelyn Falempe:
>> ast_dp_is_connected() used to also check for link training success
>> to report the DP connector as connected. Without this check, the
>> physical_status is always connected. So if no monitor is present, it
>> will fail to read the EDID and set the default resolution to 640x480
>> instead of 1024x768.
>>
>> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
>> Fixes: 2281475168d2 ("drm/ast: astdp: Perform link training during 
>> atomic_enable")
>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: Dave Airlie <airlied@redhat.com>
>> Cc: dri-devel@lists.freedesktop.org
>> Cc: <stable@vger.kernel.org> # v6.12+
> 
> I cannot reproduce the problem, but the patch looks correct. My AST2600 
> with ASTDP still works correctly with the patch allied.

Thanks, interesting that it doesn't affect all hardwares.
I got reports from two different vendors about this issue.

If no other comments, I will push it to drm-misc-next tomorrow (only 
adding reported-by: and tested-by: tags).
Jocelyn Falempe Jan. 29, 2025, 10:10 a.m. UTC | #3
On 27/01/2025 13:52, Jocelyn Falempe wrote:
> 
> Thanks, interesting that it doesn't affect all hardwares.
> I got reports from two different vendors about this issue.
> 
> If no other comments, I will push it to drm-misc-next tomorrow (only 
> adding reported-by: and tested-by: tags).
> 

I just pushed it to drm-misc-next.

Thanks
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ast/ast_dp.c b/drivers/gpu/drm/ast/ast_dp.c
index 0e282b7b167c..30aad5c0112a 100644
--- a/drivers/gpu/drm/ast/ast_dp.c
+++ b/drivers/gpu/drm/ast/ast_dp.c
@@ -17,6 +17,12 @@  static bool ast_astdp_is_connected(struct ast_device *ast)
 {
 	if (!ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xDF, AST_IO_VGACRDF_HPD))
 		return false;
+	/*
+	 * HPD might be set even if no monitor is connected, so also check that
+	 * the link training was successful.
+	 */
+	if (!ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xDC, AST_IO_VGACRDC_LINK_SUCCESS))
+		return false;
 	return true;
 }