Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5207881imu; Wed, 19 Dec 2018 07:21:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/VJCBLq4jDS3qPuGfNn/9eRWxH0Zv3wobGHV0AoDEed80Yn08YB8/d3zwZlnORlqAUC+Gqi X-Received: by 2002:a63:fc49:: with SMTP id r9mr3223003pgk.209.1545232912413; Wed, 19 Dec 2018 07:21:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545232912; cv=none; d=google.com; s=arc-20160816; b=HNtKAd4OyYmd25MXjLDYeBR0TtaFFy0lDgVd5sZvqRTZ322jTkblR9TOl6s9QYHty+ egBbpq6m+sGLIVU4zxU+2rBVB1SBxnIrRpvDHtQQoIQIqzpUauuTc/mQd6rqNIAAfcrL V3R1j/PoxcPJcIp+ieypftjfndy69c+ei3i8gsK3ldAQarNhD4N+TkBfI0Ia8wdjHxEv 2FpSkeostVhqfIFNlx3HV/+ypIqfEe0j1nhERjxpUGgCw9GlK0v6HzI85H9UsxmZOmrp ttHaFkfAEEITS0G4+b4T5NtQiEE6/oWVMMacXWWeH2zPuzaNPmFe+AiqZz00cvdHkvnH TKmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=t/OncnmoBOfoup/CLynU/furd7kAq7onWoRhmw3V8/E=; b=FmENhnSK62PtAqvpeyrPNwaJJItJUM+W1OpwNj+iTDVldceTtPuozlzNBnVvpJlvqQ tvSMakqLKv1LRSrFsK5Ty7l+WWFl2FjHertk35Tpv8Gs4LpLCmWztcXowWGuUF9eGQxN frEi4XMgiOFk0vyK0pYtsNlHvH3q40mZ648cetZhKc3EN6/t5C6Zk6EAqoG4UzdzW/qF 1VmGM0WpX0huluvOF4KWQWOHion9AzPohqAYQCPGw+fSMBrCNZppfTnuMPpfQAkNzyIT DnhhcRX1UG+hDkeSUkrxxNs4tchCL/SUmzLftFbsCmpgNJYl0kFzjAmd23e1dykdURZt qwzQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=liu.se Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si16115383pgm.441.2018.12.19.07.21.35; Wed, 19 Dec 2018 07:21:52 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=liu.se Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728948AbeLSNLx (ORCPT + 99 others); Wed, 19 Dec 2018 08:11:53 -0500 Received: from mail.lysator.liu.se ([130.236.254.3]:54235 "EHLO mail.lysator.liu.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726833AbeLSNLg (ORCPT ); Wed, 19 Dec 2018 08:11:36 -0500 X-Greylist: delayed 396 seconds by postgrey-1.27 at vger.kernel.org; Wed, 19 Dec 2018 08:11:35 EST Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 1D03540037; Wed, 19 Dec 2018 14:05:12 +0100 (CET) Received: from orc.pedanet (c-17f4e255.26241707-0-68616c6d7374616473746164736e6174.bbcust.telenor.se [85.226.244.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id C493840005; Wed, 19 Dec 2018 14:05:11 +0100 (CET) From: Peter Rosin To: linux-kernel@vger.kernel.org Cc: Peter Rosin , David Airlie , Rob Herring , Mark Rutland , Archit Taneja , Andrzej Hajda , Laurent Pinchart , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH v2 3/3] drm/bridge: add pwdn-gpios support to the lvds-encoder Date: Wed, 19 Dec 2018 14:04:49 +0100 Message-Id: <20181219130449.31641-4-peda@lysator.liu.se> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181219130449.31641-1-peda@lysator.liu.se> References: <20181219130449.31641-1-peda@lysator.liu.se> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Rosin Optionally power down the LVDS-encoder when it is not in use. Signed-off-by: Peter Rosin --- drivers/gpu/drm/bridge/lvds-encoder.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c index 75b0d3f6e4de..43d584a6a6b9 100644 --- a/drivers/gpu/drm/bridge/lvds-encoder.c +++ b/drivers/gpu/drm/bridge/lvds-encoder.c @@ -11,11 +11,13 @@ #include #include +#include #include struct lvds_encoder { struct drm_bridge bridge; struct drm_bridge *panel_bridge; + struct gpio_desc *pwdn_gpio; }; static int lvds_encoder_attach(struct drm_bridge *bridge) @@ -28,8 +30,30 @@ static int lvds_encoder_attach(struct drm_bridge *bridge) bridge); } +static void lvds_encoder_enable(struct drm_bridge *bridge) +{ + struct lvds_encoder *lvds_encoder = container_of(bridge, + struct lvds_encoder, + bridge); + + if (lvds_encoder->pwdn_gpio) + gpiod_set_value_cansleep(lvds_encoder->pwdn_gpio, 0); +} + +static void lvds_encoder_disable(struct drm_bridge *bridge) +{ + struct lvds_encoder *lvds_encoder = container_of(bridge, + struct lvds_encoder, + bridge); + + if (lvds_encoder->pwdn_gpio) + gpiod_set_value_cansleep(lvds_encoder->pwdn_gpio, 1); +} + static struct drm_bridge_funcs funcs = { .attach = lvds_encoder_attach, + .enable = lvds_encoder_enable, + .disable = lvds_encoder_disable, }; static int lvds_encoder_probe(struct platform_device *pdev) @@ -45,6 +69,16 @@ static int lvds_encoder_probe(struct platform_device *pdev) if (!lvds_encoder) return -ENOMEM; + lvds_encoder->pwdn_gpio = devm_gpiod_get_optional(&pdev->dev, "pwdn", + GPIOD_OUT_HIGH); + if (IS_ERR(lvds_encoder->pwdn_gpio)) { + int err = PTR_ERR(lvds_encoder->pwdn_gpio); + + if (err != -EPROBE_DEFER) + dev_err(&pdev->dev, "pwdn GPIO failure: %d\n", err); + return err; + } + /* Locate the panel DT node. */ port = of_graph_get_port_by_id(pdev->dev.of_node, 1); if (!port) { -- 2.11.0