From patchwork Sat Jan 19 18:21:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Kemnade X-Patchwork-Id: 10772473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8946113B4 for ; Sun, 20 Jan 2019 17:04:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7532C28B08 for ; Sun, 20 Jan 2019 17:04:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68EF428BEB; Sun, 20 Jan 2019 17:04:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AC58A28B08 for ; Sun, 20 Jan 2019 17:04:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F2776E632; Sun, 20 Jan 2019 17:04:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from h2641619.stratoserver.net (mail.andi.de1.cc [IPv6:2a01:238:43f3:0:615b:ee97:1f81:cbf2]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64A7C6E39F for ; Sat, 19 Jan 2019 19:06:53 +0000 (UTC) Received: from p200300ccfbfb41001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:fbfb:4100:1a3d:a2ff:febf:d33a] helo=aktux) by h2641619.stratoserver.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gkvFU-0002M8-MY; Sat, 19 Jan 2019 19:21:40 +0100 Received: from andi by aktux with local (Exim 4.89) (envelope-from ) id 1gkvFT-0002Sz-PD; Sat, 19 Jan 2019 19:21:39 +0100 From: Andreas Kemnade To: tomi.valkeinen@ti.com, airlied@linux.ie, daniel@ffwll.ch, laurent.pinchart@ideasonboard.com, sre@kernel.org, dri-devel@lists.freedesktop.org, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org Subject: [PATCH 1/2] drm/omap: panel-tpo-td028ttec1: add backlight support Date: Sat, 19 Jan 2019 19:21:30 +0100 Message-Id: <20190119182131.9341-2-andreas@kemnade.info> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190119182131.9341-1-andreas@kemnade.info> References: <20190119182131.9341-1-andreas@kemnade.info> X-Mailman-Approved-At: Sun, 20 Jan 2019 17:03:52 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Kemnade MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This panel has a backlight, so fetch it from devicetree using the as documented in panel-common.txt. It is implemented the same way as in panel-dpi.c This ensures the backlight is also disabled when the display is turned off like when doing xset dpms force off. Signed-off-by: Andreas Kemnade --- .../gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c index 7ddc8c574a61..f326ba9dcf62 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c @@ -35,6 +35,8 @@ struct panel_drv_data { struct videomode vm; + struct backlight_device *backlight; + struct spi_device *spi_dev; }; @@ -268,6 +270,8 @@ static int td028ttec1_panel_enable(struct omap_dss_device *dssdev) r |= jbt_ret_write_0(ddata, JBT_REG_DISPLAY_ON); + backlight_enable(ddata->backlight); + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; transfer_err: @@ -283,6 +287,8 @@ static void td028ttec1_panel_disable(struct omap_dss_device *dssdev) if (!omapdss_device_is_enabled(dssdev)) return; + backlight_disable(ddata->backlight); + dev_dbg(dssdev->dev, "td028ttec1_panel_disable()\n"); jbt_ret_write_0(ddata, JBT_REG_DISPLAY_OFF); @@ -321,6 +327,15 @@ static int td028ttec1_panel_probe(struct spi_device *spi) dev_dbg(&spi->dev, "%s\n", __func__); + ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); + if (ddata == NULL) + return -ENOMEM; + + ddata->backlight = devm_of_find_backlight(&spi->dev); + + if (IS_ERR(ddata->backlight)) + return PTR_ERR(ddata->backlight); + spi->bits_per_word = 9; spi->mode = SPI_MODE_3; @@ -330,9 +345,6 @@ static int td028ttec1_panel_probe(struct spi_device *spi) return r; } - ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); - if (ddata == NULL) - return -ENOMEM; dev_set_drvdata(&spi->dev, ddata);