Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4656491yba; Mon, 20 May 2019 01:07:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXUuAvLZINndvxH2puLeGyVxQ6rv+YGN7LKvYi3T+ajbPhR5uN6+CBnIi+SvFjFK0prNv2 X-Received: by 2002:aa7:9159:: with SMTP id 25mr47970563pfi.64.1558339647336; Mon, 20 May 2019 01:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558339647; cv=none; d=google.com; s=arc-20160816; b=R3f96MJxWIS5JITth6SEEwCL24AKr95WErSCOznPmy79QqYUdX+uFOQIbqD4C+T7Ej laUFWgpnMzanmhRRmUjo5atdStLj4qRgGPcFmlvB34kyE8oQOBK2jKAjvXlKRfZYT4DV /BPvSkHMtd6/zowxMnHnfKU7VtTxqhWxYiVnXNtpUOzLH8JUninJLrS44sCYeh18ZYk5 thcqnfNGjIJ/ULi/vByCctcv6ALdM9gDcqrbx+4HIXfakKDLu2rk6biHATjLZQ0o9jbs IEa3tLYjWLcw2rNKau2YzAk6tEor7QUia4GntI+CY8igfTqmCRoIevaCI5x/v7ayaK5M QPuA== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=NVJc3rGHy/J6o4wlJoUuXcZAkFZUi0WqO2wh4s9EHSo=; b=RJeOfRiKIWAg5NCZzt7Q5YOs0qwTg0+5wlE8pQUjmlvMOsAq3Tz9E8JEXvJ1DwMgys q1Zg+Dnn0mr9qz/ST2WyaVU/Oti69lair6XB90iIx3X/avZcbH3ycg378LKSVgtpCE/T xHqqgjJXT/WUPdRtnJyIx7u5LRWuVo39QBFXsDKQRnHdNw+qKNmmdaLYBs6Sol//oWLs Y5Kk0ETmfwPNYhJ9BjbVsyrKqR9cGp/V/lW7nJMsiKMW6BKfyIT7HMV2f0xIaOe0zOgQ SHuCBfoKEXvfbLGMAeTpNXs2C+9/wxNEPKrTOtvEo9lPCsrDEHr31s1xWwCPZktmFb7M UnXQ== 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 c16si18203461pfr.94.2019.05.20.01.07.12; Mon, 20 May 2019 01:07: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; 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 S1730810AbfETGsp (ORCPT + 99 others); Mon, 20 May 2019 02:48:45 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:41107 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726052AbfETGsp (ORCPT ); Mon, 20 May 2019 02:48:45 -0400 X-UUID: df6bf8f9060a436fbbf524ddfc74a8a6-20190520 X-UUID: df6bf8f9060a436fbbf524ddfc74a8a6-20190520 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1552444152; Mon, 20 May 2019 14:48:30 +0800 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 CC: Rob Herring , Pawel Moll , "Mark Rutland" , Ian Campbell , Kumar Gala , , David Airlie , "Matthias Brugger" , Thierry Reding , "Ajay Kumar" , Inki Dae , "Rahul Sharma" , Sean Paul , Vincent Palatin , Andy Yan , Philipp Zabel , "Russell King" , , , , , , , Sascha Hauer , , , , , 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> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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)) {