linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: pcf857x: restore the initial line state of all pcf lines
@ 2014-12-12  8:06 Kishon Vijay Abraham I
  2014-12-15 20:50 ` Nishanth Menon
  0 siblings, 1 reply; 10+ messages in thread
From: Kishon Vijay Abraham I @ 2014-12-12  8:06 UTC (permalink / raw)
  To: linus.walleij, gnurou, linux-gpio, linux-kernel, nsekhar
  Cc: kishon, linux-omap, linux-mmc

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 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.

Fixed it by driving high all the pcf lines.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/gpio/gpio-pcf857x.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index 236708a..00b15b2 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -448,6 +448,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",
@@ -456,6 +464,7 @@ static struct i2c_driver pcf857x_driver = {
 	},
 	.probe	= pcf857x_probe,
 	.remove	= pcf857x_remove,
+	.shutdown = pcf857x_shutdown,
 	.id_table = pcf857x_id,
 };
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-03-25 15:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-12  8:06 [PATCH] gpio: pcf857x: restore the initial line state of all pcf lines Kishon Vijay Abraham I
2014-12-15 20:50 ` Nishanth Menon
2014-12-18  6:18   ` Kishon Vijay Abraham I
2014-12-18 14:11     ` Nishanth Menon
2015-01-05  6:26       ` Kishon Vijay Abraham I
2015-01-14 11:58         ` Linus Walleij
2015-03-16  8:46           ` Kishon Vijay Abraham I
2015-03-18 12:21             ` Linus Walleij
2015-03-18 13:21               ` Kishon Vijay Abraham I
2015-03-25 15:28                 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).