diff mbox series

drm/gma500/cdv: Check vbt config bits when detecting lvds panels

Message ID 20190416114607.1072-1-patrik.r.jakobsson@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/gma500/cdv: Check vbt config bits when detecting lvds panels | expand

Commit Message

Patrik Jakobsson April 16, 2019, 11:46 a.m. UTC
Some machines have an lvds child device in vbt even though a panel is
not attached. To make detection more reliable we now also check the lvds
config bits available in the vbt.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1665766
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/gma500/cdv_intel_lvds.c | 3 +++
 drivers/gpu/drm/gma500/intel_bios.c     | 3 +++
 drivers/gpu/drm/gma500/psb_drv.h        | 1 +
 3 files changed, 7 insertions(+)

Comments

Hans de Goede April 21, 2019, 6:46 p.m. UTC | #1
Hi,

On 16-04-19 13:46, Patrik Jakobsson wrote:
> Some machines have an lvds child device in vbt even though a panel is
> not attached. To make detection more reliable we now also check the lvds
> config bits available in the vbt.
> 
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1665766
> Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

The reporter of https://bugzilla.redhat.com/show_bug.cgi?id=1665766
just got back to me and he confirms that this patch fixes the
false-positive LVDS panel detection on his NAS, without needing
a DMI blacklist.

So it looks like this patch indeed is a better fix then my initial
DMI blacklist approach and from my pov this patch is ready to
go upstream.

Regards,

Hans


