From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4760BC433DF for ; Sun, 2 Aug 2020 11:07:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C5222075B for ; Sun, 2 Aug 2020 11:07:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fkFQcpqs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C5222075B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8ECAE6E0FC; Sun, 2 Aug 2020 11:07:33 +0000 (UTC) Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 57FBD6E0F5 for ; Sun, 2 Aug 2020 11:07:32 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id t23so13223459ljc.3 for ; Sun, 02 Aug 2020 04:07:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yLGfPCSGFzX1pfjLnt4+4gCxp0y0iHIPZ/xyetvHNEI=; b=fkFQcpqsUIJWzziJajDk7wSX4nUaaSj0bqXqtc9LeULjE01vqHFaTiLBCQ/FLouThR nkype2yYBuPCpl/YCImE2SWGJwi5+xV20q12S4rD+GcqPXwdFzkqKtzHFLnP8UqGn5yR 6MG32nAHwsnxDSO3fdskOMPjO/+4WDPWqvsFxobti7DGwhli3Itd+vtdDVkNODvO3Kwx 1nXJHK2NFTyFQwqx78PQD7/L2nJiGDXg+YVUI0+tU4kES2HW//bZeDgUuxM9KOdKs2Z6 RGUhjWAHNYKI3/5V38wQtf5KQ+tXRJCnFH72l3icFPE3k9C+64egZmTZQoztM38MUK2Y BPoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yLGfPCSGFzX1pfjLnt4+4gCxp0y0iHIPZ/xyetvHNEI=; b=a4eJoI3ZBul5K6Mv/+REJz264Q+sQIu8hATBhnaDXdvWVEJYj+y3LZfZCHKwpqxNEA UQU5rUSJHyg5Vex3Ts4ZE8SxgTurfsl2SrYZ4wIj+0EmlbPPPQs7McPRb13Zs9hPDOdF RVex4fhaXpbBVHAJC66qMtsz5xBarGo75FAN5cUYJCHCtGesM4oxIGzJ1AUaTn34Fm8/ hRL+iUN2iLGmKYfeQJh+EDcvSfQF1zxqIKaCiw8KWVe15nZz0dVZv+SxFtXimy7u8zKJ xT9l2Gjzf4USwOAF31or7t07dZ/YerpBGkkJ5Z1ErXp5UC5T86a25t30XWtXQ/Vd3uaz H2ZQ== X-Gm-Message-State: AOAM532SfILeN8AQN5rK3EzYnzo/Z+Hq7RGOceVOP+mgvLJgzI5xvaPv dknsCk8ai26aTt78by6GOk4SLVOOpDw= X-Google-Smtp-Source: ABdhPJzxi7fz52DERq/CMav6EPIMsEQsGo8HcVr2O12zysf4L554P54JOjLZOM9aaLealJ1lYQkXgw== X-Received: by 2002:a05:651c:c5:: with SMTP id 5mr5696050ljr.443.1596366450595; Sun, 02 Aug 2020 04:07:30 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:b9d6:7e3c:5453:a61c]) by smtp.gmail.com with ESMTPSA id l3sm3045520lji.115.2020.08.02.04.07.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2020 04:07:30 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 14/22] drm/panel: sony-acx424akp: Backlight update Date: Sun, 2 Aug 2020 13:06:28 +0200 Message-Id: <20200802110636.1018743-15-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200802110636.1018743-1-sam@ravnborg.org> References: <20200802110636.1018743-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Thierry Reding , Sam Ravnborg Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" - Use get method to read brightness - Use drm_panel support for backlight - This drops enable/disable operations as they are no longer needed. The enable/disable operations had some backlight related comments that are no longer valid. The only correct way to enable/disable backlight is using the backlight enable/disable helpers. - Use macro for backlight initialization Signed-off-by: Sam Ravnborg Linus Walleij Cc: Linus Walleij Cc: Thierry Reding Cc: Sam Ravnborg --- drivers/gpu/drm/panel/panel-sony-acx424akp.c | 49 ++++---------------- 1 file changed, 9 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sony-acx424akp.c b/drivers/gpu/drm/panel/panel-sony-acx424akp.c index c91e55b2d7a3..ce9ae8f1f5d7 100644 --- a/drivers/gpu/drm/panel/panel-sony-acx424akp.c +++ b/drivers/gpu/drm/panel/panel-sony-acx424akp.c @@ -99,7 +99,7 @@ static int acx424akp_set_brightness(struct backlight_device *bl) struct acx424akp *acx = bl_get_data(bl); struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); int period_ns = 1023; - int duty_ns = bl->props.brightness; + int duty_ns = backlight_get_brightness(bl); u8 pwm_ratio; u8 pwm_div; u8 par; @@ -332,8 +332,6 @@ static int acx424akp_prepare(struct drm_panel *panel) } } - acx->bl->props.power = FB_BLANK_NORMAL; - return 0; err_power_off: @@ -376,34 +374,6 @@ static int acx424akp_unprepare(struct drm_panel *panel) msleep(85); acx424akp_power_off(acx); - acx->bl->props.power = FB_BLANK_POWERDOWN; - - return 0; -} - -static int acx424akp_enable(struct drm_panel *panel) -{ - struct acx424akp *acx = panel_to_acx424akp(panel); - - /* - * The backlight is on as long as the display is on - * so no use to call backlight_enable() here. - */ - acx->bl->props.power = FB_BLANK_UNBLANK; - - return 0; -} - -static int acx424akp_disable(struct drm_panel *panel) -{ - struct acx424akp *acx = panel_to_acx424akp(panel); - - /* - * The backlight is on as long as the display is on - * so no use to call backlight_disable() here. - */ - acx->bl->props.power = FB_BLANK_NORMAL; - return 0; } @@ -435,18 +405,18 @@ static int acx424akp_get_modes(struct drm_panel *panel, } static const struct drm_panel_funcs acx424akp_drm_funcs = { - .disable = acx424akp_disable, .unprepare = acx424akp_unprepare, .prepare = acx424akp_prepare, - .enable = acx424akp_enable, .get_modes = acx424akp_get_modes, }; static int acx424akp_probe(struct mipi_dsi_device *dsi) { + struct backlight_device *bd; struct device *dev = &dsi->dev; struct acx424akp *acx; int ret; + DECLARE_BACKLIGHT_INIT_RAW(props, 512, 1023); acx = devm_kzalloc(dev, sizeof(struct acx424akp), GFP_KERNEL); if (!acx) @@ -496,15 +466,14 @@ static int acx424akp_probe(struct mipi_dsi_device *dsi) drm_panel_init(&acx->panel, dev, &acx424akp_drm_funcs, DRM_MODE_CONNECTOR_DSI); - acx->bl = devm_backlight_device_register(dev, "acx424akp", dev, acx, - &acx424akp_bl_ops, NULL); - if (IS_ERR(acx->bl)) { + bd = devm_backlight_device_register(dev, "acx424akp", dev, acx, + &acx424akp_bl_ops, &props); + if (IS_ERR(bd)) { DRM_DEV_ERROR(dev, "failed to register backlight device\n"); - return PTR_ERR(acx->bl); + return PTR_ERR(bd); } - acx->bl->props.max_brightness = 1023; - acx->bl->props.brightness = 512; - acx->bl->props.power = FB_BLANK_POWERDOWN; + + acx->panel.backlight = bd; ret = drm_panel_add(&acx->panel); if (ret < 0) -- 2.25.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel