From patchwork Fri May 27 06:35:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 68727 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp777892qge; Thu, 26 May 2016 23:35:38 -0700 (PDT) X-Received: by 10.66.65.109 with SMTP id w13mr19715001pas.142.1464330937740; Thu, 26 May 2016 23:35:37 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ce1si26258650pad.166.2016.05.26.23.35.37; Thu, 26 May 2016 23:35:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-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-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754183AbcE0Gfg (ORCPT + 4 others); Fri, 27 May 2016 02:35:36 -0400 Received: from bear.ext.ti.com ([198.47.19.11]:44838 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754034AbcE0Gff (ORCPT ); Fri, 27 May 2016 02:35:35 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id u4R6ZYhO022545; Fri, 27 May 2016 01:35:34 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4R6ZXdi021955; Fri, 27 May 2016 01:35:33 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Fri, 27 May 2016 01:35:33 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4R6ZUQ7027995; Fri, 27 May 2016 01:35:31 -0500 From: Kishon Vijay Abraham I To: , , , , CC: , Subject: [RESEND PATCH] gpio: pcf857x: restore the initial line state of all pcf lines Date: Fri, 27 May 2016 12:05:29 +0530 Message-ID: <1464330929-10910-1-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The reset values for all the PCF lines are high and hence on shutdown we should drive all the lines high in order to bring it to the reset state. This is actually required since PCF doesn't have a reset line and even after warm reset (by invoking "reboot" in prompt) the PCF lines maintains it's previous programmed state. This becomes a problem if the boards are designed to work with the default initial state. DRA7XX_evm uses PCF8575 and one of the PCF output lines feeds to MMC/SD VDD and this line should be driven high in order for the MMC/SD to be detected. This line is modelled as regulator and the hsmmc driver takes care of enabling and disabling it. In the case of 'reboot', during shutdown path as part of it's cleanup process the hsmmc driver disables this regulator. This makes MMC *boot* not functional. Fix it by driving all the pcf lines high. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sekhar Nori --- This patch was sent long back [1]. But there was a concern that contention might occur if the PCF shutdown handler is invoked before the shutdown handler of the PCF's consumers. In that case PCF shutdown handler can't drive all the pcf lines high without knowing if the PCF consumers are still active. However commit 52cdbdd4985 ("driver core: correct device's shutdown order") will make sure shutdown handler of PCF's consumers are invoked before invoking the shutdown handler of PCF. So it should be safe to merge this now. [1] -> https://patchwork.ozlabs.org/patch/420382/ drivers/gpio/gpio-pcf857x.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index 169c09a..d168410 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c @@ -440,6 +440,14 @@ static int pcf857x_remove(struct i2c_client *client) return status; } +static void pcf857x_shutdown(struct i2c_client *client) +{ + struct pcf857x *gpio = i2c_get_clientdata(client); + + /* Drive all the I/O lines high */ + gpio->write(gpio->client, BIT(gpio->chip.ngpio) - 1); +} + static struct i2c_driver pcf857x_driver = { .driver = { .name = "pcf857x", @@ -447,6 +455,7 @@ static struct i2c_driver pcf857x_driver = { }, .probe = pcf857x_probe, .remove = pcf857x_remove, + .shutdown = pcf857x_shutdown, .id_table = pcf857x_id, };