[PATCH drm-dp 09/10] drm/hisilicon/hibmc: fix HPD no showing with VGA para of GRUB

Yongbang Shi posted 10 patches 6 months, 3 weeks ago
There is a newer version of this series
[PATCH drm-dp 09/10] drm/hisilicon/hibmc: fix HPD no showing with VGA para of GRUB
Posted by Yongbang Shi 6 months, 3 weeks ago
From: Baihan Li <libaihan@huawei.com>

In early OS versions, there is a bug in hibmc-drm driver previously,
so some OS add a VGA parameter in GRUB(video=VGA-1:640x480-32@60me) to
fix the bug, that will config a force VGA mode to drm driver. However, the
HPD problem exists that mentioned in previous patch, so change VGA's status
in force() to compatible with some older OS versions.

Fixes: f9698f802e50 ("drm/hisilicon/hibmc: Restructuring the header dp_reg.h")
Signed-off-by: Baihan Li <libaihan@huawei.com>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
index 73dd3d5fc26c..d609ccda2f2a 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
@@ -61,6 +61,19 @@ static int hibmc_vdac_detect(struct drm_connector *connector, struct drm_modeset
 	return connector_status_connected;
 }
 
+static void hibmc_vdac_force(struct drm_connector *connector)
+{
+	struct hibmc_drm_private *priv = to_hibmc_drm_private(connector->dev);
+	struct hibmc_dp *dp = &priv->dp;
+
+	if (dp->hpd_status) {
+		connector->status = connector_status_disconnected;
+		return;
+	}
+
+	connector->status = connector_status_connected;
+}
+
 static void hibmc_connector_destroy(struct drm_connector *connector)
 {
 	struct hibmc_vdac *vdac = to_hibmc_vdac(connector);
@@ -81,6 +94,7 @@ static const struct drm_connector_funcs hibmc_connector_funcs = {
 	.reset = drm_atomic_helper_connector_reset,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
+	.force = hibmc_vdac_force,
 };
 
 static void hibmc_encoder_mode_set(struct drm_encoder *encoder,
-- 
2.33.0

Re: [PATCH drm-dp 09/10] drm/hisilicon/hibmc: fix HPD no showing with VGA para of GRUB
Posted by Dmitry Baryshkov 6 months, 1 week ago
On Fri, May 30, 2025 at 05:54:31PM +0800, Yongbang Shi wrote:
> From: Baihan Li <libaihan@huawei.com>
> 
> In early OS versions, there is a bug in hibmc-drm driver previously,

Which OS? What does that mean? Why do we need to workaround userspace
issues in the kernel?

> so some OS add a VGA parameter in GRUB(video=VGA-1:640x480-32@60me) to
> fix the bug, that will config a force VGA mode to drm driver. However, the
> HPD problem exists that mentioned in previous patch, so change VGA's status
> in force() to compatible with some older OS versions.
> 
> Fixes: f9698f802e50 ("drm/hisilicon/hibmc: Restructuring the header dp_reg.h")
> Signed-off-by: Baihan Li <libaihan@huawei.com>
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> index 73dd3d5fc26c..d609ccda2f2a 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> @@ -61,6 +61,19 @@ static int hibmc_vdac_detect(struct drm_connector *connector, struct drm_modeset
>  	return connector_status_connected;
>  }
>  
> +static void hibmc_vdac_force(struct drm_connector *connector)
> +{
> +	struct hibmc_drm_private *priv = to_hibmc_drm_private(connector->dev);
> +	struct hibmc_dp *dp = &priv->dp;
> +
> +	if (dp->hpd_status) {
> +		connector->status = connector_status_disconnected;
> +		return;
> +	}
> +
> +	connector->status = connector_status_connected;

You are again trying to tie VGA and DP status, so NAK.

> +}
> +
>  static void hibmc_connector_destroy(struct drm_connector *connector)
>  {
>  	struct hibmc_vdac *vdac = to_hibmc_vdac(connector);
> @@ -81,6 +94,7 @@ static const struct drm_connector_funcs hibmc_connector_funcs = {
>  	.reset = drm_atomic_helper_connector_reset,
>  	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
>  	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> +	.force = hibmc_vdac_force,
>  };
>  
>  static void hibmc_encoder_mode_set(struct drm_encoder *encoder,
> -- 
> 2.33.0
> 

-- 
With best wishes
Dmitry
Re: [PATCH drm-dp 09/10] drm/hisilicon/hibmc: fix HPD no showing with VGA para of GRUB
Posted by Yongbang Shi 6 months, 1 week ago
> On Fri, May 30, 2025 at 05:54:31PM +0800, Yongbang Shi wrote:
>> From: Baihan Li <libaihan@huawei.com>
>>
>> In early OS versions, there is a bug in hibmc-drm driver previously,
> Which OS? What does that mean? Why do we need to workaround userspace
> issues in the kernel?

We use OpenEuler 22.03, there is a VGA cfg(video=VGA-1:640x480-32@60me) in GRUB args.
If it exists, it will affect DP HPD.


>> so some OS add a VGA parameter in GRUB(video=VGA-1:640x480-32@60me) to
>> fix the bug, that will config a force VGA mode to drm driver. However, the
>> HPD problem exists that mentioned in previous patch, so change VGA's status
>> in force() to compatible with some older OS versions.
>>
>> Fixes: f9698f802e50 ("drm/hisilicon/hibmc: Restructuring the header dp_reg.h")
>> Signed-off-by: Baihan Li <libaihan@huawei.com>
>> ---
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> index 73dd3d5fc26c..d609ccda2f2a 100644
>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> @@ -61,6 +61,19 @@ static int hibmc_vdac_detect(struct drm_connector *connector, struct drm_modeset
>>   	return connector_status_connected;
>>   }
>>   
>> +static void hibmc_vdac_force(struct drm_connector *connector)
>> +{
>> +	struct hibmc_drm_private *priv = to_hibmc_drm_private(connector->dev);
>> +	struct hibmc_dp *dp = &priv->dp;
>> +
>> +	if (dp->hpd_status) {
>> +		connector->status = connector_status_disconnected;
>> +		return;
>> +	}
>> +
>> +	connector->status = connector_status_connected;
> You are again trying to tie VGA and DP status, so NAK.
>
>> +}
>> +
>>   static void hibmc_connector_destroy(struct drm_connector *connector)
>>   {
>>   	struct hibmc_vdac *vdac = to_hibmc_vdac(connector);
>> @@ -81,6 +94,7 @@ static const struct drm_connector_funcs hibmc_connector_funcs = {
>>   	.reset = drm_atomic_helper_connector_reset,
>>   	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
>>   	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>> +	.force = hibmc_vdac_force,
>>   };
>>   
>>   static void hibmc_encoder_mode_set(struct drm_encoder *encoder,
>> -- 
>> 2.33.0
>>