diff mbox series

[07/13] drm/dp: Change argument type for drm_edp_backlight_set_level

Message ID 20250411042909.2626807-8-suraj.kandpal@intel.com (mailing list archive)
State New
Headers show
Series Modify drm helpers to use luminance | expand

Commit Message

Kandpal, Suraj April 11, 2025, 4:29 a.m. UTC
Use u32 for level variable as one may need to pass value for
DP_EDP_PANEL_TARGET_LUMINANCE_VALUE.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 drivers/gpu/drm/display/drm_dp_helper.c | 6 +++---
 include/drm/display/drm_dp_helper.h     | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Jani Nikula April 11, 2025, 10:39 a.m. UTC | #1
On Fri, 11 Apr 2025, Suraj Kandpal <suraj.kandpal@intel.com> wrote:
> Use u32 for level variable as one may need to pass value for
> DP_EDP_PANEL_TARGET_LUMINANCE_VALUE.
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>  drivers/gpu/drm/display/drm_dp_helper.c | 6 +++---
>  include/drm/display/drm_dp_helper.h     | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
> index bb1242a1bf6b..895ed4a22fc3 100644
> --- a/drivers/gpu/drm/display/drm_dp_helper.c
> +++ b/drivers/gpu/drm/display/drm_dp_helper.c
> @@ -3933,7 +3933,7 @@ EXPORT_SYMBOL(drm_dp_pcon_convert_rgb_to_ycbcr);
>   * Returns: %0 on success, negative error code on failure
>   */
>  int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl,
> -				u16 level)
> +				u32 level)
>  {
>  	int ret;
>  	u8 buf[2] = { 0 };
> @@ -4047,7 +4047,7 @@ int drm_edp_backlight_enable(struct drm_dp_aux *aux, const struct drm_edp_backli
>  		return ret < 0 ? ret : -EIO;
>  	}
>  
> -	ret = drm_edp_backlight_set_level(aux, bl, level);
> +	ret = drm_edp_backlight_set_level(aux, bl, (u32)level);

What difference do you think the cast makes?

>  	if (ret < 0)
>  		return ret;
>  	ret = drm_edp_backlight_set_enable(aux, bl, true);
> @@ -4327,7 +4327,7 @@ static int dp_aux_backlight_update_status(struct backlight_device *bd)
>  			bl->enabled = true;
>  			return 0;
>  		}
> -		ret = drm_edp_backlight_set_level(bl->aux, &bl->info, brightness);
> +		ret = drm_edp_backlight_set_level(bl->aux, &bl->info, (u32)brightness);

Ditto.