> ---
>   drivers/gpu/drm/gma500/cdv_intel_lvds.c | 3 +++
>   drivers/gpu/drm/gma500/intel_bios.c     | 3 +++
>   drivers/gpu/drm/gma500/psb_drv.h        | 1 +
>   3 files changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> index de9531caaca0..9c8446184b17 100644
> --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> @@ -594,6 +594,9 @@ void cdv_intel_lvds_init(struct drm_device *dev,
>   	int pipe;
>   	u8 pin;
>   
> +	if (!dev_priv->lvds_enabled_in_vbt)
> +		return;
> +
>   	pin = GMBUS_PORT_PANEL;
>   	if (!lvds_is_present_in_vbt(dev, &pin)) {
>   		DRM_DEBUG_KMS("LVDS is not present in VBT\n");
> diff --git a/drivers/gpu/drm/gma500/intel_bios.c b/drivers/gpu/drm/gma500/intel_bios.c
> index 63bde4e86c6a..e019ea271ffc 100644
> --- a/drivers/gpu/drm/gma500/intel_bios.c
> +++ b/drivers/gpu/drm/gma500/intel_bios.c
> @@ -436,6 +436,9 @@ parse_driver_features(struct drm_psb_private *dev_priv,
>   	if (driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
>   		dev_priv->edp.support = 1;
>   
> +	dev_priv->lvds_enabled_in_vbt = driver->lvds_config != 0;
> +	DRM_DEBUG_KMS("LVDS VBT config bits: 0x%x\n", driver->lvds_config);
> +
>   	/* This bit means to use 96Mhz for DPLL_A or not */
>   	if (driver->primary_lfp_id)
>   		dev_priv->dplla_96mhz = true;
> diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
> index 941b238bdcc9..bc608ddc3bd1 100644
> --- a/drivers/gpu/drm/gma500/psb_drv.h
> +++ b/drivers/gpu/drm/gma500/psb_drv.h
> @@ -537,6 +537,7 @@ struct drm_psb_private {
>   	int lvds_ssc_freq;
>   	bool is_lvds_on;
>   	bool is_mipi_on;
> +	bool lvds_enabled_in_vbt;
>   	u32 mipi_ctrl_display;
>   
>   	unsigned int core_freq;
>
Patrik Jakobsson April 22, 2019, 5:54 p.m. UTC | #2
On Sun, Apr 21, 2019 at 8:46 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 16-04-19 13:46, Patrik Jakobsson wrote:
> > Some machines have an lvds child device in vbt even though a panel is
> > not attached. To make detection more reliable we now also check the lvds
> > config bits available in the vbt.
> >
> > Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1665766
> > Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> The reporter of https://bugzilla.redhat.com/show_bug.cgi?id=1665766
> just got back to me and he confirms that this patch fixes the
> false-positive LVDS panel detection on his NAS, without needing
> a DMI blacklist.
>
> So it looks like this patch indeed is a better fix then my initial
> DMI blacklist approach and from my pov this patch is ready to
> go upstream.

Thanks Hans, can I add your review tag?

>
> Regards,
>
> Hans
>
>
> > ---
> >   drivers/gpu/drm/gma500/cdv_intel_lvds.c | 3 +++
> >   drivers/gpu/drm/gma500/intel_bios.c     | 3 +++
> >   drivers/gpu/drm/gma500/psb_drv.h        | 1 +
> >   3 files changed, 7 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> > index de9531caaca0..9c8446184b17 100644
> > --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> > +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
> > @@ -594,6 +594,9 @@ void cdv_intel_lvds_init(struct drm_device *dev,
> >       int pipe;
> >       u8 pin;
> >
> > +     if (!dev_priv->lvds_enabled_in_vbt)
> > +             return;
> > +
> >       pin = GMBUS_PORT_PANEL;
> >       if (!lvds_is_present_in_vbt(dev, &pin)) {
> >               DRM_DEBUG_KMS("LVDS is not present in VBT\n");
> > diff --git a/drivers/gpu/drm/gma500/intel_bios.c b/drivers/gpu/drm/gma500/intel_bios.c
> > index 63bde4e86c6a..e019ea271ffc 100644
> > --- a/drivers/gpu/drm/gma500/intel_bios.c
> > +++ b/drivers/gpu/drm/gma500/intel_bios.c
> > @@ -436,6 +436,9 @@ parse_driver_features(struct drm_psb_private *dev_priv,
> >       if (driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
> >               dev_priv->edp.support = 1;
> >
> > +     dev_priv->lvds_enabled_in_vbt = driver->lvds_config != 0;
> > +     DRM_DEBUG_KMS("LVDS VBT config bits: 0x%x\n", driver->lvds_config);
> > +
> >       /* This bit means to use 96Mhz for DPLL_A or not */
> >       if (driver->primary_lfp_id)
> >               dev_priv->dplla_96mhz = true;
> > diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
> > index 941b238bdcc9..bc608ddc3bd1 100644
> > --- a/drivers/gpu/drm/gma500/psb_drv.h
> > +++ b/drivers/gpu/drm/gma500/psb_drv.h
> > @@ -537,6 +537,7 @@ struct drm_psb_private {
> >       int lvds_ssc_freq;
> >       bool is_lvds_on;
> >       bool is_mipi_on;
> > +     bool lvds_enabled_in_vbt;
> >       u32 mipi_ctrl_display;
> >
> >       unsigned int core_freq;
> >
Hans de Goede April 29, 2019, 2:44 p.m. UTC | #3
Hi,

On 22-04-19 19:54, Patrik Jakobsson wrote:
> On Sun, Apr 21, 2019 at 8:46 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi,
>>
>> On 16-04-19 13:46, Patrik Jakobsson wrote:
>>> Some machines have an lvds child device in vbt even though a panel is
>>> not attached. To make detection more reliable we now also check the lvds
>>> config bits available in the vbt.
>>>
>>> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1665766
>>> Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
>>> Cc: Hans de Goede <hdegoede@redhat.com>
>>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>
>> The reporter of https://bugzilla.redhat.com/show_bug.cgi?id=1665766
>> just got back to me and he confirms that this patch fixes the
>> false-positive LVDS panel detection on his NAS, without needing
>> a DMI blacklist.
>>
>> So it looks like this patch indeed is a better fix then my initial
>> DMI blacklist approach and from my pov this patch is ready to
>> go upstream.
> 
> Thanks Hans, can I add your review tag?

Erm, then I would need to actually review it first ... done:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


>>> ---
>>>    drivers/gpu/drm/gma500/cdv_intel_lvds.c | 3 +++
>>>    drivers/gpu/drm/gma500/intel_bios.c     | 3 +++
>>>    drivers/gpu/drm/gma500/psb_drv.h        | 1 +
>>>    3 files changed, 7 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
>>> index de9531caaca0..9c8446184b17 100644
>>> --- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
>>> +++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
>>> @@ -594,6 +594,9 @@ void cdv_intel_lvds_init(struct drm_device *dev,
>>>        int pipe;
>>>        u8 pin;
>>>
>>> +     if (!dev_priv->lvds_enabled_in_vbt)
>>> +             return;
>>> +
>>>        pin = GMBUS_PORT_PANEL;
>>>        if (!lvds_is_present_in_vbt(dev, &pin)) {
>>>                DRM_DEBUG_KMS("LVDS is not present in VBT\n");
>>> diff --git a/drivers/gpu/drm/gma500/intel_bios.c b/drivers/gpu/drm/gma500/intel_bios.c
>>> index 63bde4e86c6a..e019ea271ffc 100644
>>> --- a/drivers/gpu/drm/gma500/intel_bios.c
>>> +++ b/drivers/gpu/drm/gma500/intel_bios.c
>>> @@ -436,6 +436,9 @@ parse_driver_features(struct drm_psb_private *dev_priv,
>>>        if (driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
>>>                dev_priv->edp.support = 1;
>>>
>>> +     dev_priv->lvds_enabled_in_vbt = driver->lvds_config != 0;
>>> +     DRM_DEBUG_KMS("LVDS VBT config bits: 0x%x\n", driver->lvds_config);
>>> +
>>>        /* This bit means to use 96Mhz for DPLL_A or not */
>>>        if (driver->primary_lfp_id)
>>>                dev_priv->dplla_96mhz = true;
>>> diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
>>> index 941b238bdcc9..bc608ddc3bd1 100644
>>> --- a/drivers/gpu/drm/gma500/psb_drv.h
>>> +++ b/drivers/gpu/drm/gma500/psb_drv.h
>>> @@ -537,6 +537,7 @@ struct drm_psb_private {
>>>        int lvds_ssc_freq;
>>>        bool is_lvds_on;
>>>        bool is_mipi_on;
>>> +     bool lvds_enabled_in_vbt;
>>>        u32 mipi_ctrl_display;
>>>
>>>        unsigned int core_freq;
>>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index de9531caaca0..9c8446184b17 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -594,6 +594,9 @@  void cdv_intel_lvds_init(struct drm_device *dev,
 	int pipe;
 	u8 pin;
 
+	if (!dev_priv->lvds_enabled_in_vbt)
+		return;
+
 	pin = GMBUS_PORT_PANEL;
 	if (!lvds_is_present_in_vbt(dev, &pin)) {
 		DRM_DEBUG_KMS("LVDS is not present in VBT\n");
diff --git a/drivers/gpu/drm/gma500/intel_bios.c b/drivers/gpu/drm/gma500/intel_bios.c
index 63bde4e86c6a..e019ea271ffc 100644
--- a/drivers/gpu/drm/gma500/intel_bios.c
+++ b/drivers/gpu/drm/gma500/intel_bios.c
@@ -436,6 +436,9 @@  parse_driver_features(struct drm_psb_private *dev_priv,
 	if (driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
 		dev_priv->edp.support = 1;
 
+	dev_priv->lvds_enabled_in_vbt = driver->lvds_config != 0;
+	DRM_DEBUG_KMS("LVDS VBT config bits: 0x%x\n", driver->lvds_config);
+
 	/* This bit means to use 96Mhz for DPLL_A or not */
 	if (driver->primary_lfp_id)
 		dev_priv->dplla_96mhz = true;
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index 941b238bdcc9..bc608ddc3bd1 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -537,6 +537,7 @@  struct drm_psb_private {
 	int lvds_ssc_freq;
 	bool is_lvds_on;
 	bool is_mipi_on;
+	bool lvds_enabled_in_vbt;
 	u32 mipi_ctrl_display;
 
 	unsigned int core_freq;