Received: by 10.192.165.148 with SMTP id m20csp3475999imm; Mon, 23 Apr 2018 07:13:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx485yV4ydKIWKEg803Rxt0nbgvR8d5B9IWUpTZOeQ5CjlKORbRapZQSjMB3BFeKLg4hV5lFD X-Received: by 2002:a17:902:9a90:: with SMTP id w16-v6mr20993957plp.390.1524492809804; Mon, 23 Apr 2018 07:13:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524492809; cv=none; d=google.com; s=arc-20160816; b=jGJ7B2RPRs4oC03+5fsm1T9IhZLDXW8V6uqX805kfaDCyIro0eWM9t2guHqvF6A8H2 ReBeFSEotwoC4YcUjNvfe3S4ECY1YqeohxzNySYTdPgsd/F3GD24ksFilqaP02n7STXK ibkcq+v7VoqPHl4RcQoyVltvFFFh1UAcI1DtCrd5kiHZ+uHs3KV2rvmQUHBfpcujqGVB VKZzywBjKXroPLLwza/vTmTQoUTTobxpf4Mw8dqBjY/rl79tiv6TUZCbFJJsx91B2vwx takTdeSdx7pzqrfsv5vL3hUZimGpylVRxaRByiNHTcbmzntW3sFJFZidB5WAlsYhz9QE qjOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=Fk/MPUGjhztE/L2ORVw/cGMZVZlqUq6zUPZKujV6Duw=; b=A+o0OihptIVjlTLALehT/Cvlg40+otzVbKuPWvnfmRC8OwvY9u5bwvcFg9Z8EfgmMg 0N8CQKvaZO/rhUEOGZI8WhzOyjFvfCl5qI8HCzyQ3NTlPYrcECwndc15S3BNw0ehYWEi q8LJ8v8SxHU/Fpt37WY+EtepPdzNVbr4XJ9CjUS6R3BLw080YMKFV4F+GwR7YwIWpsfR hoM40Ptosb44VdiMmBEw+8vBKX798o6u28i/D0J9ByWAXh+G/PO1nOglLBEaJsxumeeJ Y5QVanw7SF+cH5KY0lwkz1PO41mqb4kIEQp+SM+aBidFwRPHnLC2f8gDVznpCxM/g991 NumA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7si6688882pgv.415.2018.04.23.07.13.15; Mon, 23 Apr 2018 07:13:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932070AbeDWOL3 (ORCPT + 99 others); Mon, 23 Apr 2018 10:11:29 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:55231 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755563AbeDWOLT (ORCPT ); Mon, 23 Apr 2018 10:11:19 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w3NE50aV022576; Mon, 23 Apr 2018 16:11:06 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2hfu2tu6fc-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 23 Apr 2018 16:11:06 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id CFE0031; Mon, 23 Apr 2018 14:11:05 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B717C2C3F; Mon, 23 Apr 2018 14:11:05 +0000 (GMT) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 23 Apr 2018 16:11:05 +0200 Received: from localhost (10.201.23.32) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 23 Apr 2018 16:11:05 +0200 From: Philippe Cornu To: Thierry Reding , David Airlie , , CC: Andrzej Hajda , Yannick Fertre , Philippe Cornu , "Benjamin Gaignard" , Vincent Abriou , Alexandre Torgue Subject: [PATCH 4/4] drm/panel: otm8009a: use new backlight api Date: Mon, 23 Apr 2018 16:10:53 +0200 Message-ID: <20180423141054.13128-5-philippe.cornu@st.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180423141054.13128-1-philippe.cornu@st.com> References: <20180423141054.13128-1-philippe.cornu@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.32] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-23_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new backlight api. Signed-off-by: Philippe Cornu --- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 26 ++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c index 4c638b7b9943..c2a71bd17e08 100644 --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c @@ -260,11 +260,7 @@ static int otm8009a_disable(struct drm_panel *panel) if (!ctx->enabled) return 0; /* This is not an issue so we return 0 here */ - /* Power off the backlight. Note: end-user still controls brightness */ - ctx->bl_dev->props.power = FB_BLANK_POWERDOWN; - ret = backlight_update_status(ctx->bl_dev); - if (ret) - return ret; + backlight_disable(ctx->bl_dev); ret = mipi_dsi_dcs_set_display_off(dsi); if (ret) @@ -338,12 +334,7 @@ static int otm8009a_enable(struct drm_panel *panel) if (ctx->enabled) return 0; - /* - * Power on the backlight. Note: end-user still controls brightness - * Note: ctx->prepared must be true before updating the backlight. - */ - ctx->bl_dev->props.power = FB_BLANK_UNBLANK; - backlight_update_status(ctx->bl_dev); + backlight_enable(ctx->bl_dev); ctx->enabled = true; @@ -459,11 +450,14 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi) ctx->panel.dev = dev; ctx->panel.funcs = &otm8009a_drm_funcs; - ctx->bl_dev = backlight_device_register(dev_name(dev), dev, ctx, - &otm8009a_backlight_ops, NULL); + ctx->bl_dev = devm_backlight_device_register(dev, dev_name(dev), + dsi->host->dev, ctx, + &otm8009a_backlight_ops, + NULL); if (IS_ERR(ctx->bl_dev)) { - dev_err(dev, "failed to register backlight device\n"); - return PTR_ERR(ctx->bl_dev); + ret = PTR_ERR(ctx->bl_dev); + dev_err(dev, "failed to register backlight %d\n", ret); + return ret; } ctx->bl_dev->props.max_brightness = OTM8009A_BACKLIGHT_MAX; @@ -491,8 +485,6 @@ static int otm8009a_remove(struct mipi_dsi_device *dsi) mipi_dsi_detach(dsi); drm_panel_remove(&ctx->panel); - backlight_device_unregister(ctx->bl_dev); - return 0; } -- 2.15.1