Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1562215ybb; Sat, 4 Apr 2020 07:08:27 -0700 (PDT) X-Google-Smtp-Source: APiQypIXEBLcLEygbzusjczeXg2P2taFu1m2kVJYJxUpKKcUoEan/ldZY0woSmm1z/uBA+JQ37rb X-Received: by 2002:a9d:4ee:: with SMTP id 101mr10265678otm.301.1586009307347; Sat, 04 Apr 2020 07:08:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586009307; cv=none; d=google.com; s=arc-20160816; b=x4odFYr1SCEnuXdq+vHBgogvupO3EqTj3N9mcWtajOTMMIJMvIW1WuPoADKjscd9ti uMP7+xsYLWnS94GD1/CjPtvNCqUlv3de1D5aW8omZL9IYqXNHLx0AXjO6q7g3AKXKeMj KY50lsoRGFYGGcZdTg0wvWNbCDXpBz0AA9H9A+uGqRi37lK/A1DCfv3bjNG3KFd7AzQR H1XorWF+YTAoS7rahktxRAuXscLCji4E0TN+3cqRSbH9cBg5SQ2+5Qj25ZbHUibJrFwk k4QtDtNQK0Ex03umpAI/OOpW7uehTDxbqHWgRCsabZpdVpnAHE5o1SWXB6+QAJsFTF/t 1+5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=OkXmWqhHwyQZGMRPT8spXRbsXOFxypnSOieNgmVHM6E=; b=DjfSqqv6b5djTw+6GaRv7RgAwiHXTCdRPLkPiYGCUXqc7n56d/2P65LqHx4Hd7aZaM C2J5PaJAnGqhTnqERru/fA4leY22kVw2XCYgr1YAfOeKlR9Q57lLKkppOEDCeCv94K6Y CHGjWuTOSSnLY4Hw38tFhbQJa9MiDCGv93yP0Cc1c5+RgqSJegI66mV0JVePqLdVC7kf D3vMHpaVZ6gazjIrFdiT2+55Knj4MXz5b83r9v3p7wPt5kR733+3wSAgLGn3EmlCtpwC YYEp31kcFEHZaCQQMW4zGfyhhLo6L38MabpqSB8SpG9UY7pkK4AWeOINTvZyPHEYXbhb X3qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y6kx7Zct; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z17si5331635oth.282.2020.04.04.07.08.15; Sat, 04 Apr 2020 07:08:27 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Y6kx7Zct; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726377AbgDDOHw (ORCPT + 99 others); Sat, 4 Apr 2020 10:07:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:48800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726302AbgDDOHv (ORCPT ); Sat, 4 Apr 2020 10:07:51 -0400 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 13B1E2071C; Sat, 4 Apr 2020 14:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586009271; bh=/fGwNQGSGd8258j4HpL7qVgnU4jtouS/+Lk1L8UMLa0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Y6kx7ZctsdH13Tn2DH/MWaklMItFSw/j1F5h0zFx9Sa4p4YGfwaQNyFCi55i9jn9n IXLbICIi/o6HN642XKH/oL+0gGZ6MUMnAi/f/fKnfd45Seui669+Hj7LUS3fzuq2Ng B2Ec4WS5K3mgCnmu+njSanerAiao94B2vW673P5Y= Received: by mail-ed1-f48.google.com with SMTP id cw6so12832626edb.9; Sat, 04 Apr 2020 07:07:51 -0700 (PDT) X-Gm-Message-State: AGi0PuauDL87zVwO7OA4MANJzBdryN3DFY+HZ3H8EFapyk+BUrAX7ZpR CpCdYNhrXgAzb5WzhrjeRP3HVy10sT+XE/N2uA== X-Received: by 2002:a17:906:fca4:: with SMTP id qw4mr422751ejb.324.1586009269517; Sat, 04 Apr 2020 07:07:49 -0700 (PDT) MIME-Version: 1.0 References: <20200403080350.95826-1-jitao.shi@mediatek.com> <20200403080350.95826-4-jitao.shi@mediatek.com> In-Reply-To: <20200403080350.95826-4-jitao.shi@mediatek.com> From: Chun-Kuang Hu Date: Sat, 4 Apr 2020 22:07:37 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v14 3/3] drm/mediatek: set dpi pin mode to gpio low to avoid leakage current To: Jitao Shi Cc: Rob Herring , Mark Rutland , Matthias Brugger , Daniel Vetter , David Airlie , DRI Development , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, srv_heupstream@mediatek.com, huijuan.xie@mediatek.com, stonea168@163.com, cawa.cheng@mediatek.com, linux-mediatek@lists.infradead.org, yingjoe.chen@mediatek.com, eddie.huang@mediatek.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Jitao: Jitao Shi =E6=96=BC 2020=E5=B9=B44=E6=9C=883=E6=97= =A5 =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=884:04=E5=AF=AB=E9=81=93=EF=BC=9A > > Config dpi pins mode to output and pull low when dpi is disabled. > Aovid leakage current from some dpi pins (Hsync Vsync DE ... ). Reviewed-by: Chun-Kuang Hu > > Signed-off-by: Jitao Shi > --- > drivers/gpu/drm/mediatek/mtk_dpi.c | 31 ++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediate= k/mtk_dpi.c > index 087f5ce732e1..1e01254788d9 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c > @@ -10,7 +10,9 @@ > #include > #include > #include > +#include > #include > +#include > #include > #include > > @@ -74,6 +76,9 @@ struct mtk_dpi { > enum mtk_dpi_out_yc_map yc_map; > enum mtk_dpi_out_bit_num bit_num; > enum mtk_dpi_out_channel_swap channel_swap; > + struct pinctrl *pinctrl; > + struct pinctrl_state *pins_gpio; > + struct pinctrl_state *pins_dpi; > int refcount; > }; > > @@ -379,6 +384,9 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi) > if (--dpi->refcount !=3D 0) > return; > > + if (dpi->pinctrl && dpi->pins_gpio) > + pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio); > + > mtk_dpi_disable(dpi); > clk_disable_unprepare(dpi->pixel_clk); > clk_disable_unprepare(dpi->engine_clk); > @@ -403,6 +411,9 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) > goto err_pixel; > } > > + if (dpi->pinctrl && dpi->pins_dpi) > + pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi); > + > mtk_dpi_enable(dpi); > return 0; > > @@ -705,6 +716,26 @@ static int mtk_dpi_probe(struct platform_device *pde= v) > dpi->dev =3D dev; > dpi->conf =3D (struct mtk_dpi_conf *)of_device_get_match_data(dev= ); > > + dpi->pinctrl =3D devm_pinctrl_get(&pdev->dev); > + if (IS_ERR(dpi->pinctrl)) { > + dpi->pinctrl =3D NULL; > + dev_dbg(&pdev->dev, "Cannot find pinctrl!\n"); > + } > + if (dpi->pinctrl) { > + dpi->pins_gpio =3D pinctrl_lookup_state(dpi->pinctrl, "sl= eep"); > + if (IS_ERR(dpi->pins_gpio)) { > + dpi->pins_gpio =3D NULL; > + dev_dbg(&pdev->dev, "Cannot find pinctrl idle!\n"= ); > + } > + if (dpi->pins_gpio) > + pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio= ); > + > + dpi->pins_dpi =3D pinctrl_lookup_state(dpi->pinctrl, "def= ault"); > + if (IS_ERR(dpi->pins_dpi)) { > + dpi->pins_dpi =3D NULL; > + dev_dbg(&pdev->dev, "Cannot find pinctrl active!\= n"); > + } > + } > mem =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); > dpi->regs =3D devm_ioremap_resource(dev, mem); > if (IS_ERR(dpi->regs)) { > -- > 2.21.0 > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel