Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4071174rwl; Sat, 7 Jan 2023 10:29:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXtUsf4/lLnP59huoSfWolfP5GEvlDBd/LCy1RBMmjkwIZsrHvBLzRVA1lvTGz+8aM7g2Trr X-Received: by 2002:a05:6a20:4291:b0:b0:47e7:6cba with SMTP id o17-20020a056a20429100b000b047e76cbamr82572688pzj.46.1673116142135; Sat, 07 Jan 2023 10:29:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673116142; cv=none; d=google.com; s=arc-20160816; b=YbfcuOOHC6Nk5D+rVoO8nIDoWklShIOew8tI8ofJ7q94JDUqDEheXjQw5NcuNMDeQq riFJG02D3BH+zNR8UeFRSjXNnOLuymk/z/4ebeoT/Kx1ioU4nBwic0oynHqlDCppXMj0 S4/qucM1OpLy6HSJFgZ3pw61scurIT4rvXpLKT0n0SdAj1iMauxiPJ52OoAqYpUgSVWO NFfUkuFoSorY7ZNlIdVfIZu/GHWx4VmJKIO20DIwQV1dICOWb6OevMg9Ere2gClnwNvI p0JM20AQS4hefjqpWG4LlEQc0bQBM6hEcAJK8ZYvOgfYqbV91pV4kBvBhI1V4Xwq3MTQ 3brA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=7sG+cwhQbG2VqfiM2CBCVoSPK56j5Dyb2O3M/xG/35g=; b=A70sEZhOd2ad2YNPR/ZjDCsz47JjnIO29omhFmEq6+S85/m21nSlP1P8G7DSCFo9s6 kzuR04jWTN6ThBZ5HolnwtLm53ygKGd1+/v5UpcusbEib0f2ZIlfCaB2vEDRvBi57AWa yFeLML4X9nYikn8Z0Cs0wzKTsRCB+ppb21r31tuIhW45ayAasGYW5yGv4khw3OADIj8U B8cQrFApbXE9CQ6NhlseVCKgQgZm8Mq9VKYgDWici8aVK7Zs5NUpoNGnEibSaBr6X1nz RKVpM36qkJJX/0P/GQzse3NOqdfO+SYa/M5jVk5IBVDfVuEU8ArCgoEuWqhUFHSAmV/N Mbnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kSLKP185; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bn1-20020a056a02030100b00478f1cf9428si4988896pgb.845.2023.01.07.10.28.54; Sat, 07 Jan 2023 10:29:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kSLKP185; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232902AbjAGS12 (ORCPT + 54 others); Sat, 7 Jan 2023 13:27:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232633AbjAGS00 (ORCPT ); Sat, 7 Jan 2023 13:26:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E88FB40C12; Sat, 7 Jan 2023 10:26:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40A1EB80689; Sat, 7 Jan 2023 18:26:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 72536C433AC; Sat, 7 Jan 2023 18:26:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673115981; bh=CGUKurJK1iYSsqV7DCPY1kNfW8t884NAue0bEi2srQ8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=kSLKP185ei3AEEFXwIPjE6QdJYPCRuPWWZvaRE10jNJrkmZelz1gq3fQ0Du4yaoWP Rn6vIKFT5nTUkWwS8HQK7A+D1JjcOyi2Qp+l997hHlO8UYi5KGumFH9Iv97Yoxosnf c5qEE5PEkasLF1dsL8AAhXWQUkvg5i4Se7up6Xi8uPsprJClqDFEcsxW25/7tbfsfS XuY7rH4o8KbpzSiR/pwIc638TR5aKUgelx94MH9TmTUjqYYTH0SnwhjE6nzRmFHnWE H0ZtguvJ6iOZPhsthGsTri3tuv5xSpovkt7K7vUiFzkkDSDs27VQo+1XAYZEl5hkxr lAcNIXVoJ11BA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C3E7C46467; Sat, 7 Jan 2023 18:26:21 +0000 (UTC) From: Sam Ravnborg via B4 Submission Endpoint Date: Sat, 07 Jan 2023 19:26:20 +0100 Subject: [PATCH 06/15] video: fbdev: aty128fb: Introduce backlight_get_brightness() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230107-sam-video-backlight-drop-fb_blank-v1-6-1bd9bafb351f@ravnborg.org> References: <20230107-sam-video-backlight-drop-fb_blank-v1-0-1bd9bafb351f@ravnborg.org> In-Reply-To: <20230107-sam-video-backlight-drop-fb_blank-v1-0-1bd9bafb351f@ravnborg.org> To: Nicolas Ferre , Helge Deller , Alexandre Belloni , Claudiu Beznea , Antonino Daplas , Benjamin Herrenschmidt , Paul Mackerras , Greg Kroah-Hartman , Robin van der Gracht , Miguel Ojeda , Lee Jones , Daniel Thompson , Jingoo Han Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, Stephen Kitt , Sam Ravnborg X-Mailer: b4 0.11.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1673115978; l=1162; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=n8Kx2XY+cYFmLkcdV5dyk6zjH/vhpqMDIzovg3Z1GFo=; =?utf-8?q?b=3DqvKdgsM7OlWq?= =?utf-8?q?GoR/P13Xavz5UkNGEdv1D6H6ewY0ou7Vszpmyqw86Gyff1CGVv3rHRS/v1qiPegZ?= IzxoKSMSBSuVXcEH8FTi9l2NNIUcaugLu4GMLSPyYepKLKiAsSsb X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Submission Endpoint for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sam Ravnborg Introduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties. Signed-off-by: Sam Ravnborg Cc: Paul Mackerras Cc: linux-fbdev@vger.kernel.org --- drivers/video/fbdev/aty/aty128fb.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index dd31b9d7d337..736126cc5049 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -1764,17 +1764,10 @@ static int aty128_bl_update_status(struct backlight_device *bd) { struct aty128fb_par *par = bl_get_data(bd); unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); - int level; - - if (bd->props.power != FB_BLANK_UNBLANK || - bd->props.fb_blank != FB_BLANK_UNBLANK || - !par->lcd_on) - level = 0; - else - level = bd->props.brightness; + int level = backlight_get_brightness(bd); reg |= LVDS_BL_MOD_EN | LVDS_BLON; - if (level > 0) { + if (level > 0 || par->lcd_on) { reg |= LVDS_DIGION; if (!(reg & LVDS_ON)) { reg &= ~LVDS_BLON; -- 2.34.1