Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755098AbcDTO4y (ORCPT ); Wed, 20 Apr 2016 10:56:54 -0400 Received: from mail-oi0-f43.google.com ([209.85.218.43]:33221 "EHLO mail-oi0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753039AbcDTO4v (ORCPT ); Wed, 20 Apr 2016 10:56:51 -0400 MIME-Version: 1.0 In-Reply-To: <1461068317-28016-9-git-send-email-patrice.chotard@st.com> References: <1461068317-28016-1-git-send-email-patrice.chotard@st.com> <1461068317-28016-9-git-send-email-patrice.chotard@st.com> Date: Wed, 20 Apr 2016 16:56:50 +0200 Message-ID: Subject: Re: [PATCH 8/8] gpio: stmpe: configure GPIO as output by default From: Linus Walleij To: Patrice CHOTARD Cc: Lee Jones , Alexandre Courbot , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Maxime Coquelin , amelie.delaunay@st.com, Shawn Guo , Sascha Hauer , Dinh Nguyen , Viresh Kumar , Shiraz Hashim , Stephen Warren , Thierry Reding Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1127 Lines: 36 On Tue, Apr 19, 2016 at 2:18 PM, wrote: > 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 Not only do you set them all to outout but also: > + /* 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); You are driving them all low. Now GPIO is general purpose: what if they are connected to a line with a pull-up resistor? That is not saving power, instead consuming more than if you were setting them all to 1. I am afraid this is wrong. What you need is to be able to define in the DT (or similar) a set of initial values for the GPIO lines, and set them to 0 for this design. Such bindings have been discussed but no conclusion or merged patch has emerged. Please help out in driving a standard for this! Yours, Linus Walleij