From patchwork Mon Mar 1 16:05:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 388706 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3611461jap; Mon, 1 Mar 2021 11:02:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHAigBnJ5atROqh6ngTtWki6e5J/ErapqQksOWUjLNW+WRHh57IRHJbihrLL8w1m7F8zq4 X-Received: by 2002:a17:907:2953:: with SMTP id et19mr17019053ejc.527.1614625338621; Mon, 01 Mar 2021 11:02:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614625338; cv=none; d=google.com; s=arc-20160816; b=ZU7MQOnCeOq92jhkloZIm8RVh72U9RFCoe0B5JJ8B6yoSGxf7EXI5Q4+YTHrF500mU tZPE64w4jnlZz82YQMxM5GPQhvaLay9+sdCY1U7M8rfwYJdqC7xJb9lWnlFFdBq4AzaY 5akAK0sPiPQmNPbi89p9WoKXpOAaeBlliV9nS4luMDIudR73oL3nIxJZJaFOUrtGAf9Y LklmJVEE0BQD1U9Lep5BY/SFcL2SSgSNJ4o4EF99fcVZLLklKCra5zDIPT8WgGiHaDOz v7JFyU8TJVMBSmyi2IxlX1kFduQ2HWxREq26CNbh20I8xF9qu18Pohy9dzvFKQcOoIcu Uh9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7wsbpcdQU1FgQiEbawzGJOV1Cyd91BuTdHWURMdSBwc=; b=RXL8WBulppLQxLUD5rNcKaK26TJwWJEzFjR+A7h+q/bP/9YS3BG9urylorndWbtpCS G2Go47uay5uuRchxwzykZ5vr9y/0bhRS4W7NnPztvI1wIHJEPCHjdmjVu1GLlrfqrEzZ J2ySOEBgtQNJlVQGTLz2EUo6vJ93/xgaLqyWfPf5cWzTLT/lCtsBNSAhRjnXaQGvY+HA VcTnHYmuPuU20+RVMUYV4mf8fqkbXxPUU36Bqwx8sn+TURiNCM/fD1fEbyDPXrymY5o/ NdOSWCDHiRzZRG/3QdTOl2QpfUHg5sl1lHStfIPd4ivIc2gymR1jNKq/LYqK/Lg8vjP9 spMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rr6bV4Jx; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si9029256edu.225.2021.03.01.11.02.18; Mon, 01 Mar 2021 11:02:18 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rr6bV4Jx; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236440AbhCATB3 (ORCPT + 13 others); Mon, 1 Mar 2021 14:01:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:58452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240790AbhCASxz (ORCPT ); Mon, 1 Mar 2021 13:53:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6E63E652FF; Mon, 1 Mar 2021 17:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614620500; bh=+fWMW4hbZLQyi3W48S8xyXMDuZELvjioGHJ/K7T+Gto=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rr6bV4JxUoCppEUljrnKUiawYzu85ripJ6gauPyKJb51tIly1wRrO3QwqqW75wMFZ SZ5tCvzxx7B3RnfW0bgCkGZigOOcHMWzksjlrCMgLuAwDa9gxcXG77UajS1DWJP0kO BpNr2wnP1n5jApl3hrEPWjUeE09xTkQYeHBh+vg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , Linus Walleij , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.11 176/775] drm/panel: s6e63m0: Support max-brightness Date: Mon, 1 Mar 2021 17:05:44 +0100 Message-Id: <20210301161210.327472163@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161201.679371205@linuxfoundation.org> References: <20210301161201.679371205@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit 1f20bf5921de420071fdb1d55cda7550ae137bcd ] 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 Fixes: 9c3f0a0dd6a1 ("drm/panel: s6e63m0: Implement 28 backlight levels") Signed-off-by: Linus Walleij Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20201214222210.238081-1-linus.walleij@linaro.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) -- 2.27.0 diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c index bf6d704d4d272..603c5dfe87682 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;