diff mbox series

[v2] drm/i915: Check backlight type while doing eDP backlight initializaiton

Message ID 1560933806-5184-1-git-send-email-shawn.c.lee@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm/i915: Check backlight type while doing eDP backlight initializaiton | expand

Commit Message

Lee Shawn C June 19, 2019, 8:43 a.m. UTC
If LFP backlight type setting from VBT was "VESA eDP AUX Interface".
Driver should check panel capability and try to initialize aux backlight.
No matter i915_modparams.enable_dpcd_backlight was enabled or not.

v2: access dev_priv->vbt.backlight.type directly and remove unused function.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Jose Roberto de Souza <jose.souza@intel.com>
Cc: Cooper Chiou <cooper.chiou@intel.com>

Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
---
 drivers/gpu/drm/i915/display/intel_bios.h             | 1 +
 drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Jani Nikula June 19, 2019, 9:40 a.m. UTC | #1
On Wed, 19 Jun 2019, Lee Shawn C <shawn.c.lee@intel.com> wrote:
> If LFP backlight type setting from VBT was "VESA eDP AUX Interface".
> Driver should check panel capability and try to initialize aux backlight.
> No matter i915_modparams.enable_dpcd_backlight was enabled or not.
>
> v2: access dev_priv->vbt.backlight.type directly and remove unused function.
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Jose Roberto de Souza <jose.souza@intel.com>
> Cc: Cooper Chiou <cooper.chiou@intel.com>
>
> Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_bios.h             | 1 +
>  drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
> index 4e42cfaf61a7..0b7be6389a07 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.h
> +++ b/drivers/gpu/drm/i915/display/intel_bios.h
> @@ -42,6 +42,7 @@ enum intel_backlight_type {
>  	INTEL_BACKLIGHT_DISPLAY_DDI,
>  	INTEL_BACKLIGHT_DSI_DCS,
>  	INTEL_BACKLIGHT_PANEL_DRIVER_INTERFACE,
> +	INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE,
>  };
>  
>  struct edp_power_seq {
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> index 7ded95a334db..db7c7b9f9b56 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> @@ -264,8 +264,10 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector)
>  int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)
>  {
>  	struct intel_panel *panel = &intel_connector->panel;
> +	struct drm_i915_private *dev_priv = to_i915(intel_connector->base.dev);
>  
> -	if (!i915_modparams.enable_dpcd_backlight)
> +	if (!i915_modparams.enable_dpcd_backlight &&
> +	    (dev_priv->vbt.backlight.type != INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE))
>  		return -ENODEV;

There was also this part in the v1 review:

    The usual thing to do is to set i915.enable_dpcd_backlight initial value
    to -1 (i.e. make it an int), and with that default value respect
    VBT. Otherwise, respect the value of enable_dpcd_backlight.


BR,
Jani.



>  
>  	if (!intel_dp_aux_display_control_capable(intel_connector))
Lee Shawn C June 20, 2019, 2:09 a.m. UTC | #2
On Wed, 19 Jun 2019, Jani Nikula <jani.nikula@intel.com> wrote:
>On Wed, 19 Jun 2019, Lee Shawn C <shawn.c.lee@intel.com> wrote:
>> If LFP backlight type setting from VBT was "VESA eDP AUX Interface".
>> Driver should check panel capability and try to initialize aux backlight.
>> No matter i915_modparams.enable_dpcd_backlight was enabled or not.
>>
>> v2: access dev_priv->vbt.backlight.type directly and remove unused function.
>>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Cc: Jani Nikula <jani.nikula@intel.com>
>> Cc: Jose Roberto de Souza <jose.souza@intel.com>
>> Cc: Cooper Chiou <cooper.chiou@intel.com>
>>
>> Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_bios.h             | 1 +
>>  drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 4 +++-
>>  2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_bios.h 
>> b/drivers/gpu/drm/i915/display/intel_bios.h
>> index 4e42cfaf61a7..0b7be6389a07 100644
>> --- a/drivers/gpu/drm/i915/display/intel_bios.h
>> +++ b/drivers/gpu/drm/i915/display/intel_bios.h
>> @@ -42,6 +42,7 @@ enum intel_backlight_type {
>>  	INTEL_BACKLIGHT_DISPLAY_DDI,
>>  	INTEL_BACKLIGHT_DSI_DCS,
>>  	INTEL_BACKLIGHT_PANEL_DRIVER_INTERFACE,
>> +	INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE,
>>  };
>>  
>>  struct edp_power_seq {
>> diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 
>> b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
>> index 7ded95a334db..db7c7b9f9b56 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
>> @@ -264,8 +264,10 @@ intel_dp_aux_display_control_capable(struct 
>> intel_connector *connector)  int 
>> intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)  {
>>  	struct intel_panel *panel = &intel_connector->panel;
>> +	struct drm_i915_private *dev_priv = 
>> +to_i915(intel_connector->base.dev);
>>  
>> -	if (!i915_modparams.enable_dpcd_backlight)
>> +	if (!i915_modparams.enable_dpcd_backlight &&
>> +	    (dev_priv->vbt.backlight.type != 
>> +INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE))
>>  		return -ENODEV;
>
>There was also this part in the v1 review:
>
>    The usual thing to do is to set i915.enable_dpcd_backlight initial value
>    to -1 (i.e. make it an int), and with that default value respect
>    VBT. Otherwise, respect the value of enable_dpcd_backlight.
>
>
>BR,
>Jani.

Do you mean we should do following?
1. Change i915.enable_dpcd_backlight type from bool to int.
2. Give default value as -1 for enable_dpcd_backlight in i915_param.h.
3. Add a judgement to check LFP backlight type was aux interface or not.
   Between if (!i915_modparams.enable_dpcd_backlight) and 
   if (!intel_dp_aux_display_control_capable(intel_connector)).

Best regards,
Shawn

>>  
>>  	if (!intel_dp_aux_display_control_capable(intel_connector))
>
>--
>Jani Nikula, Intel Open Source Graphics Center
Jani Nikula June 20, 2019, 9 a.m. UTC | #3
On Thu, 20 Jun 2019, "Lee, Shawn C" <shawn.c.lee@intel.com> wrote:
> On Wed, 19 Jun 2019, Jani Nikula <jani.nikula@intel.com> wrote:
>>On Wed, 19 Jun 2019, Lee Shawn C <shawn.c.lee@intel.com> wrote:
>>> If LFP backlight type setting from VBT was "VESA eDP AUX Interface".
>>> Driver should check panel capability and try to initialize aux backlight.
>>> No matter i915_modparams.enable_dpcd_backlight was enabled or not.
>>>
>>> v2: access dev_priv->vbt.backlight.type directly and remove unused function.
>>>
>>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>> Cc: Jani Nikula <jani.nikula@intel.com>
>>> Cc: Jose Roberto de Souza <jose.souza@intel.com>
>>> Cc: Cooper Chiou <cooper.chiou@intel.com>
>>>
>>> Signed-off-by: Lee Shawn C <shawn.c.lee@intel.com>
>>> ---
>>>  drivers/gpu/drm/i915/display/intel_bios.h             | 1 +
>>>  drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 4 +++-
>>>  2 files changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/display/intel_bios.h 
>>> b/drivers/gpu/drm/i915/display/intel_bios.h
>>> index 4e42cfaf61a7..0b7be6389a07 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_bios.h
>>> +++ b/drivers/gpu/drm/i915/display/intel_bios.h
>>> @@ -42,6 +42,7 @@ enum intel_backlight_type {
>>>  	INTEL_BACKLIGHT_DISPLAY_DDI,
>>>  	INTEL_BACKLIGHT_DSI_DCS,
>>>  	INTEL_BACKLIGHT_PANEL_DRIVER_INTERFACE,
>>> +	INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE,
>>>  };
>>>  
>>>  struct edp_power_seq {
>>> diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c 
>>> b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
>>> index 7ded95a334db..db7c7b9f9b56 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
>>> @@ -264,8 +264,10 @@ intel_dp_aux_display_control_capable(struct 
>>> intel_connector *connector)  int 
>>> intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)  {
>>>  	struct intel_panel *panel = &intel_connector->panel;
>>> +	struct drm_i915_private *dev_priv = 
>>> +to_i915(intel_connector->base.dev);
>>>  
>>> -	if (!i915_modparams.enable_dpcd_backlight)
>>> +	if (!i915_modparams.enable_dpcd_backlight &&
>>> +	    (dev_priv->vbt.backlight.type != 
>>> +INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE))
>>>  		return -ENODEV;
>>
>>There was also this part in the v1 review:
>>
>>    The usual thing to do is to set i915.enable_dpcd_backlight initial value
>>    to -1 (i.e. make it an int), and with that default value respect
>>    VBT. Otherwise, respect the value of enable_dpcd_backlight.
>>
>>
>>BR,
>>Jani.
>
> Do you mean we should do following?
> 1. Change i915.enable_dpcd_backlight type from bool to int.

Yes.

> 2. Give default value as -1 for enable_dpcd_backlight in i915_param.h.

Yes.

> 3. Add a judgement to check LFP backlight type was aux interface or not.
>    Between if (!i915_modparams.enable_dpcd_backlight) and 
>    if (!intel_dp_aux_display_control_capable(intel_connector)).

Basically replace:

if (!i915_modparams.enable_dpcd_backlight)
	return -ENODEV;

with something like this:

if (i915_modparams.enable_dpcd_backlight == 0 ||
    (i915_modparams.enable_dpcd_backlight == -1 && 
     dev_priv->vbt.backlight.type != INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE))
	return -ENODEV;

i.e. if modparam == -1, use vbt, otherwise use modparam. This lets you
override vbt using the modparam.

You'll still have the capability check below like before.

BR,
Jani.


>
> Best regards,
> Shawn
>
>>>  
>>>  	if (!intel_dp_aux_display_control_capable(intel_connector))
>>
>>--
>>Jani Nikula, Intel Open Source Graphics Center
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
index 4e42cfaf61a7..0b7be6389a07 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.h
+++ b/drivers/gpu/drm/i915/display/intel_bios.h
@@ -42,6 +42,7 @@  enum intel_backlight_type {
 	INTEL_BACKLIGHT_DISPLAY_DDI,
 	INTEL_BACKLIGHT_DSI_DCS,
 	INTEL_BACKLIGHT_PANEL_DRIVER_INTERFACE,
+	INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE,
 };
 
 struct edp_power_seq {
diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
index 7ded95a334db..db7c7b9f9b56 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
@@ -264,8 +264,10 @@  intel_dp_aux_display_control_capable(struct intel_connector *connector)
 int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)
 {
 	struct intel_panel *panel = &intel_connector->panel;
+	struct drm_i915_private *dev_priv = to_i915(intel_connector->base.dev);
 
-	if (!i915_modparams.enable_dpcd_backlight)
+	if (!i915_modparams.enable_dpcd_backlight &&
+	    (dev_priv->vbt.backlight.type != INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE))
 		return -ENODEV;
 
 	if (!intel_dp_aux_display_control_capable(intel_connector))