>  	} else {
>  		if (bl->enabled) {
>  			drm_edp_backlight_disable(bl->aux, &bl->info);
> diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
> index 62be80417ded..6bce0176efd3 100644
> --- a/include/drm/display/drm_dp_helper.h
> +++ b/include/drm/display/drm_dp_helper.h
> @@ -853,7 +853,7 @@ drm_edp_backlight_init(struct drm_dp_aux *aux, struct drm_edp_backlight_info *bl
>  		       u16 driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE],
>  		       u32 *current_level, u8 *current_mode, bool need_luminance);
>  int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl,
> -				u16 level);
> +				u32 level);
>  int drm_edp_backlight_enable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl,
>  			     u16 level);
>  int drm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl);
Kandpal, Suraj April 14, 2025, 4:16 a.m. UTC | #2
> -----Original Message-----
> From: Jani Nikula <jani.nikula@linux.intel.com>
> Sent: Friday, April 11, 2025 4:09 PM
> To: Kandpal, Suraj <suraj.kandpal@intel.com>; nouveau@lists.freedesktop.org;
> dri-devel@lists.freedesktop.org; intel-xe@lists.freedesktop.org; intel-
> gfx@lists.freedesktop.org
> Cc: Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>; Murthy, Arun R
> <arun.r.murthy@intel.com>; Kandpal, Suraj <suraj.kandpal@intel.com>
> Subject: Re: [PATCH 07/13] drm/dp: Change argument type for
> drm_edp_backlight_set_level
> 
> On Fri, 11 Apr 2025, Suraj Kandpal <suraj.kandpal@intel.com> wrote:
> > Use u32 for level variable as one may need to pass value for
> > DP_EDP_PANEL_TARGET_LUMINANCE_VALUE.
> >
> > Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> > ---
> >  drivers/gpu/drm/display/drm_dp_helper.c | 6 +++---
> >  include/drm/display/drm_dp_helper.h     | 2 +-
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/display/drm_dp_helper.c
> > b/drivers/gpu/drm/display/drm_dp_helper.c
> > index bb1242a1bf6b..895ed4a22fc3 100644
> > --- a/drivers/gpu/drm/display/drm_dp_helper.c
> > +++ b/drivers/gpu/drm/display/drm_dp_helper.c
> > @@ -3933,7 +3933,7 @@
> EXPORT_SYMBOL(drm_dp_pcon_convert_rgb_to_ycbcr);
> >   * Returns: %0 on success, negative error code on failure
> >   */
> >  int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct
> drm_edp_backlight_info *bl,
> > -				u16 level)
> > +				u32 level)
> >  {
> >  	int ret;
> >  	u8 buf[2] = { 0 };
> > @@ -4047,7 +4047,7 @@ int drm_edp_backlight_enable(struct drm_dp_aux
> *aux, const struct drm_edp_backli
> >  		return ret < 0 ? ret : -EIO;
> >  	}
> >
> > -	ret = drm_edp_backlight_set_level(aux, bl, level);
> > +	ret = drm_edp_backlight_set_level(aux, bl, (u32)level);
> 
> What difference do you think the cast makes?

You are right this is not needed the var should be automatically be promoted will fix this here
And in another patch where I have done the same mistake.

Regards,
Suraj Kandpal

> 
> >  	if (ret < 0)
> >  		return ret;
> >  	ret = drm_edp_backlight_set_enable(aux, bl, true); @@ -4327,7
> > +4327,7 @@ static int dp_aux_backlight_update_status(struct
> backlight_device *bd)
> >  			bl->enabled = true;
> >  			return 0;
> >  		}
> > -		ret = drm_edp_backlight_set_level(bl->aux, &bl->info,
> brightness);
> > +		ret = drm_edp_backlight_set_level(bl->aux, &bl->info,
> > +(u32)brightness);
> 
> Ditto.
> 
> >  	} else {
> >  		if (bl->enabled) {
> >  			drm_edp_backlight_disable(bl->aux, &bl->info); diff --
> git
> > a/include/drm/display/drm_dp_helper.h
> > b/include/drm/display/drm_dp_helper.h
> > index 62be80417ded..6bce0176efd3 100644
> > --- a/include/drm/display/drm_dp_helper.h
> > +++ b/include/drm/display/drm_dp_helper.h
> > @@ -853,7 +853,7 @@ drm_edp_backlight_init(struct drm_dp_aux *aux,
> struct drm_edp_backlight_info *bl
> >  		       u16 driver_pwm_freq_hz, const u8
> edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE],
> >  		       u32 *current_level, u8 *current_mode, bool
> need_luminance);
> > int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct
> drm_edp_backlight_info *bl,
> > -				u16 level);
> > +				u32 level);
> >  int drm_edp_backlight_enable(struct drm_dp_aux *aux, const struct
> drm_edp_backlight_info *bl,
> >  			     u16 level);
> >  int drm_edp_backlight_disable(struct drm_dp_aux *aux, const struct
> > drm_edp_backlight_info *bl);
> 
> --
> Jani Nikula, Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
index bb1242a1bf6b..895ed4a22fc3 100644
--- a/drivers/gpu/drm/display/drm_dp_helper.c
+++ b/drivers/gpu/drm/display/drm_dp_helper.c
@@ -3933,7 +3933,7 @@  EXPORT_SYMBOL(drm_dp_pcon_convert_rgb_to_ycbcr);
  * Returns: %0 on success, negative error code on failure
  */
 int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl,
-				u16 level)
+				u32 level)
 {
 	int ret;
 	u8 buf[2] = { 0 };
@@ -4047,7 +4047,7 @@  int drm_edp_backlight_enable(struct drm_dp_aux *aux, const struct drm_edp_backli
 		return ret < 0 ? ret : -EIO;
 	}
 
-	ret = drm_edp_backlight_set_level(aux, bl, level);
+	ret = drm_edp_backlight_set_level(aux, bl, (u32)level);
 	if (ret < 0)
 		return ret;
 	ret = drm_edp_backlight_set_enable(aux, bl, true);
@@ -4327,7 +4327,7 @@  static int dp_aux_backlight_update_status(struct backlight_device *bd)
 			bl->enabled = true;
 			return 0;
 		}
-		ret = drm_edp_backlight_set_level(bl->aux, &bl->info, brightness);
+		ret = drm_edp_backlight_set_level(bl->aux, &bl->info, (u32)brightness);
 	} else {
 		if (bl->enabled) {
 			drm_edp_backlight_disable(bl->aux, &bl->info);
diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
index 62be80417ded..6bce0176efd3 100644
--- a/include/drm/display/drm_dp_helper.h
+++ b/include/drm/display/drm_dp_helper.h
@@ -853,7 +853,7 @@  drm_edp_backlight_init(struct drm_dp_aux *aux, struct drm_edp_backlight_info *bl
 		       u16 driver_pwm_freq_hz, const u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE],
 		       u32 *current_level, u8 *current_mode, bool need_luminance);
 int drm_edp_backlight_set_level(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl,
-				u16 level);
+				u32 level);
 int drm_edp_backlight_enable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl,
 			     u16 level);
 int drm_edp_backlight_disable(struct drm_dp_aux *aux, const struct drm_edp_backlight_info *bl);