Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4081644rwl; Sat, 7 Jan 2023 10:40:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXs76VBuh4kX30caMTU0CVNBAb015suxwXYZ0ON1DHzxPgKmnO0fbc+i+xGotuk5JqFcIgko X-Received: by 2002:a17:907:6f09:b0:7c1:37:6d5e with SMTP id sy9-20020a1709076f0900b007c100376d5emr30680419ejc.2.1673116851526; Sat, 07 Jan 2023 10:40:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673116851; cv=none; d=google.com; s=arc-20160816; b=YwpEqrQ8hIlTrQGs1VHRCvwGTVG9tHHJkXWoWyqu5MIgjMR2MUiBG9gD1FJzO853Wa HKv+Dh+00kA31C6+7BGF3tWWzP3FAUA/5CcnRAcThzZMjW4cYCvNEtwde1+bAq32jCy/ UxoNC7H/rVPsG4GDFq0QIdgtAxFKIbgXoNjY5f9em9HBLuJzCeAC45ByXvdA55w657Aw bPBdTxXbIdTr4Or/toDKAWYn3dOvMLLpgA6EfqkrNb2HZ5HS3JsafI8mIjusolHhgGXr IgEDBalbHDVa9xk9YTK0XCM7JbwMLM87JOEQP6afA4nUyTkL+ZvYWxY71TBFMD1FShUx sxiA== 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=v6H2SfBVJ6oN4prbC4dDuqYJivZIihegrsk/307NKUI=; b=k4QvbTPPdluTBFI7+I6KZi5NVi4FretvlNy+qzl2AGqnVQNT65yGTJUgLukGHn2BNK JNjVYL5pkvZDizzVMaZcXp04BhVt+x+LEfPs8Ai/MvSMThMvwpDeIhRPvdbr0Li5rTCo Aw8T4LVlFRJ9JOrbwyxpYL6AkOMAa8yK+wSTHrI3Qud0uQgnqRoYc6dV190XtStN0REK V69BQECt0wQScGXYzv5lcBj7Qp+EPV9JuWTmd/OB+k1NiGTH3Ha0yBwfOlzlYjmFOwVq vJxJ+TjE8wkwPbZpg42VWiQp+S6lOY76oRRbkqJ8SJugSBf6n/naVfO4QOqBrIaY4d70 rPXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=leSuGdHp; 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 qf11-20020a1709077f0b00b007c167bc7df9si5713595ejc.255.2023.01.07.10.40.39; Sat, 07 Jan 2023 10:40:51 -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=leSuGdHp; 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 S233324AbjAGS1k (ORCPT + 54 others); Sat, 7 Jan 2023 13:27:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232671AbjAGS02 (ORCPT ); Sat, 7 Jan 2023 13:26:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0A8040C0C; Sat, 7 Jan 2023 10:26:26 -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 C73B0B8069F; Sat, 7 Jan 2023 18:26:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 0630FC43323; Sat, 7 Jan 2023 18:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673115982; bh=xpo8jUeerzmavUSQe9zKlH8WJyJePz17BLWzlSJ9W5w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=leSuGdHpQ5DishtvWWyEHD84Rm+3zDpxcCk6Y/o5NTJYim1zGPo/nCCGi4ApYAmy5 EGPK6F9qRo9FA79zd96UlO8+oj7N9uIqJpTRy4x/wHdIBbOGYh0cXV0rSfMsiQaTRA v0UEBf9kIh57tMQLQAE8TwDjdE1kJ3OK7oxPEqMFT/Ub/bv63O5PS8Npo+Ycim1/os B60WufGI+Ceet6SmbiOonk0wvsqabqYtY7L8a867H0+wzmf4WjjRAnoiidtyztMs67 i93IRKMOI7IDyPWcz0VgvqKkn2Gfh23SlDjV/RJ9KWzU5152Y6/OhuNViPzi5nf7F/ 5U+P5w5KEdTQA== 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 E6565C46467; Sat, 7 Jan 2023 18:26:21 +0000 (UTC) From: Sam Ravnborg via B4 Submission Endpoint Date: Sat, 07 Jan 2023 19:26:27 +0100 Subject: [PATCH 13/15] backlight: omap1: Use backlight helpers 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-13-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=3774; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=srCckeZD3FDZipiWT3z6Jx0O9ZavywUIgE9g9CQnkT4=; =?utf-8?q?b=3DZnBn79WC7Jd0?= =?utf-8?q?7w2kvEoUqNXOLxMXiRR81z3KD4hu/AuT4FkBWuhIb8mnv9JkUKSSwMaj8t3RWh8T?= 8DR2+MBwD0MvdIdeiVcdPN0SSEF+zFiSKPHpLxPwqkw+xml8oExD 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 Rework backlight handling to avoid access to the deprecated backlight_properties.fb_blank member. The rework includes removal of get_brightness() operation, because there was no read back from HW so no use for it. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/omap1_bl.c | 67 +++++--------------------------------- 1 file changed, 9 insertions(+), 58 deletions(-) diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c index 69a49384b3de..49f37da857e7 100644 --- a/drivers/video/backlight/omap1_bl.c +++ b/drivers/video/backlight/omap1_bl.c @@ -20,9 +20,6 @@ #define OMAPBL_MAX_INTENSITY 0xff struct omap_backlight { - int powermode; - int current_intensity; - struct device *dev; struct omap_backlight_config *pdata; }; @@ -37,82 +34,40 @@ static inline void omapbl_send_enable(int enable) omap_writeb(enable, OMAP_PWL_CLK_ENABLE); } -static void omapbl_blank(struct omap_backlight *bl, int mode) -{ - if (bl->pdata->set_power) - bl->pdata->set_power(bl->dev, mode); - - switch (mode) { - case FB_BLANK_NORMAL: - case FB_BLANK_VSYNC_SUSPEND: - case FB_BLANK_HSYNC_SUSPEND: - case FB_BLANK_POWERDOWN: - omapbl_send_intensity(0); - omapbl_send_enable(0); - break; - - case FB_BLANK_UNBLANK: - omapbl_send_intensity(bl->current_intensity); - omapbl_send_enable(1); - break; - } -} - #ifdef CONFIG_PM_SLEEP static int omapbl_suspend(struct device *dev) { struct backlight_device *bl_dev = dev_get_drvdata(dev); - struct omap_backlight *bl = bl_get_data(bl_dev); - omapbl_blank(bl, FB_BLANK_POWERDOWN); + backlight_disable(bl_dev); return 0; } static int omapbl_resume(struct device *dev) { struct backlight_device *bl_dev = dev_get_drvdata(dev); - struct omap_backlight *bl = bl_get_data(bl_dev); - omapbl_blank(bl, bl->powermode); + backlight_enable(bl_dev); return 0; } #endif -static int omapbl_set_power(struct backlight_device *dev, int state) -{ - struct omap_backlight *bl = bl_get_data(dev); - - omapbl_blank(bl, state); - bl->powermode = state; - - return 0; -} - static int omapbl_update_status(struct backlight_device *dev) { - struct omap_backlight *bl = bl_get_data(dev); + int brightness = backlight_get_brightness(dev); - if (bl->current_intensity != dev->props.brightness) { - if (bl->powermode == FB_BLANK_UNBLANK) - omapbl_send_intensity(dev->props.brightness); - bl->current_intensity = dev->props.brightness; + if (brightness > 0) { + omapbl_send_intensity(dev->props.brightness); + omapbl_send_enable(1); + } else { + omapbl_send_intensity(0); + omapbl_send_enable(0); } - if (dev->props.fb_blank != bl->powermode) - omapbl_set_power(dev, dev->props.fb_blank); - return 0; } -static int omapbl_get_intensity(struct backlight_device *dev) -{ - struct omap_backlight *bl = bl_get_data(dev); - - return bl->current_intensity; -} - static const struct backlight_ops omapbl_ops = { - .get_brightness = omapbl_get_intensity, .update_status = omapbl_update_status, }; @@ -139,9 +94,6 @@ static int omapbl_probe(struct platform_device *pdev) if (IS_ERR(dev)) return PTR_ERR(dev); - bl->powermode = FB_BLANK_POWERDOWN; - bl->current_intensity = 0; - bl->pdata = pdata; bl->dev = &pdev->dev; @@ -149,7 +101,6 @@ static int omapbl_probe(struct platform_device *pdev) omap_cfg_reg(PWL); /* Conflicts with UART3 */ - dev->props.fb_blank = FB_BLANK_UNBLANK; dev->props.brightness = pdata->default_intensity; omapbl_update_status(dev); -- 2.34.1