dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Stephan Gerhold <stephan@gerhold.net>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/panel: s6e63m0: Support max-brightness
Date: Tue, 15 Dec 2020 06:44:22 +0100	[thread overview]
Message-ID: <20201215054422.GA1027716@ravnborg.org> (raw)
In-Reply-To: <20201214222210.238081-1-linus.walleij@linaro.org>

Hi Linus.
On Mon, Dec 14, 2020 at 11:22:10PM +0100, Linus Walleij wrote:
> The "max-brightness" is a standard backlight property that
> we need to support for the Samsung GT-I8190 Golden because
> the display will go black if we crank up the brightness
> too high.
> 
> As the platform needs this ability to give picture this is
> a regression fix along with the addition of the property
> to the GT-I8190 device tree.
> 
> Cc: Stephan Gerhold <stephan@gerhold.net>
> Fixes: 9c3f0a0dd6a1 ("drm/panel: s6e63m0: Implement 28 backlight levels")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Looks good. backlight_properties.max_brightness is an int, but this
looks like a sub-optimal type so the use of u32 in this patch is fine.

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

As we are in the merge window it should be drm-next-fixes material,
but you may have to wait until -rc2 before the drm-next-fixes branched
is ready.

	Sam

> ---
>  drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> index bf6d704d4d27..603c5dfe8768 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> @@ -692,12 +692,12 @@ static const struct backlight_ops s6e63m0_backlight_ops = {
>  	.update_status	= s6e63m0_set_brightness,
>  };
>  
> -static int s6e63m0_backlight_register(struct s6e63m0 *ctx)
> +static int s6e63m0_backlight_register(struct s6e63m0 *ctx, u32 max_brightness)
>  {
>  	struct backlight_properties props = {
>  		.type		= BACKLIGHT_RAW,
> -		.brightness	= MAX_BRIGHTNESS,
> -		.max_brightness = MAX_BRIGHTNESS
> +		.brightness	= max_brightness,
> +		.max_brightness = max_brightness,
>  	};
>  	struct device *dev = ctx->dev;
>  	int ret = 0;
> @@ -719,6 +719,7 @@ int s6e63m0_probe(struct device *dev,
>  		  bool dsi_mode)
>  {
>  	struct s6e63m0 *ctx;
> +	u32 max_brightness;
>  	int ret;
>  
>  	ctx = devm_kzalloc(dev, sizeof(struct s6e63m0), GFP_KERNEL);
> @@ -734,6 +735,14 @@ int s6e63m0_probe(struct device *dev,
>  	ctx->enabled = false;
>  	ctx->prepared = false;
>  
> +	ret = device_property_read_u32(dev, "max-brightness", &max_brightness);
> +	if (ret)
> +		max_brightness = MAX_BRIGHTNESS;
> +	if (max_brightness > MAX_BRIGHTNESS) {
> +		dev_err(dev, "illegal max brightness specified\n");
> +		max_brightness = MAX_BRIGHTNESS;
> +	}
> +
>  	ctx->supplies[0].supply = "vdd3";
>  	ctx->supplies[1].supply = "vci";
>  	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),
> @@ -753,7 +762,7 @@ int s6e63m0_probe(struct device *dev,
>  		       dsi_mode ? DRM_MODE_CONNECTOR_DSI :
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -	ret = s6e63m0_backlight_register(ctx);
> +	ret = s6e63m0_backlight_register(ctx, max_brightness);
>  	if (ret < 0)
>  		return ret;
>  
> -- 
> 2.29.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2020-12-15  5:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 22:22 [PATCH] drm/panel: s6e63m0: Support max-brightness Linus Walleij
2020-12-15  5:44 ` Sam Ravnborg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201215054422.GA1027716@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linus.walleij@linaro.org \
    --cc=stephan@gerhold.net \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox