<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div class="gmail_attr" dir="ltr">Jitao Shi <<a href="mailto:jitao.shi@mediatek.com">jitao.shi@mediatek.com</a>> 於 2020年3月11日 週三 下午3:19寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">Config dpi pins mode to output and pull low when dpi is disabled.<br>
Aovid leakage current from some dpi pins (Hsync Vsync DE ... ).<br>
<br></blockquote><div><br></div><div><span style="text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:rgb(255,255,255)">Reviewed-by: Chun-Kuang Hu <</span><a style="text-align:left;color:rgb(17,85,204);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:underline;word-spacing:0px;white-space:normal" href="mailto:chunkuang.hu@kernel.org" target="_blank">chunkuang.hu@kernel.org</a><span style="text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-family:Arial,Helvetica,sans-serif;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:none;background-color:rgb(255,255,255)">></span><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">
Signed-off-by: Jitao Shi <<a href="mailto:jitao.shi@mediatek.com" target="_blank">jitao.shi@mediatek.com</a>><br>
---<br>
drivers/gpu/drm/mediatek/mtk_dpi.c | 31 ++++++++++++++++++++++++++++++<br>
1 file changed, 31 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c<br>
index 2871e68e7767..b6359e979588 100644<br>
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c<br>
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c<br>
@@ -10,7 +10,9 @@<br>
#include <linux/kernel.h><br>
#include <linux/of.h><br>
#include <linux/of_device.h><br>
+#include <linux/of_gpio.h><br>
#include <linux/of_graph.h><br>
+#include <linux/pinctrl/consumer.h><br>
#include <linux/platform_device.h><br>
#include <linux/types.h><br>
<br>
@@ -74,6 +76,9 @@ struct mtk_dpi {<br>
enum mtk_dpi_out_yc_map yc_map;<br>
enum mtk_dpi_out_bit_num bit_num;<br>
enum mtk_dpi_out_channel_swap channel_swap;<br>
+ struct pinctrl *pinctrl;<br>
+ struct pinctrl_state *pins_gpio;<br>
+ struct pinctrl_state *pins_dpi;<br>
int refcount;<br>
u32 pclk_sample;<br>
};<br>
@@ -387,6 +392,9 @@ static void mtk_dpi_power_off(struct mtk_dpi *dpi)<br>
if (--dpi->refcount != 0)<br>
return;<br>
<br>
+ if (dpi->pinctrl && dpi->pins_gpio)<br>
+ pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);<br>
+<br>
mtk_dpi_disable(dpi);<br>
clk_disable_unprepare(dpi->pixel_clk);<br>
clk_disable_unprepare(dpi->engine_clk);<br>
@@ -411,6 +419,9 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi)<br>
goto err_pixel;<br>
}<br>
<br>
+ if (dpi->pinctrl && dpi->pins_dpi)<br>
+ pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi);<br>
+<br>
mtk_dpi_enable(dpi);<br>
return 0;<br>
<br>
@@ -728,6 +739,26 @@ static int mtk_dpi_probe(struct platform_device *pdev)<br>
of_property_read_u32(ep, "pclk-sample", &dpi->pclk_sample);<br>
of_node_put(ep);<br>
<br>
+ dpi->pinctrl = devm_pinctrl_get(&pdev->dev);<br>
+ if (IS_ERR(dpi->pinctrl)) {<br>
+ dpi->pinctrl = NULL;<br>
+ dev_dbg(&pdev->dev, "Cannot find pinctrl!\n");<br>
+ }<br>
+ if (dpi->pinctrl) {<br>
+ dpi->pins_gpio = pinctrl_lookup_state(dpi->pinctrl, "sleep");<br>
+ if (IS_ERR(dpi->pins_gpio)) {<br>
+ dpi->pins_gpio = NULL;<br>
+ dev_dbg(&pdev->dev, "Cannot find pinctrl idle!\n");<br>
+ }<br>
+ if (dpi->pins_gpio)<br>
+ pinctrl_select_state(dpi->pinctrl, dpi->pins_gpio);<br>
+<br>
+ dpi->pins_dpi = pinctrl_lookup_state(dpi->pinctrl, "default");<br>
+ if (IS_ERR(dpi->pins_dpi)) {<br>
+ dpi->pins_dpi = NULL;<br>
+ dev_dbg(&pdev->dev, "Cannot find pinctrl active!\n");<br>
+ }<br>
+ }<br>
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);<br>
dpi->regs = devm_ioremap_resource(dev, mem);<br>
if (IS_ERR(dpi->regs)) {<br>
-- <br>
2.21.0<br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org" target="_blank">dri-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank" rel="noreferrer">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</blockquote></div></div></div>