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=-4.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED 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 5F59FC04AAF for ; Mon, 20 May 2019 06:48:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 24A5D206B6 for ; Mon, 20 May 2019 06:48:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qFbPHGxv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24A5D206B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vddfX/BBVmfYy2Uy/x9huqebSD0jZeosBDzDkQSgbVs=; b=qFbPHGxvkET5EY 3CeiKSP0Y/35IGfM0Eh12NTjjag2vxiqMZO7A4yR4W1STsCroeo0jCjwKvZFkHDr6I38cGKd0YMfJ 47cSHPIOZ2RmXooSBgvJE0tdTqW91a7dDqg511ct3cC3NZFgklVTVG+h4gFLZiU8VXWcywJOt+U7k RFO7HG/ajyZZhrHOFNzBXvvzug1h5q6oobtOJtqritXJr9vSTHQTBqDc15UQNX+a9YRdAkgrb+jg6 b7e+H9cqNDg95EtUQ4bvFb18MZKrhoMA2thgZzO8/EVeAukdHpxOkbtsncwNENtWpUbpjNErXvfPk jt/HXTenxGH8exghAOmA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSc6A-0003Hp-6J; Mon, 20 May 2019 06:48:38 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSc66-0003Gw-Qb; Mon, 20 May 2019 06:48:36 +0000 X-UUID: d558322e6568429480e7c9b6e55c33d9-20190519 X-UUID: d558322e6568429480e7c9b6e55c33d9-20190519 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1691588567; Sun, 19 May 2019 22:48:32 -0800 Received: from MTKMBS33N1.mediatek.inc (172.27.4.75) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 19 May 2019 23:48:31 -0700 Received: from mtkcas09.mediatek.inc (172.21.101.178) by MTKMBS33N1.mediatek.inc (172.27.4.75) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 20 May 2019 14:48:29 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Mon, 20 May 2019 14:48:28 +0800 Message-ID: <1558334909.7311.27.camel@mtksdaap41> Subject: Re: [v4 4/5] drm/mediatek: control dpi pins dpi or gpio mode in on or off From: CK Hu To: Jitao Shi Date: Mon, 20 May 2019 14:48:29 +0800 In-Reply-To: <20190518095618.18454-5-jitao.shi@mediatek.com> References: <20190518095618.18454-1-jitao.shi@mediatek.com> <20190518095618.18454-5-jitao.shi@mediatek.com> X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190519_234834_867423_E71D94DD X-CRM114-Status: GOOD ( 15.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, David Airlie , stonea168@163.com, dri-devel@lists.freedesktop.org, yingjoe.chen@mediatek.com, Ajay Kumar , Vincent Palatin , cawa.cheng@mediatek.com, bibby.hsieh@mediatek.com, Russell King , Thierry Reding , linux-pwm@vger.kernel.org, Sascha Hauer , Pawel Moll , Ian Campbell , Inki Dae , Rob Herring , linux-mediatek@lists.infradead.org, Andy Yan , Matthias Brugger , eddie.huang@mediatek.com, linux-arm-kernel@lists.infradead.org, Rahul Sharma , srv_heupstream@mediatek.com, linux-kernel@vger.kernel.org, Philipp Zabel , Kumar Gala , Sean Paul Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, Jitao: On Sat, 2019-05-18 at 17:56 +0800, Jitao Shi wrote: > Pull dpi pins low when dpi has nothing to display. Aovid leakage > current from some dpi pins (Hsync Vsync DE ... ). > > Some chips have dpi pins, but there are some chip don't have pins. > So this function is controlled by chips driver data. > > Signed-off-by: Jitao Shi > --- > drivers/gpu/drm/mediatek/mtk_dpi.c | 35 +++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c > index 77e6e0f99188..0c4ba0a2be27 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c > @@ -17,10 +17,12 @@ > #include > #include > #include > -#include > #include > #include > +#include > #include > +#include > +#include > #include > #include > #include > @@ -79,6 +81,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_default; > + struct pinctrl_state *pins_dpi; > int refcount; > }; > > @@ -118,6 +123,7 @@ struct mtk_dpi_conf { > u32 reg_h_fre_con; > bool edge_sel_en; > bool dual_edge; > + bool dpi_pin_ctrl; > }; > > static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask) > @@ -392,6 +398,9 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi) > if (--dpi->refcount != 0) > return; > > + if (dpi->conf->dpi_pin_ctrl) > + pinctrl_select_state(dpi->pinctrl, dpi->pins_default); > + > mtk_dpi_disable(dpi); > clk_disable_unprepare(dpi->pixel_clk); > clk_disable_unprepare(dpi->engine_clk); > @@ -416,6 +425,9 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) > goto err_pixel; > } > > + if (dpi->conf->dpi_pin_ctrl) > + pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi); > + > mtk_dpi_enable(dpi); > return 0; > > @@ -724,6 +736,27 @@ static int mtk_dpi_probe(struct platform_device *pdev) > dpi->dev = dev; > dpi->conf = (struct mtk_dpi_conf *)of_device_get_match_data(dev); > > + if (dpi->conf->dpi_pin_ctrl) { > + dpi->pinctrl = devm_pinctrl_get(&pdev->dev); Please describe this in binding document. Regards, CK > + if (IS_ERR(dpi->pinctrl)) { > + dev_err(&pdev->dev, "Cannot find pinctrl!\n"); > + return PTR_ERR(dpi->pinctrl); > + } > + > + dpi->pins_default = pinctrl_lookup_state(dpi->pinctrl, > + "default"); > + if (IS_ERR(dpi->pins_default)) { > + dev_err(&pdev->dev, "Cannot find pinctrl default!\n"); > + return PTR_ERR(dpi->pins_default); > + } > + > + dpi->pins_dpi = pinctrl_lookup_state(dpi->pinctrl, "dpimode"); > + if (IS_ERR(dpi->pins_dpi)) { > + dev_err(&pdev->dev, "Cannot find pinctrl dpimode!\n"); > + return PTR_ERR(dpi->pins_dpi); > + } > + } > + > mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); > dpi->regs = devm_ioremap_resource(dev, mem); > if (IS_ERR(dpi->regs)) { _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel