diff mbox series

[2/2] drm/amd/display: Add aux_backlight module option

Message ID 20210203124241.8512-3-tiwai@suse.de (mailing list archive)
State New, archived
Headers show
Series drm/amd/display: some backlight fixes | expand

Commit Message

Takashi Iwai Feb. 3, 2021, 12:42 p.m. UTC
There seem devices that don't work with the aux channel backlight
control.  For allowing such users to test with the other backlight
control method, provide a new module option, aux_backlight, to specify
enabling or disabling the aux backport support explicitly.  As
default, the aux support is detected by the hardware capability.

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1180749
BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1438
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h               | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 4 ++++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 3 files changed, 8 insertions(+)

Comments

Alex Deucher Feb. 5, 2021, 4:34 p.m. UTC | #1
On Wed, Feb 3, 2021 at 7:42 AM Takashi Iwai <tiwai@suse.de> wrote:
>
> There seem devices that don't work with the aux channel backlight
> control.  For allowing such users to test with the other backlight
> control method, provide a new module option, aux_backlight, to specify
> enabling or disabling the aux backport support explicitly.  As
> default, the aux support is detected by the hardware capability.
>
> BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1180749
> BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1438
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h               | 1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 4 ++++
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
>  3 files changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 5993dd0fdd8e..4793cd5e69f9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -179,6 +179,7 @@ extern uint amdgpu_smu_memory_pool_size;
>  extern uint amdgpu_dc_feature_mask;
>  extern uint amdgpu_dc_debug_mask;
>  extern uint amdgpu_dm_abm_level;
> +extern int amdgpu_aux_backlight;
>  extern struct amdgpu_mgpu_info mgpu_info;
>  extern int amdgpu_ras_enable;
>  extern uint amdgpu_ras_mask;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 7169fb5e3d9c..5b66822da954 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -777,6 +777,10 @@ uint amdgpu_dm_abm_level;
>  MODULE_PARM_DESC(abmlevel, "ABM level (0 = off (default), 1-4 = backlight reduction level) ");
>  module_param_named(abmlevel, amdgpu_dm_abm_level, uint, 0444);
>
> +int amdgpu_aux_backlight = -1;
> +MODULE_PARM_DESC(aux_backlight, "Aux backlight control (0 = off, 1 = on, default auto)");
> +module_param_named(aux_backlight, amdgpu_aux_backlight, bint, 0444);

I'd suggest making this something more generic like "backlight" and
make -1 auto, 0 pwm, 1 aux.  That way we can handle potential future
types more cleanly.

Alex


> +
>  /**
>   * DOC: tmz (int)
>   * Trusted Memory Zone (TMZ) is a method to protect data being written
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index fb62886ae013..6ad384ef61b8 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -2209,6 +2209,9 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
>             caps->ext_caps->bits.hdr_aux_backlight_control == 1)
>                 caps->aux_support = true;
>
> +       if (amdgpu_aux_backlight >= 0)
> +               caps->aux_support = amdgpu_aux_backlight;
> +
>         /* From the specification (CTA-861-G), for calculating the maximum
>          * luminance we need to use:
>          *      Luminance = 50*2**(CV/32)
> --
> 2.26.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Takashi Iwai Feb. 6, 2021, 12:25 p.m. UTC | #2
On Fri, 05 Feb 2021 17:34:36 +0100,
Alex Deucher wrote:
> 
> On Wed, Feb 3, 2021 at 7:42 AM Takashi Iwai <tiwai@suse.de> wrote:
> >
> > There seem devices that don't work with the aux channel backlight
> > control.  For allowing such users to test with the other backlight
> > control method, provide a new module option, aux_backlight, to specify
> > enabling or disabling the aux backport support explicitly.  As
> > default, the aux support is detected by the hardware capability.
> >
> > BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1180749
> > BugLink: https://gitlab.freedesktop.org/drm/amd/-/issues/1438
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu.h               | 1 +
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           | 4 ++++
> >  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
> >  3 files changed, 8 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > index 5993dd0fdd8e..4793cd5e69f9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > @@ -179,6 +179,7 @@ extern uint amdgpu_smu_memory_pool_size;
> >  extern uint amdgpu_dc_feature_mask;
> >  extern uint amdgpu_dc_debug_mask;
> >  extern uint amdgpu_dm_abm_level;
> > +extern int amdgpu_aux_backlight;
> >  extern struct amdgpu_mgpu_info mgpu_info;
> >  extern int amdgpu_ras_enable;
> >  extern uint amdgpu_ras_mask;
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index 7169fb5e3d9c..5b66822da954 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -777,6 +777,10 @@ uint amdgpu_dm_abm_level;
> >  MODULE_PARM_DESC(abmlevel, "ABM level (0 = off (default), 1-4 = backlight reduction level) ");
> >  module_param_named(abmlevel, amdgpu_dm_abm_level, uint, 0444);
> >
> > +int amdgpu_aux_backlight = -1;
> > +MODULE_PARM_DESC(aux_backlight, "Aux backlight control (0 = off, 1 = on, default auto)");
> > +module_param_named(aux_backlight, amdgpu_aux_backlight, bint, 0444);
> 
> I'd suggest making this something more generic like "backlight" and
> make -1 auto, 0 pwm, 1 aux.  That way we can handle potential future
> types more cleanly.

OK, will respin later.


thanks,

Takashi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 5993dd0fdd8e..4793cd5e69f9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -179,6 +179,7 @@  extern uint amdgpu_smu_memory_pool_size;
 extern uint amdgpu_dc_feature_mask;
 extern uint amdgpu_dc_debug_mask;
 extern uint amdgpu_dm_abm_level;
+extern int amdgpu_aux_backlight;
 extern struct amdgpu_mgpu_info mgpu_info;
 extern int amdgpu_ras_enable;
 extern uint amdgpu_ras_mask;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 7169fb5e3d9c..5b66822da954 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -777,6 +777,10 @@  uint amdgpu_dm_abm_level;
 MODULE_PARM_DESC(abmlevel, "ABM level (0 = off (default), 1-4 = backlight reduction level) ");
 module_param_named(abmlevel, amdgpu_dm_abm_level, uint, 0444);
 
+int amdgpu_aux_backlight = -1;
+MODULE_PARM_DESC(aux_backlight, "Aux backlight control (0 = off, 1 = on, default auto)");
+module_param_named(aux_backlight, amdgpu_aux_backlight, bint, 0444);
+
 /**
  * DOC: tmz (int)
  * Trusted Memory Zone (TMZ) is a method to protect data being written
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index fb62886ae013..6ad384ef61b8 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2209,6 +2209,9 @@  static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
 	    caps->ext_caps->bits.hdr_aux_backlight_control == 1)
 		caps->aux_support = true;
 
+	if (amdgpu_aux_backlight >= 0)
+		caps->aux_support = amdgpu_aux_backlight;
+
 	/* From the specification (CTA-861-G), for calculating the maximum
 	 * luminance we need to use:
 	 *	Luminance = 50*2**(CV/32)