diff mbox series

drm/i915: set min brightness for aux backlight interface.

Message ID 20210419151718.22979-1-shawn.c.lee@intel.com (mailing list archive)
State New
Headers show
Series drm/i915: set min brightness for aux backlight interface. | expand

Commit Message

Lee, Shawn C April 19, 2021, 3:17 p.m. UTC
Min brightness level for aux backlight interface is always zero.
Driver should refer to VBT's setting to configure proper minimum
level just like PWM backlight interface.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Lyude Paul <lyude@redhat.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_dp_aux_backlight.c | 2 +-
 drivers/gpu/drm/i915/display/intel_panel.c            | 2 +-
 drivers/gpu/drm/i915/display/intel_panel.h            | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

Comments

Jani Nikula April 21, 2021, 9:42 a.m. UTC | #1
On Mon, 19 Apr 2021, Lee Shawn C <shawn.c.lee@intel.com> wrote:
> Min brightness level for aux backlight interface is always zero.
> Driver should refer to VBT's setting to configure proper minimum
> level just like PWM backlight interface.

Unfortunately this change makes it harder for Lyude to extract the dpcd
backlight code from i915 to drm helpers, and I think the min brightness
should be handled after or in connection with that change.

BR,
Jani.


>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Cc: Lyude Paul <lyude@redhat.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_dp_aux_backlight.c | 2 +-
>  drivers/gpu/drm/i915/display/intel_panel.c            | 2 +-
>  drivers/gpu/drm/i915/display/intel_panel.h            | 1 +
>  3 files changed, 3 insertions(+), 2 deletions(-)
>
> 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 4f8337c7fd2e..efd8fa155105 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
> @@ -571,7 +571,7 @@ static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector,
>  	if (!panel->backlight.max)
>  		return -ENODEV;
>  
> -	panel->backlight.min = 0;
> +	panel->backlight.min = get_backlight_min_vbt(connector);
>  	panel->backlight.level = intel_dp_aux_vesa_get_backlight(connector, pipe);
>  	panel->backlight.enabled = intel_dp_aux_vesa_backlight_dpcd_mode(connector) &&
>  				   panel->backlight.level != 0;
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index 551fcaa77c2c..6d58ec192a04 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -1614,7 +1614,7 @@ static u32 get_backlight_max_vbt(struct intel_connector *connector)
>  /*
>   * Note: The setup hooks can't assume pipe is set!
>   */
> -static u32 get_backlight_min_vbt(struct intel_connector *connector)
> +u32 get_backlight_min_vbt(struct intel_connector *connector)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>  	struct intel_panel *panel = &connector->panel;
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.h b/drivers/gpu/drm/i915/display/intel_panel.h
> index 1d340f77bffc..63da4e355585 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.h
> +++ b/drivers/gpu/drm/i915/display/intel_panel.h
> @@ -53,6 +53,7 @@ void intel_panel_set_pwm_level(const struct drm_connector_state *conn_state, u32
>  u32 intel_panel_invert_pwm_level(struct intel_connector *connector, u32 level);
>  u32 intel_panel_backlight_level_to_pwm(struct intel_connector *connector, u32 level);
>  u32 intel_panel_backlight_level_from_pwm(struct intel_connector *connector, u32 val);
> +u32 get_backlight_min_vbt(struct intel_connector *connector);
>  
>  #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
>  int intel_backlight_device_register(struct intel_connector *connector);
Lee, Shawn C April 23, 2021, 2:23 p.m. UTC | #2
On Wed, 21 Apr 2021, Jani Nikula <jani.nikula@linux.intel.com> wrote:
>On Mon, 19 Apr 2021, Lee Shawn C <shawn.c.lee@intel.com> wrote:
>> Min brightness level for aux backlight interface is always zero.
>> Driver should refer to VBT's setting to configure proper minimum level 
>> just like PWM backlight interface.
>
>Unfortunately this change makes it harder for Lyude to extract the dpcd backlight code from i915 to drm helpers, and I think the min brightness should be handled after or in connection with that change.
>
>BR,
>Jani.
>

Understood. We will wait for Lyude's patch landing on upstream. And confirm i915 driver need this change or not.

Best regards,
Shawn

>
>>
>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
>> Cc: Lyude Paul <lyude@redhat.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_dp_aux_backlight.c | 2 +-
>>  drivers/gpu/drm/i915/display/intel_panel.c            | 2 +-
>>  drivers/gpu/drm/i915/display/intel_panel.h            | 1 +
>>  3 files changed, 3 insertions(+), 2 deletions(-)
>>
>> 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 4f8337c7fd2e..efd8fa155105 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
>> @@ -571,7 +571,7 @@ static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector,
>>  	if (!panel->backlight.max)
>>  		return -ENODEV;
>>  
>> -	panel->backlight.min = 0;
>> +	panel->backlight.min = get_backlight_min_vbt(connector);
>>  	panel->backlight.level = intel_dp_aux_vesa_get_backlight(connector, pipe);
>>  	panel->backlight.enabled = intel_dp_aux_vesa_backlight_dpcd_mode(connector) &&
>>  				   panel->backlight.level != 0;
>> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c 
>> b/drivers/gpu/drm/i915/display/intel_panel.c
>> index 551fcaa77c2c..6d58ec192a04 100644
>> --- a/drivers/gpu/drm/i915/display/intel_panel.c
>> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
>> @@ -1614,7 +1614,7 @@ static u32 get_backlight_max_vbt(struct 
>> intel_connector *connector)
>>  /*
>>   * Note: The setup hooks can't assume pipe is set!
>>   */
>> -static u32 get_backlight_min_vbt(struct intel_connector *connector)
>> +u32 get_backlight_min_vbt(struct intel_connector *connector)
>>  {
>>  	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>>  	struct intel_panel *panel = &connector->panel; diff --git 
>> a/drivers/gpu/drm/i915/display/intel_panel.h 
>> b/drivers/gpu/drm/i915/display/intel_panel.h
>> index 1d340f77bffc..63da4e355585 100644
>> --- a/drivers/gpu/drm/i915/display/intel_panel.h
>> +++ b/drivers/gpu/drm/i915/display/intel_panel.h
>> @@ -53,6 +53,7 @@ void intel_panel_set_pwm_level(const struct 
>> drm_connector_state *conn_state, u32
>>  u32 intel_panel_invert_pwm_level(struct intel_connector *connector, 
>> u32 level);
>>  u32 intel_panel_backlight_level_to_pwm(struct intel_connector 
>> *connector, u32 level);
>>  u32 intel_panel_backlight_level_from_pwm(struct intel_connector 
>> *connector, u32 val);
>> +u32 get_backlight_min_vbt(struct intel_connector *connector);
>>  
>>  #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
>>  int intel_backlight_device_register(struct intel_connector 
>> *connector);
>
>--
>Jani Nikula, Intel Open Source Graphics Center
>
diff mbox series

Patch

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 4f8337c7fd2e..efd8fa155105 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
@@ -571,7 +571,7 @@  static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector,
 	if (!panel->backlight.max)
 		return -ENODEV;
 
-	panel->backlight.min = 0;
+	panel->backlight.min = get_backlight_min_vbt(connector);
 	panel->backlight.level = intel_dp_aux_vesa_get_backlight(connector, pipe);
 	panel->backlight.enabled = intel_dp_aux_vesa_backlight_dpcd_mode(connector) &&
 				   panel->backlight.level != 0;
diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index 551fcaa77c2c..6d58ec192a04 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -1614,7 +1614,7 @@  static u32 get_backlight_max_vbt(struct intel_connector *connector)
 /*
  * Note: The setup hooks can't assume pipe is set!
  */
-static u32 get_backlight_min_vbt(struct intel_connector *connector)
+u32 get_backlight_min_vbt(struct intel_connector *connector)
 {
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	struct intel_panel *panel = &connector->panel;
diff --git a/drivers/gpu/drm/i915/display/intel_panel.h b/drivers/gpu/drm/i915/display/intel_panel.h
index 1d340f77bffc..63da4e355585 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.h
+++ b/drivers/gpu/drm/i915/display/intel_panel.h
@@ -53,6 +53,7 @@  void intel_panel_set_pwm_level(const struct drm_connector_state *conn_state, u32
 u32 intel_panel_invert_pwm_level(struct intel_connector *connector, u32 level);
 u32 intel_panel_backlight_level_to_pwm(struct intel_connector *connector, u32 level);
 u32 intel_panel_backlight_level_from_pwm(struct intel_connector *connector, u32 val);
+u32 get_backlight_min_vbt(struct intel_connector *connector);
 
 #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
 int intel_backlight_device_register(struct intel_connector *connector);