Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754056AbcDSMWV (ORCPT ); Tue, 19 Apr 2016 08:22:21 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:48903 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753507AbcDSMT2 (ORCPT ); Tue, 19 Apr 2016 08:19:28 -0400 From: To: , , , , CC: , , , , , , , , , , , Patrice Chotard Subject: [PATCH 8/8] gpio: stmpe: configure GPIO as output by default Date: Tue, 19 Apr 2016 14:18:37 +0200 Message-ID: <1461068317-28016-9-git-send-email-patrice.chotard@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461068317-28016-1-git-send-email-patrice.chotard@st.com> References: <1461068317-28016-1-git-send-email-patrice.chotard@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.48.1.66] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-04-19_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1148 Lines: 37 From: Patrice Chotard Configures all GPIOs as output, in order to minimize power consumption when GPIOs are unused. Signed-off-by: Amelie DELAUNAY Signed-off-by: Patrice Chotard --- drivers/gpio/gpio-stmpe.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 45e5b92..80c6ae6 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -410,7 +410,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); struct device_node *np = pdev->dev.of_node; struct stmpe_gpio *stmpe_gpio; - int ret; + int ret, i; int irq = 0; irq = platform_get_irq(pdev, 0); @@ -475,6 +475,10 @@ static int stmpe_gpio_probe(struct platform_device *pdev) NULL); } + /* To minimize power consumption, configure unused GPIOs as outputs */ + for (i = 0; i < stmpe_gpio->chip.ngpio; i++) + stmpe_gpio_direction_output(&stmpe_gpio->chip, i, 0); + platform_set_drvdata(pdev, stmpe_gpio); return 0; -- 1.9.1